Support Software for Vector Reduction/Transformation Operators Version of the Day
Public Member Functions
RTOpPack::SparseSubVectorT< Scalar > Class Template Reference

Class for a (sparse or dense) sub-vector. More...

#include <RTOpPack_SparseSubVectorT.hpp>

List of all members.

Public Member Functions

 SparseSubVectorT ()
 
 SparseSubVectorT (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, Teuchos_Index subNz_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in, const ArrayRCP< const Teuchos_Index > &indices_in, ptrdiff_t indicesStride_in, ptrdiff_t localOffset_in, bool isSorted_in)
 
 SparseSubVectorT (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in)
 
 SparseSubVectorT (const ConstSubVectorView< Scalar > &sv)
 
void initialize (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, Teuchos_Index subNz_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in, const ArrayRCP< const Teuchos_Index > &indices_in, ptrdiff_t indicesStride_in, ptrdiff_t localOffset_in, bool isSorted_in)
 
void initialize (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in)
 
void uninitialize ()
 
void setGlobalOffset (Teuchos_Index globalOffset_in)
 
Teuchos_Index globalOffset () const
 Offset for the sub-vector into the global vector.
Teuchos_Index subDim () const
 Dimension of the sub-vector.
Teuchos_Index subNz () const
 Number of nonzero elements (subNz == subDim for dense vectors).
const ArrayRCP< const Scalar > values () const
 Array (size min{|valueStride*subNz|,1}) for the values in the vector.
ptrdiff_t valuesStride () const
 Stride between elements in values[].
const ArrayRCP< const
Teuchos_Index > 
indices () const
 Array (size indicesStride*subNz) if not Teuchos::null) for the indices of the nonzero elements in the vector (sparse vectors only).
ptrdiff_t indicesStride () const
 Stride between indices in indices[] (sparse vectors only).
ptrdiff_t localOffset () const
 Offset of indices[] into local sub-vector (sparse vectors only).
bool isSorted () const
 If isSorted == false then the vector is not sorted, otherwise it is sorted (sparse vectors only).
RTOP_DEPRECATED SparseSubVectorT (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, Teuchos_Index subNz_in, const Scalar values_in[], ptrdiff_t valuesStride_in, const Teuchos_Index indices_in[], ptrdiff_t indicesStride_in, ptrdiff_t localOffset_in, int isSorted_in)
 Deprecated.
RTOP_DEPRECATED SparseSubVectorT (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, const Scalar values_in[], ptrdiff_t valuesStride_in)
 Deprecated.
RTOP_DEPRECATED void initialize (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, Teuchos_Index subNz_in, const Scalar values_in[], ptrdiff_t valuesStride_in, const Teuchos_Index indices_in[], ptrdiff_t indicesStride_in, ptrdiff_t localOffset_in, int isSorted_in)
 Deprecated.
RTOP_DEPRECATED void initialize (Teuchos_Index globalOffset_in, Teuchos_Index subDim_in, const Scalar values_in[], ptrdiff_t valuesStride_in)
 Deprecated.
RTOP_DEPRECATED void set_uninitialized ()
 Deprecated.

Detailed Description

template<class Scalar>
class RTOpPack::SparseSubVectorT< Scalar >

Class for a (sparse or dense) sub-vector.

Warning! This class is really nothing more than a dumb data container!

Sparse and dense local vectors are supported as follows:

A dense vector vec is identified by vec.subDim() == vec.subNz() and vec.indices() == Teuchos::null in which case vec.indicesStride(), vec.localOffset() and vec.isSorted() are ignored. For a dense sub-vector vec, the corresponding entries in the global vector x(j) (zero-based) are as follows:


 x(vec.globalOffset() + k) == vec.values()[vec.valueStride() * k],

     for k = 0,...,vec.subDim()-1

 

The stride member vec.valueStride() may be positive (>0) or negative (<0) but not zero (0). A negative stride vec.valueStride() < 0 allows a reverse traversal of the elements in vec.values().

A sparse vector is identified by vec.subDim() > vec.subNz() or vec.indices() != Teuchos::null in which case all the fields in the structure are meaningful. The corresponding elements in the global vector x(j) defined as:


 x( vec.globalOffset() + vec.localOffset() + vec.indices()[vec.indicesStride()*k] )
 == vec.values[vec.valueStride()*k],

     for k = 0,...,vec.subNz()-1

 

If vec.subNz() == 0 then vec.indices() == Teuchos::null. If vec.subDim() > vec.subNz() > 0, then vec.indices() != Teuchos::null must be true.

A sparse sub-vector may be sorted (vec.isSorted()!=0) or unsorted (vec.isSorted()==0) but the indices vec.indices()[k] must be unique. A sorted vector (vec.isSorted()!=0) means that the indices are in ascending order:


 vec.indices()[vec.indicesStride()*k] < vec.indices()[vec.indicesStride()*k],

     for k = 0,...,vec.subNz()-1

 

The member vec.localOffset() is used to shift the values in vec.indices()[] to be in range of the local sub-vector. In other words:

  
 0 <= vec.localOffset() + vec.indices()[vec.indicesStride()*k] < vec.subDim(),

     for k = 0...vec.subNz()-1

 

