Epetra  Development
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
Epetra_IntSerialDenseVector Class Reference

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

#include <Epetra_IntSerialDenseVector.h>

Inheritance diagram for Epetra_IntSerialDenseVector:
Inheritance graph
[legend]
Collaboration diagram for Epetra_IntSerialDenseVector:
Collaboration graph
[legend]

Public Member Functions

 Epetra_IntSerialDenseVector ()
 Default constructor; defines a zero size object. More...
 
 Epetra_IntSerialDenseVector (int Length_in)
 Sized constructor; defines a variable-sized object. More...
 
 Epetra_IntSerialDenseVector (Epetra_DataAccess CV_in, int *Values_in, int Length_in)
 Set object values from one-dimensional array. More...
 
 Epetra_IntSerialDenseVector (const Epetra_IntSerialDenseVector &Source)
 Epetra_IntSerialDenseVector copy constructor.
 
int Size (int Length_in)
 Set length of a Epetra_IntSerialDenseVector object; init values to zero. More...
 
int Resize (int Length_in)
 Resize a Epetra_IntSerialDenseVector object. More...
 
virtual ~Epetra_IntSerialDenseVector ()
 Epetra_IntSerialDenseVector destructor.
 
int & operator() (int Index)
 Element access function. More...
 
const int & operator() (int Index) const
 Element access function. More...
 
int & operator[] (int Index)
 Element access function. More...
 
const int & operator[] (int Index) const
 Element access function. More...
 
int Random ()
 Set vector values to random numbers. More...
 
int Length () const
 Returns length of vector.
 
int * Values ()
 Returns pointer to the values in vector.
 
const int * Values () const
 Returns const pointer to the values in vector.
 
Epetra_DataAccess CV () const
 Returns the data access mode of the this vector.
 
Epetra_IntSerialDenseVectoroperator= (const Epetra_IntSerialDenseVector &Source)
 Copy from one vector to another. More...
 
I/O methods
virtual void Print (std::ostream &os) const
 Print service methods; defines behavior of ostream << operator.
 
Expert-only unsupported methods
int MakeViewOf (const Epetra_IntSerialDenseVector &Source)
 Reset an existing IntSerialDenseVector to point to another Vector. More...
 
- Public Member Functions inherited from Epetra_IntSerialDenseMatrix
 Epetra_IntSerialDenseMatrix ()
 Default constructor; defines a zero size object. More...
 
 Epetra_IntSerialDenseMatrix (int NumRows, int NumCols)
 Shaped constructor; defines a variable-sized object. More...
 
 Epetra_IntSerialDenseMatrix (Epetra_DataAccess CV, int *A, int LDA, int NumRows, int NumCols)
 Set object values from two-dimensional array. More...
 
 Epetra_IntSerialDenseMatrix (const Epetra_IntSerialDenseMatrix &Source)
 Epetra_IntSerialDenseMatrix copy constructor. More...
 
virtual ~Epetra_IntSerialDenseMatrix ()
 Epetra_IntSerialDenseMatrix destructor.
 
int Shape (int NumRows, int NumCols)
 Set dimensions of a Epetra_IntSerialDenseMatrix object; init values to zero. More...
 
int Reshape (int NumRows, int NumCols)
 Reshape a Epetra_IntSerialDenseMatrix object. More...
 
virtual int OneNorm ()
 Computes the 1-Norm of the this matrix. More...
 
virtual int InfNorm ()
 Computes the Infinity-Norm of the this matrix.
 
Epetra_IntSerialDenseMatrixoperator= (const Epetra_IntSerialDenseMatrix &Source)
 Copy from one matrix to another. More...
 
bool operator== (const Epetra_IntSerialDenseMatrix &rhs) const
 Comparison operator. More...
 
bool operator!= (const Epetra_IntSerialDenseMatrix &rhs) const
 Inequality operator. More...
 
int & operator() (int RowIndex, int ColIndex)
 Element access function. More...
 
const int & operator() (int RowIndex, int ColIndex) const
 Element access function. More...
 
int * operator[] (int ColIndex)
 Column access function. More...
 
const int * operator[] (int ColIndex) const
 Column access function. More...
 
int Random ()
 Set matrix values to random numbers. More...
 
int M () const
 Returns row dimension of system.
 
int N () const
 Returns column dimension of system.
 
const int * A () const
 Returns const pointer to the this matrix.
 
int * A ()
 Returns pointer to the this matrix.
 
int LDA () const
 Returns the leading dimension of the this matrix.
 
Epetra_DataAccess CV () const
 Returns the data access mode of the this matrix.
 
int MakeViewOf (const Epetra_IntSerialDenseMatrix &Source)
 Reset an existing IntSerialDenseMatrix to point to another Matrix. More...
 
- Public Member Functions inherited from Epetra_Object
 Epetra_Object (int TracebackModeIn=-1, bool set_label=true)
 Epetra_Object Constructor. More...
 
 Epetra_Object (const char *const Label, int TracebackModeIn=-1)
 Epetra_Object Constructor. More...
 
 Epetra_Object (const Epetra_Object &Object)
 Epetra_Object Copy Constructor. More...
 
