CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::PolyTrie< T > Class Template Reference

#include <PolyTrie.hh>

+ Inheritance diagram for CASM::PolyTrie< T >:

Detailed Description

template<typename T>
class CASM::PolyTrie< T >

Definition at line 27 of file PolyTrie.hh.

Public Types

typedef T value_type
 
typedef PTLeaf< T > leaf_type
 
typedef PTIterator< PolyTrie< T > > iterator
 
typedef PTIterator< PolyTrie
< T >, true > 
const_iterator
 

Public Member Functions

 PolyTrie (Index _depth)
 
 PolyTrie (const PolyTrie< T > &orig)
 
 ~PolyTrie ()
 
void remove ()
 Virtual from PTNode<T>, you cannot remove a PolyTrie. More...
 
void remove (const Array< Index > &ind)
 Remove entry at 'ind'. More...
 
void swap (PolyTrie< T > &other)
 Efficient swap of this PolyTrie with another. More...
 
void redefine (Index new_depth)
 Clears all leaves and resets depth. More...
 
void clear ()
 
Index depth () const
 
get (const Array< Index > &ind) const
 get() provides constant access does not change trie structure More...
 
T & at (const Array< Index > &ind)
 at() provides non-const access and changes trie if leaf does not exist at ind More...
 
T & operator() (const Array< Index > &ind)
 
operator() (const Array< Index > &ind) const
 
void set (const Array< Index > &ind, const T &_val)
 set() allows assignment that prunes the trie if _val is approximately 0; More...
 
void list_leaf (PTLeaf< T > *new_leaf)
 
bool prune_zeros (double tol=PTNode< T >::PT_TOL())
 removes zero entries, if there are any, and returns true if entries were removed. More...
 
PTLeaf< T > * begin_ptr ()
 
PTLeaf< T > const * begin_ptr () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void print_sparse (std::ostream &out) const
 
PolyTrieoperator*= (const T &scale)
 
PolyTrieoperator+= (const PolyTrie< T > &RHS)
 
PolyTrieoperator-= (const PolyTrie< T > &RHS)
 
PolyTrie operator+ (const PolyTrie< T > &RHS) const
 
PolyTrie operator- (const PolyTrie< T > &RHS) const
 
bool compare (const PolyTrie< T > &RHS, double tol=2 *PTNode< T >::PT_TOL()) const
 
bool operator== (const PolyTrie< T > &RHS) const
 
bool almost_zero (double tol=2 *PTNode< T >::PT_TOL()) const
 
template<typename CompareType >
void sort_leaves (const CompareType &compare)
 
const T & val () const
 
void remove (Index ind)
 
void swap (Array< PTNode< T > * > &RHS)
 
PTNode< T > *& at (Index ind)
 
const PTNode< T > *& at (Index ind) const
 
bool operator== (const Array< PTNode< T > * > &RHS) const
 

Protected Types

typedef Array< PTNode< T > * > X1
 
typedef Array< X1X2
 
typedef Array< X2X3
 
typedef Array< X3X4
 
typedef Array< X4X5
 
typedef Array< X5X6
 
typedef Array< X6X7
 
typedef Array< X7X8
 
typedef Array< X8X9
 
typedef Index size_type
 

Protected Member Functions

PTNode< T > * valid_node_at (Index i)
 
PTNode< T > * valid_leaf_at (PolyTrie< T > &home_trie, const Array< Index > &ind)
 
Index size () const
 
const PTNode< T > *& operator[] (Index ind) const
 
PTNode< T > *& operator[] (Index ind)
 
PTNode< T > *& back ()
 
const PTNode< T > *& back () const
 
PTNode< T > *const * cbegin () const
 
PTNode< T > *const * cend () const
 
void push_back (const PTNode< T > *&toPush)
 
void pop_back ()
 
void resize (Index new_N)
 
void resize (Index new_N, const PTNode< T > *&fill_val)
 
void reserve (Index new_max)
 
void sort (const CompareType &comp)
 
void sort (Array< Index > &ind_order)
 
void sort ()
 
Arrayappend (const Array &new_tail)
 
Arrayappend_unique (const Array &new_tail)
 
void swap_elem (Index i, Index j)
 
Arraypermute (const Array< Index > &perm_array)
 
Arrayipermute (const Array< Index > &perm_array)
 
bool next_permute ()
 
ReturnArray< Indexas_perm_inverse () const
 
ReturnArray< Indexas_perm_transform_by (const Array< Index > &trans_perm) const
 
const PTNode< T > *& max () const
 
const PTNode< T > *& min () const
 
ReturnArray< PTNode< T > * > sub_array (Index ind_begin, Index ind_end) const
 
PTNode< T > * sum () const
 
bool is_ascending () const
 
bool is_descending () const
 
bool is_constant () const
 
bool is_permute () const
 
bool has_fixed_points () const
 Checks whether any values are equal to their index – only valid for Array<Index> More...
 
bool operator!= (const Array< PTNode< T > * > &RHS) const
 
bool operator< (const Array< PTNode< T > * > &RHS) const
 
bool operator> (const Array< PTNode< T > * > &RHS) const
 
bool operator<= (const Array< PTNode< T > * > &RHS) const
 
bool operator>= (const Array< PTNode< T > * > &RHS) const
 
bool all_in (const Array &superset) const
 
Index coincidence (const Array &superset) const
 
Index incidences (const PTNode< T > *&test_elem) const
 
Index find (const PTNode< T > *&test_elem) const
 
Index reverse_find (const PTNode< T > *&test_elem) const
 Same as find, but starts from the last element of the Array. More...
 
Index almost_find (const PTNode< T > *&test_elem, double tol_val=TOL) const
 
Index almost_reverse_find (const PTNode< T > *&test_elem, double tol_val=TOL) const
 Same as almost_find, but start from the last element of the Array. More...
 
bool contains (const PTNode< T > *&test_elem) const
 
bool almost_contains (const PTNode< T > *&test_elem, double tol_val=TOL) const
 
void print_column (std::ostream &stream, const std::string &indent="") const
 

Static Protected Member Functions

static double PT_TOL ()
 
static ReturnArray< PTNode< T > * > sequence (const PTNode< T > *&initial, const PTNode< T > *&final)
 Returns an array with the sequence (initial, ++initial, ..., final), inclusive. More...
 
static ReturnArray< PTNode< T > * > sequence (const PTNode< T > *&initial, const PTNode< T > *&increment, const PTNode< T > *&final)
 

Protected Attributes

PTNode< T > * up_node
 
m_val
 

Private Member Functions

Index num_nonzero () const
 

Private Attributes

Index m_depth
 
PTLeaf< T > * m_leaf_list
 

Member Typedef Documentation

template<typename T>
typedef PTIterator<PolyTrie<T>, true> CASM::PolyTrie< T >::const_iterator

Definition at line 213 of file PolyTrie.hh.

template<typename T>
typedef PTIterator<PolyTrie<T> > CASM::PolyTrie< T >::iterator

Definition at line 212 of file PolyTrie.hh.

template<typename T>
typedef PTLeaf<T> CASM::PolyTrie< T >::leaf_type

Definition at line 210 of file PolyTrie.hh.

typedef Index CASM::Array< PTNode< T > * >::size_type
inherited

Definition at line 74 of file Array.hh.

template<typename T>
typedef T CASM::PolyTrie< T >::value_type

Definition at line 208 of file PolyTrie.hh.

typedef Array<PTNode< T > * > CASM::Array< PTNode< T > * >::X1
inherited

Definition at line 63 of file Array.hh.

typedef Array<X1> CASM::Array< PTNode< T > * >::X2
inherited

Definition at line 64 of file Array.hh.

typedef Array<X2> CASM::Array< PTNode< T > * >::X3
inherited

Definition at line 65 of file Array.hh.

typedef Array<X3> CASM::Array< PTNode< T > * >::X4
inherited

Definition at line 66 of file Array.hh.

typedef Array<X4> CASM::Array< PTNode< T > * >::X5
inherited

Definition at line 67 of file Array.hh.

typedef Array<X5> CASM::Array< PTNode< T > * >::X6
inherited

Definition at line 68 of file Array.hh.

typedef Array<X6> CASM::Array< PTNode< T > * >::X7
inherited

Definition at line 69 of file Array.hh.

typedef Array<X7> CASM::Array< PTNode< T > * >::X8
inherited

Definition at line 70 of file Array.hh.

typedef Array<X8> CASM::Array< PTNode< T > * >::X9
inherited

Definition at line 71 of file Array.hh.

Constructor & Destructor Documentation

template<typename T>
CASM::PolyTrie< T >::PolyTrie ( Index  _depth)
inline

Definition at line 215 of file PolyTrie.hh.

Member Function Documentation

bool CASM::Array< PTNode< T > * >::all_in ( const Array< PTNode< T > * > &  superset) const
inherited
bool CASM::Array< PTNode< T > * >::almost_contains ( const PTNode< T > * &  test_elem,
double  tol_val = TOL 
) const
inlineinherited

Definition at line 284 of file Array.hh.

Index CASM::Array< PTNode< T > * >::almost_find ( const PTNode< T > * &  test_elem,
double  tol_val = TOL 
) const
inherited
Index CASM::Array< PTNode< T > * >::almost_reverse_find ( const PTNode< T > * &  test_elem,
double  tol_val = TOL 
) const
inherited

Same as almost_find, but start from the last element of the Array.

Array& CASM::Array< PTNode< T > * >::append ( const Array< PTNode< T > * > &  new_tail)
inherited
Array& CASM::Array< PTNode< T > * >::append_unique ( const Array< PTNode< T > * > &  new_tail)
inherited
ReturnArray<Index> CASM::Array< PTNode< T > * >::as_perm_inverse ( ) const
inherited

Construct permutation that undoes the permutation performed by 'this' Inverse operation is calculated the same, regardless of permutation convention

ReturnArray<Index> CASM::Array< PTNode< T > * >::as_perm_transform_by ( const Array< Index > &  trans_perm) const
inherited

Given N distinct objects labeled from 0 to N-1, a permutation 'P_permute' that physically permutes the objects (with labels) in terms of their labels, and a permutation 'L_permute' that permutes their labels only, rewrite 'P_permute' in terms of the relabeling induced by 'L_permute' Rearrange 'this' permutation to form an equivalent permutation for any list that has already been permuted by trans_perm. Does not (nearly certain of this) depend on permutation convention

PTNode< T > * & CASM::Array< PTNode< T > * >::at ( Index  ind)
inlineinherited

Definition at line 157 of file Array.hh.

const PTNode< T > * & CASM::Array< PTNode< T > * >::at ( Index  ind) const
inlineinherited

Definition at line 162 of file Array.hh.

PTNode< T > * & CASM::Array< PTNode< T > * >::back ( )
inlineinherited

Definition at line 177 of file Array.hh.

const PTNode< T > * & CASM::Array< PTNode< T > * >::back ( ) const
inlineinherited

Definition at line 180 of file Array.hh.

template<typename T>
iterator CASM::PolyTrie< T >::begin ( )
inline

Definition at line 263 of file PolyTrie.hh.

template<typename T>
const_iterator CASM::PolyTrie< T >::begin ( ) const
inline

Definition at line 266 of file PolyTrie.hh.

template<typename T>
PTLeaf<T>* CASM::PolyTrie< T >::begin_ptr ( )
inline

Definition at line 256 of file PolyTrie.hh.

template<typename T>
PTLeaf<T> const* CASM::PolyTrie< T >::begin_ptr ( ) const
inline

Definition at line 259 of file PolyTrie.hh.

PTNode< T > * const* CASM::Array< PTNode< T > * >::cbegin ( ) const
inlineinherited

Definition at line 189 of file Array.hh.

PTNode< T > * const* CASM::Array< PTNode< T > * >::cend ( ) const
inlineinherited

Definition at line 201 of file Array.hh.

Index CASM::Array< PTNode< T > * >::coincidence ( const Array< PTNode< T > * > &  superset) const
inherited
bool CASM::Array< PTNode< T > * >::contains ( const PTNode< T > * &  test_elem) const
inlineinherited

Definition at line 281 of file Array.hh.

template<typename T>
Index CASM::PolyTrie< T >::depth ( ) const
inline

Definition at line 234 of file PolyTrie.hh.

template<typename T>
iterator CASM::PolyTrie< T >::end ( )
inline

Definition at line 270 of file PolyTrie.hh.

template<typename T>
const_iterator CASM::PolyTrie< T >::end ( ) const
inline

Definition at line 273 of file PolyTrie.hh.

Index CASM::Array< PTNode< T > * >::find ( const PTNode< T > * &  test_elem) const
inherited
bool CASM::Array< PTNode< T > * >::has_fixed_points ( ) const
inherited

Checks whether any values are equal to their index – only valid for Array<Index>

Index CASM::Array< PTNode< T > * >::incidences ( const PTNode< T > * &  test_elem) const
inherited
Array& CASM::Array< PTNode< T > * >::ipermute ( const Array< Index > &  perm_array)
inherited
bool CASM::Array< PTNode< T > * >::is_ascending ( ) const
inherited
bool CASM::Array< PTNode< T > * >::is_constant ( ) const
inherited
bool CASM::Array< PTNode< T > * >::is_descending ( ) const
inherited
bool CASM::Array< PTNode< T > * >::is_permute ( ) const
inherited

Checks that Array contains values from 0 to perm_array.size()-1 and that no value is repeated does not depend on definition of permutation convention

const PTNode< T > * & CASM::Array< PTNode< T > * >::max ( ) const
inherited
const PTNode< T > * & CASM::Array< PTNode< T > * >::min ( ) const
inherited
bool CASM::Array< PTNode< T > * >::next_permute ( )
inherited
bool CASM::Array< PTNode< T > * >::operator!= ( const Array< PTNode< T > * > &  RHS) const
inlineinherited

Definition at line 260 of file Array.hh.

bool CASM::Array< PTNode< T > * >::operator< ( const Array< PTNode< T > * > &  RHS) const
inherited
bool CASM::Array< PTNode< T > * >::operator<= ( const Array< PTNode< T > * > &  RHS) const
inlineinherited

