Tpetra::Vector< Ordinal, Scalar > Class Template Reference

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

#include <Tpetra_VectorDecl.hpp>

Inheritance diagram for Tpetra::Vector< Ordinal, Scalar >:

Tpetra::DistObject< Ordinal, Scalar > Teuchos::Object List of all members.

Public Member Functions

Constructor/Destructor Methods
 Vector (const Map< Ordinal > &map)
 Sets all vector entries to zero.
 Vector (const Teuchos::ArrayView< const Scalar > &values, const Map< Ordinal > &map)
 Set object values from user array. Throws an exception if an incorrect number of entries are specified.
 Vector (const Vector< Ordinal, Scalar > &source)
 Copy constructor.
 ~Vector ()
 Destructor.
Post-Construction Modification Routines
void submitEntries (const Teuchos::ArrayView< const Ordinal > &indices, const Teuchos::ArrayView< const Scalar > &values)
 Submit entries. Values submitted will be summed with existing values.
void setAllToScalar (const Scalar &value)
 Set all entries to scalarValue.
void setAllToRandom ()
 Set all entries to random values.
Mathematical Methods
Scalar dotProduct (const Vector< Ordinal, Scalar > &x) const
 Returns result of dot product, result = this.x.
void absoluteValue (const Vector< Ordinal, Scalar > &x)
 Changes this vector to elementwise absolute values of x.
void reciprocal (const Vector< Ordinal, Scalar > &x)
 Changes this vector to element-wise reciprocal values of x.
void scale (const Scalar &scalarThis)
 Scale the current values of a vector, this = scalarThis*this.
void scale (const Scalar &scalarX, const Vector< Ordinal, Scalar > &x)
 Replace vector values with scaled values of x, this = scalarX*x.
void update (const Scalar &scalarX, const Vector< Ordinal, Scalar > &x, const Scalar &scalarThis)
 Update vector values with scaled values of x, this = scalarThis*this + scalarX*x.
void update (const Scalar &scalarX, const Vector< Ordinal, Scalar > &x, const Scalar &scalarY, const Vector< Ordinal, Scalar > &y, const Scalar &scalarThis)
 Update vector with scaled values of x and y, this = scalarThis*this + scalarX*x + scalarY*y.
Scalar norm1 () const
 Compute 1-norm of vector.
Scalar norm2 () const
 Compute 2-norm of vector.
Scalar normInf () const
 Compute Infinity-norm of vector.
Scalar normWeighted (const Vector< Ordinal, Scalar > &weights) const
 Compute Weighted 2-norm (RMS Norm) of vector.
Scalar minValue () const
 Compute minimum value of vector.
Scalar maxValue () const
 Compute maximum value of vector.
Scalar meanValue () const
 Compute mean (average) value of vector.
void elementwiseMultiply (const Scalar &scalarXY, const Vector< Ordinal, Scalar > &x, const Vector< Ordinal, Scalar > &y, const Scalar &scalarThis)
 Vector multiplication (elementwise).
void elementwiseReciprocalMultiply (Scalar scalarXY, const Vector< Ordinal, Scalar > &x, const Vector< Ordinal, Scalar > &y, const Scalar &scalarThis)
 Reciprocal multiply (elementwise).
Random number utilities
const Scalar & getSeed () const
 Get seed.
void setSeed (const Scalar &seed)
 Set seed.
Element access methods
Scalar & operator[] (Ordinal index)
 [] operator, nonconst version
const Scalar & operator[] (Ordinal index) const
 [] operator, const version
Attribute access methods
Ordinal getNumMyEntries () const
 Returns number of vector entries owned by this image.
Ordinal getNumGlobalEntries () const
 Returns number of vector entries across all images.
I/O methods
void print (std::ostream &os) const
 Print method, used by overloaded << operator.
Misc.
const Map< Ordinal > & getMap () const
 Returns a const reference to the VectorSpace this Vector belongs to.
Vector< Ordinal, Scalar > & operator= (const Vector< Ordinal, Scalar > &source)
 Assignment Operator.
Expert/Developer Use Only.

Detailed Description

template<typename Ordinal, typename Scalar>
class Tpetra::Vector< Ordinal, Scalar >

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

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

Vector entries can only be accessed through their local index values. 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.


Constructor & Destructor Documentation

template<typename Ordinal, typename Scalar>
Tpetra::Vector< Ordinal, Scalar >::Vector ( const Map< Ordinal > &  map  ) 

Sets all vector entries to zero.

template<typename Ordinal, typename Scalar>
Tpetra::Vector< Ordinal, Scalar >::Vector ( const Teuchos::ArrayView< const Scalar > &  values,
const Map< Ordinal > &  map 
)

Set object values from user array. Throws an exception if an incorrect number of entries are specified.

template<typename Ordinal, typename Scalar>
Tpetra::Vector< Ordinal, Scalar >::Vector ( const Vector< Ordinal, Scalar > &  source  ) 

