Epetra_SerialDenseVector Class Reference

Epetra_SerialDenseVector: A class for constructing and using dense vectors. More...

#include <Epetra_SerialDenseVector.h>

Inheritance diagram for Epetra_SerialDenseVector:

Inheritance graph
[legend]
List of all members.

Constructors/destructors

 Epetra_SerialDenseVector ()
 Default constructor; defines a zero size object.
 Epetra_SerialDenseVector (int Length)
 Sized constructor; defines a variable-sized object.
 Epetra_SerialDenseVector (Epetra_DataAccess CV, double *Values, int Length)
 Set object values from one-dimensional array.
 Epetra_SerialDenseVector (const Epetra_SerialDenseVector &Source)
 Epetra_SerialDenseVector copy constructor.
virtual ~Epetra_SerialDenseVector ()
 Epetra_SerialDenseVector destructor.

Post-construction modification routines

int Size (int Length_in)
 Set length of a Epetra_SerialDenseVector object; init values to zero.
int Resize (int Length_in)
 Resize a Epetra_SerialDenseVector object.

Element access methods

Epetra_SerialDenseVectoroperator= (const Epetra_SerialDenseVector &Source)
 Value copy from one vector to another.
double & operator() (int Index)
 Element access function.
const double & operator() (int Index) const
 Element access function.
double & operator[] (int Index)
 Element access function.
const double & operator[] (int Index) const
 Column access function.

Mathematical methods

int Random ()
 Set vector values to random numbers.
double Dot (const Epetra_SerialDenseVector &x) const
 Compute 1-norm of each vector in multi-vector.
double Norm1 () const
 Compute 1-norm of each vector in multi-vector.
double Norm2 () const
 Compute 2-norm of each vector in multi-vector.
double NormInf () const
 Compute Inf-norm of each vector in multi-vector.

Attribute access methods

int Length () const
 Returns length of vector.
double * Values () const
 Returns pointer to the values in vector.
Epetra_DataAccess CV () const
 Returns the data access mode of the this vector.

I/O methods

virtual void Print (ostream &os) const
 Print service methods; defines behavior of ostream << operator.

Detailed Description

Epetra_SerialDenseVector: A class for constructing and using dense vectors.

The Epetra_SerialDenseVector class enables the construction and use of real-valued, double-precision dense vectors. It is built on the BLAS and LAPACK and derives from the Epetra_SerialDenseMatrix class.

The Epetra_SerialDenseVector class is intended to provide convenient vector notation but derives all signficant functionality from Epetra_SerialDenseMatrix.

Constructing Epetra_SerialDenseVector Objects

There are four Epetra_SerialDenseVector constructors. The first constructs a zero-length object which should be made to appropriate length using the Size() or Resize() functions and then filled with the [] or () operators. The second constructs an object sized to the dimension specified, which should be filled with the [] or () operators. The third is a constructor that accepts user data as a 1D array, and the fourth is a copy constructor. The third constructor has two data access modes (specified by the Epetra_DataAccess argument):

  1. Copy mode - Allocates memory and makes a copy of the user-provided data. In this case, the user data is not needed after construction.
  2. View mode - Creates a "view" of the user data. In this case, the user data is required to remain intact for the life of the object.

Warning:
View mode is extremely dangerous from a data hiding perspective. Therefore, we strongly encourage users to develop code using Copy mode first and only use the View mode in a secondary optimization phase.
Extracting Data from Epetra_SerialDenseVector Objects

Once a Epetra_SerialDenseVector is constructed, it is possible to view the data via access functions.

Warning:
Use of these access functions cam be extremely dangerous from a data hiding perspective.
The final useful function is Flops(). Each Epetra_SerialDenseVector object keep track of the number of serial floating point operations performed using the specified object as the this argument to the function. The Flops() function returns this number as a double precision number. Using this information, in conjunction with the Epetra_Time class, one can get accurate parallel performance numbers.

Definition at line 83 of file Epetra_SerialDenseVector.h.


Constructor & Destructor Documentation

Epetra_SerialDenseVector::Epetra_SerialDenseVector (  ) 

Default constructor; defines a zero size object.

Epetra_SerialDenseVector objects defined by the default constructor should be sized with the Size() or Resize functions. Values should be defined by using the [] or () operators.

Definition at line 32 of file Epetra_SerialDenseVector.cpp.

Epetra_SerialDenseVector::Epetra_SerialDenseVector ( int  Length  ) 

Sized constructor; defines a variable-sized object.

Parameters:
In Length - Length of vector.
Epetra_SerialDenseVector objects defined by the sized constructor are already sized to the dimension given as a parameter. All values are initialized to 0. Calling this constructor is equivalent to using the default constructor, and then calling the Size function on it. Values should be defined by using the [] or () operators.

Definition at line 39 of file Epetra_SerialDenseVector.cpp.

Epetra_SerialDenseVector::Epetra_SerialDenseVector ( Epetra_DataAccess  CV,
double *  Values,
int  Length 
)

Set object values from one-dimensional array.

Parameters:
In Epetra_DataAccess - Enumerated type set to Copy or View.
In Values - Pointer to an array of double precision numbers containing the values.
In Length - Length of vector.
See Detailed Description section for further discussion.

Definition at line 46 of file Epetra_SerialDenseVector.cpp.

Epetra_SerialDenseVector::Epetra_SerialDenseVector ( const Epetra_SerialDenseVector Source  ) 

