Standard class for every matrix in Carmen. More...
#include <Matrix.h>
Public Member Functions | |
Matrix () | |
Constructor of matrix class. Generates a 1,1 matrix equal to zero. More... | |
Matrix (const int i, const int j) | |
Generates a matrix with i lines and j columns, each component being equal to zero. Example : More... | |
Matrix (const int i) | |
Generates a square matrix with i lines and i columns, each component being equal to zero. Example : More... | |
Matrix (const Matrix &M) | |
Generates a copy of the matrix M. Example : More... | |
Matrix (const Vector &V) | |
Generates a vector-matrix identical to V. Example : More... | |
~Matrix () | |
Distructor of matrix class. Deallocate memory of the matrix. More... | |
void | setValue (const int i, const int j, const real a) |
Sets the component i, j to value a. More... | |
void | setZero () |
Sets all the components to zero. More... | |
real | value (const int i, const int j) const |
Returns the value of the component i, j. More... | |
int | lines () const |
Returns the number of lines of the matrix. More... | |
int | columns () const |
Returns the number of columns of the matrix. More... | |
bool | operator== (const Matrix &M) const |
Compares the current matrix to a matrix M and returns true if they are equal. More... | |
void | operator= (const Matrix &M) |
Set the current matrix to the dimension and the value of M. More... | |
void | operator+= (const Matrix &M) |
Adds M to the current matrix. More... | |
Matrix | operator+ (const Matrix &M) const |
Returns the addition of the current matrix and M. More... | |
void | operator-= (const Matrix &M) |
Subtracts M to the current matrix. More... | |
Matrix | operator- (const Matrix &M) const |
Returns the difference between the current matrix and M. More... | |
Matrix | operator- () const |
Returns the opposite of the current matrix. More... | |
void | operator*= (const real a) |
Multiplies the current matrix by a real a. More... | |
Matrix | operator* (const real a) const |
Returns the product of the current matrix and a real a. More... | |
void | operator/= (const real a) |
Divides the current matrix by a real a. More... | |
Matrix | operator/ (const real a) const |
Returns the division of the current matrix by a real a. More... | |
Matrix | operator* (const Matrix &M) const |
Returns the product of the current matrix and a matrix M. More... | |
Vector | operator* (const Vector &V) const |
Returns the product of the current matrix and a vectorV. More... | |
void | setEigenMatrix (const bool isLeft, const int AxisNo, const Vector V, const real c, const real h=0.) |
Sets matrix as eigenmatrix. More... | |
Public Attributes | |
int | Lines |
int | Columns |
real * | U |
Standard class for every matrix in Carmen.
It contains the following data:
the number of lines Lines ;
the number of columns Columns ;
the array of reals *U.
Matrix::Matrix | ( | ) |
Constructor of matrix class. Generates a 1,1 matrix equal to zero.
Example :
#include "Matrix.h"
Matrix M;
Matrix::Matrix | ( | const int | i, |
const int | j | ||
) |
Generates a matrix with i lines and j columns, each component being equal to zero. Example :
#include "Matrix.h"
Matrix M(4,5);
i | |
j |
Matrix::Matrix | ( | const int | i | ) |
Generates a square matrix with i lines and i columns, each component being equal to zero. Example :
#include "Matrix.h"
Matrix M(4);
i |
Matrix::Matrix | ( | const Matrix & | M | ) |
Generates a copy of the matrix M. Example :
#include "Matrix.h"
M | Matrix |
Matrix::Matrix | ( | const Vector & | V | ) |
Generates a vector-matrix identical to V. Example :
#include "Matrix.h"
V |
Matrix::~Matrix | ( | ) |
Distructor of matrix class. Deallocate memory of the matrix.
|
inline |
Returns the number of columns of the matrix.
|
inline |
Returns the number of lines of the matrix.
Returns the product of the current matrix and a real a.
Example :
#include "Matrix.h"
Matrix M(2,2);
Matrix P;
real x = 2.;
...
P = M*x;
The operation P = x*M can also be done. See operator*(const real a, const Matrix& M).
a | Real value |
Returns the product of the current matrix and a matrix M.
Example :
#include "Matrix.h"
Matrix M(2,3);
Matrix P(3,1);
Matrix Q;
...
Q = M*P;
M | Matrix |
Returns the product of the current matrix and a vectorV.
Example :
#include "Matrix.h"
Matrix M(2,3);
Vector V(3);
Vector P;
...
P = M*V;
V | Vector |
void Matrix::operator*= | ( | const real | a | ) |
Multiplies the current matrix by a real a.
Example :
#include "Matrix.h"
Matrix M(2,2);
real x = 2.;
...
M *= x;
a | Real value |
void Matrix::operator+= | ( | const Matrix & | M | ) |
Adds M to the current matrix.
Example :
#include "Matrix.h"
Matrix M(2,2);
Matrix P(2,2);
...
P += M;
M | Matrix |
Matrix Matrix::operator- | ( | ) | const |
void Matrix::operator-= | ( | const Matrix & | M | ) |
Subtracts M to the current matrix.
Example :
#include "Matrix.h"
Matrix M(2,2);
Matrix P(2,2);
...
P -= M;
M | Matrix |
void Matrix::operator/= | ( | const real | a | ) |
Divides the current matrix by a real a.
Example :
#include "Matrix.h"
Matrix M(2,2);
real x = 2.;
...
M /= x;
a | Real value |
void Matrix::operator= | ( | const Matrix & | M | ) |
Set the current matrix to the dimension and the value of M.
Example :
#include "Matrix.h"
Matrix M(2,2);
Matrix P;
...
P = M;
M | Matrix |
bool Matrix::operator== | ( | const Matrix & | M | ) | const |
Compares the current matrix to a matrix M and returns true if they are equal.
Example :
#include "Matrix.h"
Matrix M(2,2);
Matrix P(2,2);
real x;
...
if (M == P)
x = M.value(1,1);
M | Matrix |
void Matrix::setEigenMatrix | ( | const bool | isLeft, |
const int | AxisNo, | ||
const Vector | V, | ||
const real | c, | ||
const real | h = 0. |
||
) |
Sets matrix as eigenmatrix.
isLeft | Boolean variable. True if location is on the left. |
AxisNo | Axis of interest. |
V | Vector |
c | Real value |
h | Real value |
|
inline |
Sets the component i, j to value a.
Example :
#include "Matrix.h"
Matrix M(2,2);
real x = 3.;
real y = 1.;
M.setValue(1,1,x);
M.setValue(2,1,y);
i | Position |
j | Position |
a | Value |
void Matrix::setZero | ( | ) |
Sets all the components to zero.
|
inline |
Returns the value of the component i, j.
Example :
#include "Matrix.h"
Matrix M(2,2);
real x;
real y;
...
x = M.value(1,1);
y = M.value(2,1);
i | |
j |
int Matrix::Columns |
Lines and columns of the matrix
int Matrix::Lines |
real* Matrix::U |
Components