# 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, VectorBase< Scalar > *v)
Set single element: `v(i) = alpha`.
template<class Scalar>
void Thyra::put_scalar (const Scalar &alpha, 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, VectorBase< Scalar > *y)
VectorBase assignment: `y(i) = x(i), i = 0...y->space()->dim()-1`.
template<class Scalar>
void Thyra::add_scalar (const Scalar &alpha, 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, VectorBase< Scalar > *y)
Scale all elements by a scalar: `y(i) *= alpha, i = 0...y->space()->dim()-1`.
template<class Scalar>
void Thyra::abs (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 (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, 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::Vp_StVtV (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, 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 (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, 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 int m,const Scalar alpha[],const VectorBase< Scalar > *x[],const Scalar &beta,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, 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 71 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 434 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 442 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 82 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 93 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 104 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 115 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 125 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 135 of file Thyra_VectorStdOps.hpp.

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

Set single element: `v(i) = alpha`.

Definition at line 147 of file Thyra_VectorStdOps.hpp.

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

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

Definition at line 158 of file Thyra_VectorStdOps.hpp.

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

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

Definition at line 169 of file Thyra_VectorStdOps.hpp.

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

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

Definition at line 181 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::scale ( const Scalar & alpha, 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 192 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::abs ( 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 208 of file Thyra_VectorStdOps.hpp.

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

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

Definition at line 220 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, VectorBase< Scalar > * v_lhs )

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

Definition at line 232 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::Vp_StVtV ( 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 247 of file Thyra_VectorStdOps.hpp.

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

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

Definition at line 256 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::Vt_StV ( 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 269 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, VectorBase< Scalar > * v_lhs )

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

Definition at line 276 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::linear_combination ( const int m, const Scalar alpha[], const VectorBase< Scalar > * x[], const Scalar & beta, 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 291 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 316 of file Thyra_VectorStdOps.hpp.

template<class Scalar>
 void Thyra::randomize ( Scalar l, Scalar u, 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 322 of file Thyra_VectorStdOps.hpp.

Generated on Tue Oct 20 12:46:59 2009 for Thyra Operator/Vector Support by  1.4.7