Stokhos Development
Classes | Public Member Functions | Protected Attributes
Stokhos::Sparse3Tensor< ordinal_type, value_type > Class Template Reference

Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format. More...

#include <Stokhos_Sparse3Tensor.hpp>

List of all members.

Classes

struct  JValues

Public Member Functions

 Sparse3Tensor (ordinal_type sz)
 Constructor.
 ~Sparse3Tensor ()
 Destructor.
ordinal_type size () const
 Return size.
ordinal_type num_values (ordinal_type k) const
 Return number of n of non-zero's in C(:,:,k) for a given k.
void value (ordinal_type k, ordinal_type l, ordinal_type &i, ordinal_type &j, value_type &c) const
 Get value C(i,j,k) for 0 <= l < n for a given k.
void add_term (ordinal_type i, ordinal_type j, ordinal_type k, const value_type &c)
 Add new term for given (i,j,k)
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.
void print (std::ostream &os) const
 Print tensor.
ordinal_type num_j (ordinal_type k) const
ordinal_type j_index (ordinal_type k, ordinal_type l) const
const Teuchos::Array
< ordinal_type > & 
Jindices (ordinal_type k) const
const Teuchos::Array
< ordinal_type > & 
Iindices (ordinal_type k, ordinal_type l) const
const Teuchos::Array
< value_type > & 
values (ordinal_type k, ordinal_type l) const

Protected Attributes

Teuchos::Array< Teuchos::Array
< ordinal_type > > 
i_indices
 i-indices in Cijk for each k
Teuchos::Array< Teuchos::Array
< ordinal_type > > 
j_indices
 j-indices in Cijk for each k
Teuchos::Array< Teuchos::Array
< value_type > > 
Cijk_values
 values in Cijk for each k
Teuchos::Array< Teuchos::Array
< JValues > > 
j_values
 i-indices in Cijk for each k
Teuchos::Array< Teuchos::Array
< ordinal_type > > 
j_indices2
 j-indices in Cijk for each k

Detailed Description

template<typename ordinal_type, typename value_type>
class Stokhos::Sparse3Tensor< ordinal_type, value_type >

Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.

To do: Remove old data structure and accessor methods. Also add sorting and searching to add_term() method so adding entries is not so delicate.


Member Function Documentation

template<typename ordinal_type , typename value_type >
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)

IMPORTANT: The current implementation of this method assumes entries are added in increasing order, and does not do a search if duplicate entries are added!

Currently it fills both data structures for storing coefficients, so all accessor methods should work.

template<typename ordinal_type , typename value_type >
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.

The current implementation does search over all entries already added, so it should work as entries are added in any order. However the search is slow and certainly could be improved upon. (Should investigate a sorted data structure).

Currently it only fills the new data structure, so num_values() and value() will not work.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator