Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Matrix Class Reference

#include <Matrix.h>

List of all members.

Public Methods

 Matrix ()
 constructors and destructor. More...

 Matrix (int nrows, int ncols)
 Matrix (double *data, int nrows, int ncols)
 Matrix (const Matrix &M)
 ~Matrix ()
int noRows () const
 utility methods. More...

int noCols () const
void Zero (void)
int resize (int numRow, int numCol)
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)
 AB. More...

double& operator() (int row, int col)
 overloaded operators all of which are pure. More...

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-scalar operations. More...

Matrix& operator-= (double fact)
Matrix& operator *= (double fact)
Matrix& operator/= (double fact)
Matrix operator+ (double fact) const
 matrix-scalar operations. More...

Matrix operator- (double fact) const
Matrix operator * (double fact) const
Matrix operator/ (double fact) const
Vector operator * (const Vector &V) const
 matrix-vector operations. More...

Vector operator^ (const Vector &V) const
Matrix operator+ (const Matrix &M) const
 matrix-matrix operations. More...

Matrix operator- (const Matrix &M) const
Matrix operator * (const Matrix &M) const
Matrix operator^ (const Matrix &M) const
 Matrix operator/(const Matrix &M) const;. More...

Matrix& operator+= (const Matrix &M)
Matrix& operator-= (const Matrix &M)
void Output (ostream &s) const
 methods to read/write to/from the matrix. More...

void Input (istream &s)
int Assemble (const Matrix &V, int init_row, int init_col, double fact=1.0)
 methods added by Remo. More...

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)

Friends

ostream& operator<< (ostream &s, const Matrix &M)
istream& operator>> (istream &s, Matrix &M)
Matrix operator * (double a, const Matrix &M)


Detailed Description

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 of order 2 X 3: A = \left[ \begin{array}{ccc} a_{0,0} & a_{0,1} & a_{0,2} \ a_{1,0} & a_{1,1} & a_{1,2} \ \end{array} \right]

The Matrix class provides the implementation of a general unsymmetric matrix. The data for the matrix is stored in a 1d double array of size numRows*numCols with the data for located at j*numRows + i in the 1d array. This is similar to the ordering of a Fortran 2d array and will permit calls to numerical Fortran libraries, e.g. BLAS, for certain method calls at a future stage. At present no subclassing is permitted (THIS MAY CHANGE), the reason for this is that the Matrix objects are envisioned to be small scale matrices primarily used for the passing of data between objects in the system. To allow subclassing could reduce the efficiency of the program due to the manner in which virtual functions are implemented.\

Definition at line 81 of file Matrix.h.


Constructor & Destructor Documentation

Matrix::Matrix ( )
 

constructors and destructor.

Definition at line 54 of file Matrix.cpp.

Matrix::Matrix ( int nrows,
int ncols )
 

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

Definition at line 61 of file Matrix.cpp.

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

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

Definition at line 95 of file Matrix.cpp.

Matrix::Matrix ( const Matrix & M )
 

To construct a Matrix with numRows = {nrows}, and numCols = {ncols} and all coefficients equal to . 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.

Definition at line 114 of file Matrix.cpp.

Matrix::~Matrix ( )
 

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 = and numCols = is returned. The constructor tests for the type of to see whether the performance can be improved, by avoiding having to call 's overloaded (i,j) operators if is of type genMatrix.

Definition at line 144 of file Matrix.cpp.


Member Function Documentation

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

methods added by Remo.

Definition at line 1200 of file Matrix.cpp.

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

Definition at line 215 of file Matrix.cpp.

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

Definition at line 1238 of file Matrix.cpp.

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

Definition at line 1276 of file Matrix.cpp.

void Matrix::Input ( istream & s )
 

Definition at line 1166 of file Matrix.cpp.

Referenced by operator>>().

void Matrix::Output ( ostream & s ) const
 

methods to read/write to/from the matrix.

Definition at line 1155 of file Matrix.cpp.

Referenced by operator<<().

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

Definition at line 318 of file Matrix.cpp.

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

Definition at line 255 of file Matrix.cpp.

Referenced by Vector::operator/(), NLBeamColumn3d::update(), and NLBeamColumn2d::update().

void Matrix::Zero ( void )
 