The member vec.valueStride() may be positive (>0) or negative (<0) but not zero (0). Also, the member vec.indicesStride() may be may be positive (>0) or negative (<0) but not zero (0). If vec.subNz() == 0 for a sparse vector then vec.values == Teuchos::null and vec.indices() == Teuchos::null.

This specification allows a lot of flexibility in determining how the vectors are laid out in memory. However, allowing vectors to be sparse and unsorted may make many user defined operations considerably harder and expensive to implement.

Definition at line 135 of file RTOpPack_SparseSubVectorT.hpp.


Constructor & Destructor Documentation

template<class Scalar >
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( ) [inline]

Definition at line 138 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
Teuchos_Index  subNz_in,
const ArrayRCP< const Scalar > &  values_in,
ptrdiff_t  valuesStride_in,
const ArrayRCP< const Teuchos_Index > &  indices_in,
ptrdiff_t  indicesStride_in,
ptrdiff_t  localOffset_in,
bool  isSorted_in 
) [inline]

Definition at line 144 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
const ArrayRCP< const Scalar > &  values_in,
ptrdiff_t  valuesStride_in 
) [inline]

Definition at line 161 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( const ConstSubVectorView< Scalar > &  sv) [inline]

Definition at line 175 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOP_DEPRECATED RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
Teuchos_Index  subNz_in,
const Scalar  values_in[],
ptrdiff_t  valuesStride_in,
const Teuchos_Index  indices_in[],
ptrdiff_t  indicesStride_in,
ptrdiff_t  localOffset_in,
int  isSorted_in 
) [inline]

Deprecated.

Definition at line 275 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOP_DEPRECATED RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
const Scalar  values_in[],
ptrdiff_t  valuesStride_in 
) [inline]

Deprecated.

Definition at line 286 of file RTOpPack_SparseSubVectorT.hpp.


Member Function Documentation

template<class Scalar >
void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
Teuchos_Index  subNz_in,
const ArrayRCP< const Scalar > &  values_in,
ptrdiff_t  valuesStride_in,
const ArrayRCP< const Teuchos_Index > &  indices_in,
ptrdiff_t  indicesStride_in,
ptrdiff_t  localOffset_in,
bool  isSorted_in 
) [inline]

Definition at line 181 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
const ArrayRCP< const Scalar > &  values_in,
ptrdiff_t  valuesStride_in 
) [inline]

Definition at line 221 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
void RTOpPack::SparseSubVectorT< Scalar >::uninitialize ( ) [inline]

Definition at line 230 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
void RTOpPack::SparseSubVectorT< Scalar >::setGlobalOffset ( Teuchos_Index  globalOffset_in) [inline]

Definition at line 237 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
Teuchos_Index RTOpPack::SparseSubVectorT< Scalar >::globalOffset ( ) const [inline]

Offset for the sub-vector into the global vector.

Definition at line 239 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
Teuchos_Index RTOpPack::SparseSubVectorT< Scalar >::subDim ( ) const [inline]

Dimension of the sub-vector.

Definition at line 241 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
Teuchos_Index RTOpPack::SparseSubVectorT< Scalar >::subNz ( ) const [inline]

Number of nonzero elements (subNz == subDim for dense vectors).

Definition at line 244 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
const ArrayRCP<const Scalar> RTOpPack::SparseSubVectorT< Scalar >::values ( ) const [inline]

Array (size min{|valueStride*subNz|,1}) for the values in the vector.

Definition at line 247 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
ptrdiff_t RTOpPack::SparseSubVectorT< Scalar >::valuesStride ( ) const [inline]

Stride between elements in values[].

Definition at line 249 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
const ArrayRCP<const Teuchos_Index> RTOpPack::SparseSubVectorT< Scalar >::indices ( ) const [inline]

Array (size indicesStride*subNz) if not Teuchos::null) for the indices of the nonzero elements in the vector (sparse vectors only).

Definition at line 254 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
ptrdiff_t RTOpPack::SparseSubVectorT< Scalar >::indicesStride ( ) const [inline]

Stride between indices in indices[] (sparse vectors only).

Definition at line 256 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
ptrdiff_t RTOpPack::SparseSubVectorT< Scalar >::localOffset ( ) const [inline]

Offset of indices[] into local sub-vector (sparse vectors only).

Definition at line 259 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
bool RTOpPack::SparseSubVectorT< Scalar >::isSorted ( ) const [inline]

If isSorted == false then the vector is not sorted, otherwise it is sorted (sparse vectors only).

Definition at line 262 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOP_DEPRECATED void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
Teuchos_Index  subNz_in,
const Scalar  values_in[],
ptrdiff_t  valuesStride_in,
const Teuchos_Index  indices_in[],
ptrdiff_t  indicesStride_in,
ptrdiff_t  localOffset_in,
int  isSorted_in 
) [inline]

Deprecated.

Definition at line 294 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOP_DEPRECATED void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset_in,
Teuchos_Index  subDim_in,
const Scalar  values_in[],
ptrdiff_t  valuesStride_in 
) [inline]

Deprecated.

Definition at line 307 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar >
RTOP_DEPRECATED void RTOpPack::SparseSubVectorT< Scalar >::set_uninitialized ( ) [inline]

Deprecated.

Definition at line 317 of file RTOpPack_SparseSubVectorT.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends