Matrice Class Reference
[Utilities.]

Matrix handling. More...

#include <matrice.h>

List of all members.

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)
Tblstd
 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.
Tblband
 Pointer on the array of the band representation of a square matrix.
Tbllu
 Pointer on the first array of the LU-representation.
Itblpermute
 Pointer on the second array of the LU-representation.

Friends

ostream & operator<< (ostream &, const Matrice &)
 Display.
Matrice operator+ (const Matrice &, const Matrice &)
Matrice operator- (const Matrice &, const Matrice &)
Matrice operator* (const Matrice &, double)
Matrice operator* (double, const Matrice &)
Matrice operator* (const Matrice &, const Matrice &)
Matrice operator/ (const Matrice &, double)

Detailed Description

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 148 of file matrice.h.


Constructor & Destructor Documentation

Matrice::Matrice ( int  size1,
int  size2 
)

Standard constructor.

All the representations are set to ETATNONDEF.

Parameters:
size1 [input] number of lines.
size2 [input] number of columns.

Definition at line 199 of file matrice.C.

References band, etat, kl, ku, lu, permute, and std.

Matrice::Matrice ( const Matrice source  ) 

Constructor by copy.

Definition at line 210 of file matrice.C.

References band, etat, kl, ku, lu, permute, and std.

Matrice::Matrice ( const Tbl tab  ) 

Constructor from a Tbl.

Parameters:
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 224 of file matrice.C.

References band, etat, Tbl::get_etat(), Tbl::get_ndim(), Tbl::get_taille(), kl, ku, lu, permute, Tbl::set_etat_qcq(), Tbl::set_etat_zero(), std, and Tbl::t.

Matrice::~Matrice (  ) 

Destructor.

Definition at line 251 of file matrice.C.

References del_t().


Member Function Documentation

void Matrice::annule_hard (  ) 

Sets the logical state to ETATQCQ (undefined state).

And sets all the components to zero

Definition at line 189 of file matrice.C.

References del_deriv(), etat, Tbl::get_taille(), Tbl::set_etat_qcq(), std, and Tbl::t.

void Matrice::del_deriv (  )  [private]

Deletes the (mutable) derived members: band, lu, permute.

Definition at line 160 of file matrice.C.

References band, lu, and permute.

void Matrice::del_t (  )  [private]

Logical destructor : dellocates the memory of the various used representations.

Definition at line 152 of file matrice.C.

References del_deriv(), and std.

double Matrice::determinant (  )  const

Computes the determinant of the matrix, using LAPACK and the standard decomposition.

Definition at line 556 of file matrice.C.

References get_dim(), and val_propre().

Tbl Matrice::get_array (  )  const [inline]

Returns the array of matrix elements.

Definition at line 247 of file matrice.h.

References std.

int Matrice::get_dim ( int  i  )  const

Returns the dimension of the matrix.

Parameters:
i [input] if i =0 returns the number of lines and if i =2 returns the number of columns.

Definition at line 256 of file matrice.C.

References Tbl::get_dim(), and std.

int Matrice::get_etat (  )  const [inline]

Returns the logical state.

Definition at line 209 of file matrice.h.

References etat.

Tbl Matrice::inverse ( const Tbl sec_membre  )  const

Solves the linear system represented by the matrix.

The calculus assumes the the LU-decomposition has been done and is conducted using LAPACK.

Parameters:
sec_membre [input] the right-hand side of the system.

Definition at line 420 of file matrice.C.

References band, get_dim(), Tbl::get_dim(), Itbl::get_etat(), Tbl::get_etat(), kl, ku, lu, permute, Itbl::t, and Tbl::t.

double Matrice::operator() ( int  j,
int  i 
) const [inline]

Read-only of a particuliar element.

Parameters:
j [input] line coordinate.
i [input] column coordinate.

Definition at line 286 of file matrice.h.

References Dim_tbl::dim, Tbl::dim, etat, std, and Tbl::t.

void Matrice::operator*= ( double  x  ) 

Multiplication of this by a double.

Definition at line 618 of file matrice.C.

References std.

void Matrice::operator+= ( double  x  ) 

Addition of a double to this.

Definition at line 608 of file matrice.C.

References std.

void Matrice::operator+= ( const Matrice a  ) 

Addition of a Matrice to this.

Definition at line 598 of file matrice.C.

References std.

void Matrice::operator-= ( double  x  ) 

Subtraction of a double to this.

Definition at line 613 of file matrice.C.

References std.

void Matrice::operator-= ( const Matrice a  ) 

Subtraction of a Matrice to this.

