ML Version of the Day
Loading...
Searching...
No Matches
MLAPI::MultiVector Class Reference

Basic class for distributed double-precision vectors. More...

#include <MLAPI_MultiVector.h>

Inheritance diagram for MLAPI::MultiVector:
Collaboration diagram for MLAPI::MultiVector:

Public Member Functions

 MultiVector ()
 Default constructor.
 MultiVector (const Space &VectorSpace, const int NumVectors=1, bool SetToZero=true)
 Constructor for a given Space.
 MultiVector (const Space &VectorSpace, double **Values, const int NumVectors=1)
 Constructor with a given Space, and user-provided array of values.
 MultiVector (const Space &VectorSpace, Teuchos::RefCountPtr< DoubleVector > RCPValues)
 Constructor with a given Space, and user-provided RefCountPtr.
 MultiVector (const Space &VectorSpace, std::vector< Teuchos::RefCountPtr< DoubleVector > > RCPValues)
 Constructor with a given Space, and user-provided array of values.
 MultiVector (const MultiVector &rhs)
 Copy constructor.
 ~MultiVector ()
 Destructor.
void Reshape ()
 Resets this object.
void Reshape (const Space &S, const int NumVectors=1, const bool SetToZero=true)
 Sets the space of this vector.
void Append (const int NumVectors=1, const bool SetToZero=true)
 Appends a new vector.
void Append (const MultiVector &rhs)
 Appends a new vector.
void Delete (const int v)
 Deletes the last vector.
MultiVectoroperator= (double rhs)
 Sets all elements of this vector to rhs.
MultiVectoroperator= (const MultiVector &rhs)
 Copies the rhs into this object.
MultiVectoroperator= (const BaseLinearCombination &rhs)
 Sets the elements from the input BaseLinearCombination.
bool operator== (const MultiVector &) const
MultiVectoroperator= (const std::string &Label)
 Sets the name of this object, does not touch vector elements or space.
const double & operator() (const int i) const
 Returns the value of local element i (const version).
double & operator() (const int i)
 Returns the value of local element i (non-const version).
const double & operator() (const int i, const int v) const
 Returns the value of local element i.
double & operator() (const int i, const int v)
 Returns the value of local element i (non-const version).
const SpaceGetVectorSpace () const
 Returns the Space on which this vector is defined.
SpaceGetVectorSpace ()
 Returns the Space on which this vector is defined (non-const).
int GetNumVectors () const
 Returns the number of vectors.
int GetMyLength () const
 Returns the local length of each vector.
int GetGlobalLength () const
 Returns the global length of each vector.
double * GetValues (const int v)
 Returns a pointer to the double array (non-const version).
const double * GetValues (const int v) const
 Returns a pointer to the double array (const version).
Teuchos::RefCountPtr< DoubleVector > & GetRCPValues (const int v)
 Returns a pointer to the double array (non-const version).
const Teuchos::RefCountPtr< DoubleVector > & GetRCPValues (const int v) const
 Returns a pointer to the double array (const version).
void SetRCPValues (const Teuchos::RefCountPtr< DoubleVector > &RCPValues, const int v)
 Sets the RefCountPtr<Values_>.
void Update (const double alpha, int v=-1)
 Sets this(v) = rhs.
void Update (const MultiVector &rhs)
 Sets this = rhs.
void Update (double alpha, const MultiVector &rhs)
 Sets this = alpha * rhs.
void Update (double alpha, const MultiVector &x, double beta, const MultiVector &y)
 Sets this = alpha * x + beta * y.
void Update (double alpha, const MultiVector &rhs, double beta)
 Sets this = alpha * rhs + beta * this.
double DotProduct (const MultiVector &rhs, int v=-1) const
 Computes the dot product between this vector and rhs.
double Norm2 (int v=-1) const
 Computes the 2-norm of this vector.
double NormInf (int v=-1) const
 Computes the infinite norm of this vector.
double NormOne (int v=-1) const
 Computes the one norm of this vector.
void Reciprocal (int v=-1)
 Replaces each element of the vector with its reciprocal.
void Scale (const double Factor, int v=-1)
 Scales each element by the specified factor.
void Random (int v=-1)
 Populates the vector with random elements.
void Sort (int v=-1, const bool IsIncreasing=false)
 Sorts the component of the vector.
