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 56 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 60 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 61 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 62 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 64 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 65 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 66 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 68 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 69 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 70 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 72 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 73 of file Stokhos_Sparse3Tensor.hpp.
|
private |
Definition at line 74 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 79 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 82 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 85 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 88 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 91 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 94 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 97 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 100 of file Stokhos_Sparse3Tensor.hpp.
Stokhos::Sparse3Tensor< ordinal_type, value_type >::Sparse3Tensor | ( | ) |
Constructor.
Definition at line 47 of file Stokhos_Sparse3TensorImp.hpp.
|
inline |
Destructor.
Definition at line 106 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 55 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 69 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 83 of file Stokhos_Sparse3TensorImp.hpp.
bool Stokhos::Sparse3Tensor< ordinal_type, value_type >::fillCompleted | ( | ) | const |
Return whether fillComplete() has been called.
Definition at line 143 of file Stokhos_Sparse3TensorImp.hpp.
void Stokhos::Sparse3Tensor< ordinal_type, value_type >::print | ( | std::ostream & | os | ) | const |
Print tensor.
Definition at line 151 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 170 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 195 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 214 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 226 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 239 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 251 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 263 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 275 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 287 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 299 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 311 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 323 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 335 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 347 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 359 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 371 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 383 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 395 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 407 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 419 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 443 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 455 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 479 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 491 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 503 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 515 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 527 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 539 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 551 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 563 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 284 of file Stokhos_Sparse3Tensor.hpp.
|
related |
Return index of a Sparse3Tensor iterator (e.g., i for a given kji_iterator)
Definition at line 295 of file Stokhos_Sparse3Tensor.hpp.
|
related |
Return index of a Sparse3Tensor reverse iterator
Definition at line 304 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 315 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
Indicate whether fillComplete() has been called.
Definition at line 253 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
kji indices and values in Cijk (data structure for filling)
Definition at line 259 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
kji indices and values in Cijk (data structure for iterating)
Definition at line 262 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
ikj indices and values in Cijk (data structure for filling)
Definition at line 270 of file Stokhos_Sparse3Tensor.hpp.
|
protected |
kji indices and values in Cijk (data structure for iterating)
Definition at line 273 of file Stokhos_Sparse3Tensor.hpp.