4 #include <unordered_map>
6 #include <initializer_list>
41 friend class MultiIndexSet;
45 MultiIndex() : MultiIndex(0) {};
51 explicit MultiIndex(
unsigned lengthIn);
58 MultiIndex(
unsigned lengthIn,
unsigned val);
65 MultiIndex(Eigen::RowVectorXi
const& indIn);
71 MultiIndex(std::initializer_list<unsigned>
const& indIn);
77 static std::shared_ptr<MultiIndex> Copy(std::shared_ptr<MultiIndex>
const& indIn){
return std::make_shared<MultiIndex>(*indIn);};
80 virtual ~MultiIndex() =
default;
85 Eigen::RowVectorXi GetVector()
const;
90 unsigned Sum()
const{
return totalOrder;};
95 unsigned Max()
const{
return maxValue;};
102 bool SetValue(
unsigned ind,
unsigned val);
108 unsigned GetValue(
unsigned ind)
const;
115 void SetLength(
unsigned newLength);
119 unsigned int NumNz()
const;
121 std::string ToString()
const;
128 unsigned GetLength()
const{
return length;};
130 bool operator==(
const MultiIndex &b)
const;
131 bool operator!=(
const MultiIndex &b)
const;
132 bool operator<(
const MultiIndex &b)
const;
133 bool operator>(
const MultiIndex &b)
const;
134 bool operator>=(
const MultiIndex &b)
const;
135 bool operator<=(
const MultiIndex &b)
const;
138 MultiIndex& operator++();
139 MultiIndex
operator+(
const MultiIndex &b)
const;
140 MultiIndex& operator-=(
const MultiIndex &b);
141 MultiIndex& operator--();
142 MultiIndex operator-(
const MultiIndex &b)
const;
144 std::unordered_map<unsigned, unsigned>::const_iterator GetNzBegin()
const{
return nzInds.begin();};
145 std::unordered_map<unsigned, unsigned>::const_iterator GetNzEnd()
const{
return nzInds.end();};
152 std::unordered_map<unsigned, unsigned> nzInds;
164 bool operator()(std::shared_ptr<MultiIndex>
const& a, std::shared_ptr<MultiIndex>
const& b)
const{
return (*a)<(*b);};
167 std::ostream& operator<< (std::ostream &out,
const muq::Utilities::MultiIndex &ind);
SumMean operator+(MeanType1 const &mu1, MeanType2 const &mu2)
std::shared_ptr< MultiIndexSet > operator+=(std::shared_ptr< MultiIndexSet > x, std::shared_ptr< MultiIndexSet > y)
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types