virtual std::ostream & Print (std::ostream &os, const bool verbose=true) const
 Prints basic information about this object on std::ostream.
bool IsAlias (const MultiVector &rhs) const
Public Member Functions inherited from MLAPI::BaseObject
 BaseObject ()
 Constructor with empty label.
 BaseObject (const std::string &Label)
 Constructor with given Label.
virtual ~BaseObject ()
 Destructor.
void SetLabel (const std::string &Label)
 Sets the Label of this object to Label.
const std::string & GetLabel () const
 Returns the Label of this object.
Public Member Functions inherited from MLAPI::CompObject
 CompObject ()
 Constructor, set counter to 0.0.
 ~CompObject ()
 Destructor.
double GetFlops () const
 Returns the internal counter of flops.
void SetFlops (double Flops) const
 Sets internal counter to Flops.
void UpdateFlops (double Flops) const
 Updates internal counter by summing Flops.
Public Member Functions inherited from MLAPI::TimeObject
 TimeObject ()
 Constructor, set counter to 0.0.
 ~TimeObject ()
 Destructor.
void ResetTimer () const
 Resets the internal timer.
void UpdateTime () const
 Updates the internal timer with the time spent since the last call to ResetTimer().
void UpdateTime (double t) const
 Updates the internal timer with input value t.
double GetTime () const
 Returns the internally stored counter.

Friends

std::ostream & operator<< (std::ostream &os, MultiVector const &mv)

Additional Inherited Members

Protected Attributes inherited from MLAPI::TimeObject
Epetra_Time Time_
 Object used to track time.
double TotalTime_
 Internal counter.

Detailed Description

Basic class for distributed double-precision vectors.

Author
Marzio Sala, SNL 9214.
Date
Last updated on Feb-05.

Constructor & Destructor Documentation

◆ MultiVector() [1/6]

MLAPI::MultiVector::MultiVector ( )
inline

◆ MultiVector() [2/6]

MLAPI::MultiVector::MultiVector ( const Space & VectorSpace,
const int NumVectors = 1,
bool SetToZero = true )
inline

Constructor for a given Space.

References GetMyLength(), and SetRCPValues().

◆ MultiVector() [3/6]

MLAPI::MultiVector::MultiVector ( const Space & VectorSpace,
double ** Values,
const int NumVectors = 1 )
inline

Constructor with a given Space, and user-provided array of values.

References GetNumVectors(), and SetRCPValues().

◆ MultiVector() [4/6]

MLAPI::MultiVector::MultiVector ( const Space & VectorSpace,
Teuchos::RefCountPtr< DoubleVector > RCPValues )
inline

Constructor with a given Space, and user-provided RefCountPtr.

References GetNumVectors(), and SetRCPValues().

◆ MultiVector() [5/6]

MLAPI::MultiVector::MultiVector ( const Space & VectorSpace,
std::vector< Teuchos::RefCountPtr< DoubleVector > > RCPValues )
inline

Constructor with a given Space, and user-provided array of values.

References GetNumVectors(), and SetRCPValues().

◆ MultiVector() [6/6]

MLAPI::MultiVector::MultiVector ( const MultiVector & rhs)
inline

◆ ~MultiVector()

MLAPI::MultiVector::~MultiVector ( )
inline

Destructor.

References GetNumVectors(), and SetRCPValues().

Member Function Documentation

◆ Append() [1/2]

void MLAPI::MultiVector::Append ( const int NumVectors = 1,
const bool SetToZero = true )
inline

Appends a new vector.

References GetMyLength(), GetNumVectors(), and Update().

Referenced by MLAPI::MultiLevelAdaptiveSA::IncrementNullSpace().

◆ Append() [2/2]

void MLAPI::MultiVector::Append ( const MultiVector & rhs)
inline

Appends a new vector.

References GetNumVectors(), GetRCPValues(), and MultiVector().

◆ Delete()

void MLAPI::MultiVector::Delete ( const int v)
inline

Deletes the last vector.

References GetNumVectors(), and GetRCPValues().

Referenced by MLAPI::MultiLevelAdaptiveSA::IncrementNullSpace().

◆ DotProduct()

double MLAPI::MultiVector::DotProduct ( const MultiVector & rhs,
int v = -1 ) const
inline

◆ GetGlobalLength()

