glucat  0.8.4
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Friends | List of all members
glucat::index_set< LO, HI > Class Template Reference

Index set class based on std::bitset<> in Gnu standard C++ library. More...

#include <index_set.h>

Classes

class  reference
 Index set member reference. More...
 

Public Types

typedef index_set index_set_t
 
typedef std::pair< index_t, index_tindex_pair_t
 

Public Member Functions

 index_set ()
 Default constructor creates an empty set. More...
 
 index_set (const bitset_t bst)
 Constructor from bitset_t. More...
 
 index_set (const index_t idx)
 Constructor from index. More...
 
 index_set (const set_value_t folded_val, const index_set_t frm, const bool prechecked=false)
 Constructor from set value of an index set folded within the given frame. More...
 
 index_set (const index_pair_t &range, const bool prechecked=false)
 Constructor from range of indices from range.first to range.second. More...
 
 index_set (const std::string &str)
 Constructor from string. More...
 
bool operator== (const index_set_t rhs) const
 Equality. More...
 
bool operator!= (const index_set_t rhs) const
 Inequality. More...
 
index_set_t operator~ () const
 Set complement: not. More...
 
index_set_toperator^= (const index_set_t rhs)
 Symmetric set difference: exclusive or. More...
 
index_set_toperator&= (const index_set_t rhs)
 Set intersection: and. More...
 
index_set_toperator|= (const index_set_t rhs)
 Set union: or. More...
 
bool operator[] (const index_t idx) const
 Subscripting: Test idx for membership: test value of bit idx. More...
 
bool test (const index_t idx) const
 Test idx for membership: test value of bit idx. More...
 
index_set_tset ()
 Include all indices except 0: set all bits except 0. More...
 
index_set_tset (const index_t idx)
 Include idx: Set bit at idx if idx != 0. More...
 
index_set_tset (const index_t idx, const int val)
 Set membership of idx to val if idx != 0: Set bit at idx to val if idx != 0. More...
 
index_set_treset ()
 Make set empty: Set all bits to 0. More...
 
index_set_treset (const index_t idx)
 Exclude idx: Set bit at idx to 0. More...
 
index_set_tflip ()
 Set complement, except 0: flip all bits, except 0. More...
 
index_set_tflip (const index_t idx)
 Complement membership of idx if idx != 0: flip bit at idx if idx != 0. More...
 
index_t count () const
 Cardinality: Number of indices included in set. More...
 
index_t count_neg () const
 Number of negative indices included in set. More...
 
index_t count_pos () const
 Number of positive indices included in set. More...
 
index_t min () const
 Minimum member. More...
 
index_t max () const
 Maximum member. More...
 
bool operator< (const index_set_t rhs) const
 Less than operator used for comparisons, map, etc. More...
 
bool is_contiguous () const
 Determine if the index set is contiguous, ie. has no gaps. More...
 
const index_set_t fold () const
 Fold this index set within itself as a frame. More...
 
const index_set_t fold (const index_set_t frm, const bool prechecked=false) const
 Fold this index set within the given frame. More...
 
const index_set_t unfold (const index_set_t frm, const bool prechecked=false) const
 Unfold this index set within the given frame. More...
 
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. More...
 
int sign_of_mult (const index_set_t ist) const
 Sign of geometric product of two Clifford basis elements. More...
 
int sign_of_square () const
 Sign of geometric square of a Clifford basis element. More...
 
size_t hash_fn () const
 Hash function. More...
 
reference operator[] (index_t idx)
 Subscripting: Element access. More...
 

Static Public Member Functions

static const std::string classname ()
 

Static Public Attributes

static const index_t v_lo = LO
 
static const index_t v_hi = HI
 

Private Types

typedef std::bitset< HI-LO > bitset_t
 
typedef error< index_seterror_t
 

Private Member Functions

 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))
 
bool lex_less_than (const index_set_t rhs) const
 Lexicographic ordering of two sets: *this < rhs. More...
 

Friends

class reference
 
const index_set_t operator^ (const index_set_t &lhs, const index_set_t &rhs)
 
const index_set_t operator& (const index_set_t &lhs, const index_set_t &rhs)
 
const index_set_t operator| (const index_set_t &lhs, const index_set_t &rhs)
 
int compare (const index_set_t &lhs, const index_set_t &rhs)
 

Detailed Description

template<const index_t LO, const index_t HI>
class glucat::index_set< LO, HI >

Index set class based on std::bitset<> in Gnu standard C++ library.

Definition at line 74 of file index_set.h.

Member Typedef Documentation

◆ bitset_t

template<const index_t LO, const index_t HI>
typedef std::bitset<HI-LO> glucat::index_set< LO, HI >::bitset_t
private

Definition at line 110 of file index_set.h.

◆ error_t

template<const index_t LO, const index_t HI>
typedef error<index_set> glucat::index_set< LO, HI >::error_t
private

