69 #include "utility/kernel/CommandEntity.h"    70 #include "utility/matrices/m_double.h"    79 #define MATRIX_VERY_LARGE_VALUE 1.0e213   114     static double MATRIX_NOT_VALID_ENTRY;
   131     Matrix(
int nrows, 
int ncols);
   132     Matrix(
double *data, 
int nrows, 
int ncols);
   134     Matrix(
const boost::python::list &l);
   135     inline virtual ~
Matrix(
void) {}
   138     int setData(
double *newData, 
int nRows, 
int nCols);
   139     const double *getDataPtr(
void) 
const;
   140     double *getDataPtr(
void);
   141     bool isEmpty(
void) 
const;
   142     int getDataSize(
void) 
const;
   143     int getNumBytes(
void) 
const;
   148     int resize(
int numRow, 
int numCol);
   156     Matrix getInverse(
void) 
const;
   158     double rowSum(
int i) 
const;
   162     double Norm2(
void) 
const;
   163     double Norm(
void) 
const;
   165     double RCond(
void) 
const;
   168     int addMatrixTranspose(
double factThis, 
const Matrix &other, 
double factOther);
   169     int addMatrixProduct(
double factThis, 
const Matrix &A, 
const Matrix &B, 
double factOther); 
   170     int addMatrixTransposeProduct(
double factThis, 
const Matrix &A, 
const Matrix &B, 
double factOther); 
   176     const double &
operator()(
int row, 
int col) 
const;
   182     boost::python::list 
getPyList(
void) 
const;
   183     void setPyList(
const boost::python::list &);
   185     template <
class TNSR>
   186     Matrix &operator=(
const TNSR &);
   188     inline bool isRow(
void)
 const   189       { 
return (numRows == 1); }
   190     inline bool isColumn(
void)
 const   191       { 
return (numCols == 1); }
   230     void Output(std::ostream &s) 
const;
   231     void Input(
const std::string &);
   232     void write(std::ofstream &);
   233     void read(std::ifstream &);
   237     int Assemble(
const Matrix &V, 
int init_row, 
int init_col, 
double fact = 1.0);
   238     int AssembleTranspose(
const Matrix &V, 
int init_row, 
int init_col, 
double fact = 1.0);
   239     int Extract(
const Matrix &V, 
int init_row, 
int init_col, 
double fact = 1.0);
   242     friend std::ostream &operator<<(std::ostream &, 
const Matrix &);
   244     inline std::string toString(
void)
 const   251 std::ostream &operator<<(std::ostream &, 
const Matrix &);
   259 inline bool Matrix::isEmpty(
void)
 const   262 inline int Matrix::getDataSize()
 const   263   { 
return data.
Size(); }
   265 inline int Matrix::getNumBytes(
void)
 const   276 inline const double *Matrix::getDataPtr(
void)
 const   279 inline double *Matrix::getDataPtr(
void)
   295     if((row < 0) || (row >= numRows))
   298           << 
"; row " << row << 
" out of range [0, "   299           <<  numRows-1 << std::endl;
   302     else if((col < 0) || (col >= numCols))
   305           << 
"; row " << col << 
" out of range [0, "   306           <<  numCols-1 << std::endl;
   307     return MATRIX_NOT_VALID_ENTRY;
   310     return data(col*numRows + row);
   327     if((row < 0) || (row >= numRows))
   331                   << 
" out of range [0, " <<  numRows-1 << std::endl;
   334     else if((col < 0) || (col >= numCols))
   338                   << 
" out of range [0, " <<  numCols-1 << std::endl;
   339         return MATRIX_NOT_VALID_ENTRY;
   342     return data(col*numRows + row);
   350 template <
class TNSR>
   357           << 
"; BJtensor must be of rank 4.\n";
   361     if(dim != V.dim(2) != V.dim(3) != V.dim(4))
   364           << 
"; BJtensor must have square dimensions.\n";
   368     if(dim != 2 || dim != 3 || dim != 1)
   371               << 
"; BJtensor must be of dimension 2 or 3.\n";
   377         if((numCols != 1) || (numRows != 1))
   380                   << 
"; matrix must be 1x1 for BJtensor of dimension 3.\n";
   383         (*this)(0,0)= V(1,1,1,1);
   388         if((numCols != 3) || (numRows != 3))
   391                   << 
