48 class UnknownNumberingScheme;
87 SparseMtrx(
int n,
int m) : nRows(n), nColumns(m), version(0) { }
105 }
else if ( j <= 0 ) {
106 OOFEM_ERROR(
"matrix error on columns : %d <= 0", j);
107 }
else if ( i > nRows ) {
108 OOFEM_ERROR(
"matrix error on rows : %d => %d", i, nRows);
109 }
else if ( j > nColumns ) {
110 OOFEM_ERROR(
"matrix error on columns : %d => %d", j, nColumns);
118 bool isSquare()
const {
return nRows == nColumns; }
120 bool isNotEmpty()
const {
return nRows > 0 && nColumns > 0; }
173 for (
int i = 1; i <= m.
giveSize(); ++i ) {
174 this->at(i, i) += x * m.
at(i);
240 virtual bool canBeFactorized()
const = 0;
255 virtual void zero() = 0;
267 virtual double &at(
int i,
int j) = 0;
269 virtual double at(
int i,
int j)
const = 0;
283 virtual bool isAsymmetric()
const = 0;
285 virtual const char *giveClassName()
const = 0;
287 std :: string
errorInfo(
const char *func)
const {
return std :: string(giveClassName()) + func; }
294 this->times(x, answer);
301 this->timesT(x, answer);
307 #endif // sparsemtrx_h
bool isNotEmpty() const
Tests for empty matrix.
int nColumns
Number of columns.
virtual void timesT(const FloatArray &x, FloatArray &answer) const
Evaluates .
Base class for all matrices stored in sparse format.
virtual FloatArray * backSubstitutionWith(FloatArray &y) const
Computes the solution of linear system where A is receiver.
double & at(int i)
Coefficient access function.
virtual double computeNorm() const
Returns the norm of receiver.
Class implementing an array of integers.
virtual void add(double x, SparseMtrx &m)
Adds x * m.
virtual SparseMtrx * giveSubMatrix(const IntArray &rows, const IntArray &cols)
virtual void printStatistics() const
Prints the receiver statistics (one-line) to stdout.
virtual void addDiagonal(double x, FloatArray &m)
Adds x * m (treats m as a diagonal matrix, stored as an array)
int giveNumberOfRows() const
Returns number of rows of receiver.
virtual void toFloatMatrix(FloatMatrix &answer) const
Converts receiving sparse matrix to a dense float matrix.
#define OOFEM_LOG_INFO(...)
virtual int buildInternalStructure(EngngModel *eModel, int n, int m, const IntArray &I, const IntArray &J)
Builds internal structure of receiver based on I and J.
virtual int assembleBegin()
Starts assembling the elements.
virtual void printYourself() const
Prints receiver to stdout. Works only for relatively small matrices.
void checkBounds(int i, int j) const
Checks size of receiver towards requested bounds.
long SparseMtrxVersionType
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual void times(const FloatMatrix &B, FloatMatrix &answer) const
Evaluates .
virtual int buildInternalStructure(EngngModel *eModel, int di, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s)
Build internal structure of receiver.
SparseMtrxVersionType version
Allows to track if receiver changes.
virtual SparseMtrx * GiveCopy() const
Returns a newly allocated copy of receiver.
Class representing vector of real numbers.
Implementation of matrix containing floating point numbers.
FloatArray trans_mult(const FloatArray &x) const
IML compatibility, .
virtual SparseMtrx * factorized()
Returns the receiver factorized.
bool isSquare() const
Returns nonzero if receiver is square matrix.
virtual void timesT(const FloatMatrix &B, FloatMatrix &answer) const
Evaluates .
FloatArray operator*(const double &a, const FloatArray &x)
virtual int assembleEnd()
Returns when assemble is completed.
std::string errorInfo(const char *func) const
Error printing helper.
int giveNumberOfColumns() const
Returns number of columns of receiver.
SparseMtrx(int n, int m)
Constructor, creates (n,m) sparse matrix.
virtual void times(double x)
Multiplies receiver by scalar value.
Abstract base class representing the "problem" under consideration.
virtual bool isAllocatedAt(int i, int j) const
Checks whether memory is allocated at position (i,j).
int giveSize() const
Returns the size of receiver.
virtual void times(const FloatArray &x, FloatArray &answer) const
Evaluates .
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual ~SparseMtrx()
Destructor.
virtual void writeToFile(const char *fname) const
Helpful for debugging, writes the matrix to given file.
SparseMtrxVersionType giveVersion()
Return receiver version.