virtual ~Epetra_Object ()
 Epetra_Object Destructor. More...
 
virtual int ReportError (const std::string Message, int ErrorCode) const
 Error reporting method.
 
virtual void SetLabel (const char *const Label)
 Epetra_Object Label definition using char *. More...
 
virtual const char * Label () const
 Epetra_Object Label access funtion. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Epetra_Object
static void SetTracebackMode (int TracebackModeValue)
 Set the value of the Epetra_Object error traceback report mode. More...
 
static int GetTracebackMode ()
 Get the value of the Epetra_Object error report mode.
 
static std::ostream & GetTracebackStream ()
 Get the output stream for error reporting.
 
- Static Public Attributes inherited from Epetra_Object
static int TracebackMode
 
- Protected Member Functions inherited from Epetra_IntSerialDenseMatrix
void CopyMat (int *Source, int Source_LDA, int NumRows, int NumCols, int *Target, int Target_LDA)
 
void CleanupData ()
 
- Protected Member Functions inherited from Epetra_Object
std::string toString (const int &x) const
 
std::string toString (const long long &x) const
 
std::string toString (const double &x) const
 
- Protected Attributes inherited from Epetra_IntSerialDenseMatrix
Epetra_DataAccess CV_
 
bool A_Copied_
 
int M_
 
int N_
 
int LDA_
 
int * A_
 

Detailed Description

Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.

The Epetra_IntSerialDenseVector class enables the construction and use of integer-valued,
dense vectors.  It derives from the Epetra_IntSerialDenseMatrix class.

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

Constructing Epetra_IntSerialDenseVector Objects

There are three Epetra_IntSerialDenseVector 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_IntSerialDenseVector Objects

Once a Epetra_IntSerialDenseVector 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.

Constructor & Destructor Documentation

Epetra_IntSerialDenseVector::Epetra_IntSerialDenseVector ( )

Default constructor; defines a zero size object.

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

Epetra_IntSerialDenseVector::Epetra_IntSerialDenseVector ( int  Length_in)

Sized constructor; defines a variable-sized object.

Parameters
InLength - Length of vector.

Epetra_IntSerialDenseVector 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.

Epetra_IntSerialDenseVector::Epetra_IntSerialDenseVector ( Epetra_DataAccess  CV_in,
int *  Values_in,
int  Length_in 
)

Set object values from one-dimensional array.

Parameters
InEpetra_DataAccess - Enumerated type set to Copy or View.
InValues - Pointer to an array of integer numbers containing the values.
InLength - Length of vector.

See Detailed Description section for further discussion.

Member Function Documentation

int Epetra_IntSerialDenseVector::MakeViewOf ( const Epetra_IntSerialDenseVector Source)

Reset an existing IntSerialDenseVector to point to another Vector.

Allows an existing IntSerialDenseVector to become a View of another vector's data, regardless of the DataAccess mode of the Source vector. It is assumed that the Source vector is an independent vector, and no checking is done to verify this.

This is used by Epetra_CrsGraph in the OptimizeStorage method. It is used so that an existing (Copy) vector can be converted to a View. This frees up memory that CrsGraph no longer needs.

Parameters
SourceThe IntSerialDenseVector this will become a view of.
Returns
Integer error code, set to 0 if successful.
Warning
This method is extremely dangerous and should only be used by experts.
int & Epetra_IntSerialDenseVector::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.

References Epetra_Object::ReportError().

const int & Epetra_IntSerialDenseVector::operator() ( int  Index) const
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.

References Epetra_Object::ReportError().

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

Copy from one vector to another.

The operator= allows one to copy the values from one existing IntSerialDenseVector to another. The left hand side vector will take on the data access mode of the right hand side vector.

Returns
Values of the left hand side vector are modified by the values of the right hand side vector.
int & Epetra_IntSerialDenseVector::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.

References Epetra_Object::ReportError().

const int & Epetra_IntSerialDenseVector::operator[] ( int  Index) const
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.

References Epetra_Object::ReportError().

int Epetra_IntSerialDenseVector::Random ( )

Set vector values to random numbers.

IntSerialDenseVector uses the random number generator provided by Epetra_Util.
The vector values will be set to random values on the interval (0, 2^31 - 1).
Returns
Integer error code, set to 0 if successful.
int Epetra_IntSerialDenseVector::Resize ( int  Length_in)
inline

Resize a Epetra_IntSerialDenseVector object.

Parameters
InLength - Length of vector object.

Allows user to define the dimension of a Epetra_IntSerialDenseVector. 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.

References Epetra_IntSerialDenseMatrix::Reshape().

int Epetra_IntSerialDenseVector::Size ( int  Length_in)
inline

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

Parameters
InLength - Length of vector object.

Allows user to define the dimension of a Epetra_IntSerialDenseVector. 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.

References Epetra_IntSerialDenseMatrix::Shape().


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