Zero's out the Matrix, i.e. sets all the components of the matrix to . 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.

Definition at line 158 of file Matrix.cpp.

Referenced by LagrangeMP_FE::LagrangeMP_FE(), LagrangeSP_FE::LagrangeSP_FE(), RigidBeam::RigidBeam(), RigidDiaphragm::RigidDiaphragm(), RigidRod::RigidRod(), EnhancedQuad::displaySelf(), TransformationDOF_Group::doneID(), ZeroLengthSection::getDamp(), ZeroLengthND::getDamp(), ZeroLength::getDamp(), TrussSection::getDamp(), Truss::getDamp(), FourNodeQuad::getDamp(), ElasticBeam3d::getDamp(), ElasticBeam2d::getDamp(), DispBeamColumn3d::getDamp(), DispBeamColumn2d::getDamp(), CorotTruss::getDamp(), ZeroLengthSection::getMass(), ZeroLengthND::getMass(), ZeroLength::getMass(), TrussSection::getMass(), Truss::getMass(), FourNodeQuad::getMass(), ElasticBeam3d::getMass(), ElasticBeam2d::getMass(), DispBeamColumn3d::getMass(), DispBeamColumn2d::getMass(), CorotTruss::getMass(), TrussSection::getResponse(), Truss::getSecantStiff(), TransformationDOF_Group::getT(), ZeroLengthND::getTangentStiff(), ZeroLength::getTangentStiff(), TrussSection::getTangentStiff(), Truss::getTangentStiff(), FourNodeQuad::getTangentStiff(), DispBeamColumn3d::getTangentStiff(), DispBeamColumn2d::getTangentStiff(), CorotTruss::getTangentStiff(), J2Plasticity::plastic_integrator(), ElasticIsotropic3D::recvSelf(), SectionAggregator::revertToStart(), NLBeamColumn3d::revertToStart(), NLBeamColumn2d::revertToStart(), BeamWithHinges3d::revertToStart(), BeamWithHinges2d::revertToStart(), Node::setNumColR(), Node::setNumEigenvectors(), NLBeamColumn3d::update(), NLBeamColumn2d::update(), J2Plasticity::zero(), FE_Element::zeroTangent(), and DOF_Group::zeroTangent().

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

Definition at line 386 of file Matrix.cpp.

Referenced by FE_Element::addCtoTang(), FE_Element::addKcToTang(), FE_Element::addKiToTang(), FE_Element::addKsToTang(), FE_Element::addKtToTang(), addMatrixTripleProduct(), FE_Element::addMtoTang(), DOF_Group::addMtoTang(), operator+(), and operator-().

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

Definition at line 458 of file Matrix.cpp.

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

AB.

Definition at line 571 of file Matrix.cpp.

Referenced by ZeroLengthSection::getTangentStiff(), CorotTruss::getTangentStiff(), NLBeamColumn3d::update(), and NLBeamColumn2d::update().

int Matrix::noCols ( ) const [inline]
 

Returns the number of columns, numCols, of the Matrix.

Definition at line 274 of file Matrix.h.

Referenced by DOF_Group::DOF_Group(), FE_Element::FE_Element(), Input(), LagrangeMP_FE::LagrangeMP_FE(), LagrangeSP_FE::LagrangeSP_FE(), MP_Constraint::MP_Constraint(), Output(), PenaltyMP_FE::PenaltyMP_FE(), PenaltySP_FE::PenaltySP_FE(), TransformationDOF_Group::TransformationDOF_Group(), SymArpackSOE::addA(), SparseGenColLinSOE::addA(), ProfileSPDLinSOE::addA(), FullGenLinSOE::addA(), BandSPDLinSOE::addA(), BandGenLinSOE::addA(), BandArpackSOE::addA(), Node::addInertiaLoadToUnbalance(), Vector::addMatrixTransposeVector(), Vector::addMatrixVector(), TransformationDOF_Group::doneID(), X11Renderer::drawPolygon(), Node::getRV(), TransformationFE::getResidual(), TransformationFE::getTangent(), PlainHandler::handle(), Vector::operator/(), FileDatastore::recvMatrix(), FileDatastore::sendMatrix(), Node::sendSelf(), MP_Constraint::sendSelf(), TrussSection::setDomain(), Truss::setDomain(), Node::setEigenvector(), TransformationFE::setID(), FE_Element::setKc(), Node::setMass(), Node::setNumColR(), Node::setNumEigenvectors(), Node::setR(), and TransformationFE::transformResponse().

