Support Software for Vector Reduction/Transformation Operators
Version of the Day
|
Class for a (sparse or dense) sub-vector. More...
#include <RTOpPack_SparseSubVectorT.hpp>
Public Member Functions | |
SparseSubVectorT () | |
SparseSubVectorT (Teuchos_Ordinal globalOffset_in, Teuchos_Ordinal subDim_in, Teuchos_Ordinal subNz_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in, const ArrayRCP< const Teuchos_Ordinal > &indices_in, ptrdiff_t indicesStride_in, ptrdiff_t localOffset_in, bool isSorted_in) | |
SparseSubVectorT (Teuchos_Ordinal globalOffset_in, Teuchos_Ordinal subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in) | |
SparseSubVectorT (const ConstSubVectorView< Scalar > &sv) | |
void | initialize (Teuchos_Ordinal globalOffset_in, Teuchos_Ordinal subDim_in, Teuchos_Ordinal subNz_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in, const ArrayRCP< const Teuchos_Ordinal > &indices_in, ptrdiff_t indicesStride_in, ptrdiff_t localOffset_in, bool isSorted_in) |
void | initialize (Teuchos_Ordinal globalOffset_in, Teuchos_Ordinal subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in) |
void | uninitialize () |
void | setGlobalOffset (Teuchos_Ordinal globalOffset_in) |
Teuchos_Ordinal | globalOffset () const |
Offset for the sub-vector into the global vector. More... | |
Teuchos_Ordinal | subDim () const |
Dimension of the sub-vector. More... | |
Teuchos_Ordinal | subNz () const |
Number of nonzero elements (subNz == subDim for dense vectors). More... | |
const ArrayRCP< const Scalar > | values () const |
Array (size min{|valueStride*subNz |,1}) for the values in the vector. More... | |
ptrdiff_t | valuesStride () const |
Stride between elements in values[] . More... | |
const ArrayRCP< const Teuchos_Ordinal > | indices () const |
Array (size indicesStride*subNz ) if not Teuchos::null ) for the indices of the nonzero elements in the vector (sparse vectors only). More... | |
ptrdiff_t | indicesStride () const |
Stride between indices in indices[] (sparse vectors only). More... | |
ptrdiff_t | localOffset () const |
Offset of indices[] into local sub-vector (sparse vectors only). More... | |
bool | isSorted () const |
If isSorted == false then the vector is not sorted, otherwise it is sorted (sparse vectors only). More... | |
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 103 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 106 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 112 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 129 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 143 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 149 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 192 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 201 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Definition at line 208 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Offset for the sub-vector into the global vector.
Definition at line 210 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Dimension of the sub-vector.
Definition at line 212 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Number of nonzero elements (subNz == subDim
for dense vectors).
Definition at line 215 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Array (size min{|valueStride*subNz
|,1}) for the values in the vector.
Definition at line 218 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Stride between elements in values[]
.
Definition at line 220 of file RTOpPack_SparseSubVectorT.hpp.
|
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 225 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Stride between indices in indices[] (sparse vectors only).
Definition at line 227 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
Offset of indices[] into local sub-vector (sparse vectors only).
Definition at line 230 of file RTOpPack_SparseSubVectorT.hpp.
|
inline |
If isSorted == false
then the vector is not sorted, otherwise it is sorted (sparse vectors only).
Definition at line 233 of file RTOpPack_SparseSubVectorT.hpp.