5#ifndef OILAB_ORDEREDTUPLET_H
6#define OILAB_ORDEREDTUPLET_H
12 class OrderedTuplet :
public Eigen::Matrix<typename LatticeCore<dim>::IntScalarType,dim,1>
20 for(
int i=0; i<dim-1; ++i)
22 if (this->
operator()(i) < rhs(i))
return true;
23 if (rhs(i) < this->
operator()(i))
return false;
25 if (this->
operator()(dim-1) < rhs(dim-1))
return true;
42 class XTuplet :
public Eigen::Matrix<int,Eigen::Dynamic,1>
50 results.push_back(current_tuple);
52 for (
int i = 0; i < n; ++i) {
53 current_tuple(index) = i;
69 std::vector<XTuplet> results;
71 current_tuple.setZero();
79 static void generate_tuples(std::vector<int> n,
int k, std::vector<XTuplet>& results,
XTuplet& current_tuple,
int index) {
81 results.push_back(current_tuple);
83 for (
int i = 0; i < n[index]; ++i) {
84 current_tuple(index) = i;
100 assert(n.size() == k);
101 std::vector<XTuplet> results;
103 current_tuple.setZero();
113 for (
int i = 0; i < rhs.size()-1; ++i) {
114 if (this->
operator()(i) < rhs(i))
return true;
115 if (rhs(i) < this->
operator()(i))
return false;
117 if (this->
operator()(rhs.size()- 1) < rhs(rhs.size()- 1))
return true;
126 for (
int stateIndex = 0; stateIndex < (*this).size(); ++stateIndex) {
127 if(stateIndex==0 or stateIndex==1)
128 if((*this).operator()(stateIndex) == 2 )
130 if(stateIndex>=2 and stateIndex<=(*this).size()/2) {
131 if ((*this).operator()(stateIndex) == 1)
133 if ((*this).operator()(stateIndex) == 2)
136 if(stateIndex>=(*this).size()/2+1 and stateIndex<(*this).size())
137 if((*this).operator()(stateIndex) == 1 )
144 static std::basic_ostream<char>&
operator<<(std::basic_ostream<char>& s,
const XTuplet& m) {
145 return s << m.transpose() ;
bool operator<(const OrderedTuplet &rhs) const
static void generate_tuples(int n, int k, std::vector< XTuplet > &results, XTuplet ¤t_tuple, int index)
static std::vector< XTuplet > generate_tuples(int n, int k)
bool operator<(const XTuplet &rhs) const
static void generate_tuples(std::vector< int > n, int k, std::vector< XTuplet > &results, XTuplet ¤t_tuple, int index)
static std::vector< XTuplet > generate_tuples(std::vector< int > n, int k)
basic_ostream< char > & operator<<(basic_ostream< char > &s, const LatticeDirection< dim > &m)