12 #ifndef RTOPPACK_SPARSE_SUB_VECTOR_T_HPP
13 #define RTOPPACK_SPARSE_SUB_VECTOR_T_HPP
102 template<
class Scalar>
116 ptrdiff_t localOffset_in,
bool isSorted_in
124 initialize(globalOffset_in, subDim_in, subNz_in, values_in, valuesStride_in,
125 indices_in, indicesStride_in, localOffset_in, isSorted_in);
139 initialize(globalOffset_in, subDim_in, values_in, valuesStride_in);
153 ptrdiff_t localOffset_in,
bool isSorted_in
164 subNz_in*as<Teuchos_Ordinal>(std::abs(as<int>(valuesStride_in))));
166 TEUCHOS_ASSERT(indicesStride_in != 0);
168 subNz_in*as<Teuchos_Ordinal>(std::abs(as<int>(indicesStride_in))));
171 for (
int k = 0; k < subNz_in-1; ++k) {
175 "Error indices["<<k<<
"]="<<idx_k<<
" >= indices["<<k+1<<
"]="<<idx_kp1
197 initialize(globalOffset_in, subDim_in, subDim_in, values_in, valuesStride_in,
251 #endif // RTOPPACK_SPARSE_SUB_VECTOR_T_HPP
bool is_null(const boost::shared_ptr< T > &p)
void initialize(Teuchos_Ordinal globalOffset_in, Teuchos_Ordinal subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in)
ArrayRCP< const Teuchos_Ordinal > indices_
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)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Class for a (sparse or dense) sub-vector.
SparseSubVectorT(const ConstSubVectorView< Scalar > &sv)
Class for a non-changeable sub-vector.
#define TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(index, lower_inclusive, upper_exclusive)
TEUCHOS_ORDINAL_TYPE Teuchos_Ordinal
bool isSorted() const
If isSorted == false then the vector is not sorted, otherwise it is sorted (sparse vectors only)...
size_type lowerOffset() const
Teuchos_Ordinal globalOffset_
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)
ptrdiff_t localOffset() const
Offset of indices[] into local sub-vector (sparse vectors only).
Teuchos_Ordinal subNz() const
Number of nonzero elements (subNz == subDim for dense vectors).
TypeTo as(const TypeFrom &t)
const ArrayRCP< const Scalar > values() const
Array (size min{|valueStride*subNz|,1}) for the values in the vector.
Teuchos_Ordinal subDim() const
Dimension of the sub-vector.
ArrayRCP< const Scalar > values_
void setGlobalOffset(Teuchos_Ordinal globalOffset_in)
SparseSubVectorT(Teuchos_Ordinal globalOffset_in, Teuchos_Ordinal subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t valuesStride_in)
ptrdiff_t indicesStride() const
Stride between indices in indices[] (sparse vectors only).
ptrdiff_t valuesStride() const
Stride between elements in values[].
Teuchos_Ordinal globalOffset() const
Offset for the sub-vector into the global vector.
const ArrayRCP< const Teuchos_Ordinal > indices() const
Array (size indicesStride*subNz) if not Teuchos::null) for the indices of the nonzero elements in the...
#define TEUCHOS_ASSERT(assertion_test)
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)