int MLAPI::MultiVector::GetGlobalLength ( ) const
inline

◆ GetMyLength()

◆ GetNumVectors()

◆ GetRCPValues()

Teuchos::RefCountPtr< DoubleVector > & MLAPI::MultiVector::GetRCPValues ( const int v)
inline

Returns a pointer to the double array (non-const version).

Referenced by Append(), Delete(), MultiVector(), and operator=().

◆ GetValues()

double * MLAPI::MultiVector::GetValues ( const int v)
inline

◆ GetVectorSpace()

const Space & MLAPI::MultiVector::GetVectorSpace ( ) const
inline

◆ Norm2()

double MLAPI::MultiVector::Norm2 ( int v = -1) const
inline

◆ NormInf()

double MLAPI::MultiVector::NormInf ( int v = -1) const
inline

◆ NormOne()

double MLAPI::MultiVector::NormOne ( int v = -1) const
inline

◆ operator()() [1/4]

double & MLAPI::MultiVector::operator() ( const int i)
inline

Returns the value of local element i (non-const version).

References GetValues().

◆ operator()() [2/4]

const double & MLAPI::MultiVector::operator() ( const int i) const
inline

Returns the value of local element i (const version).

References GetValues().

◆ operator()() [3/4]

double & MLAPI::MultiVector::operator() ( const int i,
const int v )
inline

Returns the value of local element i (non-const version).

References GetValues().

◆ operator()() [4/4]

const double & MLAPI::MultiVector::operator() ( const int i,
const int v ) const
inline

Returns the value of local element i.

References GetValues().

◆ operator=() [1/4]

MultiVector & MLAPI::MultiVector::operator= ( const BaseLinearCombination & rhs)
inline

Sets the elements from the input BaseLinearCombination.

References MultiVector().

◆ operator=() [2/4]

MultiVector & MLAPI::MultiVector::operator= ( const MultiVector & rhs)
inline

◆ operator=() [3/4]

MultiVector & MLAPI::MultiVector::operator= ( const std::string & Label)
inline

Sets the name of this object, does not touch vector elements or space.

References MultiVector(), and MLAPI::BaseObject::SetLabel().

◆ operator=() [4/4]

MultiVector & MLAPI::MultiVector::operator= ( double rhs)
inline

Sets all elements of this vector to rhs.

References GetMyLength(), GetNumVectors(), GetValues(), and MultiVector().

◆ Print()

virtual std::ostream & MLAPI::MultiVector::Print ( std::ostream & os,
const bool verbose = true ) const
inlinevirtual

◆ Random()

void MLAPI::MultiVector::Random ( int v = -1)
inline

◆ Reciprocal()

void MLAPI::MultiVector::Reciprocal ( int v = -1)
inline

◆ Reshape() [1/2]

◆ Reshape() [2/2]

void MLAPI::MultiVector::Reshape ( const Space & S,
const int NumVectors = 1,
const bool SetToZero = true )
inline

Sets the space of this vector.

References GetMyLength(), GetNumVectors(), and SetRCPValues().

◆ Scale()

◆ SetRCPValues()

void MLAPI::MultiVector::SetRCPValues ( const Teuchos::RefCountPtr< DoubleVector > & RCPValues,
const int v )
inline

◆ Sort()

void MLAPI::MultiVector::Sort ( int v = -1,
const bool IsIncreasing = false )
inline

Sorts the component of the vector.

References GetMyLength(), MLAPI::TimeObject::ResetTimer(), and MLAPI::TimeObject::UpdateTime().

◆ Update() [1/5]

void MLAPI::MultiVector::Update ( const double alpha,
int v = -1 )
inline

Sets this(v) = rhs.

References GetMyLength(), GetNumVectors(), and GetValues().

Referenced by Append(), and Update().

◆ Update() [2/5]

void MLAPI::MultiVector::Update ( const MultiVector & rhs)
inline

◆ Update() [3/5]

void MLAPI::MultiVector::Update ( double alpha,
const MultiVector & rhs )
inline

◆ Update() [4/5]

void MLAPI::MultiVector::Update ( double alpha,
const MultiVector & rhs,
double beta )
inline

◆ Update() [5/5]

void MLAPI::MultiVector::Update ( double alpha,
const MultiVector & x,
double beta,
const MultiVector & y )
inline

The documentation for this class was generated from the following file: