10 #ifndef STOKHOS_SPARSE3TENSOR_HPP
11 #define STOKHOS_SPARSE3TENSOR_HPP
23 template <
typename ordinal_type,
typename value_type>
28 typedef std::map<const ordinal_type, value_type>
i_map;
29 typedef std::map<const ordinal_type, i_map>
ji_map;
30 typedef std::map<const ordinal_type, ji_map>
kji_map;
32 typedef std::map<const ordinal_type, value_type>
j_map;
33 typedef std::map<const ordinal_type, j_map>
kj_map;
34 typedef std::map<const ordinal_type, kj_map>
ikj_map;
96 void print(std::ostream& os)
const;
250 template <
typename ordinal_type,
typename value_type>
261 template <
typename index_iterator,
typename value_iterator>
270 template <
typename index_iterator,
typename value_iterator>
281 template <
typename index_iterator,
typename value_iterator>
292 #endif // STOKHOS_SPARSE3TENSOR_HPP
Sparse3Tensor()
Constructor.
j_sparse_array::const_iterator ikj_iterator
Iterator for looping over j entries given i and k.
bool fill_completed
Indicate whether fillComplete() has been called.
SparseArray< ordinal_type, j_sparse_array > kj_sparse_array
Sparse3Tensor & operator=(const Sparse3Tensor &b)
k_iterator k_begin() const
Iterator pointing to first k entry.
SparseArrayIterator< index_iterator, value_iterator >::value_type index(const SparseArrayIterator< index_iterator, value_iterator > &it)
std::map< const ordinal_type, ji_map > kji_map
ordinal_type num_j(const k_iterator &k) const
Number of j entries in C(i,j,k) for given k.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
std::iterator_traits< value_iterator_type >::reference value_reference
base_type::value_type value_type
ji_sparse_array::const_iterator kj_iterator
Iterator for looping over j entries given k.
ikj_sparse_array::const_iterator i_iterator
Iterator for looping over i entries.
ordinal_type num_k() const
Number of k entries in C(i,j,k)
kj_iterator j_begin(const k_iterator &k) const
Iterator pointing to first j entry for given k.
ikj_sparse_array::const_reverse_iterator i_reverse_iterator
Iterator for looping over i entries in reverse.
void fillComplete()
Signal all terms have been added.
std::map< const ordinal_type, kj_map > ikj_map
Container for a "sparse" array.
i_reverse_iterator i_rbegin() const
Reverse iterator pointing to last k entry.
kj_iterator j_end(const k_iterator &k) const
Iterator pointing to last j entry for given k.
Bi-directional iterator for traversing a sparse array.
Bi-directional reverse iterator for traversing a sparse array.
std::map< const ordinal_type, value_type > j_map
base_type::value_type value_type
kji_sparse_array::const_iterator k_iterator
Iterator for looping over k entries.
ikj_sparse_array ikj_array
kji indices and values in Cijk (data structure for iterating)
SparseArrayReverseIterator< index_iterator, value_iterator >::value_type index(const SparseArrayReverseIterator< index_iterator, value_iterator > &it)
std::map< const ordinal_type, j_map > kj_map
std::ostream & operator<<(std::ostream &os, const ProductContainer< coeff_type > &vec)
SparseArray< ordinal_type, value_type > j_sparse_array
void add_term(ordinal_type i, ordinal_type j, ordinal_type k, const value_type &c)
Add new term for given (i,j,k)
i_reverse_iterator i_rend() const
Reverse iterator pointing to first k entry.
std::map< const ordinal_type, i_map > ji_map
SparseArray< ordinal_type, ji_sparse_array > kji_sparse_array
k_iterator k_end() const
Iterator pointing to last k entry.
k_iterator find_k(ordinal_type k) const
Return k iterator for given index k.
kji_sparse_array kji_array
kji indices and values in Cijk (data structure for iterating)
i_iterator i_begin() const
Iterator pointing to first k entry.
kj_sparse_array::const_iterator ik_iterator
Iterator for looping over k entries given i.
bool fillCompleted() const
Return whether fillComplete() has been called.
j_sparse_array::const_iterator kji_iterator
Iterator for looping over i entries given k and j.
SparseArray< ordinal_type, value_type > i_sparse_array
std::map< const ordinal_type, value_type > i_map
ikj_map ikj_data
ikj indices and values in Cijk (data structure for filling)
SparseArrayIterator< index_iterator, value_iterator >::value_reference value(const SparseArrayIterator< index_iterator, value_iterator > &it)
kji_iterator find_i(const kj_iterator &j, ordinal_type i) const
Return i iterator given j iterator and index i.
ordinal_type num_i() const
Number of i entries in C(i,j,k)
void print(std::ostream &os) const
Print tensor.
void sum_term(ordinal_type i, ordinal_type j, ordinal_type k, const value_type &c)
Add new term for given (i,j,k) and sum in if already there.
k_reverse_iterator k_rbegin() const
Reverse iterator pointing to last k entry.
SparseArray< ordinal_type, i_sparse_array > ji_sparse_array
value_type getValue(ordinal_type i, ordinal_type j, ordinal_type k) const
Get Cijk value for a given i, j, k indices.
~Sparse3Tensor()
Destructor.
value_reference value() const
Return value associated with iterator.
k_reverse_iterator k_rend() const
Reverse iterator pointing to first k entry.
i_iterator i_end() const
Iterator pointing to last k entry.
kj_iterator find_j(const k_iterator &k, ordinal_type j) const
Return j iterator given k iterator and index j.
kji_map kji_data
kji indices and values in Cijk (data structure for filling)
kji_sparse_array::const_reverse_iterator k_reverse_iterator
Iterator for looping over k entries in reverse.
SparseArray< ordinal_type, kj_sparse_array > ikj_sparse_array
ordinal_type num_entries() const
Return number of non-zero entries.