Definition at line 111 of file index_set.h.

◆ index_pair_t

template<const index_t LO, const index_t HI>
typedef std::pair<index_t,index_t> glucat::index_set< LO, HI >::index_pair_t

Definition at line 114 of file index_set.h.

◆ index_set_t

template<const index_t LO, const index_t HI>
typedef index_set glucat::index_set< LO, HI >::index_set_t

Definition at line 113 of file index_set.h.

Constructor & Destructor Documentation

◆ index_set() [1/6]

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::index_set ( )
inline

Default constructor creates an empty set.

Definition at line 121 of file index_set.h.

◆ index_set() [2/6]

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::index_set ( const bitset_t  bst)

Constructor from bitset_t.

Definition at line 89 of file index_set_imp.h.

◆ index_set() [3/6]

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::index_set ( const index_t  idx)

Constructor from index.

Constructor from index value.

Definition at line 83 of file index_set_imp.h.

◆ index_set() [4/6]

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::index_set ( const set_value_t  folded_val,
const index_set_t  frm,
const bool  prechecked = false 
)

Constructor from set value of an index set folded within the given frame.

Definition at line 96 of file index_set_imp.h.

◆ index_set() [5/6]

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::index_set ( const index_pair_t range,
const bool  prechecked = false 
)

Constructor from range of indices from range.first to range.second.

Definition at line 110 of file index_set_imp.h.

◆ index_set() [6/6]

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::index_set ( const std::string &  str)

Constructor from string.

Definition at line 130 of file index_set_imp.h.

Member Function Documentation

◆ BOOST_STATIC_ASSERT()

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::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)  )
private

◆ classname()

template<const index_t LO, const index_t HI>
const std::string glucat::index_set< LO, HI >::classname
inlinestatic

Definition at line 77 of file index_set_imp.h.

◆ count()

template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::count
inline

◆ count_neg()

template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::count_neg
inline

Number of negative indices included in set.

Definition at line 392 of file index_set_imp.h.

◆ count_pos()

template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::count_pos
inline

Number of positive indices included in set.

Definition at line 404 of file index_set_imp.h.

◆ flip() [1/2]

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::flip
inline

Set complement, except 0: flip all bits, except 0.

Definition at line 347 of file index_set_imp.h.

◆ flip() [2/2]

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::flip ( const index_t  idx)
inline

Complement membership of idx if idx != 0: flip bit at idx if idx != 0.

Definition at line 358 of file index_set_imp.h.

References glucat::index_set< LO, HI >::count().

◆ fold() [1/2]

template<const index_t LO, const index_t HI>
const index_set< LO, HI > glucat::index_set< LO, HI >::fold
inline

Fold this index set within itself as a frame.

Definition at line 776 of file index_set_imp.h.

References glucat::index_set< LO, HI >::set().

Referenced by glucat::index_set< LO, HI >::unfold().

◆ fold() [2/2]

template<const index_t LO, const index_t HI>
const index_set< LO, HI > glucat::index_set< LO, HI >::fold ( const index_set_t  frm,
const bool  prechecked = false 
) const

Fold this index set within the given frame.

Definition at line 784 of file index_set_imp.h.

◆ hash_fn()

template<const index_t LO, const index_t HI>
size_t glucat::index_set< LO, HI >::hash_fn
inline

Hash function.

Definition at line 976 of file index_set_imp.h.

Referenced by glucat::index_set_hash< LO, HI >::operator()().

◆ is_contiguous()

template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::is_contiguous
inline

Determine if the index set is contiguous, ie. has no gaps.

Determine if the index set is contiguous, ie. has no gaps when 0 is included.

Definition at line 760 of file index_set_imp.h.

References glucat::index_set< LO, HI >::set().

◆ lex_less_than()

template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::lex_less_than ( const index_set_t  rhs) const
inlineprivate

Lexicographic ordering of two sets: *this < rhs.

Definition at line 616 of file index_set_imp.h.

◆ max()

template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::max

Maximum member.

Maximum member, or 0 if none.

Definition at line 578 of file index_set_imp.h.

Referenced by PyClical.index_set::__iter__(), and glucat::framed_multi< Scalar_T, LO, HI >::framed_multi().

◆ min()

template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::min

Minimum member.

Minimum member, or 0 if none.

Definition at line 489 of file index_set_imp.h.

Referenced by PyClical.index_set::__iter__(), glucat::framed_multi< Scalar_T, LO, HI >::framed_multi(), and glucat::index_set< LO, HI >::unfold().

◆ operator!=()

template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::operator!= ( const index_set_t  rhs) const
inline

Inequality.

Definition at line 158 of file index_set_imp.h.

◆ operator&=()

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::operator&= ( const index_set_t  rhs)
inline

Set intersection: and.

