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, Teuchos_Index subDim, Teuchos_Index subNz, const ArrayRCP< const Scalar > &values, ptrdiff_t valuesStride, const ArrayRCP< const Teuchos_Index > &indices, ptrdiff_t indicesStride, ptrdiff_t localOffset, bool isSorted)
 
 SparseSubVectorT (Teuchos_Index globalOffset, Teuchos_Index subDim, const ArrayRCP< const Scalar > &values, ptrdiff_t valuesStride)
 
 SparseSubVectorT (const ConstSubVectorView< Scalar > &sv)
 
void initialize (Teuchos_Index globalOffset, Teuchos_Index subDim, Teuchos_Index subNz, const ArrayRCP< const Scalar > &values, ptrdiff_t valuesStride, const ArrayRCP< const Teuchos_Index > &indices, ptrdiff_t indicesStride, ptrdiff_t localOffset, bool isSorted)
 
void initialize (Teuchos_Index globalOffset, Teuchos_Index subDim, const ArrayRCP< const Scalar > &values, ptrdiff_t valuesStride)
 
void uninitialize ()
 
void setGlobalOffset (Teuchos_Index globalOffset)
 
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_Indexindices () 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).
 SparseSubVectorT (Teuchos_Index globalOffset, Teuchos_Index subDim, Teuchos_Index subNz, const Scalar values[], ptrdiff_t valuesStride, const Teuchos_Index indices[], ptrdiff_t indicesStride, ptrdiff_t localOffset, int isSorted)
 Deprecated.
 SparseSubVectorT (Teuchos_Index globalOffset, Teuchos_Index subDim, const Scalar values[], ptrdiff_t valuesStride)
 Deprecated.
void initialize (Teuchos_Index globalOffset, Teuchos_Index subDim, Teuchos_Index subNz, const Scalar values[], ptrdiff_t valuesStride, const Teuchos_Index indices[], ptrdiff_t indicesStride, ptrdiff_t localOffset, int isSorted)
 Deprecated.
void initialize (Teuchos_Index globalOffset, Teuchos_Index subDim, const Scalar values[], ptrdiff_t valuesStride)
 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 122 of file RTOpPack_SparseSubVectorT.hpp.


Constructor & Destructor Documentation

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

Definition at line 125 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar>
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
Teuchos_Index  subNz,
const ArrayRCP< const Scalar > &  values,
ptrdiff_t  valuesStride,
const ArrayRCP< const Teuchos_Index > &  indices,
ptrdiff_t  indicesStride,
ptrdiff_t  localOffset,
bool  isSorted 
) [inline]

Definition at line 131 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar>
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
const ArrayRCP< const Scalar > &  values,
ptrdiff_t  valuesStride 
) [inline]

Definition at line 148 of file RTOpPack_SparseSubVectorT.hpp.

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

Definition at line 162 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar>
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
Teuchos_Index  subNz,
const Scalar  values[],
ptrdiff_t  valuesStride,
const Teuchos_Index  indices[],
ptrdiff_t  indicesStride,
ptrdiff_t  localOffset,
int  isSorted 
) [inline]

Deprecated.

Definition at line 257 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar>
RTOpPack::SparseSubVectorT< Scalar >::SparseSubVectorT ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
const Scalar  values[],
ptrdiff_t  valuesStride 
) [inline]

Deprecated.

Definition at line 268 of file RTOpPack_SparseSubVectorT.hpp.


Member Function Documentation

template<class Scalar>
void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
Teuchos_Index  subNz,
const ArrayRCP< const Scalar > &  values,
ptrdiff_t  valuesStride,
const ArrayRCP< const Teuchos_Index > &  indices,
ptrdiff_t  indicesStride,
ptrdiff_t  localOffset,
bool  isSorted 
) [inline]

Definition at line 168 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar>
void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
const ArrayRCP< const Scalar > &  values,
ptrdiff_t  valuesStride 
) [inline]

Definition at line 203 of file RTOpPack_SparseSubVectorT.hpp.

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

Definition at line 212 of file RTOpPack_SparseSubVectorT.hpp.

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

Definition at line 219 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 221 of file RTOpPack_SparseSubVectorT.hpp.

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

Dimension of the sub-vector.

Definition at line 223 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 226 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 229 of file RTOpPack_SparseSubVectorT.hpp.

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

Stride between elements in values[].

Definition at line 231 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 236 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 238 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 241 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 244 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar>
void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
Teuchos_Index  subNz,
const Scalar  values[],
ptrdiff_t  valuesStride,
const Teuchos_Index  indices[],
ptrdiff_t  indicesStride,
ptrdiff_t  localOffset,
int  isSorted 
) [inline]

Deprecated.

Definition at line 276 of file RTOpPack_SparseSubVectorT.hpp.

template<class Scalar>
void RTOpPack::SparseSubVectorT< Scalar >::initialize ( Teuchos_Index  globalOffset,
Teuchos_Index  subDim,
const Scalar  values[],
ptrdiff_t  valuesStride 
) [inline]

Deprecated.

Definition at line 289 of file RTOpPack_SparseSubVectorT.hpp.

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

Deprecated.

Definition at line 299 of file RTOpPack_SparseSubVectorT.hpp.


The documentation for this class was generated from the following file:
Generated on Wed May 12 21:41:19 2010 for Support Software for Vector Reduction/Transformation Operators by  doxygen 1.4.7