Tpetra::Vector< OrdinalType, ScalarType > Class Template Reference

Tpetra::Vector: A class for constructing and using sparse vectors. More...

#include <Tpetra_Vector.hpp>

Inheritance diagram for Tpetra::Vector< OrdinalType, ScalarType >:

Inheritance graph
[legend]
Collaboration diagram for Tpetra::Vector< OrdinalType, ScalarType >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Vector (VectorSpace< OrdinalType, ScalarType > const &VectorSpace)
 Sets all vector entries to zero.
 Vector (const ScalarType *vectorEntries, OrdinalType numEntries, VectorSpace< OrdinalType, ScalarType > const &VectorSpace)
 Set object values from user array. Throws an exception if an incorrect number of entries are specified.
 Vector (Vector< OrdinalType, ScalarType > const &Source)
 Copy constructor.
 ~Vector ()
 Destructor.
void submitEntries (OrdinalType numEntries, OrdinalType const *indices, ScalarType const *values)
 Submit entries. Values submitted will be summed with existing values.
void setAllToScalar (ScalarType const value)
 Set all entries to scalarValue.
void setAllToRandom ()
 Set all entries to random values.
void extractCopy (ScalarType *userArray) const
 Put vector entries into user array (copy).
void extractView (ScalarType **userPointerArray) const
 Put pointers to vector entries into user array (view).
ScalarType dotProduct (Vector< OrdinalType, ScalarType > const &x) const
 Returns result of dot product, result = this.x.
void absoluteValue (Vector< OrdinalType, ScalarType > const &x)
 Changes this vector to elementwise absolute values of x.
void reciprocal (Vector< OrdinalType, ScalarType > const &x)
 Changes this vector to element-wise reciprocal values of x.
void scale (ScalarType scalarThis)
 Scale the current values of a vector, this = scalarThis*this.
void scale (ScalarType scalarX, Vector< OrdinalType, ScalarType > const &x)
 Replace vector values with scaled values of x, this = scalarX*x.
void update (ScalarType scalarX, Vector< OrdinalType, ScalarType > const &x, ScalarType scalarThis)
 Update vector values with scaled values of x, this = scalarThis*this + scalarX*x.
void update (ScalarType scalarX, Vector< OrdinalType, ScalarType > const &x, ScalarType scalarY, Vector< OrdinalType, ScalarType > const &y, ScalarType scalarThis)
 Update vector with scaled values of x and y, this = scalarThis*this + scalarX*x + scalarY*y.
ScalarType norm1 () const
 Compute 1-norm of vector.
ScalarType norm2 () const
 Compute 2-norm of vector.
ScalarType normInf () const
 Compute Infinity-norm of vector.
ScalarType normWeighted (Vector< OrdinalType, ScalarType > const &weights) const
 Compute Weighted 2-norm (RMS Norm) of vector.
ScalarType minValue () const
 Compute minimum value of vector.
ScalarType maxValue () const
 Compute maximum value of vector.
ScalarType meanValue () const
 Compute mean (average) value of vector.
void elementwiseMultiply (ScalarType scalarXY, Vector< OrdinalType, ScalarType > const &x, Vector< OrdinalType, ScalarType > const &y, ScalarType scalarThis)
 Vector multiplication (elementwise).
void elementwiseReciprocalMultiply (ScalarType scalarXY, Vector< OrdinalType, ScalarType > const &x, Vector< OrdinalType, ScalarType > const &y, ScalarType scalarThis)
 Reciprocal multiply (elementwise).
ScalarType getSeed () const
 Get seed.
void setSeed (ScalarType seed)
 Set seed.
ScalarType & operator[] (OrdinalType index)
 [] operator, nonconst version
ScalarType const & operator[] (OrdinalType index) const
 [] operator, const version
OrdinalType getNumMyEntries () const
 Returns number of vector entries owned by this image.
OrdinalType getNumGlobalEntries () const
 Returns number of vector entries across all images.
void print (ostream &os) const
 Print method, used by overloaded << operator.
void printValues (ostream &os) const
VectorSpace< OrdinalType,
ScalarType > const & 
vectorSpace () const
 Returns a const reference to the VectorSpace this Vector belongs to.
Vector< OrdinalType, ScalarType > & operator= (Vector< OrdinalType, ScalarType > const &Source)
 Assignment Operator.
ScalarType * scalarPointer ()
ScalarType const * scalarPointer () const

Classes

struct  greater_mag
struct  less_mag

Detailed Description

template<typename OrdinalType, typename ScalarType>
class Tpetra::Vector< OrdinalType, ScalarType >

Tpetra::Vector: A class for constructing and using sparse vectors.

Vector is templated on ScalarType for the vector entries, and on OrdinalType for the vector indices. A VectorSpace object is needed for all Vector objects.

Vector entries can only be accessed through their local index values. (This is due to the fact that a VectorSpace can be created with either an ElementSpace or a BlockElementSpace, and there is no way to globally access a BES Point.) Global index values can be converted to local indices by using the VectorSpace::getLocalIndex method.

Note that for most of the mathematical methods that set this to the result of an operation on vectors passed as parameters, the this vector can be used as one of the parameters (unless otherwise specified).

Vector error codes (positive for non-fatal, negative for fatal):

  1. +1 Specified vector index not found on this image.
  2. +2 Vector sizes do not match.
  3. +3 Cannot perform that operation on an empty vector.
  4. -1 Invalid number of entries passed to constructor.
  5. -99 Internal Vector error. Contact developer.


Member Function Documentation

template<typename OrdinalType, typename ScalarType>
void Tpetra::Vector< OrdinalType, ScalarType >::elementwiseMultiply ( ScalarType  scalarXY,
Vector< OrdinalType, ScalarType > const &  x,
Vector< OrdinalType, ScalarType > const &  y,
ScalarType  scalarThis 
) [inline]

Vector multiplication (elementwise).

this = scalarThis*this + scalarXY*x, where @ represents elementwise multiplication.

template<typename OrdinalType, typename ScalarType>
void Tpetra::Vector< OrdinalType, ScalarType >::elementwiseReciprocalMultiply ( ScalarType  scalarXY,
Vector< OrdinalType, ScalarType > const &  x,
Vector< OrdinalType, ScalarType > const &  y,
ScalarType  scalarThis 
) [inline]

Reciprocal multiply (elementwise).

this = scalarThis*this + scalarXY*y, where @ represents elementwise division.


The documentation for this class was generated from the following file:
Generated on Tue Oct 20 12:56:02 2009 for Tpetra by doxygen 1.4.7