#include <RTOpPack_Types.hpp>
Public Member Functions | |
| SparseSubVectorT () | |
| | |
| 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) | |
| | |
| SparseSubVectorT (Teuchos_Index globalOffset, Teuchos_Index subDim, const Scalar values[], ptrdiff_t valuesStride) | |
| | |
| SparseSubVectorT (const ConstSubVectorView< Scalar > &sv) | |
| | |
| 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) |
| | |
| void | initialize (Teuchos_Index globalOffset, Teuchos_Index subDim, const Scalar values[], ptrdiff_t valuesStride) |
| | |
| void | set_uninitialized () |
| | |
| 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 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 Teuchos_Index * | indices () const |
Array (size min{|indicesStride*subNz|,1} if not 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). | |
| int | isSorted () const |
If isSorted == 0 then the vector is not sorted, otherwise it is sorted (sparse vectors only). | |
Sparse and dense local vectors are supported as follows:
A dense vector vec is identified by vec.subDim() == vec.subNz() and vec.indices() == 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) (one based) are as follows:
x( vec.globalOffset() + k )
= vec.values()[ vec.valueStride() * k ]
for k = 0,...,vec.subDim()-1
vec.valueStride() may be positive (>0), negative (<0) or even zero (0). A negative stride vec.valueStride() < 0 allows a reverse traversal of the elements in vec.values()[]. A zero stride vec.valueStride() == 0 allows a vector with all the elements the same.
A sparse vector is identified by vec.subDim() > vec.subNz() or vec.indices() != 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
vec.subNz() == 0 then it is allowed for vec.indices() == NULL. If vec.subDim() > vec.subNz() > 0 then vec.indices() != 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
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.subNz() for k = 0...vec.subNz()-1
vec.valueStride() may be positive (>0), negative (<0) or zero (0). However, the member vec.indicesStride() may be may be positive (>0) or negative (<0) but not zero (0). Allowing vec.indicesStride() == 0 would mean that a vector would have vec.subNz() nonzero elements with all the same value and all the same indexes and non-unique indices are not allowed. Allowing non-unique indexes would make some operations (e.g. dot product) very difficult to implement and therefore can not be allowed. A sparse vector where vec.valueStride() == 0 is one where all of the non-zeros have the value vec.values[0]. If vec.subNz() == 0 for a sparse vector then it is allowed for vec.values == NULL and vec.indices() == 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.
To avoid making mistakes in setting the members of this struct use one of the helper functions RTOp_sparse_sub_vector_from_dense(), RTOp_sparse_sub_vector() or RTOp_sub_vector_null().
Definition at line 258 of file RTOpPack_Types.hpp.
|
|||||||||
|
Definition at line 261 of file RTOpPack_Types.hpp. |
|
||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 267 of file RTOpPack_Types.hpp. |
|
||||||||||||||||||||||||
|
Definition at line 278 of file RTOpPack_Types.hpp. |
|
||||||||||
|
Definition at line 287 of file RTOpPack_Types.hpp. |
|
||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 292 of file RTOpPack_Types.hpp. |
|
||||||||||||||||||||||||
|
Definition at line 304 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Definition at line 314 of file RTOpPack_Types.hpp. |
|
||||||||||
|
Definition at line 321 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Offset for the sub-vector into the global vector.
Definition at line 323 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Dimension of the sub-vector.
Definition at line 325 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Number of nonzero elements (
Definition at line 327 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Array (size min{|
Definition at line 329 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Stride between elements in
Definition at line 331 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Array (size min{|
Definition at line 335 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Stride between indices in indices[] (sparse vectors only).
Definition at line 337 of file RTOpPack_Types.hpp. |
|
|||||||||
|
Offset of indices[] into local sub-vector (sparse vectors only).
Definition at line 339 of file RTOpPack_Types.hpp. |
|
|||||||||
|
If
Definition at line 341 of file RTOpPack_Types.hpp. |
1.3.9.1