Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
|
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format. More...
#include <Stokhos_Sparse3Tensor.hpp>
Public Types | |
typedef kji_sparse_array::const_iterator | k_iterator |
Iterator for looping over k entries. More... | |
typedef kji_sparse_array::const_reverse_iterator | k_reverse_iterator |
Iterator for looping over k entries in reverse. More... | |
typedef ji_sparse_array::const_iterator | kj_iterator |
Iterator for looping over j entries given k. More... | |
typedef j_sparse_array::const_iterator | kji_iterator |
Iterator for looping over i entries given k and j. More... | |
typedef ikj_sparse_array::const_iterator | i_iterator |
Iterator for looping over i entries. More... | |
typedef ikj_sparse_array::const_reverse_iterator | i_reverse_iterator |
Iterator for looping over i entries in reverse. More... | |
typedef kj_sparse_array::const_iterator | ik_iterator |
Iterator for looping over k entries given i. More... | |
typedef j_sparse_array::const_iterator | ikj_iterator |
Iterator for looping over j entries given i and k. More... | |
Public Member Functions | |
Sparse3Tensor () | |
Constructor. More... | |
~Sparse3Tensor () | |
Destructor. More... | |
void | add_term (ordinal_type i, ordinal_type j, ordinal_type k, const value_type &c) |
Add new term for given (i,j,k) More... | |
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. More... | |
void | fillComplete () |
Signal all terms have been added. More... | |
bool | fillCompleted () const |
Return whether fillComplete() has been called. More... | |
void | print (std::ostream &os) const |
Print tensor. More... | |
value_type | getValue (ordinal_type i, ordinal_type j, ordinal_type k) const |
Get Cijk value for a given i, j, k indices. More... | |
ordinal_type | num_entries () const |
Return number of non-zero entries. More... | |
Protected Attributes | |
bool | fill_completed |
Indicate whether fillComplete() has been called. More... | |
Private Types | |
typedef std::map< const ordinal_type, value_type > | i_map |
typedef std::map< const ordinal_type, i_map > | ji_map |
typedef std::map< const ordinal_type, ji_map > | kji_map |
typedef std::map< const ordinal_type, value_type > | j_map |
typedef std::map< const ordinal_type, j_map > | kj_map |
typedef std::map< const ordinal_type, kj_map > | ikj_map |
typedef SparseArray < ordinal_type, value_type > | i_sparse_array |
typedef SparseArray < ordinal_type, i_sparse_array > | ji_sparse_array |
typedef SparseArray < ordinal_type, ji_sparse_array > | kji_sparse_array |
typedef SparseArray < ordinal_type, value_type > | j_sparse_array |
typedef SparseArray < ordinal_type, j_sparse_array > | kj_sparse_array |
typedef SparseArray < ordinal_type, kj_sparse_array > | ikj_sparse_array |
Private Member Functions | |
Sparse3Tensor (const Sparse3Tensor &) | |
Sparse3Tensor & | operator= (const Sparse3Tensor &b) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename ordinal_type , typename value_type > | |
std::ostream & | operator<< (std::ostream &os, const Sparse3Tensor< ordinal_type, value_type > &Cijk) |
template<typename index_iterator , typename value_iterator > | |
SparseArrayIterator < index_iterator, value_iterator >::value_type | index (const SparseArrayIterator< index_iterator, value_iterator > &it) |
template<typename index_iterator , typename value_iterator > | |
SparseArrayReverseIterator < index_iterator, value_iterator >::value_type | index (const SparseArrayReverseIterator< index_iterator, value_iterator > &it) |
template<typename index_iterator , typename value_iterator > | |
SparseArrayIterator < index_iterator, value_iterator > ::value_reference | value (const SparseArrayIterator< index_iterator, value_iterator > &it) |
k-based data-structure accessor methods | |
ordinal_type | num_k () const |
Number of k entries in C(i,j,k) More... | |
ordinal_type | num_j (const k_iterator &k) const |
Number of j entries in C(i,j,k) for given k. More... | |
ordinal_type | num_i (const kj_iterator &j) const |
Number of i entries in C(i,j,k) for given k and j. More... | |
k_iterator | find_k (ordinal_type k) const |
Return k iterator for given index k. More... | |
kj_iterator | find_j (const k_iterator &k, ordinal_type j) const |
Return j iterator given k iterator and index j. More... | |
kji_iterator | find_i (const kj_iterator &j, ordinal_type i) const |
Return i iterator given j iterator and index i. More... | |
k_iterator | k_begin () const |
Iterator pointing to first k entry. More... | |
k_iterator | k_end () const |
Iterator pointing to last k entry. More... | |
k_reverse_iterator | k_rbegin () const |
Reverse iterator pointing to last k entry. More... | |
k_reverse_iterator | k_rend () const |
Reverse iterator pointing to first k entry. More... | |
kj_iterator | j_begin (const k_iterator &k) const |
Iterator pointing to first j entry for given k. More... | |
kj_iterator | j_end (const k_iterator &k) const |
Iterator pointing to last j entry for given k. More... | |
kj_iterator | j_begin (const k_reverse_iterator &k) const |
Iterator pointing to first j entry for given k. More... | |
kj_iterator | j_end (const k_reverse_iterator &k) const |
Iterator pointing to last j entry for given k. More... | |
kji_iterator | i_begin (const kj_iterator &j) const |
Iterator pointing to first i entry for given j and k. More... | |
kji_iterator | i_end (const kj_iterator &j) const |
Iterator pointing to last i entry for given j and k. More... | |
i-based data-structure accessor methods | |
ordinal_type | num_i () const |
Number of i entries in C(i,j,k) More... | |
ordinal_type | num_k (const i_iterator &i) const |
Number of k entries in C(i,j,k) for given i. More... | |
ordinal_type | num_j (const ik_iterator &k) const |
Number of j entries in C(i,j,k) for given i and k. More... | |
i_iterator | find_i (ordinal_type i) const |
Return i iterator for given index i. More... | |
ik_iterator | find_k (const i_iterator &i, ordinal_type k) const |
Return k iterator given i iterator and index k. More... | |
ikj_iterator | find_j (const ik_iterator &k, ordinal_type j) const |
Return j iterator given k iterator and index j. More... | |
i_iterator | i_begin () const |
Iterator pointing to first k entry. More... | |
i_iterator | i_end () const |
Iterator pointing to last k entry. More... | |
i_reverse_iterator | i_rbegin () const |
Reverse iterator pointing to last k entry. More... | |
i_reverse_iterator | i_rend () const |
Reverse iterator pointing to first k entry. More... | |
ik_iterator | k_begin (const i_iterator &i) const |
Iterator pointing to first k entry for given i. More... | |
ik_iterator | k_end (const i_iterator &i) const |
Iterator pointing to last k entry for given i. More... | |
ik_iterator | k_begin (const i_reverse_iterator &i) const |
Iterator pointing to first k entry for given i. More... | |
ik_iterator | k_end (const i_reverse_iterator &i) const |
Iterator pointing to last k entry for given i. More... | |
ikj_iterator | j_begin (const ik_iterator &k) const |
Iterator pointing to first j entry for given i and k. More... | |
ikj_iterator | j_end (const ik_iterator &k) const |
Iterator pointing to last j entry for given i and k. More... | |
k-based structure | |
kji_map | kji_data |
kji indices and values in Cijk (data structure for filling) More... | |
kji_sparse_array | kji_array |
kji indices and values in Cijk (data structure for iterating) More... | |
i-based structure | |
ikj_map | ikj_data |
ikj indices and values in Cijk (data structure for filling) More... | |
ikj_sparse_array | ikj_array |
kji indices and values in Cijk (data structure for iterating) More... | |
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
Definition at line 24 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 28 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 29 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 30 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 32 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 33 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 34 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 36 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 37 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 38 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 40 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 41 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 42 of file Stokhos_Sparse3Tensor.hpp.
typedef kji_sparse_array::const_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_iterator |
Iterator for looping over k entries.
Definition at line 47 of file Stokhos_Sparse3Tensor.hpp.
typedef kji_sparse_array::const_reverse_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_reverse_iterator |
Iterator for looping over k entries in reverse.
Definition at line 50 of file Stokhos_Sparse3Tensor.hpp.
typedef ji_sparse_array::const_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::kj_iterator |
Iterator for looping over j entries given k.
Definition at line 53 of file Stokhos_Sparse3Tensor.hpp.
typedef j_sparse_array::const_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::kji_iterator |
Iterator for looping over i entries given k and j.
Definition at line 56 of file Stokhos_Sparse3Tensor.hpp.
typedef ikj_sparse_array::const_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_iterator |
Iterator for looping over i entries.
Definition at line 59 of file Stokhos_Sparse3Tensor.hpp.
typedef ikj_sparse_array::const_reverse_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_reverse_iterator |
Iterator for looping over i entries in reverse.
Definition at line 62 of file Stokhos_Sparse3Tensor.hpp.
typedef kj_sparse_array::const_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::ik_iterator |
Iterator for looping over k entries given i.
Definition at line 65 of file Stokhos_Sparse3Tensor.hpp.
typedef j_sparse_array::const_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::ikj_iterator |
Iterator for looping over j entries given i and k.
Definition at line 68 of file Stokhos_Sparse3Tensor.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::Sparse3Tensor | ( | ) |
Constructor.
Definition at line 15 of file Stokhos_Sparse3TensorImp.hpp.
|
inline |
Destructor.
Definition at line 74 of file Stokhos_Sparse3Tensor.hpp.
|
private |
void Stokhos::Sparse3Tensor< ordinal_type, value_type >::add_term | ( | ordinal_type | i, |
ordinal_type | j, | ||
ordinal_type | k, | ||
const value_type & | c | ||
) |
Add new term for given (i,j,k)
Definition at line 23 of file Stokhos_Sparse3TensorImp.hpp.
void Stokhos::Sparse3Tensor< ordinal_type, value_type >::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.
Definition at line 37 of file Stokhos_Sparse3TensorImp.hpp.
void Stokhos::Sparse3Tensor< ordinal_type, value_type >::fillComplete | ( | ) |
Signal all terms have been added.
This method must be called before using any of the accessor methods below. It sets up a new set of data structures that are much more efficient for iterating through the tensor.
Definition at line 51 of file Stokhos_Sparse3TensorImp.hpp.
bool Stokhos::Sparse3Tensor< ordinal_type, value_type >::fillCompleted | ( | ) | const |
Return whether fillComplete() has been called.
Definition at line 111 of file Stokhos_Sparse3TensorImp.hpp.
void Stokhos::Sparse3Tensor< ordinal_type, value_type >::print | ( | std::ostream & | os | ) | const |
Print tensor.
Definition at line 119 of file Stokhos_Sparse3TensorImp.hpp.
value_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::getValue | ( | ordinal_type | i, |
ordinal_type | j, | ||
ordinal_type | k | ||
) | const |
Get Cijk value for a given i, j, k indices.
Definition at line 138 of file Stokhos_Sparse3TensorImp.hpp.
ordinal_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::num_entries | ( | ) | const |
Return number of non-zero entries.
Definition at line 163 of file Stokhos_Sparse3TensorImp.hpp.
ordinal_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::num_k | ( | ) | const |
Number of k entries in C(i,j,k)
Definition at line 182 of file Stokhos_Sparse3TensorImp.hpp.
ordinal_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::num_j | ( | const k_iterator & | k | ) | const |
Number of j entries in C(i,j,k) for given k.
Definition at line 194 of file Stokhos_Sparse3TensorImp.hpp.
ordinal_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::num_i | ( | const kj_iterator & | j | ) | const |
Number of i entries in C(i,j,k) for given k and j.
Definition at line 207 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::find_k | ( | ordinal_type | k | ) | const |
Return k iterator for given index k.
Definition at line 219 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ikj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::find_j | ( | const k_iterator & | k, |
ordinal_type | j | ||
) | const |
Return j iterator given k iterator and index j.
Definition at line 231 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::kji_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::find_i | ( | const kj_iterator & | j, |
ordinal_type | i | ||
) | const |
Return i iterator given j iterator and index i.
Definition at line 243 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_begin | ( | ) | const |
Iterator pointing to first k entry.
Definition at line 255 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_end | ( | ) | const |
Iterator pointing to last k entry.
Definition at line 267 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_reverse_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_rbegin | ( | ) | const |
Reverse iterator pointing to last k entry.
Definition at line 279 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_reverse_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_rend | ( | ) | const |
Reverse iterator pointing to first k entry.
Definition at line 291 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ikj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::j_begin | ( | const k_iterator & | k | ) | const |
Iterator pointing to first j entry for given k.
Definition at line 303 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ikj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::j_end | ( | const k_iterator & | k | ) | const |
Iterator pointing to last j entry for given k.
Definition at line 315 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::kj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::j_begin | ( | const k_reverse_iterator & | k | ) | const |
Iterator pointing to first j entry for given k.
Definition at line 327 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::kj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::j_end | ( | const k_reverse_iterator & | k | ) | const |
Iterator pointing to last j entry for given k.
Definition at line 339 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::kji_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_begin | ( | const kj_iterator & | j | ) | const |
Iterator pointing to first i entry for given j and k.
Definition at line 351 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::kji_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_end | ( | const kj_iterator & | j | ) | const |
Iterator pointing to last i entry for given j and k.
Definition at line 363 of file Stokhos_Sparse3TensorImp.hpp.
ordinal_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::num_i | ( | ) | const |
Number of i entries in C(i,j,k)
Definition at line 375 of file Stokhos_Sparse3TensorImp.hpp.
ordinal_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::num_k | ( | const i_iterator & | i | ) | const |
Number of k entries in C(i,j,k) for given i.
Definition at line 387 of file Stokhos_Sparse3TensorImp.hpp.
ordinal_type Stokhos::Sparse3Tensor< ordinal_type, value_type >::num_j | ( | const ik_iterator & | k | ) | const |
Number of j entries in C(i,j,k) for given i and k.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::find_i | ( | ordinal_type | i | ) | const |
Return i iterator for given index i.
Definition at line 411 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ik_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::find_k | ( | const i_iterator & | i, |
ordinal_type | k | ||
) | const |
Return k iterator given i iterator and index k.
Definition at line 423 of file Stokhos_Sparse3TensorImp.hpp.
ikj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::find_j | ( | const ik_iterator & | k, |
ordinal_type | j | ||
) | const |
Return j iterator given k iterator and index j.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_begin | ( | ) | const |
Iterator pointing to first k entry.
Definition at line 447 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_end | ( | ) | const |
Iterator pointing to last k entry.
Definition at line 459 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_reverse_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_rbegin | ( | ) | const |
Reverse iterator pointing to last k entry.
Definition at line 471 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_reverse_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::i_rend | ( | ) | const |
Reverse iterator pointing to first k entry.
Definition at line 483 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ik_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_begin | ( | const i_iterator & | i | ) | const |
Iterator pointing to first k entry for given i.
Definition at line 495 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ik_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_end | ( | const i_iterator & | i | ) | const |
Iterator pointing to last k entry for given i.
Definition at line 507 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ik_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_begin | ( | const i_reverse_iterator & | i | ) | const |
Iterator pointing to first k entry for given i.
Definition at line 519 of file Stokhos_Sparse3TensorImp.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::ik_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::k_end | ( | const i_reverse_iterator & | i | ) | const |
Iterator pointing to last k entry for given i.
Definition at line 531 of file Stokhos_Sparse3TensorImp.hpp.
ikj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::j_begin | ( | const ik_iterator & | k | ) | const |
Iterator pointing to first j entry for given i and k.
ikj_iterator Stokhos::Sparse3Tensor< ordinal_type, value_type >::j_end | ( | const ik_iterator & | k | ) | const |
Iterator pointing to last j entry for given i and k.
|
private |
|
related |
Print triple product tensor to output stream
Definition at line 252 of file Stokhos_Sparse3Tensor.hpp.
|
related |
Return index of a Sparse3Tensor iterator (e.g., i for a given kji_iterator)
Definition at line 263 of file Stokhos_Sparse3Tensor.hpp.
|
related |
Return index of a Sparse3Tensor reverse iterator
Definition at line 272 of file Stokhos_Sparse3Tensor.hpp.
|
related |
Return value of a Sparse3Tensor iterator (e.g., c = C(i,j,k) for a given kji_iterator)
Definition at line 283 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
Indicate whether fillComplete() has been called.
Definition at line 221 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
kji indices and values in Cijk (data structure for filling)
Definition at line 227 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
kji indices and values in Cijk (data structure for iterating)
Definition at line 230 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
ikj indices and values in Cijk (data structure for filling)
Definition at line 238 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
kji indices and values in Cijk (data structure for iterating)
Definition at line 241 of file Stokhos_Sparse3Tensor.hpp.