Go to the documentation of this file. 1 #ifndef _GLUCAT_INDEX_SET_H
2 #define _GLUCAT_INDEX_SET_H
37 #include <boost/static_assert.hpp>
44 template<const index_t LO, const index_t HI>
48 template<const index_t LO, const index_t HI>
49 const index_set<LO,HI>
51 const index_set<LO,HI>& rhs);
54 template<const index_t LO, const index_t HI>
55 const index_set<LO,HI>
57 const index_set<LO,HI>& rhs);
60 template<const index_t LO, const index_t HI>
61 const index_set<LO,HI>
63 const index_set<LO,HI>& rhs);
67 template<const index_t LO, const index_t HI>
69 compare(
const index_set<LO,HI>& a,
const index_set<LO,HI>& b);
72 template<const index_t LO, const index_t HI>
74 private std::bitset<HI-LO>
78 (-LO < _GLUCAT_BITS_PER_ULONG) && \
79 ( HI < _GLUCAT_BITS_PER_ULONG) && \
80 ( HI-LO <= _GLUCAT_BITS_PER_ULONG));
192 operator bool ()
const;
209 Default_index_set_too_big_for_value)
237 #endif // _GLUCAT_INDEX_SET_H
std::bitset< HI-LO > bitset_t
index_t min_neg(const index_set< LO, HI > &ist)
Minimum negative index, or 0 if none.
bool operator~() const
Flips a bit.
index_set_t & operator^=(const index_set_t rhs)
Symmetric set difference: exclusive or.
index_t count_pos() const
Number of positive indices included in set.
const index_set_t unfold(const index_set_t frm, const bool prechecked=false) const
Unfold this index set within the given frame.
bool test(const index_t idx) const
Test idx for membership: test value of bit idx.
index_t min() const
Minimum member.
index_set()
Default constructor creates an empty set.
static const index_t v_lo
const Multivector< Scalar_T, LO, HI > operator|(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Transformation via twisted adjoint action.
index_t count() const
Cardinality: Number of indices included in set.
index_t max_pos(const index_set< LO, HI > &ist)
Maximum positive index, or 0 if none.
int index_t
Size of index_t should be enough to represent LO, HI.
bool operator==(const index_set_t rhs) const
Equality.
index_set_t operator~() const
Set complement: not.
bool operator<(const index_set_t rhs) const
Less than operator used for comparisons, map, etc.
index_set_t & operator|=(const index_set_t rhs)
Set union: or.
unsigned long set_value_t
Size of set_value_t should be enough to contain index_set<LO,HI>
bool operator[](const index_t idx) const
Subscripting: Test idx for membership: test value of bit idx.
Index set class based on std::bitset<> in Gnu standard C++ library.
index_set_t & reset()
Make set empty: Set all bits to 0.
reference()
Private default constructor is left undefined.
const index_set_t fold() const
Fold this index set within itself as a frame.
static const index_t v_hi
std::pair< index_t, index_t > index_pair_t
bool is_contiguous() const
Determine if the index set is contiguous, ie. has no gaps.
static const std::string classname()
reference & operator=(const bool x)
for b[i] = x;
int compare(const index_set< LO, HI > &a, const index_set< LO, HI > &b)
"lexicographic compare" eg. {3,4,5} is less than {3,7,8}
bool operator!=(const index_set_t rhs) const
Inequality.
int sign_of_square(index_t j)
Square of generator {j}.
Specific exception class.
const Multivector< Scalar_T, LO, HI > operator&(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Inner product.
index_set_t & set()
Include all indices except 0: set all bits except 0.
index_t count_neg() const
Number of negative indices included in set.
reference & flip()
for b[i].flip();
error< index_set > error_t
_GLUCAT_CTAssert(std::numeric_limits< unsigned char >::radix==2, CannotDetermineBitsPerChar) const index_t BITS_PER_CHAR
If radix of unsigned char is not 2, we can't easily determine number of bits from sizeof.
size_t hash_fn() const
Hash function.
int sign_of_square() const
Sign of geometric square of a Clifford basis element.
set_value_t value_of_fold(const index_set_t frm) const
The set value of the fold of this index set within the given frame.
bool lex_less_than(const index_set_t rhs) const
Lexicographic ordering of two sets: *this < rhs.
index_set_t & flip()
Set complement, except 0: flip all bits, except 0.
index_set_t & operator&=(const index_set_t rhs)
Set intersection: and.
int sign_of_mult(const index_set_t ist) const
Sign of geometric product of two Clifford basis elements.
const Multivector< Scalar_T, LO, HI > operator^(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Outer product.
BOOST_STATIC_ASSERT((LO<=0) &&(0<=HI) &&(LO< HI) &&(-LO< _GLUCAT_BITS_PER_ULONG) &&(HI< _GLUCAT_BITS_PER_ULONG) &&(HI-LO<=_GLUCAT_BITS_PER_ULONG))
index_t max() const
Maximum member.