int Matrix::noRows ( ) const [inline]
 

utility methods.

Definition at line 267 of file Matrix.h.

Referenced by DOF_Group::DOF_Group(), FE_Element::FE_Element(), Input(), LagrangeMP_FE::LagrangeMP_FE(), Output(), TransformationDOF_Group::TransformationDOF_Group(), SymArpackSOE::addA(), SparseGenColLinSOE::addA(), ProfileSPDLinSOE::addA(), FullGenLinSOE::addA(), BandSPDLinSOE::addA(), BandGenLinSOE::addA(), BandArpackSOE::addA(), TransformationDOF_Group::addM_Force(), Vector::addMatrixTransposeVector(), Vector::addMatrixVector(), TransformationDOF_Group::doneID(), X11Renderer::drawPolygon(), Node::getMass(), PlainHandler::handle(), Vector::operator/(), FileDatastore::recvMatrix(), FileDatastore::sendMatrix(), MP_Constraint::sendSelf(), TransformationFE::setID(), Node::setMass(), and Node::setNumColR().

Matrix Matrix::operator * ( const Matrix & M ) const
 

Definition at line 1042 of file Matrix.cpp.

Vector Matrix::operator * ( const Vector & V ) const
 

matrix-vector operations.

Definition at line 969 of file Matrix.cpp.

Matrix Matrix::operator * ( double fact ) const
 

Definition at line 944 of file Matrix.cpp.

Matrix & Matrix::operator *= ( double fact )
 

Definition at line 879 of file Matrix.cpp.

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

Definition at line 672 of file Matrix.cpp.

double Matrix::operator() ( int row,
int col ) const [inline]
 

Definition at line 301 of file Matrix.h.

double & Matrix::operator() ( int row,
int col ) [inline]
 

overloaded operators all of which are pure.

Definition at line 282 of file Matrix.h.

Matrix Matrix::operator+ ( const Matrix & M ) const
 

matrix-matrix operations.

Definition at line 1025 of file Matrix.cpp.

Matrix Matrix::operator+ ( double fact ) const
 

matrix-scalar operations.

Definition at line 928 of file Matrix.cpp.

Matrix & Matrix::operator+= ( const Matrix & M )
 

Definition at line 1112 of file Matrix.cpp.

Matrix & Matrix::operator+= ( double fact )
 

matrix-scalar operations.

Definition at line 847 of file Matrix.cpp.

Matrix Matrix::operator- ( const Matrix & M ) const
 

Definition at line 1033 of file Matrix.cpp.

Matrix Matrix::operator- ( double fact ) const
 

Definition at line 936 of file Matrix.cpp.

Matrix & Matrix::operator-= ( const Matrix & M )
 

Definition at line 1131 of file Matrix.cpp.

Matrix & Matrix::operator-= ( double fact )
 

Definition at line 864 of file Matrix.cpp.

Matrix Matrix::operator/ ( double fact ) const
 

Definition at line 952 of file Matrix.cpp.

Matrix & Matrix::operator/= ( double fact )
 

Definition at line 893 of file Matrix.cpp.

Matrix & Matrix::operator= ( const Tensor & T )
 

Definition at line 742 of file Matrix.cpp.

Matrix & Matrix::operator= ( const Matrix & M )
 

Definition at line 695 of file Matrix.cpp.

Matrix Matrix::operator^ ( const Matrix & M ) const
 

Matrix operator/(const Matrix &M) const;.

Definition at line 1079 of file Matrix.cpp.

Vector Matrix::operator^ ( const Vector & V ) const
 

Definition at line 1001 of file Matrix.cpp.

int Matrix::resize ( int numRow,
int numCol )
 

Definition at line 167 of file Matrix.cpp.


Friends And Related Function Documentation

Matrix operator * ( double a,
const Matrix & M ) [friend]
 

Definition at line 1311 of file Matrix.cpp.

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

Definition at line 1178 of file Matrix.cpp.

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

Definition at line 1188 of file Matrix.cpp.


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