glucat  0.8.2
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>

Inheritance diagram for glucat::index_set< LO, HI >:
Inheritance graph
[legend]
Collaboration diagram for glucat::index_set< LO, HI >:
Collaboration graph
[legend]

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 45 of file index_set.h.

Member Typedef Documentation

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 81 of file index_set.h.

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

Definition at line 82 of file index_set.h.

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 85 of file index_set.h.

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

Definition at line 84 of file index_set.h.

Constructor & Destructor Documentation

template<const index_t LO, const index_t HI>
glucat::index_set< LO, HI >::index_set ( )
inline
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 61 of file index_set_imp.h.

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

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 55 of file index_set_imp.h.

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

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 
)
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 82 of file index_set_imp.h.

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

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 102 of file index_set_imp.h.

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

Member Function Documentation

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
template<const index_t LO, const index_t HI>
const std::string glucat::index_set< LO, HI >::classname ( )
inlinestatic

Definition at line 49 of file index_set_imp.h.

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

template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::count ( ) const
inline
template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::count_neg ( ) const
inline
template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::count_pos ( ) const
inline
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 319 of file index_set_imp.h.

Referenced by glucat::index_set< LO, HI >::reference::flip(), glucat::index_set< LO, HI >::index_set(), and glucat::index_set< LO, HI >::reset().

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 330 of file index_set_imp.h.

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

template<const index_t LO, const index_t HI>
const index_set< LO, HI > glucat::index_set< LO, HI >::fold ( ) const
inline
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
template<const index_t LO, const index_t HI>
size_t glucat::index_set< LO, HI >::hash_fn ( ) const
inline
template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::is_contiguous ( ) const
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 732 of file index_set_imp.h.

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

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

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 588 of file index_set_imp.h.

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

Referenced by glucat::compare(), and glucat::index_set< LO, HI >::operator<().

template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::max ( ) const
template<const index_t LO, const index_t HI>
index_t glucat::index_set< LO, HI >::min ( ) const
template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::operator!= ( const index_set_t  rhs) const
inline
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 174 of file index_set_imp.h.

Referenced by glucat::index_set< LO, HI >::index_set(), and glucat::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 597 of file index_set_imp.h.

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

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

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 119 of file index_set_imp.h.

References glucat::index_set< LO, HI >::operator!=().

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

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 232 of file index_set_imp.h.

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

Referenced by glucat::index_set< LO, HI >::index_set(), glucat::index_set< LO, HI >::operator[](), and glucat::operator|().

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 224 of file index_set_imp.h.

References glucat::index_set< LO, HI >::operator[](), and glucat::index_set< LO, HI >::reference.

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 149 of file index_set_imp.h.

Referenced by glucat::index_set< LO, HI >::index_set(), and glucat::index_set< LO, HI >::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 199 of file index_set_imp.h.

Referenced by glucat::index_set< LO, HI >::index_set(), and glucat::operator&().

template<const index_t LO, const index_t HI>
index_set< LO, HI > glucat::index_set< LO, HI >::operator~ ( ) const
inline
template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::reset ( )
inline
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 305 of file index_set_imp.h.

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

template<const index_t LO, const index_t HI>
index_set< LO, HI > & glucat::index_set< LO, HI >::set ( )
inline
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 266 of file index_set_imp.h.

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

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 280 of file index_set_imp.h.

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

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 879 of file index_set_imp.h.

References glucat::inverse_gray(), glucat::inverse_reversed_gray(), and glucat::index_set< LO, HI >::sign_of_square().

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

template<const index_t LO, const index_t HI>
int glucat::index_set< LO, HI >::sign_of_square ( ) const
inline
template<const index_t LO, const index_t HI>
bool glucat::index_set< LO, HI >::test ( const index_t  idx) const
inline
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
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 828 of file index_set_imp.h.

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

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

Friends And Related Function Documentation

template<const index_t LO, const index_t HI>
int compare ( const index_set_t lhs,
const index_set_t rhs 
)
friend
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
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
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
template<const index_t LO, const index_t HI>
friend class reference
friend

Definition at line 173 of file index_set.h.

Referenced by glucat::index_set< LO, HI >::operator[]().

Member Data Documentation

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

Definition at line 88 of file index_set.h.

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

Definition at line 87 of file index_set.h.


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