This commit is contained in:
Christian Zimmermann 2024-10-23 22:39:36 -07:00
parent 7754fd084e
commit a549fb6b9c
2 changed files with 30 additions and 6 deletions

View file

@ -280,6 +280,17 @@ namespace CNORXZ
{ {
return FPos(pos.val(), map); return FPos(pos.val(), map);
} }
template <SizeT... Is>
static constexpr decltype(auto) mks(const PosT& pos, std::index_sequence<Is...> is)
{
if constexpr(is_static_pos_type<PosT>::value){
return SFPos<pos.val(),Is...> {};
}
else {
return mk(pos, &SFPos<0,Is...>::permutation[0]);
}
}
}; };
template <class BPosT, class NPosT> template <class BPosT, class NPosT>
@ -289,6 +300,13 @@ namespace CNORXZ
{ {
return mkMPos( MkFPos<BPosT>::mk( pos, map ), MkFPos<NPosT>::mk( pos.next(), map ) ); return mkMPos( MkFPos<BPosT>::mk( pos, map ), MkFPos<NPosT>::mk( pos.next(), map ) );
} }
template <SizeT... Is>
static constexpr decltype(auto) mks(const MPos<BPosT,NPosT>& pos,
std::index_sequence<Is...> is)
{
return mkMPos( MkFPos<BPosT>::mks( pos, is ), MkFPos<NPosT>::mks( pos.next(), is ) );
}
}; };
template <class PosT> template <class PosT>
@ -297,13 +315,19 @@ namespace CNORXZ
return MkFPos<PosT>::mk(pos, map); return MkFPos<PosT>::mk(pos, map);
} }
template <class PosT, SizeT... Is>
constexpr decltype(auto) mkSFPos(const PosT& pos, std::index_sequence<Is...> is)
{
return MkFPos<PosT>::mks(pos, is);
}
/*===========+ /*===========+
| SFPos | | SFPos |
+===========*/ +===========*/
template <SizeT N, SizeT... Ms> template <SizeT N, SizeT... Ms>
Arr<SizeT,sizeof...(Ms)> SFPos<N,Ms...>::sMs = { Ms... }; Arr<SizeT,sizeof...(Ms)> SFPos<N,Ms...>::permutation = { Ms... };
template <SizeT N, SizeT... Ms> template <SizeT N, SizeT... Ms>
constexpr SizeT SFPos<N,Ms...>::size() const constexpr SizeT SFPos<N,Ms...>::size() const
@ -343,10 +367,10 @@ namespace CNORXZ
} }
else { else {
if constexpr(is_epos_type<PosT>::value){ if constexpr(is_epos_type<PosT>::value){
return FPos(N * a.scal().val(), &sMs[0]); return FPos(N * a.scal().val(), &permutation[0]);
} }
else { else {
return FPos(N * a.val(), &sMs[0]); return FPos(N * a.val(), &permutation[0]);
} }
} }
} }
@ -392,7 +416,7 @@ namespace CNORXZ
template <SizeT N, SizeT... Ms> template <SizeT N, SizeT... Ms>
constexpr SFPos<N,Ms...>::operator FPos() const constexpr SFPos<N,Ms...>::operator FPos() const
{ {
return FPos(N, &sMs[0]); return FPos(N, &permutation[0]);
} }
template <SizeT N, SizeT... Ms> template <SizeT N, SizeT... Ms>

View file

@ -129,9 +129,9 @@ namespace CNORXZ
template <SizeT N, SizeT... Ms> template <SizeT N, SizeT... Ms>
class SFPos class SFPos
{ {
private:
static Arr<SizeT,sizeof...(Ms)> sMs;
public: public:
static Arr<SizeT,sizeof...(Ms)> permutation;
constexpr SFPos() = default; constexpr SFPos() = default;
constexpr SizeT size() const; constexpr SizeT size() const;