|
KADATH
|
Matrix handling. More...
#include <matrice.hpp>
Public Member Functions | |
| Matrice (int size1, int size2) | |
| Standard constructor. More... | |
| Matrice (const Matrice &) | |
| Constructor by copy. More... | |
| Matrice (const Array< double > &tab) | |
Constructor from a Tbl. More... | |
| ~Matrice () | |
| Destructor. More... | |
| void | annule () |
Sets all the coeficients of the *std to 0. More... | |
| int | get_dim (int i) const |
| Returns the dimension of the matrix. More... | |
| Array< double > * | get_lu () |
Returns a pointer on the lu decomposition. More... | |
| Array< int > * | get_permute () |
| Returns a pointer on the permutation array. More... | |
| const Array< double > & | get_array () const |
| Returns the array of matrix elements. More... | |
| Array< double > & | get_array () |
| Returns the array of matrix elements non const version. More... | |
| void | operator= (double x) |
Sets all the element of *std to x. More... | |
| void | operator= (const Matrice &) |
Assignement to another Matrice. More... | |
| void | operator= (const Array< double > &) |
| Assignement to an array. More... | |
| double & | set (int i, int j) |
| Read/write of a particuliar element. More... | |
| void | copy_inside (int i, int j, const Matrice &so) |
Copies the elements of so inside the matrice, starting at the position . More... | |
| double | operator() (int i, int j) const |
| Read-only of a particuliar element. More... | |
| void | set_band (int up, int low) const |
Calculate the band storage of *std. More... | |
| void | set_lu () const |
| Calculate the LU-representation, assuming the band-storage has been done. More... | |
| Array< double > | solve (const Array< double > &sec_membre) const |
| Solves the linear system represented by the matrix. More... | |
| Array< double > | val_propre () const |
| Returns the eigenvalues of the matrix, calculated using LAPACK. More... | |
| Matrice | vect_propre () const |
| Returns the eigenvectors of the matrix, calculated using LAPACK. More... | |
| Matrice | transpose () const |
| Computes the transpose matrix. More... | |
| void | operator+= (const Matrice &) |
| Operator +=. More... | |
| void | operator+= (double) |
| Operator +=. More... | |
| void | operator-= (const Matrice &) |
| Operator -=. More... | |
| void | operator-= (double) |
| Operator -=. More... | |
| void | operator*= (double) |
| Operator *=. More... | |
| void | operator/= (double) |
| Operator /=. More... | |
Private Member Functions | |
| void | del_deriv () |
| Logical destructor : dellocates the memory of the various used representations. More... | |
Private Attributes | |
| Dim_array | sizes |
Dim_array of dimension 2 containing the size of the matrix. More... | |
| Array< double > * | std |
| Pointer on the array of the standard representation. More... | |
| int | ku |
| Number of upper-diagonals in the band representation. More... | |
| int | kl |
| Number of lower-diagonals in the band representation. More... | |
| Array< double > * | band |
| Pointer on the array of the band representation of a square matrix. More... | |
| Array< double > * | lu |
| Pointer on the first array of the LU-representation. More... | |
| Array< int > * | permute |
| Pointer on the second array of the LU-representation. More... | |
Friends | |
| ostream & | operator<< (ostream &, const Matrice &) |
| Impression. More... | |
| Matrice | operator+ (const Matrice &, const Matrice &) |
| Operator + (binary version) More... | |
| Matrice | operator- (const Matrice &, const Matrice &) |
| Operator - (binary version) More... | |
| Matrice | operator- (const Matrice &) |
| Operator - (unitary version) More... | |
| Matrice | operator* (const Matrice &, double) |
| Operator*. More... | |
| Matrice | operator* (double, const Matrice &) |
| Operator*. More... | |
| Matrice | operator* (const Matrice &, const Matrice &) |
| Operator*. More... | |
| Matrice | operator/ (const Matrice &, double) |
| Operator/. More... | |
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.
Definition at line 38 of file matrice.hpp.
| Kadath::Matrice::Matrice | ( | int | size1, |
| int | size2 | ||
| ) |
Standard constructor.
| size1 | [input] number of lines. |
| size2 | [input] number of columns. |
Definition at line 45 of file matrice.cpp.
References band, kl, ku, lu, permute, Kadath::Dim_array::set(), sizes, and std.
| Kadath::Matrice::Matrice | ( | const Matrice & | source | ) |
| Kadath::Matrice::Matrice | ( | const Array< double > & | 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 71 of file matrice.cpp.
References band, Kadath::Dim_array::get_ndim(), kl, ku, lu, permute, sizes, and std.
| Kadath::Matrice::~Matrice | ( | ) |
| void Kadath::Matrice::annule | ( | ) |
Sets all the coeficients of the *std to 0.
The other representations are destroyed.
Definition at line 37 of file matrice.cpp.
References del_deriv(), Kadath::Index::inc(), Kadath::Array< T >::set(), sizes, and std.
| void Kadath::Matrice::copy_inside | ( | int | i, |
| int | j, | ||
| const Matrice & | so | ||
| ) |
Copies the elements of so inside the matrice, starting at the position
.
Definition at line 130 of file matrice.cpp.
References del_deriv(), Kadath::Index::inc(), Kadath::Array< T >::set(), Kadath::Index::set(), sizes, and std.
|
private |
Logical destructor : dellocates the memory of the various used representations.
Deletes the (mutable) derived members: band, lu, permute
Definition at line 27 of file matrice.cpp.
|
inline |
Returns the array of matrix elements non const version.
Definition at line 116 of file matrice.hpp.
References std.
|
inline |
|
inline |
Returns the dimension of the matrix.
| i | [input] if i =0 returns the number of lines and if i =2 returns the number of columns. |
Definition at line 108 of file matrice.hpp.
References sizes.
|
inline |
Returns a pointer on the lu decomposition.
Definition at line 110 of file matrice.hpp.
References lu.
|
inline |
Returns a pointer on the permutation array.
Definition at line 112 of file matrice.hpp.
References permute.
| double Kadath::Matrice::operator() | ( | int | i, |
| int | j | ||
| ) | const |
Read-only of a particuliar element.
| j | [input] line coordinate. |
| i | [input] column coordinate. |
Definition at line 144 of file matrice.cpp.
References Kadath::Index::set(), sizes, and std.
| void Kadath::Matrice::operator*= | ( | double | x | ) |
| void Kadath::Matrice::operator+= | ( | const Matrice & | a | ) |
| void Kadath::Matrice::operator+= | ( | double | x | ) |
| void Kadath::Matrice::operator-= | ( | const Matrice & | a | ) |
| void Kadath::Matrice::operator-= | ( | double | x | ) |
| void Kadath::Matrice::operator/= | ( | double | x | ) |
| void Kadath::Matrice::operator= | ( | const Array< double > & | source | ) |
Assignement to an array.
Definition at line 111 of file matrice.cpp.
References del_deriv(), Kadath::Array< T >::get_dimensions(), kl, ku, sizes, and std.
| void Kadath::Matrice::operator= | ( | const Matrice & | source | ) |
| void Kadath::Matrice::operator= | ( | double | x | ) |
Sets all the element of *std to x.
The other representations are destroyed.
Definition at line 88 of file matrice.cpp.
References del_deriv(), and std.
| double & Kadath::Matrice::set | ( | int | i, |
| int | j | ||
| ) |
Read/write of a particuliar element.
This is done in *std and all the other representations are no longer valid.
| j | [input] line coordinate. |
| i | [input] column coordinate. |
Definition at line 122 of file matrice.cpp.
References del_deriv(), Kadath::Array< T >::set(), Kadath::Index::set(), sizes, and std.
| void Kadath::Matrice::set_band | ( | int | up, |
| int | low | ||
| ) | const |
Calculate the band storage of *std.
Please note that this function does NOT check if *std represents a real band-matrix.
| up | [input] number of upper-diagonals. |
| low | [input] number of lower-diagonals. |
Definition at line 165 of file matrice.cpp.
References band, kl, ku, Kadath::Array< T >::set(), and sizes.
| void Kadath::Matrice::set_lu | ( | ) | const |
Calculate the LU-representation, assuming the band-storage has been done.
The calculus is done using LAPACK.
Definition at line 192 of file matrice.cpp.
References band, kl, ku, lu, permute, Kadath::Array< T >::set_data(), sizes, and std.
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 221 of file matrice.cpp.
References band, Kadath::Array< T >::get_size(), kl, ku, lu, permute, Kadath::Array< T >::set_data(), and sizes.
| Matrice Kadath::Matrice::transpose | ( | ) | const |
Computes the transpose matrix.
Definition at line 362 of file matrice.cpp.
References Kadath::Array< T >::get_dimensions(), Kadath::Index::set(), set(), sizes, and std.
| Array< double > Kadath::Matrice::val_propre | ( | ) | const |
Returns the eigenvalues of the matrix, calculated using LAPACK.
Array<double> (0, *) and the imaginary parts in Array<double> (1, *). Definition at line 253 of file matrice.cpp.
References Kadath::Index::inc(), Kadath::Array< T >::set(), Kadath::Dim_array::set(), and sizes.
| Matrice Kadath::Matrice::vect_propre | ( | ) | const |
Returns the eigenvectors of the matrix, calculated using LAPACK.
Definition at line 308 of file matrice.cpp.
References Kadath::Index::inc(), set(), sizes, and std.
Operator*.
Definition at line 442 of file matrice.cpp.
Operator*.
Definition at line 430 of file matrice.cpp.
Operator*.
Definition at line 436 of file matrice.cpp.
Operator + (binary version)
Definition at line 411 of file matrice.cpp.
Operator - (unitary version)
Definition at line 423 of file matrice.cpp.
Operator - (binary version)
Definition at line 417 of file matrice.cpp.
Operator/.
Definition at line 463 of file matrice.cpp.
|
friend |
Impression.
Definition at line 152 of file matrice.cpp.
|
mutableprivate |
Pointer on the array of the band representation of a square matrix.
To be precise,
is stored in band
for
, n being the size of the matrix.
Definition at line 58 of file matrice.hpp.
|
mutableprivate |
Number of lower-diagonals in the band representation.
Definition at line 50 of file matrice.hpp.
|
mutableprivate |
Number of upper-diagonals in the band representation.
Definition at line 49 of file matrice.hpp.
|
mutableprivate |
Pointer on the first array of the LU-representation.
Definition at line 61 of file matrice.hpp.
|
mutableprivate |
Pointer on the second array of the LU-representation.
Definition at line 62 of file matrice.hpp.
|
private |
Dim_array of dimension 2 containing the size of the matrix.
Definition at line 45 of file matrice.hpp.
|
private |
Pointer on the array of the standard representation.
Definition at line 46 of file matrice.hpp.