Definition at line 202 of file index_set_imp.h.

◆ operator<()

template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::operator< ( const index_set_t  rhs) const
inline

Less than operator used for comparisons, map, etc.

Definition at line 624 of file index_set_imp.h.

◆ operator==()

template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::operator== ( const index_set_t  rhs) const
inline

Equality.

Definition at line 147 of file index_set_imp.h.

◆ operator[]() [1/2]

template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::operator[] ( const index_t  idx) const
inline

Subscripting: Test idx for membership: test value of bit idx.

Definition at line 260 of file index_set_imp.h.

◆ operator[]() [2/2]

template<const index_t LO, const index_t HI>
index_set< LO, HI >::reference glucat::index_set< LO, HI >::operator[] ( index_t  idx)
inline

Subscripting: Element access.

Definition at line 252 of file index_set_imp.h.

◆ operator^=()

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::operator^= ( const index_set_t  rhs)
inline

Symmetric set difference: exclusive or.

Definition at line 177 of file index_set_imp.h.

◆ operator|=()

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::operator|= ( const index_set_t  rhs)
inline

Set union: or.

Definition at line 227 of file index_set_imp.h.

◆ operator~()

template<const index_t LO, const index_t HI>
index_set< LO, HI > glucat::index_set< LO, HI >::operator~
inline

Set complement: not.

Definition at line 169 of file index_set_imp.h.

◆ reset() [1/2]

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::reset
inline

Make set empty: Set all bits to 0.

Definition at line 322 of file index_set_imp.h.

◆ reset() [2/2]

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::reset ( const index_t  idx)
inline

Exclude idx: Set bit at idx to 0.

Definition at line 333 of file index_set_imp.h.

◆ set() [1/3]

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::set
inline

Include all indices except 0: set all bits except 0.

Definition at line 283 of file index_set_imp.h.

Referenced by glucat::index_set< LO, HI >::fold(), and glucat::index_set< LO, HI >::is_contiguous().

◆ set() [2/3]

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::set ( const index_t  idx)
inline

Include idx: Set bit at idx if idx != 0.

Definition at line 294 of file index_set_imp.h.

◆ set() [3/3]

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::set ( const index_t  idx,
const int  val 
)
inline

Set membership of idx to val if idx != 0: Set bit at idx to val if idx != 0.

Definition at line 308 of file index_set_imp.h.

◆ sign_of_mult()

template<const index_t LO, const index_t HI>
int glucat::index_set< LO, HI >::sign_of_mult ( const index_set_t  ist) const

Sign of geometric product of two Clifford basis elements.

Definition at line 907 of file index_set_imp.h.

◆ sign_of_square()

template<const index_t LO, const index_t HI>
int glucat::index_set< LO, HI >::sign_of_square
inline

Sign of geometric square of a Clifford basis element.

Definition at line 956 of file index_set_imp.h.

◆ test()

template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::test ( const index_t  idx) const
inline

Test idx for membership: test value of bit idx.

Definition at line 268 of file index_set_imp.h.

◆ unfold()

template<const index_t LO, const index_t HI>
const index_set< LO, HI > glucat::index_set< LO, HI >::unfold ( const index_set_t  frm,
const bool  prechecked = false 
) const

Unfold this index set within the given frame.

Definition at line 822 of file index_set_imp.h.

References glucat::index_set< LO, HI >::fold(), and glucat::index_set< LO, HI >::min().

◆ value_of_fold()

template<const index_t LO, const index_t HI>
set_value_t glucat::index_set< LO, HI >::value_of_fold ( const index_set_t  frm) const
inline

The set value of the fold of this index set within the given frame.

Definition at line 856 of file index_set_imp.h.

Friends And Related Function Documentation

◆ compare

template<const index_t LO, const index_t HI>
int compare ( const index_set_t lhs,
const index_set_t rhs 
)
friend

◆ operator&

template<const index_t LO, const index_t HI>
const index_set_t operator& ( const index_set_t lhs,
const index_set_t rhs 
)
friend

◆ operator^

template<const index_t LO, const index_t HI>
const index_set_t operator^ ( const index_set_t lhs,
const index_set_t rhs 
)
friend

◆ operator|

template<const index_t LO, const index_t HI>
const index_set_t operator| ( const index_set_t lhs,
const index_set_t rhs 
)
friend

◆ reference

template<const index_t LO, const index_t HI>
friend class reference
friend

Definition at line 203 of file index_set.h.

Member Data Documentation

◆ v_hi

template<const index_t LO, const index_t HI>
const index_t glucat::index_set< LO, HI >::v_hi = HI
static

Definition at line 117 of file index_set.h.

◆ v_lo

template<const index_t LO, const index_t HI>
const index_t glucat::index_set< LO, HI >::v_lo = LO
static

Definition at line 116 of file index_set.h.


The documentation for this class was generated from the following files: