45 #include "AbstractLinAlgPack_VectorMutableDense.hpp"
46 #include "AbstractLinAlgPack_VectorDenseEncap.hpp"
47 #include "AbstractLinAlgPack_GenPermMatrixSliceOp.hpp"
48 #include "AbstractLinAlgPack_apply_op_helper.hpp"
49 #include "ReleaseResource_ref_count_ptr.hpp"
50 #include "Teuchos_Workspace.hpp"
51 #include "Teuchos_Assert.hpp"
54 #define CLASS_MEMBER_PTRS \
55 const VectorMutableDense *_this = this; \
56 const DVectorSlice *_v; \
57 const release_resource_ptr_t *_v_release; \
58 const VectorSpaceSerial *_space;
60 #define CLASS_MEMBER_PTRS
63 namespace AbstractLinAlgPack {
89 namespace rcp = MemMngPack;
90 namespace rmp = MemMngPack;
96 new rmp::ReleaseResource_ref_count_ptr<DVector>(
110 v_release_ = v_release;
124 const RTOpPack::RTOp& op
125 ,
const size_t num_vecs,
const Vector* vecs[]
128 ,
const index_type first_ele_in,
const index_type sub_dim_in,
const index_type global_offset_in
133 AbstractLinAlgPack::apply_op_validate_input(
134 "VectorMutableDense::apply_op(...)"
135 ,op,num_vecs,vecs,num_targ_vecs,targ_vecs,reduct_obj,first_ele_in,sub_dim_in,global_offset_in
139 op,num_vecs,vecs,num_targ_vecs,targ_vecs,reduct_obj
140 ,first_ele_in,sub_dim_in,global_offset_in
155 const Range1D& rng_in, RTOpPack::SubVector* sub_vec
159 const size_type this_dim = v_.
dim();
160 const Range1D rng = RangePack::full_range(rng_in,1,this_dim);
162 rng.
ubound() > this_dim, std::out_of_range
163 ,
"VectorMutableDense::get_sub_vector(...) : Error, "
165 "is not in the range [1,this->dim()] = [1," << this_dim <<
"]!" );
177 sub_vec->set_uninitialized();
226 namespace rcp = MemMngPack;
227 const size_type this_dim = this->
dim();
228 const Range1D rng = RangePack::full_range( rng_in, 1, this_dim );
231 rng.
ubound() > this_dim, std::out_of_range
232 ,
"VectorMutableDense::sub_view(...) : Error, "
234 "is not in the range [1,this->dim()] = [1," << this_dim <<
"]!" );
236 if( rng ==
Range1D(1,this_dim) )
243 const Range1D& rng_in, RTOpPack::MutableSubVector* sub_vec )
246 const size_type this_dim = v_.
dim();
247 const Range1D rng = RangePack::full_range(rng_in,1,this_dim);
250 rng.
ubound() > this_dim, std::out_of_range
251 ,
"VectorMutableDense::get_sub_vector(...) : Error, "
253 "is not in the range [1,this->dim()] = [1," << this_dim <<
"]!" );
266 sub_vec->set_uninitialized();
DVector "Adaptor" subclass for DenseLinAlgPack::DVectorSlice or DenseLinAlgPack::DVector objects...
virtual void set_sub_vector(const RTOpPack::SparseSubVector &sub_vec)
Set a specific sub-vector.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
const VectorSpace & space() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< const Vector > vec_ptr_t
vec_mut_ptr_t sub_view(const Range1D &rng)
void commit_sub_vector(RTOpPack::MutableSubVector *sub_vec)
void apply_op(const RTOpPack::RTOp &op, const size_t num_vecs, const Vector *vecs[], const size_t num_targ_vecs, VectorMutable *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const index_type first_ele, const index_type sub_dim, const index_type global_offset) const
VectorMutableDense(const size_type dim=0)
Calls this->initialize(dim).
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
VectorMutable & operator=(value_type alpha)
virtual void has_changed() const
Must be called by any vector subclass that modifies this vector object!
Abstract interface for objects that represent a space for mutable coordinate vectors.
Extract a constant DenseLinAlgPack::DVectorSlice view of a Vector object.
void set_sub_vector(const RTOpPack::SparseSubVector &sub_vec)
void initialize(const size_type dim)
Call this->initialize(v,v_release) with an allocated DenseLinAlgPack::DVector object.
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
void bind(VectorSliceTmpl< value_type > vs)
void set_ele(index_type i, value_type val)
void initialize(size_type dim)
Initialize given the dimension of the vector space.
virtual VectorMutable & operator=(value_type alpha)
Assign the elements of this vector to a scalar.
difference_type stride() const
Abstract interface for mutable coordinate vectors {abstract}.
void Vp_StMtV(value_type alpha, const GenPermMatrixSlice &P, BLAS_Cpp::Transp P_trans, const Vector &x, value_type beta)
void apply_op_serial(const RTOpPack::RTOp &op, const size_t num_vecs, const Vector *vecs[], const size_t num_targ_vecs, VectorMutable *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const index_type first_ele, const index_type sub_dim, const index_type global_offset) const
void get_sub_vector(const Range1D &rng, RTOpPack::SubVector *sub_vec) const
void free_sub_vector(RTOpPack::SubVector *sub_vec) const
value_type get_ele(index_type i) const
Concrete matrix type to represent general permutation (mapping) matrices.