|
LORENE
|
Matrix handling. More...
#include <matrice.h>
Public Member Functions | |
| Matrice (int size1, int size2) | |
| Standard constructor. | |
| Matrice (const Matrice &) | |
| Constructor by copy. | |
| Matrice (const Tbl &tab) | |
Constructor from a Tbl. | |
| ~Matrice () | |
| Destructor. | |
| int | get_etat () const |
| Returns the logical state. | |
| void | set_etat_qcq () |
Sets the logical state to ETATQCQ (ordinary state). | |
| void | set_etat_zero () |
Sets the logical state to ETATZERO (zero). | |
| void | set_etat_nondef () |
Sets the logical state to ETATNONDEF (undefined state). | |
| void | annule_hard () |
Sets the logical state to ETATQCQ (undefined state). | |
| int | get_dim (int i) const |
| Returns the dimension of the matrix. | |
| Tbl | get_array () const |
| Returns the array of matrix elements. | |
| void | operator= (double x) |
Sets all the element of *std to x. | |
| void | operator= (const Matrice &) |
Assignement to another Matrice. | |
| void | operator= (const Tbl &) |
Assignement to a Tbl. | |
| double & | set (int j, int i) |
| Read/write of a particuliar element. | |
| double | operator() (int j, int i) const |
| Read-only of a particuliar element. | |
| void | set_band (int up, int low) const |
Calculate the band storage of *std. | |
| void | set_lu () const |
| Calculate the LU-representation, assuming the band-storage has been done. | |
| Tbl | inverse (const Tbl &sec_membre) const |
| Solves the linear system represented by the matrix. | |
| Tbl | val_propre () const |
| Returns the eigenvalues of the matrix, calculated using LAPACK. | |
| Matrice | vect_propre () const |
| Returns the eigenvectors of the matrix, calculated using LAPACK. | |
| double | determinant () const |
| Computes the determinant of the matrix, using LAPACK and the standard decomposition. | |
| Matrice | transpose () const |
| Computes the transpose matrix. | |
| void | operator+= (const Matrice &) |
Addition of a Matrice to this. | |
| void | operator+= (double) |
Addition of a double to this. | |
| void | operator-= (const Matrice &) |
Subtraction of a Matrice to this. | |
| void | operator-= (double) |
Subtraction of a double to this. | |
| void | operator*= (double) |
Multiplication of this by a double. | |
| void | operator/= (double) |
Division of this by a double. | |
Private Member Functions | |
| void | del_t () |
| Logical destructor : dellocates the memory of the various used representations. | |
| void | del_deriv () |
| Deletes the (mutable) derived members: band, lu, permute. | |
Private Attributes | |
| int | etat |
logical state (ETATZERO, ETATQCQ or ETATNONDEF) | |
| Tbl * | std |
| Pointer on the array of the standard representation. | |
| int | ku |
| Number of upper-diagonals in the band representation. | |
| int | kl |
| Number of lower-diagonals in the band representation. | |
| Tbl * | band |
| Pointer on the array of the band representation of a square matrix. | |
| Tbl * | lu |
| Pointer on the first array of the LU-representation. | |
| Itbl * | permute |
| Pointer on the second array of the LU-representation. | |
Friends | |
| ostream & | operator<< (ostream &flux, const Matrice &source) |
| Display. | |
| Matrice | operator+ (const Matrice &a, const Matrice &b) |
Matrice + Matrice | |
| Matrice | operator- (const Matrice &a, const Matrice &b) |
Matrice - Matrice | |
| Matrice | operator* (const Matrice &a, double x) |
Matrice * double | |
| Matrice | operator* (double x, const Matrice &a) |
double * Matrice | |
| Matrice | operator* (const Matrice &aa, const Matrice &bb) |
| Matrix product. | |
| Matrice | operator/ (const Matrice &a, double x) |
Matrice / double | |
Matrix handling.
The matrix can be stored in the usual way in std, in a band-way by band and on a LU-decomposition by the two arrays lu and permute. All the storage conventions are those af LAPACK which is used to make the LU-decomposition, the inversion and to compute the eigenvalues of the matrix. All those representations are redondant, that means that doing the LU-decomposition, for example, does NOT destroy previously calculated type of storage.
()
| Lorene::Matrice::Matrice | ( | int | size1, |
| int | size2 ) |
| Lorene::Matrice::Matrice | ( | const Matrice & | source | ) |
| Lorene::Matrice::Matrice | ( | const Tbl & | tab | ) |
Constructor from a Tbl.
| tab | [input] 2-dimension or 1-dimension array |
If tab is a 1-dimension Tbl, a single-column matrix is created, otherwise *std is simply constructed by a Tbl copy of tab.
Definition at line 228 of file matrice.C.
References band, etat, Lorene::Tbl::get_etat(), Lorene::Tbl::get_ndim(), Lorene::Tbl::get_taille(), kl, ku, lu, permute, std, and Lorene::Tbl::t.
| Lorene::Matrice::~Matrice | ( | ) |
| void Lorene::Matrice::annule_hard | ( | ) |
Sets the logical state to ETATQCQ (undefined state).
And sets all the components to zero
Definition at line 193 of file matrice.C.
References del_deriv(), etat, and std.
|
private |
|
private |
Logical destructor : dellocates the memory of the various used representations.
Definition at line 156 of file matrice.C.
References del_deriv(), and std.
| double Lorene::Matrice::determinant | ( | ) | const |
Computes the determinant of the matrix, using LAPACK and the standard decomposition.
Definition at line 560 of file matrice.C.
References get_dim(), and val_propre().
|
inline |
| int Lorene::Matrice::get_dim | ( | int | i | ) | const |
|
inline |
Solves the linear system represented by the matrix.
The calculus assumes the the LU-decomposition has been done and is conducted using LAPACK.
| sec_membre | [input] the right-hand side of the system. |
Definition at line 424 of file matrice.C.
References band, get_dim(), Lorene::Tbl::get_dim(), kl, ku, lu, permute, and Lorene::Tbl::t.
|
inline |
| void Lorene::Matrice::operator*= | ( | double | x | ) |
| void Lorene::Matrice::operator+= | ( | const Matrice & | a | ) |
| void Lorene::Matrice::operator+= | ( | double | x | ) |
| void Lorene::Matrice::operator-= | ( | const Matrice & | a | ) |
| void Lorene::Matrice::operator-= | ( | double | x | ) |
| void Lorene::Matrice::operator/= | ( | double | x | ) |
| void Lorene::Matrice::operator= | ( | const Matrice & | source | ) |
Assignement to another Matrice.
Definition at line 273 of file matrice.C.
References band, del_t(), etat, Lorene::Tbl::get_dim(), kl, ku, lu, Matrice(), permute, set_etat_nondef(), set_etat_qcq(), set_etat_zero(), and std.
| void Lorene::Matrice::operator= | ( | const Tbl & | source | ) |
Assignement to a Tbl.
Definition at line 306 of file matrice.C.
References del_t(), Lorene::Tbl::etat, Lorene::Tbl::get_dim(), set_etat_nondef(), set_etat_qcq(), set_etat_zero(), std, and Lorene::Tbl::t.
| void Lorene::Matrice::operator= | ( | double | x | ) |
Sets all the element of *std to x.
The other representations are set to ETATNONDEF.
Definition at line 265 of file matrice.C.
References set_etat_qcq(), set_etat_zero(), std, and Lorene::x.
|
inline |
| void Lorene::Matrice::set_band | ( | int | up, |
| int | low ) const |
| void Lorene::Matrice::set_etat_nondef | ( | ) |
Sets the logical state to ETATNONDEF (undefined state).
The state of of all the representations is now ETATNONDEF.
Definition at line 187 of file matrice.C.
References del_deriv(), etat, and std.
| void Lorene::Matrice::set_etat_qcq | ( | ) |
Sets the logical state to ETATQCQ (ordinary state).
The state of *std is now ETATQCQ and the one of all the other representations is ETATNONDEF.
Definition at line 175 of file matrice.C.
References del_deriv(), etat, and std.
| void Lorene::Matrice::set_etat_zero | ( | ) |
Sets the logical state to ETATZERO (zero).
The state of *std is now ETATZERO and the one of all the other representations is ETATNONDEF.
Definition at line 181 of file matrice.C.
References del_deriv(), etat, and std.
| void Lorene::Matrice::set_lu | ( | ) | const |
| Matrice Lorene::Matrice::transpose | ( | ) | const |
Computes the transpose matrix.
Definition at line 578 of file matrice.C.
References etat, Matrice(), set(), set_etat_qcq(), set_etat_zero(), and std.
| Tbl Lorene::Matrice::val_propre | ( | ) | const |
Returns the eigenvalues of the matrix, calculated using LAPACK.
Tbl (0, *) and the imaginary parts in Tbl (1, *). Definition at line 457 of file matrice.C.
References etat, get_dim(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), and std.
| Matrice Lorene::Matrice::vect_propre | ( | ) | const |
Matrix product.
Definition at line 658 of file matrice.C.
References Lorene::Tbl::get_dim(), get_etat(), Matrice(), set(), set_etat_qcq(), set_etat_zero(), and std.
|
friend |
Display.
Definition at line 330 of file matrice.C.
References band, Lorene::Tbl::get_dim(), Lorene::Tbl::get_etat(), kl, ku, lu, Matrice(), and std.
|
mutableprivate |
|
private |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |