8#ifndef model_PERMUTATIONWITHOUTREPETITION_H_
9#define model_PERMUTATIONWITHOUTREPETITION_H_
31 template <
typename T,
int M>
32 static Eigen::Matrix<T,1,
M-1>
reducePool(
const Eigen::Matrix<T,1,M>& pool,
const int&
p)
34 Eigen::Matrix<T,1,
M-1>
temp;
47 template<
typename T,
int N>
50 return permute(pool.transpose().eval());
54 template<
typename T,
int N>
60 Eigen::Matrix<T,
k,
value(
N)> temp1;
62 for(
size_t p=0;
p<
N;++
p)
64 temp1.template block< 1,c>(0,
p*
c)=Eigen::Matrix<T,1,c>::Constant(pool(
p));
72 template<
typename T,
int N>
78 template<
typename T,
int N>
86 for(
size_t p=0;
p<
N;++
p)
88 temp1.template block< 1,c>(0,(2*
p+0)*
c)=Eigen::Matrix<T,1,c>::Constant( pool(
p));
89 temp1.template block< 1,c>(0,(2*
p+1)*
c)=Eigen::Matrix<T,1,c>::Constant(-pool(
p));
92 temp1.template block<
k-1,
c>(1,(2*
p+0)*
c)=
temp;
93 temp1.template block<
k-1,
c>(1,(2*
p+1)*
c)=
temp;
107 static constexpr int k=1;
116 template<
typename T,
int N>
117 static const Eigen::Matrix<T,
k,
value(
N)>&
permute(
const Eigen::Matrix<T,1,N>& pool)
123 template<
typename T,
int N>
126 return (Eigen::Matrix<T,k,2*N>()<<pool,-pool).finished();
static constexpr int pow(int x, int n)
A compile-time implementation of the power function.
static constexpr int factorial(int n)
static const Eigen::Matrix< T, k, 2 *N > permuteWithPlusMinusSign(const Eigen::Matrix< T, 1, N > &pool)
static const Eigen::Matrix< T, k, value(N)> & permute(const Eigen::Matrix< T, 1, N > &pool)
static constexpr int value(int N)
static constexpr int value(int N)
static Eigen::Matrix< T, k, value(N) *CTM::pow(2, k)> permuteWithPlusMinusSign(const Eigen::Matrix< T, 1, N > &pool)
static Eigen::Matrix< T, k, value(N)> permute(const Eigen::Matrix< T, 1, N > &pool)
static Eigen::Matrix< T, k, value(N) *CTM::pow(2, k)> permuteWithPlusMinusSign(const Eigen::Matrix< T, N, 1 > &pool)
static Eigen::Matrix< T, 1, M-1 > reducePool(const Eigen::Matrix< T, 1, M > &pool, const int &p)
static Eigen::Matrix< T, k, value(N)> permute(const Eigen::Matrix< T, N, 1 > &pool)