Copy constructor.

template<typename Ordinal, typename Scalar>
Tpetra::Vector< Ordinal, Scalar >::~Vector (  ) 

Destructor.


Member Function Documentation

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::submitEntries ( const Teuchos::ArrayView< const Ordinal > &  indices,
const Teuchos::ArrayView< const Scalar > &  values 
)

Submit entries. Values submitted will be summed with existing values.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::setAllToScalar ( const Scalar &  value  ) 

Set all entries to scalarValue.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::setAllToRandom (  ) 

Set all entries to random values.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::dotProduct ( const Vector< Ordinal, Scalar > &  x  )  const

Returns result of dot product, result = this.x.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::absoluteValue ( const Vector< Ordinal, Scalar > &  x  ) 

Changes this vector to elementwise absolute values of x.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::reciprocal ( const Vector< Ordinal, Scalar > &  x  ) 

Changes this vector to element-wise reciprocal values of x.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::scale ( const Scalar &  scalarThis  ) 

Scale the current values of a vector, this = scalarThis*this.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::scale ( const Scalar &  scalarX,
const Vector< Ordinal, Scalar > &  x 
)

Replace vector values with scaled values of x, this = scalarX*x.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::update ( const Scalar &  scalarX,
const Vector< Ordinal, Scalar > &  x,
const Scalar &  scalarThis 
)

Update vector values with scaled values of x, this = scalarThis*this + scalarX*x.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::update ( const Scalar &  scalarX,
const Vector< Ordinal, Scalar > &  x,
const Scalar &  scalarY,
const Vector< Ordinal, Scalar > &  y,
const Scalar &  scalarThis 
)

Update vector with scaled values of x and y, this = scalarThis*this + scalarX*x + scalarY*y.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::norm1 (  )  const

Compute 1-norm of vector.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::norm2 (  )  const

Compute 2-norm of vector.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::normInf (  )  const

Compute Infinity-norm of vector.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::normWeighted ( const Vector< Ordinal, Scalar > &  weights  )  const

Compute Weighted 2-norm (RMS Norm) of vector.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::minValue (  )  const

Compute minimum value of vector.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::maxValue (  )  const

Compute maximum value of vector.

template<typename Ordinal, typename Scalar>
Scalar Tpetra::Vector< Ordinal, Scalar >::meanValue (  )  const

Compute mean (average) value of vector.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::elementwiseMultiply ( const Scalar &  scalarXY,
const Vector< Ordinal, Scalar > &  x,
const Vector< Ordinal, Scalar > &  y,
const Scalar &  scalarThis 
)

Vector multiplication (elementwise).

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

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::elementwiseReciprocalMultiply ( Scalar  scalarXY,
const Vector< Ordinal, Scalar > &  x,
const Vector< Ordinal, Scalar > &  y,
const Scalar &  scalarThis 
)

Reciprocal multiply (elementwise).

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

template<typename Ordinal, typename Scalar>
const Scalar & Tpetra::Vector< Ordinal, Scalar >::getSeed (  )  const

Get seed.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::setSeed ( const Scalar &  seed  ) 

Set seed.

template<typename Ordinal, typename Scalar>
Scalar & Tpetra::Vector< Ordinal, Scalar >::operator[] ( Ordinal  index  ) 

[] operator, nonconst version

template<typename Ordinal, typename Scalar>
const Scalar & Tpetra::Vector< Ordinal, Scalar >::operator[] ( Ordinal  index  )  const

[] operator, const version

template<typename Ordinal, typename Scalar>
Ordinal Tpetra::Vector< Ordinal, Scalar >::getNumMyEntries (  )  const

Returns number of vector entries owned by this image.

template<typename Ordinal, typename Scalar>
Ordinal Tpetra::Vector< Ordinal, Scalar >::getNumGlobalEntries (  )  const

Returns number of vector entries across all images.

template<typename Ordinal, typename Scalar>
void Tpetra::Vector< Ordinal, Scalar >::print ( std::ostream &  os  )  const [virtual]

Print method, used by overloaded << operator.

Reimplemented from Tpetra::DistObject< Ordinal, Scalar >.

template<typename Ordinal, typename Scalar>
const Map< Ordinal > & Tpetra::Vector< Ordinal, Scalar >::getMap (  )  const

Returns a const reference to the VectorSpace this Vector belongs to.

Reimplemented from Tpetra::DistObject< Ordinal, Scalar >.

template<typename Ordinal, typename Scalar>
Vector< Ordinal, Scalar > & Tpetra::Vector< Ordinal, Scalar >::operator= ( const Vector< Ordinal, Scalar > &  source  ) 

Assignment Operator.


The documentation for this class was generated from the following files:
Generated on Wed May 12 21:59:42 2010 for Tpetra Matrix/Vector Services by  doxygen 1.4.7