5#ifndef OILAB_ORDEREDTUPLET_H
6#define OILAB_ORDEREDTUPLET_H
13 :
public Eigen::Matrix<typename LatticeCore<dim>::IntScalarType, dim, 1> {
19 for (
int i = 0; i < dim - 1; ++i) {
20 if (this->
operator()(i) < rhs(i))
22 if (rhs(i) < this->
operator()(i))
25 if (this->
operator()(dim - 1) < rhs(dim - 1))
43 class XTuplet :
public Eigen::Matrix<int,Eigen::Dynamic,1>
51 results.push_back(current_tuple);
53 for (
int i = 0; i < n; ++i) {
54 current_tuple(index) = i;
70 std::vector<XTuplet> results;
72 current_tuple.setZero();
80 static void generate_tuples(std::vector<int> n,
int k, std::vector<XTuplet>& results,
XTuplet& current_tuple,
int index) {
82 results.push_back(current_tuple);
84 for (
int i = 0; i < n[index]; ++i) {
85 current_tuple(index) = i;
101 assert(n.size() == k);
102 std::vector<XTuplet> results;
104 current_tuple.setZero();
114 for (
int i = 0; i < rhs.size()-1; ++i) {
115 if (this->
operator()(i) < rhs(i))
return true;
116 if (rhs(i) < this->
operator()(i))
return false;
118 if (this->
operator()(rhs.size()- 1) < rhs(rhs.size()- 1))
return true;
127 for (
int stateIndex = 0; stateIndex < (*this).size(); ++stateIndex) {
128 if(stateIndex==0 or stateIndex==1)
129 if((*this).operator()(stateIndex) == 2 )
131 if(stateIndex>=2 and stateIndex<=(*this).size()/2) {
132 if ((*this).operator()(stateIndex) == 1)
134 if ((*this).operator()(stateIndex) == 2)
137 if(stateIndex>=(*this).size()/2+1 and stateIndex<(*this).size())
138 if((*this).operator()(stateIndex) == 1 )
145 static std::basic_ostream<char>&
operator<<(std::basic_ostream<char>& s,
const XTuplet& m) {
146 return s << m.transpose() ;
bool operator<(const OrderedTuplet &rhs) const
static std::vector< XTuplet > generate_tuples(std::vector< int > n, int k)
static void generate_tuples(std::vector< int > n, int k, std::vector< XTuplet > &results, XTuplet ¤t_tuple, int index)
bool operator<(const XTuplet &rhs) const
static std::vector< XTuplet > generate_tuples(int n, int k)
static void generate_tuples(int n, int k, std::vector< XTuplet > &results, XTuplet ¤t_tuple, int index)
basic_ostream< char > & operator<<(basic_ostream< char > &s, const LatticeDirection< dim > &m)