Definition at line 603 of file matrice.C.

References std.

void Matrice::operator/= ( double  x  ) 

Division of this by a double.

Definition at line 623 of file matrice.C.

References std.

void Matrice::operator= ( const Tbl source  ) 

Assignement to a Tbl.

Definition at line 302 of file matrice.C.

References del_t(), Tbl::etat, Tbl::get_dim(), set_etat_nondef(), set_etat_qcq(), set_etat_zero(), std, and Tbl::t.

void Matrice::operator= ( const Matrice source  ) 

Assignement to another Matrice.

Definition at line 269 of file matrice.C.

References band, del_t(), etat, Tbl::get_dim(), kl, ku, lu, permute, set_etat_nondef(), set_etat_qcq(), set_etat_zero(), and std.

void Matrice::operator= ( double  x  ) 

Sets all the element of *std to x.

The other representations are set to ETATNONDEF.

Definition at line 261 of file matrice.C.

References set_etat_qcq(), set_etat_zero(), and std.

double& Matrice::set ( int  j,
int  i 
) [inline]

Read/write of a particuliar element.

This is done in *std and all the other representations are no longer valid.

Parameters:
j [input] line coordinate.
i [input] column coordinate.

Definition at line 273 of file matrice.h.

References band, del_deriv(), Dim_tbl::dim, Tbl::dim, etat, lu, std, and Tbl::t.

void 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.

Parameters:
up [input] number of upper-diagonals.
low [input] number of lower-diagonals.

Definition at line 360 of file matrice.C.

References Tbl::annule_hard(), band, Tbl::get_dim(), kl, ku, Tbl::set(), and std.

void 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 183 of file matrice.C.

References del_deriv(), etat, Tbl::set_etat_nondef(), and std.

void 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 171 of file matrice.C.

References del_deriv(), etat, Tbl::set_etat_qcq(), and std.

void 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 177 of file matrice.C.

References del_deriv(), etat, Tbl::set_etat_zero(), and std.

void Matrice::set_lu (  )  const

Calculate the LU-representation, assuming the band-storage has been done.

The calculus is done using LAPACK.

Definition at line 388 of file matrice.C.

References band, Tbl::get_dim(), Tbl::get_etat(), kl, ku, lu, permute, Itbl::set_etat_qcq(), std, Itbl::t, and Tbl::t.

Matrice Matrice::transpose (  )  const

Computes the transpose matrix.

Definition at line 574 of file matrice.C.

References etat, Tbl::get_dim(), set(), set_etat_qcq(), set_etat_zero(), and std.

Tbl Matrice::val_propre (  )  const

Returns the eigenvalues of the matrix, calculated using LAPACK.

Returns:
contains the real and the imaginary parts of the eigenvalues. The real parts are in Tbl (0, *) and the imaginary parts in Tbl (1, *).

Definition at line 453 of file matrice.C.

References etat, get_dim(), Tbl::set(), Tbl::set_etat_qcq(), std, and Tbl::t.

Matrice Matrice::vect_propre (  )  const

Returns the eigenvectors of the matrix, calculated using LAPACK.

Definition at line 503 of file matrice.C.

References etat, get_dim(), set(), set_etat_qcq(), std, and Tbl::t.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  ,
const Matrice  
) [friend]

Display.


Member Data Documentation

Tbl* Matrice::band [mutable, private]

Pointer on the array of the band representation of a square matrix.

To be precise, $ A(i, j)$ is stored in band $[ku+1+i-j, j]$ for $\mathrm {max}(1, j-ku) \leq i \leq \mathrm{min} (n, j+kl)$, n being the size of the matrix.

Definition at line 166 of file matrice.h.

int Matrice::etat [private]

logical state (ETATZERO, ETATQCQ or ETATNONDEF)

Definition at line 152 of file matrice.h.

int Matrice::kl [mutable, private]

Number of lower-diagonals in the band representation.

Definition at line 158 of file matrice.h.

int Matrice::ku [mutable, private]

Number of upper-diagonals in the band representation.

Definition at line 157 of file matrice.h.

Tbl* Matrice::lu [mutable, private]

Pointer on the first array of the LU-representation.

Definition at line 169 of file matrice.h.

Itbl* Matrice::permute [mutable, private]

Pointer on the second array of the LU-representation.

Definition at line 170 of file matrice.h.

Tbl* Matrice::std [private]

Pointer on the array of the standard representation.

Definition at line 154 of file matrice.h.


The documentation for this class was generated from the following files:

Generated on 7 Oct 2014 for LORENE by  doxygen 1.6.1