44 #include "AbstractLinAlgPack_VectorStdOps.hpp"
45 #include "AbstractLinAlgPack_VectorSpace.hpp"
46 #include "AbstractLinAlgPack_VectorMutable.hpp"
47 #include "AbstractLinAlgPack_AssertOp.hpp"
48 #include "AbstractLinAlgPack_SpVectorClass.hpp"
49 #include "AbstractLinAlgPack_SpVectorView.hpp"
58 #include "RTOpPack_TOpRandomize.hpp"
61 #include "RTOpPack_RTOpC.hpp"
62 #include "Teuchos_Assert.hpp"
90 class init_rtop_server_t {
92 init_rtop_server_t() {
116 init_rtop_server_t init_rtop_server;
120 AbstractLinAlgPack::value_type
124 const Vector* vecs[1] = { &v_rhs };
125 apply_op(sum_op,1,vecs,0,NULL,&*sum_targ);
126 return RTOp_ROp_sum_val(sum_op(*sum_targ));
129 AbstractLinAlgPack::value_type
133 const Vector* vecs[2] = { &v_rhs1, &v_rhs2 };
134 apply_op(dot_prod_op,2,vecs,0,NULL,&*dot_prod_targ);
135 return RTOp_ROp_dot_prod_val(dot_prod_op(*dot_prod_targ));
138 AbstractLinAlgPack::value_type
145 v_rhs2->set_sub_vector(sub_vec_view(sv_rhs2));
146 return dot(v_rhs1,*v_rhs2);
152 const Vector& v, value_type* max_v_j, index_type* max_j
159 const Vector* vecs[1] = { &v };
160 apply_op(op,1,vecs,0,NULL,&*reduct_obj);
161 RTOp_value_index_type val = RTOp_ROp_max_abs_ele_val(op(*reduct_obj));
162 *max_v_j = val.value;
173 apply_op(add_scalar_op,0,NULL,1,targ_vecs,NULL);
184 else if( alpha != 1.0 ) {
187 apply_op(scale_vector_op,0,NULL,1,targ_vecs,NULL);
198 const Vector* vecs[1] = { &v_rhs };
200 apply_op(axpy_op,1,vecs,1,targ_vecs,NULL);
210 x->set_sub_vector(sub_vec_view(sx));
216 const value_type& alpha,
const Vector& v_rhs1,
const Vector& v_rhs2
223 const Vector* vecs[2] = { &v_rhs1, &v_rhs2 };
225 apply_op(ele_wise_prod_op,2,vecs,1,targ_vecs,NULL);
229 const value_type& alpha,
const Vector& v_rhs1,
const Vector& v_rhs2
236 const int num_vecs = 2;
237 const Vector* vecs[2] = { &v_rhs1, &v_rhs2 };
239 apply_op(ele_wise_divide_op,2,vecs,1,targ_vecs,NULL);
255 apply_op(random_vector_op,0,NULL,1,targ_vecs,NULL);
266 const Vector* vecs[1] = { &v };
268 apply_op(op,1,vecs,1,targ_vecs,NULL);
virtual const VectorSpace & space() const =0
Return the vector space that this vector belongs to.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void sign(const Vector &v, VectorMutable *z)
Compute the sign of each element in an input vector.
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
void seed_random_vector_generator(unsigned int)
Seed the random number generator.
void set_bounds(const Scalar &l, const Scalar &u)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
v_lhs = alpha * v_rhs + v_lhs
void ele_wise_divide(const value_type &alpha, const Vector &v_rhs1, const Vector &v_rhs2, VectorMutable *v_lhs)
v_lhs(i) = alpha * v_rhs1(i) / v_rhs2(i), i = 1,,,dim.
void Vp_V_assert_compatibility(VectorMutable *v_lhs, const Vector &v_rhs)
v_lhs += op v_rhs
void reduct_obj_reinit(const Ptr< ReductTarget > &reduct_obj) const
void ele_wise_prod(const value_type &alpha, const Vector &v_rhs1, const Vector &v_rhs2, VectorMutable *v_lhs)
v_lhs(i) += alpha * v_rhs1(i) * v_rhs2(i), i = 1,,,dim.
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
Teuchos::RCP< ReductTarget > reduct_obj_create() const
Abstract interface for mutable coordinate vectors {abstract}.
void Vp_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs += alpha
void max_abs_ele(const Vector &v, value_type *max_v_j, index_type *max_j)
Compute the maximum element in a vector.
value_type sum(const Vector &v_rhs)
result = sum( v_rhs(i), i = 1,,,dim )
virtual vec_mut_ptr_t create_member() const =0
Create a vector member from the vector space.
void set_seed(const unsigned int seed)
void random_vector(value_type l, value_type u, VectorMutable *v)
Generate a random vector with elements uniformly distrubuted elements.
size_type nz() const
Return the number of non-zero elements.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
void VopV_assert_compatibility(const Vector &v_rhs1, const Vector &v_rhs2)
v_rhs1 op v_rhs2