Epetra_SerialDenseVector copy constructor.

Definition at line 53 of file Epetra_SerialDenseVector.cpp.

Epetra_SerialDenseVector::~Epetra_SerialDenseVector (  )  [virtual]

Epetra_SerialDenseVector destructor.

Definition at line 58 of file Epetra_SerialDenseVector.cpp.


Member Function Documentation

int Epetra_SerialDenseVector::Size ( int  Length_in  )  [inline]

Set length of a Epetra_SerialDenseVector object; init values to zero.

Parameters:
In Length - Length of vector object.
Allows user to define the dimension of a Epetra_SerialDenseVector. This function can be called at any point after construction. Any values that were previously in this object are destroyed and the resized vector starts off with all zero values.

Returns:
Integer error code, set to 0 if successful.

Definition at line 145 of file Epetra_SerialDenseVector.h.

int Epetra_SerialDenseVector::Resize ( int  Length_in  )  [inline]

Resize a Epetra_SerialDenseVector object.

Parameters:
In Length - Length of vector object.
Allows user to define the dimension of a Epetra_SerialDenseVector. This function can be called at any point after construction. Any values that were previously in this object are copied into the new size. If the new shape is smaller than the original, the first Length values are copied to the new vector.

Returns:
Integer error code, set to 0 if successful.

Definition at line 159 of file Epetra_SerialDenseVector.h.

Epetra_SerialDenseVector & Epetra_SerialDenseVector::operator= ( const Epetra_SerialDenseVector Source  ) 

Value copy from one vector to another.

The operator= allows one to copy the values from one existing SerialDenseVector to another, as long as there is enough room in the target to hold the source.

Returns:
Values of the left hand side vector are modified by the values of the right hand side vector.

Definition at line 62 of file Epetra_SerialDenseVector.cpp.

double & Epetra_SerialDenseVector::operator() ( int  Index  )  [inline]

Element access function.

Returns the specified element of the vector. Bounds checking is enforced.

Returns:
Specified element in vector.
Warning:
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Definition at line 278 of file Epetra_SerialDenseVector.h.

const double & Epetra_SerialDenseVector::operator() ( int  Index  )  const [inline]

Element access function.

Returns the specified element of the vector. Bounds checking is enforced.

Returns:
Specified element in vector.
Warning:
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Definition at line 286 of file Epetra_SerialDenseVector.h.

double & Epetra_SerialDenseVector::operator[] ( int  Index  )  [inline]

Element access function.

Returns the specified element of the vector.

Returns:
Specified element in vector.
Warning:
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Reimplemented from Epetra_SerialDenseMatrix.

Definition at line 294 of file Epetra_SerialDenseVector.h.

const double & Epetra_SerialDenseVector::operator[] ( int  Index  )  const [inline]

Column access function.

Returns the specified element of the vector.

Returns:
Specified element in vector.
Warning:
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Reimplemented from Epetra_SerialDenseMatrix.

Definition at line 302 of file Epetra_SerialDenseVector.h.

int Epetra_SerialDenseVector::Random (  ) 

Set vector values to random numbers.

SerialDenseVector uses the random number generator provided by Epetra_Util. The vector values will be set to random values on the interval (-1.0, 1.0).

Returns:
Integer error code, set to 0 if successful.

Reimplemented from Epetra_SerialDenseMatrix.

Definition at line 68 of file Epetra_SerialDenseVector.cpp.

double Epetra_SerialDenseVector::Dot ( const Epetra_SerialDenseVector x  )  const

Compute 1-norm of each vector in multi-vector.

Parameters:
x (In) Input vector x.
Returns:
Dot-product of the this vector and x.

Definition at line 74 of file Epetra_SerialDenseVector.cpp.

double Epetra_SerialDenseVector::Norm1 (  )  const

Compute 1-norm of each vector in multi-vector.

Returns:
1-norm of the vector.

Definition at line 92 of file Epetra_SerialDenseVector.cpp.

double Epetra_SerialDenseVector::Norm2 (  )  const

Compute 2-norm of each vector in multi-vector.

Parameters:
Out 
Returns:
2-norm of the vector.

Definition at line 104 of file Epetra_SerialDenseVector.cpp.

double Epetra_SerialDenseVector::NormInf (  )  const [virtual]

Compute Inf-norm of each vector in multi-vector.

Returns:
Infinity-norm of the vector.

Reimplemented from Epetra_SerialDenseMatrix.

Definition at line 115 of file Epetra_SerialDenseVector.cpp.

int Epetra_SerialDenseVector::Length (  )  const [inline]

Returns length of vector.

Definition at line 259 of file Epetra_SerialDenseVector.h.

double* Epetra_SerialDenseVector::Values (  )  const [inline]

Returns pointer to the values in vector.

Definition at line 262 of file Epetra_SerialDenseVector.h.

Epetra_DataAccess Epetra_SerialDenseVector::CV (  )  const [inline]

Returns the data access mode of the this vector.

Reimplemented from Epetra_SerialDenseMatrix.

Definition at line 265 of file Epetra_SerialDenseVector.h.

void Epetra_SerialDenseVector::Print ( ostream &  os  )  const [virtual]

Print service methods; defines behavior of ostream << operator.

Reimplemented from Epetra_SerialDenseMatrix.

Definition at line 128 of file Epetra_SerialDenseVector.cpp.


The documentation for this class was generated from the following files:
Generated on Wed May 12 21:41:09 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7