TiledArray::expressions::IndexList Class Reference

Documentation

IndexList is a sequence of "indices" (multicharacter labels) used to annotate modes of a miltidimensional tensor/array for the purpose of encoding an operation

Definition at line 107 of file index_list.h.

Public Types

using container_type = container::svector< std::string >
 
using const_iterator = typename container_type::const_iterator
 

Public Member Functions

 IndexList ()
 Constructs an empty index list. More...
 
 IndexList (const std::string &str)
 constructs from a string More...
 
template<typename InIter >
 IndexList (InIter first, InIter last)
 constructs from a range of index labels More...
 
 IndexList (const container_type &indices)
 constructs from a container of index labels More...
 
 IndexList (const IndexList &other)
 
IndexListoperator= (const IndexList &other)
 
IndexListoperator= (const std::string &str)
 
IndexListoperator*= (const Permutation &p)
 
 operator bool () const
 Bool conversion. More...
 
bool operator! () const
 Not operator. More...
 
const_iterator begin () const
 Returns an iterator to the first index. More...
 
const_iterator end () const
 Returns an iterator to the end of the index list. More...
 
const std::string & at (const std::size_t n) const
 Returns the n-th index. More...
 
const std::string & operator[] (const std::size_t n) const
 Returns the n-th index. More...
 
unsigned int dim () const
 Returns the number of elements in the index list. More...
 
unsigned int size () const
 Returns the number of elements in the index list. More...
 
const auto & data () const
 
std::string string () const
 comma-separated concatenator of indices More...
 
void swap (IndexList &other)
 
auto count (const std::string &x) const
 
auto positions (const std::string &x) const
 
template<typename V , typename = std::enable_if_t<TiledArray::detail::is_range_v<V>>>
Permutation permutation (const V &other) const
 Computes permutation that converts an index list to this list. More...
 
bool is_permutation (const IndexList &other) const
 Check that this index list is a permutation of other. More...
 

Friends

void swap (IndexList &, IndexList &)
 Exchange the content of the two index lists. More...
 
IndexList operator* (const ::TiledArray::Permutation &, const IndexList &)
 

Member Typedef Documentation

◆ const_iterator

using TiledArray::expressions::IndexList::const_iterator = typename container_type::const_iterator

Definition at line 110 of file index_list.h.

◆ container_type

Constructor & Destructor Documentation

◆ IndexList() [1/5]

TiledArray::expressions::IndexList::IndexList ( )
inline

Constructs an empty index list.

Definition at line 113 of file index_list.h.

◆ IndexList() [2/5]

TiledArray::expressions::IndexList::IndexList ( const std::string &  str)
inlineexplicit

constructs from a string

Parameters
stra string containing comma-separated index labels. All whitespaces are discarded, i.e., "a c" will be converted to "ac" and will be considered a single index.

Definition at line 120 of file index_list.h.

◆ IndexList() [3/5]

template<typename InIter >
TiledArray::expressions::IndexList::IndexList ( InIter  first,
InIter  last 
)
inline

constructs from a range of index labels

Template Parameters
InIteran input iterator dereferencing to std::string
Parameters
firstthe begin iterator
lastthe end iterator
Note
All whitespaces are discarded, i.e., "a c" will be converted to "ac" and will be considered a single index.

Definition at line 132 of file index_list.h.

◆ IndexList() [4/5]

TiledArray::expressions::IndexList::IndexList ( const container_type indices)
inline

constructs from a container of index labels

Parameters
indicesthe index container
Note
All whitespaces are discarded, i.e., "a c" will be converted to "ac" and will be considered a single index.

Definition at line 145 of file index_list.h.

◆ IndexList() [5/5]

TiledArray::expressions::IndexList::IndexList ( const IndexList other)
inline

Definition at line 148 of file index_list.h.

Member Function Documentation

◆ at()

const std::string& TiledArray::expressions::IndexList::at ( const std::size_t  n) const
inline

Returns the n-th index.

Definition at line 184 of file index_list.h.

◆ begin()

const_iterator TiledArray::expressions::IndexList::begin ( ) const
inline

Returns an iterator to the first index.

Definition at line 178 of file index_list.h.

Here is the caller graph for this function:

◆ count()

auto TiledArray::expressions::IndexList::count ( const std::string &  x) const
inline

Returns the number of times index x appears in this instance

Parameters
[in]xThe index we are searching for.
Returns
the number of times x appears in this object

Definition at line 220 of file index_list.h.

Here is the call graph for this function:

◆ data()

const auto& TiledArray::expressions::IndexList::data ( ) const
inline

Definition at line 199 of file index_list.h.

◆ dim()

unsigned int TiledArray::expressions::IndexList::dim ( ) const
inline

Returns the number of elements in the index list.

Definition at line 192 of file index_list.h.

◆ end()

const_iterator TiledArray::expressions::IndexList::end ( ) const
inline

Returns an iterator to the end of the index list.

Definition at line 181 of file index_list.h.

Here is the caller graph for this function:

◆ is_permutation()

bool TiledArray::expressions::IndexList::is_permutation ( const IndexList other) const
inline

Check that this index list is a permutation of other.

Returns
true if all indices in this index list are in other, otherwise false.

Definition at line 254 of file index_list.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool()

TiledArray::expressions::IndexList::operator bool ( ) const
inlineexplicit

Bool conversion.

Returns
true if the permutation is not empty, otherwise false.

Definition at line 170 of file index_list.h.

◆ operator!()

bool TiledArray::expressions::IndexList::operator! ( ) const
inline

Not operator.

Returns
true if the permutation is empty, otherwise false.

Definition at line 175 of file index_list.h.

◆ operator*=()

IndexList& TiledArray::expressions::IndexList::operator*= ( const Permutation p)
inline

Definition at line 161 of file index_list.h.

Here is the call graph for this function:

◆ operator=() [1/2]

IndexList& TiledArray::expressions::IndexList::operator= ( const IndexList other)
inline

Definition at line 150 of file index_list.h.

◆ operator=() [2/2]

IndexList& TiledArray::expressions::IndexList::operator= ( const std::string &  str)
inline

Definition at line 156 of file index_list.h.

◆ operator[]()

const std::string& TiledArray::expressions::IndexList::operator[] ( const std::size_t  n) const
inline

Returns the n-th index.

Definition at line 187 of file index_list.h.

◆ permutation()

template<typename V , typename = std::enable_if_t<TiledArray::detail::is_range_v<V>>>
Permutation TiledArray::expressions::IndexList::permutation ( const V &  other) const
inline

Computes permutation that converts an index list to this list.

The result of this function is a permutation that defines this=p^other .

Template Parameters
VA range type
Parameters
otherAn array that defines a index list
Returns
p as defined by the above relationship

Definition at line 246 of file index_list.h.

Here is the call graph for this function:

◆ positions()

auto TiledArray::expressions::IndexList::positions ( const std::string &  x) const
inline

Returns the positions of x in this

Parameters
[in]xThe index we are looking for.
Returns
A random-access container whose length is the number of times that x appears in the annotation and whose elements are the indices whose labels equal x.

Definition at line 230 of file index_list.h.

Here is the call graph for this function:

◆ size()

unsigned int TiledArray::expressions::IndexList::size ( ) const
inline

Returns the number of elements in the index list.

Definition at line 197 of file index_list.h.

Here is the caller graph for this function:

◆ string()

std::string TiledArray::expressions::IndexList::string ( ) const
inline

comma-separated concatenator of indices

Definition at line 202 of file index_list.h.

◆ swap()

void TiledArray::expressions::IndexList::swap ( IndexList other)
inline

Definition at line 215 of file index_list.h.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator*

IndexList operator* ( const ::TiledArray::Permutation p,
const IndexList v 
)
friend

Definition at line 338 of file index_list.h.

◆ swap

void swap ( IndexList v0,
IndexList v1 
)
friend

Exchange the content of the two index lists.

Definition at line 325 of file index_list.h.


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