"; matrix must be 1x1 for BJtensor of dimension 3.\n";
   394         (*this)(0,0)= V(1,1,1,1);
   395         (*this)(0,1)= V(1,1,2,2);
   396         (*this)(0,2)= V(1,1,1,2);
   398         (*this)(1,0)= V(2,2,1,1);
   399         (*this)(1,1)= V(2,2,2,2);
   400         (*this)(1,2)= V(2,2,1,2);
   402         (*this)(2,0)= V(1,2,1,1);
   403         (*this)(2,1)= V(1,2,2,2);
   404         (*this)(2,2)= V(1,2,1,2);
   409         if((numCols != 6) || (numRows != 6))
   412                   << 
"; matrix must be 1x1 for BJtensor of dimension 3.\n";
   415         (*this)(0,0)= V(1,1,1,1);
   416         (*this)(0,1)= V(1,1,2,2);
   417         (*this)(0,2)= V(1,1,3,3);
   418         (*this)(0,3)= V(1,1,1,2);
   419         (*this)(0,4)= V(1,1,1,3);
   420         (*this)(0,5)= V(1,1,2,3);
   422         (*this)(1,0)= V(2,2,1,1);
   423         (*this)(1,1)= V(2,2,2,2);
   424         (*this)(1,2)= V(2,2,3,3);
   425         (*this)(1,3)= V(2,2,1,2);
   426         (*this)(1,4)= V(2,2,1,3);
   427         (*this)(1,5)= V(2,2,2,3);
   429         (*this)(2,0)= V(3,3,1,1);
   430         (*this)(2,1)= V(3,3,2,2);
   431         (*this)(2,2)= V(3,3,3,3);
   432         (*this)(2,3)= V(3,3,1,2);
   433         (*this)(2,4)= V(3,3,1,3);
   434         (*this)(2,5)= V(3,3,2,3);
   436         (*this)(3,0)= V(1,2,1,1);
   437         (*this)(3,1)= V(1,2,2,2);
   438         (*this)(3,2)= V(1,2,3,3);
   439         (*this)(3,3)= V(1,2,1,2);
   440         (*this)(3,4)= V(1,2,1,3);
   441         (*this)(3,5)= V(1,2,2,3);
   443         (*this)(4,0)= V(1,3,1,1);
   444         (*this)(4,1)= V(1,3,2,2);
   445         (*this)(4,2)= V(1,3,3,3);
   446         (*this)(4,3)= V(1,3,1,2);
   447         (*this)(4,4)= V(1,3,1,3);
   448         (*this)(4,5)= V(1,3,2,3);
   450         (*this)(5,0)= V(2,3,1,1);
   451         (*this)(5,1)= V(2,3,2,2);
   452         (*this)(5,2)= V(2,3,3,3);
   453         (*this)(5,3)= V(2,3,1,2);
   454         (*this)(5,4)= V(2,3,1,3);
   455         (*this)(5,5)= V(2,3,2,3);
 int addMatrixTripleProduct(double factThis, const Matrix &A, const Matrix &B, double factOther)
