# Vector operations with standard text names. [Collection of vector operations for all scalar types.]

Collaboration diagram for Vector operations with standard text names.:

## Functions

template<class Scalar>
Scalar Thyra::sum (const VectorBase< Scalar > &v)
Sum of vector elements: result = sum( v(i), i = 0...v.space()->dim()-1 ).
template<class Scalar>
Scalar Thyra::scalarProd (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y)
Scalar product result = <x,y>.
template<class Scalar>
Teuchos::ScalarTraits< Scalar
>::magnitudeType
Thyra::norm (const VectorBase< Scalar > &v)
Natural norm: result = sqrt(<v,v>).
template<class Scalar>
Teuchos::ScalarTraits< Scalar
>::magnitudeType
Thyra::norm_1 (const VectorBase< Scalar > &v)
One (1) norm: result = ||v||1.
template<class Scalar>
Teuchos::ScalarTraits< Scalar
>::magnitudeType
Thyra::norm_2 (const VectorBase< Scalar > &v)
Euclidean (2) norm: result = ||v||2.
template<class Scalar>
Teuchos::ScalarTraits< Scalar
>::magnitudeType
Thyra::norm_2 (const VectorBase< Scalar > &w, const VectorBase< Scalar > &v)
Weighted Euclidean (2) norm: result = sqrt( sum( w(i)*conj(v(i))*v(i)) ).
template<class Scalar>
Teuchos::ScalarTraits< Scalar
>::magnitudeType
Thyra::norm_inf (const VectorBase< Scalar > &v_rhs)
Infinity norm: result = ||v||inf.
template<class Scalar>
Scalar Thyra::dot (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y)
Dot product: result = conj(x)'*y.
template<class Scalar>
Scalar Thyra::get_ele (const VectorBase< Scalar > &v, Index i)
Get single element: result = v(i).
template<class Scalar>
void Thyra::set_ele (Index i, Scalar alpha, const Ptr< VectorBase< Scalar > > &v)
Set single element: v(i) = alpha.
template<class Scalar>
void Thyra::put_scalar (const Scalar &alpha, const Ptr< VectorBase< Scalar > > &y)
Assign all elements to a scalar: y(i) = alpha, i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::copy (const VectorBase< Scalar > &x, const Ptr< VectorBase< Scalar > > &y)
Vector assignment: y(i) = x(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::add_scalar (const Scalar &alpha, const Ptr< VectorBase< Scalar > > &y)
Add a scalar to all elements: y(i) += alpha, i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::scale (const Scalar &alpha, const Ptr< VectorBase< Scalar > > &y)
Scale all elements by a scalar: y(i) *= alpha, i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::abs (const Ptr< VectorBase< Scalar > > &y, const VectorBase< Scalar > &x)
Element-wise absolute value: y(i) = abs(x(i)), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::reciprocal (const Ptr< VectorBase< Scalar > > &y, const VectorBase< Scalar > &x)
Element-wise reciprocal: y(i) = 1/x(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::ele_wise_prod (const Scalar &alpha, const VectorBase< Scalar > &x, const VectorBase< Scalar > &v, const Ptr< VectorBase< Scalar > > &y)
Element-wise product update: y(i) += alpha * x(i) * v(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::ele_wise_conj_prod (const Scalar &alpha, const VectorBase< Scalar > &x, const VectorBase< Scalar > &v, const Ptr< VectorBase< Scalar > > &y)
Element-wise conjugate product update: y(i) += alpha * conj(x(i)) * v(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::Vp_StVtV (const Ptr< VectorBase< Scalar > > &y, const Scalar &alpha, const VectorBase< Scalar > &x, const VectorBase< Scalar > &v)
Element-wise product update: y(i) += alpha * x(i) * v(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::ele_wise_prod_update (const Scalar &alpha, const VectorBase< Scalar > &x, const Ptr< VectorBase< Scalar > > &y)
Element-wise product update: y(i) *= alpha * x(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::Vt_StV (const Ptr< VectorBase< Scalar > > &y, const Scalar &alpha, const VectorBase< Scalar > &x)
Element-wise product update: y(i) *= alpha * x(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::ele_wise_divide (const Scalar &alpha, const VectorBase< Scalar > &x, const VectorBase< Scalar > &v, const Ptr< VectorBase< Scalar > > &y)
Element-wise division update: y(i) += alpha * x(i) / v(i), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::linear_combination (const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const VectorBase< Scalar > > > &x, const Scalar &beta, const Ptr< VectorBase< Scalar > > &y)
Linear combination: y(i) = beta*y(i) + sum( alpha[k]*x[k](i), k=0...m-1 ), i = 0...y->space()->dim()-1.
template<class Scalar>
void Thyra::seed_randomize (unsigned int s)
Seed the random number generator used in randomize().
template<class Scalar>
void Thyra::randomize (Scalar l, Scalar u, const Ptr< VectorBase< Scalar > > &v)
Random vector generation: v(i) = rand(l,u), , i = 1...v->space()->dim().

## Function Documentation

template<class Scalar>
 Scalar Thyra::sum ( const VectorBase< Scalar > & v_rhs )

Sum of vector elements: result = sum( v(i), i = 0...v.space()->dim()-1 ).

Examples:
test_product_space.cpp.

Definition at line 76 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 Scalar Thyra::scalarProd ( const VectorBase< Scalar > & x, const VectorBase< Scalar > & y ) [inline]

Scalar product result = <x,y>.

Returns x.space()->scalarProd(x,y).

Examples:
sillyCgSolve.hpp, sillyModifiedGramSchmidt.hpp, and sillyPowerMethod.hpp.

Definition at line 775 of file Thyra_VectorStdOpsDecl.hpp.

template<class Scalar>
 Teuchos::ScalarTraits::magnitudeType Thyra::norm ( const VectorBase< Scalar > & v ) [inline]

Natural norm: result = sqrt(<v,v>).

Returns Teuchos::ScalarTraits<Scalar>::squareroot(v.space()->scalarProd(v,v)).

Examples:
silliestCgSolve.hpp, sillyCgSolve.hpp, sillyCgSolve_mpi.cpp, sillyCgSolve_serial.cpp, sillyModifiedGramSchmidt.hpp, and sillyPowerMethod.hpp.

Definition at line 784 of file Thyra_VectorStdOpsDecl.hpp.

template<class Scalar>
 Teuchos::ScalarTraits< Scalar >::magnitudeType Thyra::norm_1 ( const VectorBase< Scalar > & v_rhs )

One (1) norm: result = ||v||1.

Definition at line 91 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 Teuchos::ScalarTraits< Scalar >::magnitudeType Thyra::norm_2 ( const VectorBase< Scalar > & v_rhs )

Euclidean (2) norm: result = ||v||2.

Definition at line 105 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 Teuchos::ScalarTraits< Scalar >::magnitudeType Thyra::norm_2 ( const VectorBase< Scalar > & w, const VectorBase< Scalar > & v )

Weighted Euclidean (2) norm: result = sqrt( sum( w(i)*conj(v(i))*v(i)) ).

Definition at line 119 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 Teuchos::ScalarTraits< Scalar >::magnitudeType Thyra::norm_inf ( const VectorBase< Scalar > & v_rhs )

Infinity norm: result = ||v||inf.

Definition at line 131 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 Scalar Thyra::dot ( const VectorBase< Scalar > & v_rhs1, const VectorBase< Scalar > & v_rhs2 )

Dot product: result = conj(x)'*y.

Definition at line 144 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 Scalar Thyra::get_ele ( const VectorBase< Scalar > & v, Index i )

Get single element: result = v(i).

Definition at line 160 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::set_ele ( Index i, Scalar alpha, const Ptr< VectorBase< Scalar > > & v )

Set single element: v(i) = alpha.

Definition at line 176 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::put_scalar ( const Scalar & alpha, const Ptr< VectorBase< Scalar > > & v_lhs )

Assign all elements to a scalar: y(i) = alpha, i = 0...y->space()->dim()-1.

Definition at line 188 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::copy ( const VectorBase< Scalar > & v_rhs, const Ptr< VectorBase< Scalar > > & v_lhs )

Vector assignment: y(i) = x(i), i = 0...y->space()->dim()-1.

Definition at line 199 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::add_scalar ( const Scalar & alpha, const Ptr< VectorBase< Scalar > > & v_lhs )

Add a scalar to all elements: y(i) += alpha, i = 0...y->space()->dim()-1.

Definition at line 209 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::scale ( const Scalar & alpha, const Ptr< VectorBase< Scalar > > & y )

Scale all elements by a scalar: y(i) *= alpha, i = 0...y->space()->dim()-1.

This takes care of the special cases of alpha == 0.0 (set y = 0.0) and alpha == 1.0 (don't do anything).

Definition at line 220 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::abs ( const Ptr< VectorBase< Scalar > > & y, const VectorBase< Scalar > & x )

Element-wise absolute value: y(i) = abs(x(i)), i = 0...y->space()->dim()-1.

Definition at line 236 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::reciprocal ( const Ptr< VectorBase< Scalar > > & y, const VectorBase< Scalar > & x )

Element-wise reciprocal: y(i) = 1/x(i), i = 0...y->space()->dim()-1.

Definition at line 245 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::ele_wise_prod ( const Scalar & alpha, const VectorBase< Scalar > & v_rhs1, const VectorBase< Scalar > & v_rhs2, const Ptr< VectorBase< Scalar > > & v_lhs )

Element-wise product update: y(i) += alpha * x(i) * v(i), i = 0...y->space()->dim()-1.

Definition at line 254 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::ele_wise_conj_prod ( const Scalar & alpha, const VectorBase< Scalar > & v_rhs1, const VectorBase< Scalar > & v_rhs2, const Ptr< VectorBase< Scalar > > & v_lhs )

Element-wise conjugate product update: y(i) += alpha * conj(x(i)) * v(i), i = 0...y->space()->dim()-1.

Definition at line 267 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::Vp_StVtV ( const Ptr< VectorBase< Scalar > > & v_lhs, const Scalar & alpha, const VectorBase< Scalar > & v_rhs1, const VectorBase< Scalar > & v_rhs2 )

Element-wise product update: y(i) += alpha * x(i) * v(i), i = 0...y->space()->dim()-1.

Definition at line 280 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::ele_wise_prod_update ( const Scalar & alpha, const VectorBase< Scalar > & v_rhs1, const Ptr< VectorBase< Scalar > > & v_lhs )

Element-wise product update: y(i) *= alpha * x(i), i = 0...y->space()->dim()-1.

Definition at line 291 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::Vt_StV ( const Ptr< VectorBase< Scalar > > & v_lhs, const Scalar & alpha, const VectorBase< Scalar > & x )

Element-wise product update: y(i) *= alpha * x(i), i = 0...y->space()->dim()-1.

Definition at line 304 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::ele_wise_divide ( const Scalar & alpha, const VectorBase< Scalar > & v_rhs1, const VectorBase< Scalar > & v_rhs2, const Ptr< VectorBase< Scalar > > & v_lhs )

Element-wise division update: y(i) += alpha * x(i) / v(i), i = 0...y->space()->dim()-1.

Definition at line 313 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::linear_combination ( const ArrayView< const Scalar > & alpha, const ArrayView< const Ptr< const VectorBase< Scalar > > > & x, const Scalar & beta, const Ptr< VectorBase< Scalar > > & y )

Linear combination: y(i) = beta*y(i) + sum( alpha[k]*x[k](i), k=0...m-1 ), i = 0...y->space()->dim()-1.

Parameters:
 m [in] Number of vectors x[] alpha [in] Array (length m) of input scalars. x [in] Array (length m) of input vectors. beta [in] Scalar multiplier for y y [in/out] Target vector that is the result of the linear combination.
This function implements a general linear combination:
y(i) = beta*y(i) + alpha[0]*x[0](i) + alpha[1]*x[1](i)
+ ... + alpha[m-1]*x[m-1](i), i = 0...y->space()->dim()-1

Definition at line 327 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::seed_randomize ( unsigned int s )

Seed the random number generator used in randomize().

Parameters:
 s [in] The seed for the random number generator.
Note, this just calls Teuchos::TOpRandomize<Scalar>::set_static_seed(s).

Definition at line 351 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::randomize ( Scalar l, Scalar u, const Ptr< VectorBase< Scalar > > & v )

Random vector generation: v(i) = rand(l,u), , i = 1...v->space()->dim().

The elements v->getEle(i) are randomly generated between [l,u].

The seed is set using the above seed_randomize() function.

Definition at line 358 of file Thyra_VectorStdOps.hpp.

Generated on Wed May 12 21:42:30 2010 for Thyra Operator/Vector Support by  1.4.7