class Matrix


Public Methods

Matrix()
Matrix(int nrows, int ncols)
Matrix(double *data, int nrows, int ncols)
Matrix(const Matrix &M)
~Matrix()
inline int noRows() const
inline int noCols() const
void Zero(void)
int Assemble(const Matrix &, const ID &rows, const ID &cols, double fact = 1.0)
int Solve(const Vector &V, Vector &res) const
int Solve(const Matrix &M, Matrix &res) const
int addMatrix(double factThis, const Matrix &other, double factOther)
int addMatrixProduct(double factThis, const Matrix &A, const Matrix &B, double factOther)
int addMatrixTripleProduct(double factThis, const Matrix &A, const Matrix &B, double factOther)
inline double& operator)(int row, int col)
inline double operator)(int row, int col) const
Matrix operator)(const ID &rows, const ID & cols) const
Matrix& operator=(const Matrix &M)
Matrix& operator=(const Tensor &T)
Matrix& operator+=(double fact)
Matrix& operator-=(double fact)
Matrix& operator*=(double fact)
Matrix& operator/=(double fact)
Matrix operator+(double fact) const
Matrix operator-(double fact) const
Matrix operator*(double fact) const
Matrix operator/(double fact) const
Vector operator*(const Vector &V) const
Vector operator^(const Vector &V) const
Matrix operator+(const Matrix &M) const
Matrix operator-(const Matrix &M) const
Matrix operator*(const Matrix &M) const
Matrix operator^(const Matrix &M) const
Matrix& operator+=(const Matrix &M)
Matrix& operator-=(const Matrix &M)
void Output(ostream &s) const
void Input(istream &s)
int Assemble(const Matrix &V, int init_row, int init_col, double fact = 1.0)
int AssembleTranspose(const Matrix &V, int init_row, int init_col, double fact = 1.0)
int Extract(const Matrix &V, int init_row, int init_col, double fact = 1.0)
friend ostream& operator<<(ostream &s, const Matrix &M)
friend istream& operator>>(istream &s, Matrix &M)
inline int Matrix::noCols() const
inline int Matrix::noRows() const

Documentation

The Matrix class provides the matrix abstraction. A matrix of order numRows X numCols is an ordered 2d array of numbers arranged in numRows rows and numCols columns. For example, a matrix A of order 2 X 3: A = \left[ \begin{array}{ccc} a_{0,0} & a_{0,1} & a_{0,2}

Matrix()

To construct a Matrix with numRows = 0, and numCols = 0. No memory is allocated to store the data.

Matrix(int nrows, int ncols)

To construct a Matrix with numRows = nrows, and numCols = ncols and all coefficients equal to 0. Allocates memory for the storage of the data. If numRows < 0, numCols < 0 or not enough memory is available available, an error message is printed and a Matrix with numRows = 0 and numCols = 0 is returned. Before the Matrix is returned, Zero() is called on the Matrix.

Matrix(double *data, int nrows, int ncols)

To construct a Matrix with numRows = nrows, and numCols = ncols and all coefficients equal to 0. The memory for storage of the data is found at the location pointed to by data. Note that this memory must have been previously allocated and it must be of appropriate size, erroneous results and segmentation faults can occur otherwise. No additional memory is allocated for the storage of the data.

Matrix(const Matrix &M)

To construct a Matrix using another Matrix. The new Matrix will be a general matrix that is identical to the Matrix M, i.e. same size and identical components. If not enough memory is available, an error message is printed and a Matrix with numRows = 0 and numCols = 0 is returned. The constructor tests for the type of M to see whether the performance can be improved, by avoiding having to call M's overloaded (i,j) operators if M is of type genMatrix.

~Matrix()

Free's up any memory allocated in the constructor. Note that if the third constructor had been invoked, the memory passed is not released back to the system (this must be done later by the user of this constructor).

inline int noRows() const

Returns the number of rows, numRows, of the Matrix. The method is declared inline for the compiler to produce faster code which does not require a method call.

inline int noCols() const

Returns the number of columns, numCols, of the Matrix

void Zero(void)

Zero's out the Matrix, i.e. sets all the components of the matrix to 0. The method tests for the type of Matrix, to see whether the performance can be improved by avoiding having to call the overloaded (i,j) operators if the Matrix is of type genMatrix.

int Assemble(const Matrix &, const ID &rows, const ID &cols, double fact = 1.0)

Assembles into the current Matrix the Matrix M. The contents of the current matrix at location (rows(i),cols(j)) is set equal to the current value plus fact times the value of the matrix M at location (i,j ). A warning is printed for every rows(i), cols(j) specified which is outside the bounds of the matrix.

int Solve(const Vector &V, Vector &res) const

Will solve the equation Ax=V for the Vector x, which is returned. At the moment the current matrix is assumed to be symmetric positive definite. THIS IS TO CHANGE. A Vector is created using V. If this Vector is not of the correct size or if an error occurs during factorization a warning message is printed and the Vector x is returned.

int Solve(const Matrix &M, Matrix &res) const

int addMatrix(double factThis, const Matrix &other, double factOther)

int addMatrixProduct(double factThis, const Matrix &A, const Matrix &B, double factOther)

int addMatrixTripleProduct(double factThis, const Matrix &A, const Matrix &B, double factOther)

inline double& operator)(int row, int col)

inline double operator)(int row, int col) const

Matrix operator)(const ID &rows, const ID & cols) const

Matrix& operator=(const Matrix &M)

Matrix& operator=(const Tensor &T)

Matrix& operator+=(double fact)

Matrix& operator-=(double fact)

Matrix& operator*=(double fact)

Matrix& operator/=(double fact)

Matrix operator+(double fact) const

Matrix operator-(double fact) const

Matrix operator*(double fact) const

Matrix operator/(double fact) const

Vector operator*(const Vector &V) const

Vector operator^(const Vector &V) const

Matrix operator+(const Matrix &M) const

Matrix operator-(const Matrix &M) const

Matrix operator*(const Matrix &M) const

Matrix operator^(const Matrix &M) const

Matrix& operator+=(const Matrix &M)

Matrix& operator-=(const Matrix &M)

void Output(ostream &s) const

void Input(istream &s)

int Assemble(const Matrix &V, int init_row, int init_col, double fact = 1.0)

int AssembleTranspose(const Matrix &V, int init_row, int init_col, double fact = 1.0)

int Extract(const Matrix &V, int init_row, int init_col, double fact = 1.0)

friend ostream& operator<<(ostream &s, const Matrix &M)

friend istream& operator>>(istream &s, Matrix &M)

inline int Matrix::noCols() const

inline int Matrix::noRows() const


This class has no child classes.

alphabetic index Contents

this page has been generated automatically by a slightly modified version of doc++ for OpenSees

Copyright Contact Us