Definition at line 265 of file Array.hh.

bool CASM::Array< PTNode< T > * >::operator== ( const Array< PTNode< T > * > &  RHS) const
inherited
bool CASM::Array< PTNode< T > * >::operator> ( const Array< PTNode< T > * > &  RHS) const
inherited
bool CASM::Array< PTNode< T > * >::operator>= ( const Array< PTNode< T > * > &  RHS) const
inlineinherited

Definition at line 268 of file Array.hh.

const PTNode< T > * & CASM::Array< PTNode< T > * >::operator[] ( Index  ind) const
inlineinherited

Definition at line 167 of file Array.hh.

PTNode< T > * & CASM::Array< PTNode< T > * >::operator[] ( Index  ind)
inlineinherited

Definition at line 172 of file Array.hh.

Array& CASM::Array< PTNode< T > * >::permute ( const Array< Index > &  perm_array)
inherited
void CASM::Array< PTNode< T > * >::pop_back ( )
inlineinherited

Definition at line 212 of file Array.hh.

void CASM::Array< PTNode< T > * >::print_column ( std::ostream &  stream,
const std::string &  indent = "" 
) const
inherited
template<typename T>
static double CASM::PTNode< T >::PT_TOL ( )
inlinestaticprotectedinherited

Definition at line 42 of file PolyTrie.hh.

void CASM::Array< PTNode< T > * >::push_back ( const PTNode< T > * &  toPush)
inherited
void CASM::Array< PTNode< T > * >::remove ( Index  ind)
inherited
template<typename T>
void CASM::PolyTrie< T >::remove ( )
inlinevirtual

Virtual from PTNode<T>, you cannot remove a PolyTrie.

Reimplemented from CASM::PTNode< T >.

Definition at line 221 of file PolyTrie.hh.

void CASM::Array< PTNode< T > * >::reserve ( Index  new_max)
inherited
void CASM::Array< PTNode< T > * >::resize ( Index  new_N)
inherited
void CASM::Array< PTNode< T > * >::resize ( Index  new_N,
const PTNode< T > * &  fill_val 
)
inherited
Index CASM::Array< PTNode< T > * >::reverse_find ( const PTNode< T > * &  test_elem) const
inherited

Same as find, but starts from the last element of the Array.

static ReturnArray<PTNode< T > * > CASM::Array< PTNode< T > * >::sequence ( const PTNode< T > * &  initial,
const PTNode< T > * &  final 
)
staticinherited

Returns an array with the sequence (initial, ++initial, ..., final), inclusive.

Returns an array with the sequence (initial, ++initial, ..., final), inclusive requires that operator<() and operator++() are defined on type T

static ReturnArray<PTNode< T > * > CASM::Array< PTNode< T > * >::sequence ( const PTNode< T > * &  initial,
const PTNode< T > * &  increment,
const PTNode< T > * &  final 
)
staticinherited

Returns an array with the sequence (initial, initial+increment, ..., final?), inclusive if final is in the sequence requires that operator<() and operator+=() are defined on type T

Returns an array with the sequence (initial, initial+increment, ..., final?), inclusive if final is in the sequence

Index CASM::Array< PTNode< T > * >::size ( ) const
inlineinherited

Definition at line 145 of file Array.hh.

void CASM::Array< PTNode< T > * >::sort ( const CompareType &  comp)
inherited
void CASM::Array< PTNode< T > * >::sort ( Array< Index > &  ind_order)
inherited
void CASM::Array< PTNode< T > * >::sort ( )
inherited
ReturnArray<PTNode< T > * > CASM::Array< PTNode< T > * >::sub_array ( Index  ind_begin,
Index  ind_end 
) const
inherited
PTNode< T > * CASM::Array< PTNode< T > * >::sum ( ) const
inherited
void CASM::Array< PTNode< T > * >::swap ( Array< PTNode< T > * > &  RHS)
inherited
void CASM::Array< PTNode< T > * >::swap_elem ( Index  i,
Index  j 
)
inlineinherited

Definition at line 231 of file Array.hh.

template<typename T>
const T& CASM::PTNode< T >::val ( ) const
inlineinherited

Definition at line 61 of file PolyTrie.hh.

Member Data Documentation

template<typename T>
Index CASM::PolyTrie< T >::m_depth
private

Definition at line 198 of file PolyTrie.hh.

template<typename T>
PTLeaf<T>* CASM::PolyTrie< T >::m_leaf_list
private

Definition at line 199 of file PolyTrie.hh.

template<typename T>
T CASM::PTNode< T >::m_val
protectedinherited

Definition at line 47 of file PolyTrie.hh.

template<typename T>
PTNode<T>* CASM::PTNode< T >::up_node
protectedinherited

Definition at line 46 of file PolyTrie.hh.


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