Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Protected Member Functions | Protected Attributes | List of all members
Epetra_LongLongSerialDenseMatrix Class Reference

Epetra_LongLongSerialDenseMatrix: A class for constructing and using general dense integer matrices. More...

#include <Epetra_LongLongSerialDenseMatrix.h>

Inheritance diagram for Epetra_LongLongSerialDenseMatrix:
Inheritance graph
[legend]

Protected Member Functions

void CopyMat (long long *Source, int Source_LDA, int NumRows, int NumCols, long long *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

Epetra_DataAccess CV_
 
bool A_Copied_
 
int M_
 
int N_
 
int LDA_
 
long long * A_
 

Constructor/Destructor Methods

 Epetra_LongLongSerialDenseMatrix ()
 Default constructor; defines a zero size object. More...
 
 Epetra_LongLongSerialDenseMatrix (int NumRows, int NumCols)
 Shaped constructor; defines a variable-sized object. More...
 
 Epetra_LongLongSerialDenseMatrix (Epetra_DataAccess CV, long long *A, int LDA, int NumRows, int NumCols)
 Set object values from two-dimensional array. More...
 
 Epetra_LongLongSerialDenseMatrix (const Epetra_LongLongSerialDenseMatrix &Source)
 Epetra_LongLongSerialDenseMatrix copy constructor. More...
 
virtual ~Epetra_LongLongSerialDenseMatrix ()
 Epetra_LongLongSerialDenseMatrix destructor. More...
 

Shaping/sizing Methods

int Shape (int NumRows, int NumCols)
 Set dimensions of a Epetra_LongLongSerialDenseMatrix object; init values to zero. More...
 
int Reshape (int NumRows, int NumCols)
 Reshape a Epetra_LongLongSerialDenseMatrix object. More...
 

Data Accessor methods

virtual long long OneNorm ()
 Computes the 1-Norm of the this matrix. More...
 
virtual long long InfNorm ()
 Computes the Infinity-Norm of the this matrix. More...
 
Epetra_LongLongSerialDenseMatrixoperator= (const Epetra_LongLongSerialDenseMatrix &Source)
 Copy from one matrix to another. More...
 
bool operator== (const Epetra_LongLongSerialDenseMatrix &rhs) const
 Comparison operator. More...
 
bool operator!= (const Epetra_LongLongSerialDenseMatrix &rhs) const
 Inequality operator. More...
 
long long & operator() (int RowIndex, int ColIndex)
 Element access function. More...
 
const long long & operator() (int RowIndex, int ColIndex) const
 Element access function. More...
 
long long * operator[] (int ColIndex)
 Column access function. More...
 
const long long * 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. More...
 
int N () const
 Returns column dimension of system. More...
 
const long long * A () const
 Returns const pointer to the this matrix. More...
 
long long * A ()
 Returns pointer to the this matrix. More...
 
int LDA () const
 Returns the leading dimension of the this matrix. More...
 
Epetra_DataAccess CV () const
 Returns the data access mode of the this matrix. More...
 

I/O methods

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

Expert-only unsupported methods

int MakeViewOf (const Epetra_LongLongSerialDenseMatrix &Source)
 Reset an existing LongLongSerialDenseMatrix to point to another Matrix. More...
 

Additional Inherited Members

- 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 void SetLabel (const char *const Label)
 Epetra_Object Label definition using char *. More...
 
virtual const char * Label () const
 Epetra_Object Label access funtion. More...
 
virtual int ReportError (const std::string Message, int ErrorCode) const
 Error reporting method. More...
 
- 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. More...
 
static std::ostream & GetTracebackStream ()
 Get the output stream for error reporting. More...
 
- Static Public Attributes inherited from Epetra_Object
static int TracebackMode
 

Detailed Description

Epetra_LongLongSerialDenseMatrix: A class for constructing and using general dense integer matrices.

The Epetra_LongLongSerialDenseMatrix class enables the construction and use of integer-valued, general
dense matrices.

The Epetra_LongLongSerialDenseMatrix class is intended to provide very basic support for dense rectangular matrices.

Constructing Epetra_LongLongSerialDenseMatrix Objects

There are four Epetra_LongLongSerialDenseMatrix constructors. The first constructs a zero-sized object which should be made to appropriate length using the Shape() or Reshape() functions and then filled with the [] or () operators. The second constructs an object sized to the dimensions specified, which should be filled with the [] or () operators. The third is a constructor that accepts user data as a 2D 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.

Epetra_LongLongSerialDenseMatrix constructors will throw an exception if an error occurrs. These exceptions will alway be negative integer values as follows:

  1. -1 Invalid dimension specified.
  2. -2 Shape returned non-zero.
  3. -3 Null pointer specified for user's data.
  4. -99 Internal Epetra_LongLongSerialDenseMatrix error. Contact developer.

Other Epetra_LongLongSerialDenseMatrix functions that do not return an integer error code (such as operators () and [] ) will throw an exception if an error occurrs. These exceptions will be integer values as follows:

  1. -1 Invalid row specified.
  2. -2 Invalid column specified.
  3. -5 Invalid assignment (type mismatch).
  4. -99 Internal Epetra_LongLongSerialDenseMatrix error. Contact developer.

bExtracting Data from Epetra_LongLongSerialDenseMatrix Objects

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

Vector and Utility Functions

Once a Epetra_LongLongSerialDenseMatrix is constructed, several mathematical functions can be applied to the object. Specifically:

Definition at line 128 of file Epetra_LongLongSerialDenseMatrix.h.

Constructor & Destructor Documentation

Epetra_LongLongSerialDenseMatrix::Epetra_LongLongSerialDenseMatrix ( )

Default constructor; defines a zero size object.

Epetra_LongLongSerialDenseMatrix objects defined by the default constructor should be sized with the Shape() or Reshape functions. Values should be defined by using the [] or () operators.

Definition at line 50 of file Epetra_LongLongSerialDenseMatrix.cpp.

Epetra_LongLongSerialDenseMatrix::Epetra_LongLongSerialDenseMatrix ( int  NumRows,
int  NumCols 
)

Shaped constructor; defines a variable-sized object.

Parameters
InNumRows - Number of rows in object.
InNumCols - Number of columns in object.

Epetra_SerialDenseMatrix objects defined by the shaped constructor are already shaped to the dimensions given as a parameters. All values are initialized to 0. Calling this constructor is equivalent to using the default constructor, and then calling the Shape function on it. Values should be defined by using the [] or () operators.

Definition at line 62 of file Epetra_LongLongSerialDenseMatrix.cpp.

Epetra_LongLongSerialDenseMatrix::Epetra_LongLongSerialDenseMatrix ( Epetra_DataAccess  CV,
long long *  A,
int  LDA,
int  NumRows,
int  NumCols 
)

Set object values from two-dimensional array.

Parameters
InEpetra_DataAccess - Enumerated type set to Copy or View.
InA - Pointer to an array of integer numbers. The first vector starts at A. The second vector starts at A+LDA, the third at A+2*LDA, and so on.
InLDA - The "Leading Dimension", or stride between vectors in memory.
InNumRows - Number of rows in object.
InNumCols - Number of columns in object.

See Detailed Description section for further discussion.

Definition at line 81 of file Epetra_LongLongSerialDenseMatrix.cpp.

Epetra_LongLongSerialDenseMatrix::Epetra_LongLongSerialDenseMatrix ( const Epetra_LongLongSerialDenseMatrix Source)

Epetra_LongLongSerialDenseMatrix copy constructor.

This matrix will take on the data access mode of the Source matrix.

Definition at line 114 of file Epetra_LongLongSerialDenseMatrix.cpp.

Epetra_LongLongSerialDenseMatrix::~Epetra_LongLongSerialDenseMatrix ( )
virtual

Member Function Documentation

int Epetra_LongLongSerialDenseMatrix::Shape ( int  NumRows,
int  NumCols 
)

Set dimensions of a Epetra_LongLongSerialDenseMatrix object; init values to zero.

Parameters
InNumRows - Number of rows in object.
InNumCols - Number of columns in object.

Allows user to define the dimensions of a Epetra_LongLongSerialDenseMatrix at any point. This function can be called at any point after construction. Any values that were previously in this object are destroyed and the resized matrix starts off with all zero values.

Returns
Integer error code, set to 0 if successful.

Definition at line 165 of file Epetra_LongLongSerialDenseMatrix.cpp.

int Epetra_LongLongSerialDenseMatrix::Reshape ( int  NumRows,
int  NumCols 
)

Reshape a Epetra_LongLongSerialDenseMatrix object.

Parameters
InNumRows - Number of rows in object.
InNumCols - Number of columns in object.

Allows user to define the dimensions of a Epetra_LongLongSerialDenseMatrix at any point. This function can be called at any point after construction. Any values that were previously in this object are copied into the new shape. If the new shape is smaller than the original, the upper left portion of the original matrix (the principal submatrix) is copied to the new matrix.

Returns
Integer error code, set to 0 if successful.

Definition at line 138 of file Epetra_LongLongSerialDenseMatrix.cpp.

long long Epetra_LongLongSerialDenseMatrix::OneNorm ( )
virtual

Computes the 1-Norm of the this matrix.

Returns
Integer error code, set to 0 if successful.

Definition at line 317 of file Epetra_LongLongSerialDenseMatrix.cpp.

long long Epetra_LongLongSerialDenseMatrix::InfNorm ( )
virtual

Computes the Infinity-Norm of the this matrix.

Definition at line 334 of file Epetra_LongLongSerialDenseMatrix.cpp.

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

Copy from one matrix to another.

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

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

Definition at line 203 of file Epetra_LongLongSerialDenseMatrix.cpp.

bool Epetra_LongLongSerialDenseMatrix::operator== ( const Epetra_LongLongSerialDenseMatrix rhs) const

Comparison operator.

operator== compares two Epetra_LongLongSerialDenseMatrix objects, returns false if sizes are different, or if any coefficients differ.

Definition at line 263 of file Epetra_LongLongSerialDenseMatrix.cpp.

bool Epetra_LongLongSerialDenseMatrix::operator!= ( const Epetra_LongLongSerialDenseMatrix rhs) const
inline

Inequality operator.

operator!= simply returns the negation of operator==.

Definition at line 248 of file Epetra_LongLongSerialDenseMatrix.h.

long long & Epetra_LongLongSerialDenseMatrix::operator() ( int  RowIndex,
int  ColIndex 
)
inline

Element access function.

The parentheses operator returns the element in the ith row and jth column if A(i,j) is specified, the expression A[j][i] (note that i and j are reversed) will return the same element. Thus, A(i,j) = A[j][i] for all valid i and j.

Returns
Element from the specified row and column.
Warning
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Definition at line 375 of file Epetra_LongLongSerialDenseMatrix.h.

const long long & Epetra_LongLongSerialDenseMatrix::operator() ( int  RowIndex,
int  ColIndex 
) const
inline

Element access function.

The parentheses operator returns the element in the ith row and jth column if A(i,j) is specified, the expression A[j][i] (note that i and j are reversed) will return the same element. Thus, A(i,j) = A[j][i] for all valid i and j.

Returns
Element from the specified row and column.
Warning
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Definition at line 387 of file Epetra_LongLongSerialDenseMatrix.h.

long long * Epetra_LongLongSerialDenseMatrix::operator[] ( int  ColIndex)
inline

Column access function.

The parentheses operator returns the element in the ith row and jth column if A(i,j) is specified, the expression A[j][i] (note that i and j are reversed) will return the same element. Thus, A(i,j) = A[j][i] for all valid i and j.

Returns
Pointer to address of specified column.
Warning
No bounds checking can be done for the index i in the expression A[j][i].
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Definition at line 399 of file Epetra_LongLongSerialDenseMatrix.h.

const long long * Epetra_LongLongSerialDenseMatrix::operator[] ( int  ColIndex) const
inline

Column access function.

The parentheses operator returns the element in the ith row and jth column if A(i,j) is specified, the expression A[j][i] (note that i and j are reversed) will return the same element. Thus, A(i,j) = A[j][i] for all valid i and j.

Returns
Pointer to address of specified column.
Warning
No bounds checking can be done for the index i in the expression A[j][i].
No bounds checking is done unless Epetra is compiled with HAVE_EPETRA_ARRAY_BOUNDS_CHECK.

Definition at line 408 of file Epetra_LongLongSerialDenseMatrix.h.

int Epetra_LongLongSerialDenseMatrix::Random ( )

Set matrix values to random numbers.

LongLongSerialDenseMatrix uses the random number generator provided by Epetra_Util. The matrix values will be set to random values on the interval (0, 2^31 - 1).

Returns
Integer error code, set to 0 if successful.

Definition at line 377 of file Epetra_LongLongSerialDenseMatrix.cpp.

int Epetra_LongLongSerialDenseMatrix::M ( ) const
inline

Returns row dimension of system.

Definition at line 311 of file Epetra_LongLongSerialDenseMatrix.h.

int Epetra_LongLongSerialDenseMatrix::N ( ) const
inline

Returns column dimension of system.

Definition at line 314 of file Epetra_LongLongSerialDenseMatrix.h.

const long long* Epetra_LongLongSerialDenseMatrix::A ( ) const
inline

Returns const pointer to the this matrix.

Definition at line 317 of file Epetra_LongLongSerialDenseMatrix.h.

long long* Epetra_LongLongSerialDenseMatrix::A ( )
inline

Returns pointer to the this matrix.

Definition at line 320 of file Epetra_LongLongSerialDenseMatrix.h.

int Epetra_LongLongSerialDenseMatrix::LDA ( ) const
inline

Returns the leading dimension of the this matrix.

Definition at line 323 of file Epetra_LongLongSerialDenseMatrix.h.

Epetra_DataAccess Epetra_LongLongSerialDenseMatrix::CV ( ) const
inline

Returns the data access mode of the this matrix.

Definition at line 326 of file Epetra_LongLongSerialDenseMatrix.h.

void Epetra_LongLongSerialDenseMatrix::Print ( std::ostream &  os) const
virtual

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

Reimplemented from Epetra_Object.

Reimplemented in Epetra_LongLongSerialDenseVector.

Definition at line 353 of file Epetra_LongLongSerialDenseMatrix.cpp.

int Epetra_LongLongSerialDenseMatrix::MakeViewOf ( const Epetra_LongLongSerialDenseMatrix Source)

Reset an existing LongLongSerialDenseMatrix to point to another Matrix.

Allows an existing LongLongSerialDenseMatrix to become a View of another matrix's data, regardless of the DataAccess mode of the Source matrix. It is assumed that the Source matrix is an independent matrix, 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) matrix can be converted to a View. This frees up memory that CrsGraph no longer needs.

Parameters
SourceThe LongLongSerialDenseMatrix this will become a view of.
Returns
Integer error code, set to 0 if successful, and set to -1 if a type mismatch occured.
Warning
This method is extremely dangerous and should only be used by experts.

Definition at line 284 of file Epetra_LongLongSerialDenseMatrix.cpp.

void Epetra_LongLongSerialDenseMatrix::CopyMat ( long long *  Source,
int  Source_LDA,
int  NumRows,
int  NumCols,
long long *  Target,
int  Target_LDA 
)
protected

Definition at line 301 of file Epetra_LongLongSerialDenseMatrix.cpp.

void Epetra_LongLongSerialDenseMatrix::CleanupData ( )
protected

Definition at line 192 of file Epetra_LongLongSerialDenseMatrix.cpp.

Member Data Documentation

Epetra_DataAccess Epetra_LongLongSerialDenseMatrix::CV_
protected

Definition at line 364 of file Epetra_LongLongSerialDenseMatrix.h.

bool Epetra_LongLongSerialDenseMatrix::A_Copied_
protected

Definition at line 365 of file Epetra_LongLongSerialDenseMatrix.h.

int Epetra_LongLongSerialDenseMatrix::M_
protected

Definition at line 366 of file Epetra_LongLongSerialDenseMatrix.h.

int Epetra_LongLongSerialDenseMatrix::N_
protected

Definition at line 367 of file Epetra_LongLongSerialDenseMatrix.h.

int Epetra_LongLongSerialDenseMatrix::LDA_
protected

Definition at line 368 of file Epetra_LongLongSerialDenseMatrix.h.

long long* Epetra_LongLongSerialDenseMatrix::A_
protected

Definition at line 369 of file Epetra_LongLongSerialDenseMatrix.h.


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