to perform this += T' * B * T 
Definition: Matrix.cpp:869
double Norm2(void) const
Returns the squared modulus (euclidean norm) of the matrix. 
Definition: Matrix.cpp:1912
Matrix transposed(const Matrix &m)
Return the transposed of the parameter. 
Definition: Matrix.h:346
friend std::string to_string(const Matrix &)
Returns a string that represents the matrix. 
Definition: Matrix.cpp:1715
Float vector abstraction. 
Definition: Vector.h:94
double columnSum(int j) const
Returns the sum of the j-th row. 
Definition: Matrix.cpp:1903
double OneNorm(void) const
Returns the value of the one norm. 
Definition: Matrix.cpp:1956
boost::python::list getPyList(void) const
Return the matrix values in a Python list. 
Definition: Matrix.cpp:1169
void Input(const std::string &)
Read from string. 
Definition: Matrix.cpp:1690
Vector getCol(int col) const
Return the column which index being passed as parameter. 
Definition: Matrix.cpp:1135
double rowNorm(void) const
Returns the maximum value of the elements of the vector that results that contains the row sums...
Definition: Matrix.cpp:1939
double & operator()(int row, int col)
Returns a reference to the data at location({row,col}). 
Definition: Matrix.h:292
double Norm(void) const
Returns the modulus (euclidean norm) of the matrix. 
Definition: Matrix.cpp:1934
void Zero(void)
Zero's out the Matrix. 
Definition: Matrix.cpp:226
Matrix operator-(void) const
Unary minus operator. 
Definition: Matrix.cpp:1459
int noCols() const
Returns the number of columns, numCols, of the Matrix. 
Definition: Matrix.h:273
double columnNorm(void) const
Returns the maximum value of the elements of the vector that results that contains the column sums...
Definition: Matrix.cpp:1948
Matrix(void)
Default constructor. 
Definition: Matrix.cpp:81
Vector of integers. 
Definition: ID.h:95
m_double matrix_to_m_double(const Matrix &m)
Converts a Matrix into an m_double. 
Definition: Matrix.cpp:1678
Matrix & operator-=(double fact)
A method to subtract fact from each component of the current Matrix. 
Definition: Matrix.cpp:1226
TCP_Socket is a sub-class of channel. 
Definition: TCP_Socket.h:71
Vector operator^(const Vector &V) const
A method to return a new Vector, of size numCols, whose components are equal to the product of the tr...
Definition: Matrix.cpp:1438
Matrix operator*(double fact) const
A method to return a new Matrix, whose components are equal to the components of the current Matrix t...
Definition: Matrix.cpp:1342
Double and integer arrays used for calling LAPACK routines. 
Definition: AuxMatrix.h:45
double RCond(void) const
Return an estimation of the reciprocal of the condition number. 
Definition: Matrix.cpp:1998
int Size(void) const
Returns the size of the Vector. 
Definition: Vector.h:235
void putCol(int, const Vector &)
Put the vector at the i-th col. 
Definition: Matrix.cpp:1152
TCP_SocketNoDelay is a sub-class of channel. 
Definition: TCP_SocketNoDelay.h:73
virtual std::string getClassName(void) const
Returns demangled class name. 
Definition: EntityWithOwner.cc:90
int Assemble(const Matrix &, const ID &rows, const ID &cols, double fact=1.0)
Assembles the argument into the current Matrix. 
Definition: Matrix.cpp:283
int getNumBytes(void) const
Number of bytes occupied by the vector. 
Definition: Vector.h:239
int Invert(Matrix &res) const
Return the inverse matrix in the argument. 
Definition: Matrix.cpp:495
Objet that can execute python scripts. 
Definition: CommandEntity.h:40
bool isEmpty(void) const
Return true if the vector has no data. 
Definition: Vector.h:258
Matrix operator/(double fact) const
A method to return a new Matrix whose components are equal to the components of the current Matrix di...
Definition: Matrix.cpp:1358
int Solve(const Vector &V, Vector &res) const
Solve the equation {} for the Vector x, which is returned. 
Definition: Matrix.cpp:345
void write(std::ofstream &)
Write to a binary file. 
Definition: Matrix.cpp:1699
MPI_Channel is a sub-class of channel. 
Definition: MPI_Channel.h:70
int noRows() const
Returns the number of rows, numRows, of the Matrix. 
Definition: Matrix.h:269
int addMatrix(double factThis, const Matrix &other, double factOther)
Add a factor fact times the Matrix other to the current Matrix. 
Definition: Matrix.cpp:566
Matrix & operator*=(double fact)
A method to multiply each component of the current Matrix by fact. 
Definition: Matrix.cpp:1246
void Output(std::ostream &s) const
Write to the argument stream. 
Definition: Matrix.cpp:1645
Message between processes. 
Definition: Message.h:77
void setPyList(const boost::python::list &)
Populate the matrix with the values of the given list. 
Definition: Matrix.cpp:182
Vector getRow(int row) const
Return the row which index being passed as parameter. 
Definition: Matrix.cpp:1101
Matrix & operator/=(double fact)
A method which will divide each component of the current Matrix by fact. 
Definition: Matrix.cpp:1268
Matrix getTrn(void) const
Return the transpuesta. 
Definition: Matrix.cpp:1777
Open source finite element program for structural analysis. 
Definition: ContinuaReprComponent.h:35
void read(std::ifstream &)
Read from a bynary file. 
Definition: Matrix.cpp:1707
const double * getDataPtr(void) const
Return a pointer to the float date. 
Definition: Vector.h:243
Matrix of floats. 
Definition: Matrix.h:111
Matrix m_double_to_matrix(const m_double &m)
Converts a matrix of type m_double into other of type Matrix. 
Definition: Matrix.cpp:1666
double rowSum(int i) const
Returns the sum of the i-th row. 
Definition: Matrix.cpp:1894
void putRow(int, const Vector &)
Put the vector at the i-th row. 
Definition: Matrix.cpp:1118
Matrix operator+(double fact) const
A method to return a new Matrix, whose components are equal to the components of the current Matrix p...
Definition: Matrix.cpp:1310
Matrix & operator+=(double fact)
A method to add fact to each component of the current Matrix. 
Definition: Matrix.cpp:1206
DP_Socket is a sub-class of channel. 
Definition: UDP_Socket.h:76