LORENE
matrice.C
1 /*
2  * Methods of class Matrice
3  *
4  * (see file matrice.h for documentation)
5  *
6  */
7 
8 /*
9  * Copyright (c) 1999-2001 Philippe Grandclement
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * LORENE is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with LORENE; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  */
28 
29 
30 
31 
32 /*
33  * $Id: matrice.C,v 1.20 2016/12/05 16:17:59 j_novak Exp $
34  * $Log: matrice.C,v $
35  * Revision 1.20 2016/12/05 16:17:59 j_novak
36  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
37  *
38  * Revision 1.19 2014/10/13 08:53:07 j_novak
39  * Lorene classes and functions now belong to the namespace Lorene.
40  *
41  * Revision 1.18 2014/10/06 15:13:14 j_novak
42  * Modified #include directives to use c++ syntax.
43  *
44  * Revision 1.17 2008/08/19 06:42:00 j_novak
45  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
46  * cast-type operations, and constant strings that must be defined as const char*
47  *
48  * Revision 1.16 2006/06/05 09:47:42 j_novak
49  * Initialisation of the member band to zero, in order not to have messages from
50  * the memory debugger.
51  *
52  * Revision 1.15 2005/11/24 14:07:29 j_novak
53  * Minor speed enhancement for annule_hard().
54  *
55  * Revision 1.14 2005/10/24 12:42:32 p_grandclement
56  * correction of annule_hard
57  *
58  * Revision 1.13 2005/10/24 09:22:24 p_grandclement
59  * addition of annule_hard for matrices
60  *
61  * Revision 1.12 2005/09/16 12:29:02 j_novak
62  * New method del_deriv() and reorganization of band, lu, permute handling.
63  *
64  * Revision 1.11 2005/01/25 12:47:34 j_novak
65  * Added some member arithmetic and operator=(Tbl).
66  *
67  * Revision 1.10 2004/12/29 12:27:36 j_novak
68  * permute is now a Itbl* which array is sent directly to the LAPACK routines.
69  * It is now possible to solve a general system (i.e. even if the Matrice
70  * is not in a banded form).
71  *
72  * Revision 1.9 2004/10/05 15:44:19 j_novak
73  * Minor speed enhancements.
74  *
75  * Revision 1.8 2004/08/24 09:14:43 p_grandclement
76  * Addition of some new operators, like Poisson in 2d... It now requieres the
77  * GSL library to work.
78  *
79  * Also, the way a variable change is stored by a Param_elliptic is changed and
80  * no longer uses Change_var but rather 2 Scalars. The codes using that feature
81  * will requiere some modification. (It should concern only the ones about monopoles)
82  *
83  * Revision 1.7 2003/12/19 16:21:44 j_novak
84  * Shadow hunt
85  *
86  * Revision 1.6 2002/10/16 14:36:42 j_novak
87  * Reorganization of #include instructions of standard C++, in order to
88  * use experimental version 3 of gcc.
89  *
90  * Revision 1.5 2002/09/24 10:51:16 e_gourgoulhon
91  *
92  * The case of a 1D Tbl in the constructor from Tbl is now taken into account
93  * (resulting in a single-column matrix).
94  *
95  * Revision 1.4 2002/09/24 08:36:44 e_gourgoulhon
96  *
97  * Corrected error in output (operator<<) : permutted number of rows and columns
98  *
99  * Added matrix multiplication
100  * Added function transpose()
101  *
102  * Revision 1.3 2002/09/09 13:00:39 e_gourgoulhon
103  * Modification of declaration of Fortran 77 prototypes for
104  * a better portability (in particular on IBM AIX systems):
105  * All Fortran subroutine names are now written F77_* and are
106  * defined in the new file C++/Include/proto_f77.h.
107  *
108  * Revision 1.2 2002/01/03 13:18:41 j_novak
109  * Optimization: the members set(i,j) and operator(i,j) of class Matrice are
110  * now defined inline. Matrice is a friend class of Tbl.
111  *
112  * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
113  * LORENE
114  *
115  * Revision 2.9 1999/12/24 10:19:16 eric
116  * Suppression des definitions de nbl et nbc lignes 149 et 150.
117  *
118  * Revision 2.8 1999/11/30 17:45:16 phil
119  * changerment prototypage
120  *
121  * Revision 2.7 1999/10/12 15:49:16 phil
122  * apres set band, lu et permute ne sont plus a jour ...
123  *
124  * Revision 2.6 1999/10/12 09:42:17 phil
125  * retrour versian anterieure
126  *
127  * Revision 2.5 1999/10/12 09:39:07 phil
128  * passage en const
129  *
130  * Revision 2.4 1999/10/11 09:35:07 phil
131  * ajout de determinant et val_propre + modif de operator= (const Matrice&)
132  *
133  * Revision 2.3 1999/10/05 17:02:46 phil
134  * ajout de determinant et val_propre
135  *
136  * Revision 2.2 1999/04/13 13:57:23 phil
137  * ajout proto.h
138  *
139  * Revision 2.1 1999/04/07 14:18:51 phil
140  * optimisation egalite
141  *
142  * Revision 2.0 1999/04/07 14:10:05 phil
143  * *** empty log message ***
144  *
145  *
146  * $Header: /cvsroot/Lorene/C++/Source/Matrice/matrice.C,v 1.20 2016/12/05 16:17:59 j_novak Exp $
147  *
148  */
149 
150 
151 //fichiers includes
152 #include <cstdlib>
153 #include "matrice.h"
154 #include "proto_f77.h"
155 
156 //Destructeur logique
157 
158 namespace Lorene {
160  if (std != 0x0) delete std ;
161  std = 0x0 ;
162  del_deriv() ;
163 }
164 
165 //Destructeur des quantites derivees
166 
168  if (band != 0x0) delete band ;
169  if (lu != 0x0) delete lu ;
170  if (permute != 0x0) delete permute ;
171  band = 0x0 ;
172  lu = 0x0 ;
173  permute = 0x0 ;
174 }
175 
176 //Manipulation des etats
177 
179  std->set_etat_qcq() ;
180  del_deriv() ;
181  etat = ETATQCQ ;
182 }
183 
185  std->set_etat_zero() ;
186  del_deriv() ;
187  etat = ETATZERO ;
188 }
189 
191  if (std != 0x0) std->set_etat_nondef() ;
192  del_deriv() ;
193  etat = ETATNONDEF ;
194 }
195 
197  std->set_etat_qcq() ;
198  del_deriv() ;
199  etat = ETATQCQ ;
200 
201  for (int i=0 ; i<std->get_taille() ; i++)
202  std->t[i] = 0 ;
203 }
204 
205 // Constructeurs
206 Matrice::Matrice (int i, int j) {
207  etat = ETATNONDEF ;
208  std = new Tbl(i, j) ;
209  kl = 0 ;
210  ku = 0 ;
211  band = 0x0 ;
212  lu = 0x0 ;
213  permute = 0x0 ;
214 }
215 
216 
217 Matrice::Matrice (const Matrice & source) {
218  etat = source.etat ;
219  kl = source.kl ;
220  ku = source.ku ;
221  std = new Tbl(*source.std) ;
222  if (source.band != 0x0) band = new Tbl(*source.band) ;
223  else band = 0x0 ;
224  if (source.lu != 0x0) lu = new Tbl(*source.lu) ;
225  else lu = 0x0 ;
226  if (source.permute != 0x0) permute = new Itbl(*source.permute) ;
227  else permute = 0x0 ;
228 }
229 
230 
231 Matrice::Matrice (const Tbl & source) {
232  etat = source.get_etat() ;
233  kl = 0 ;
234  ku = 0 ;
235  if (source.get_ndim() == 1) { // column vector
236  int n = source.get_taille() ;
237  std = new Tbl(n,1) ;
238  if (source.get_etat() == ETATZERO) {
239  std->set_etat_zero() ;
240  }
241  else {
242  assert( source.get_etat() == ETATQCQ ) ;
243  std->set_etat_qcq() ;
244  for (int i=0; i<n; i++) {
245  std->t[i] = source.t[i] ;
246  }
247  }
248  }
249  else { // 2D Tbl
250  std = new Tbl(source) ;
251  }
252  band = 0x0 ;
253  lu = 0x0 ;
254  permute = 0x0 ;
255 }
256 
257 // destructeur
259  del_t() ;
260 }
261 
262 // Extraction des dimensions
263 int Matrice::get_dim(int i) const {
264  return std->get_dim(i) ;
265 }
266 
267 // affectation
268 void Matrice::operator= (double x) {
269  if (x == 0 ) set_etat_zero() ;
270  else {
271  set_etat_qcq() ;
272  *std = x ;
273  }
274 }
275 
276 void Matrice::operator= (const Matrice &source) {
277 
278  assert (std->get_dim(0) == source.std->get_dim(0)) ;
279  assert (std->get_dim(1) == source.std->get_dim(1)) ;
280 
281  switch (source.etat) {
282  case ETATNONDEF :
283  set_etat_nondef() ;
284  break ;
285  case ETATZERO :
286  set_etat_zero() ;
287  break ;
288  case ETATQCQ :
289  set_etat_qcq() ;
290  del_t() ;
291 
292  if (source.std != 0x0)
293  std = new Tbl(*source.std) ;
294 
295  if (source.band != 0x0) {
296  band = new Tbl(*source.band) ;
297  ku = source.ku ;
298  kl = source.kl ;
299  }
300 
301  if (source.lu != 0x0) {
302  lu = new Tbl(*source.lu) ;
303  permute = new Itbl(*source.permute) ;
304  }
305  break ;
306  }
307 }
308 
309 void Matrice::operator= (const Tbl &source) {
310 
311  assert (std->get_dim(0) == source.get_dim(0)) ;
312  assert (std->get_dim(1) == source.get_dim(1)) ;
313 
314  switch (source.etat) {
315  case ETATNONDEF :
316  set_etat_nondef() ;
317  break ;
318  case ETATZERO :
319  set_etat_zero() ;
320  break ;
321  case ETATQCQ :
322  set_etat_qcq() ;
323  del_t() ;
324 
325  assert (source.t != 0x0) ;
326  std = new Tbl(source) ;
327  break ;
328  }
329 }
330 
331 
332 //Impression
333 ostream& operator<< (ostream& flux, const Matrice & source) {
334  switch (source.std->get_etat()) {
335  case ETATZERO :
336  flux << "Null matrix. " << endl ;
337  break ;
338  case ETATNONDEF :
339  flux << "Undefined matrix. " << endl ;
340  break ;
341  case ETATQCQ :
342  int nbl = source.std->get_dim(1) ;
343  int nbc = source.std->get_dim(0) ;
344  flux << "Matrix " << nbl << " * " << nbc << endl ;
345  for (int i=0 ; i<nbl ; i++) {
346  for (int j=0 ; j<nbc ; j++)
347  flux << (*source.std)(i, j) << " " ;
348  flux << endl ;
349  }
350  }
351 
352  flux << endl ;
353 
354  if ((source.band != 0x0) && (source.band->get_etat() != ETATNONDEF)) {
355  flux << "Matrix : " << source.ku << " upper diags. and "
356  << source.kl << " lower diags." << endl ;
357  }
358  // else flux << "Diagonalisation non faite." << endl ;
359 
360  if ((source.lu != 0x0) && (source.lu->get_etat() != ETATNONDEF))
361  flux << "LU factorization done." << endl ;
362 
363 return flux ;
364 }
365 
366 // Passage matrice a bande : stockage LAPACK
367 void Matrice::set_band (int u, int l) const {
368  if (band != 0x0) return ;
369  else {
370  int n = std->get_dim(0) ;
371  assert (n == std->get_dim(1)) ;
372 
373  ku = u ; kl = l ;
374  int ldab = 2*l+u+1 ;
375  band = new Tbl(ldab*n) ;
376 
377  band->annule_hard() ;
378 
379  for (int i=0 ; i<u ; i++)
380  for (int j=u-i ; j<n ; j++)
381  band->set(j*ldab+i+l) = (*this)(j-u+i, j) ;
382 
383  for (int j=0 ; j<n ; j++)
384  band->set(j*ldab+u+l) = (*this)(j, j) ;
385 
386  for (int i=u+1 ; i<u+l+1 ; i++)
387  for (int j=0 ; j<n-i+u ; j++)
388  band->set(j*ldab+i+l) = (*this) (i+j-u, j) ;
389 
390  }
391  return ;
392 }
393 
394 //Decomposition UL : stockage LAPACK
395 void Matrice::set_lu() const {
396  if (lu != 0x0) {
397  assert (permute != 0x0) ;
398  return ;
399  }
400  else {
401  // Decomposition LU
402  int n = std->get_dim(0) ;
403  int ldab, info ;
404  permute = new Itbl(n) ;
405  permute->set_etat_qcq() ;
406 
407  // Cas d'une matrice a bandes
408  if (band != 0x0) {
409  assert (band->get_etat() == ETATQCQ) ;
410  ldab = 2*kl+ku+1 ;
411  lu = new Tbl(*band) ;
412 
413  F77_dgbtrf(&n, &n, &kl, &ku, lu->t, &ldab, permute->t, &info) ;
414  }
415  else { // matrice generale
416  assert (std->get_etat() == ETATQCQ) ;
417  ldab = n ;
418  lu = new Tbl(*std) ;
419 
420  F77_dgetrf(&n, &n, lu->t, &ldab, permute->t, &info) ;
421  }
422  }
423  return ;
424 }
425 
426 // Solution de Ax = B : utilisation de LAPACK et decomposition lu.
427 Tbl Matrice::inverse (const Tbl& source) const {
428 
429  assert(lu != 0x0) ;
430  assert(lu->get_etat() == ETATQCQ) ;
431  assert(permute != 0x0) ;
432  assert(permute->get_etat() == ETATQCQ) ;
433 
434  int n = source.get_dim(0) ;
435  assert (get_dim(1) == n) ;
436  int ldab, info ;
437  const char* trans ;
438  int nrhs = 1 ;
439  int ldb = n ;
440 
441  Tbl res(source) ;
442 
443  if (band != 0x0) { //Cas d'une matrice a bandes
444  ldab = 2*kl+ku+1 ;
445  trans = "N" ;
446  F77_dgbtrs(trans, &n, &kl, &ku, &nrhs, lu->t,
447  &ldab, permute->t, res.t, &ldb, &info);
448  }
449  else { // Cas general
450  ldab = n ;
451  trans = "T" ; // stockage different entre le C et le fortran
452  F77_dgetrs(trans, &n, &nrhs, lu->t, &ldab, permute->t,
453  res.t, &ldb, &info) ;
454  }
455 
456  return res ;
457 }
458 
459 // Renvoit les valeurs propres de la matrice (appel de LAPACK) :
461 
462  assert (etat != ETATNONDEF) ;
463  assert (std != 0x0) ;
464 
465  const char* jobvl = "N" ;
466  const char* jobvr = "N" ;
467 
468  int n = get_dim(0) ;
469  assert (n == get_dim(1)) ;
470 
471  double* a = new double [n*n] ;
472  for (int i=0 ; i<n*n ; i++)
473  a[i] = std->t[i] ;
474 
475  int lda = n ;
476  double* wr = new double[n] ;
477  double* wi = new double[n] ;
478 
479  int ldvl = 1 ;
480  double* vl = 0x0 ;
481  int ldvr = 1 ;
482  double* vr = 0x0 ;
483 
484  int ldwork = 3*n ;
485  double* work = new double[ldwork] ;
486 
487  int info ;
488 
489  F77_dgeev(jobvl, jobvr, &n, a, &lda, wr, wi, vl, &ldvl, vr, &ldvr,
490  work, &ldwork, &info) ;
491 
492  Tbl result(2, n) ;
493  result.set_etat_qcq() ;
494 
495  for (int i=0 ; i<n ; i++) {
496  result.set(0, i) = wr[n-i-1] ;
497  result.set(1, i) = wi[n-i-1] ;
498  }
499 
500  delete [] wr ;
501  delete [] wi ;
502  delete [] a ;
503  delete [] work ;
504 
505  return result ;
506 
507 }
508 
509 // les valeurs vecteurs propres de la matrice (appel de LAPACK) :
511 
512  assert (etat != ETATNONDEF) ;
513  assert (std != 0x0) ;
514 
515  const char* jobvl = "V" ;
516  const char* jobvr = "N" ;
517 
518  int n = get_dim(0) ;
519  assert (n == get_dim(1)) ;
520 
521  double* a = new double [n*n] ;
522  for (int i=0 ; i<n*n ; i++)
523  a[i] = std->t[i] ;
524 
525  int lda = n ;
526  double* wr = new double[n] ;
527  double* wi = new double[n] ;
528 
529  int ldvl = n ;
530  double* vl = new double[ldvl*ldvl] ;
531  int ldvr = 1 ;
532  double* vr = 0x0 ;
533 
534  int ldwork = 4*n ;
535  double* work = new double[ldwork] ;
536 
537  int info ;
538 
539  F77_dgeev(jobvl, jobvr, &n, a, &lda, wr, wi, vl, &ldvl, vr, &ldvr,
540  work, &ldwork, &info) ;
541 
542 
543  Matrice res (n,n) ;
544  res.set_etat_qcq() ;
545 
546  int conte = 0 ;
547  for (int i=0 ; i<n ; i++)
548  for (int j=0 ; j<n ; j++) {
549  res.set(j,n-i-1) = vl[conte] ;
550  conte ++ ;
551  }
552 
553  delete [] wr ;
554  delete [] wi ;
555  delete [] a ;
556  delete [] work ;
557  delete [] vl ;
558 
559  return res ;
560 }
561 
562 // Calcul le determinant :
563 double Matrice::determinant() const {
564 
565  int n = get_dim(0) ;
566  assert(n == get_dim(1)) ;
567 
568  Tbl valp(val_propre()) ;
569  double result = 1 ;
570  for (int i = 0 ; i<n ; i++)
571  if (valp(1, i) == 0)
572  result *= valp(0, i) ;
573  else {
574  result*= valp(0, i)*valp(0, i)+valp(1, i)*valp(1, i) ;
575  i++ ;
576  }
577  return result ;
578 }
579 
580 // Transposee
582 
583  int nbl = std->get_dim(1) ;
584  int nbc = std->get_dim(0) ;
585 
586  Matrice resu(nbc, nbl) ;
587 
588  if (etat == ETATZERO) {
589  resu.set_etat_zero() ;
590  }
591  else{
592  assert(etat == ETATQCQ) ;
593  resu.set_etat_qcq() ;
594  for (int i=0; i<nbc; i++) {
595  for (int j=0; j<nbl; j++) {
596  resu.set(i,j) = (*std)(j,i) ;
597  }
598  }
599  }
600  return resu ;
601 }
602 
603 
604 // Operateurs d'arithmetique
605 void Matrice::operator+=(const Matrice& a) {
606  assert((std != 0x0)&&(a.std != 0x0)) ;
607  std->operator+=(*a.std) ;
608 }
609 
610 void Matrice::operator-=(const Matrice& a) {
611  assert((std != 0x0)&&(a.std != 0x0)) ;
612  std->operator-=(*a.std) ;
613 }
614 
615 void Matrice::operator+=(double x) {
616  assert(std != 0x0);
617  std->operator+=(x) ;
618 }
619 
620 void Matrice::operator-=(double x) {
621  assert(std != 0x0);
622  std->operator-=(x) ;
623 }
624 
625 void Matrice::operator*=(double x) {
626  assert(std != 0x0);
627  std->operator*=(x) ;
628 }
629 
630 void Matrice::operator/=(double x) {
631  assert(std != 0x0);
632  assert(x != 0) ;
633  std->operator/=(x) ;
634 }
635 
636 // Operateurs d'arithmetique non membres
637 Matrice operator+ (const Matrice& a, const Matrice& b) {
638  assert((a.std != 0x0) && (b.std != 0x0)) ;
639  Matrice res(*a.std+*b.std) ;
640  return res ;
641 }
642 
643 Matrice operator- (const Matrice& a, const Matrice& b) {
644  assert((a.std != 0x0) && (b.std != 0x0)) ;
645  Matrice res(*a.std-*b.std) ;
646  return res ;
647 }
648 
649 Matrice operator* (const Matrice& a, double x) {
650  assert(a.std != 0x0) ;
651  Matrice res(*a.std*x);
652  return res ;
653 }
654 
655 Matrice operator* (double x, const Matrice& a) {
656  assert(a.std != 0x0) ;
657  Matrice res(*a.std*x);
658  return res ;
659 }
660 
661 Matrice operator* (const Matrice& aa, const Matrice& bb) {
662 
663  int nbla = aa.std->get_dim(1) ;
664  int nbca = aa.std->get_dim(0) ;
665 #ifndef NDEBUG
666  int nblb = bb.std->get_dim(1) ;
667 #endif
668  int nbcb = bb.std->get_dim(0) ;
669 
670  assert( nbca == nblb ) ;
671 
672  Matrice resu(nbla, nbcb) ;
673 
674  if ( (aa.get_etat() == ETATZERO) || (bb.get_etat() == ETATZERO) ) {
675  resu.set_etat_zero() ;
676  }
677  else {
678  assert( aa.get_etat() == ETATQCQ ) ;
679  assert( bb.get_etat() == ETATQCQ ) ;
680  resu.set_etat_qcq() ;
681  for (int i=0; i<nbla; i++) {
682  for (int j=0; j<nbcb; j++) {
683  double sum = 0 ;
684  for (int k=0; k<nbca; k++) {
685  sum += aa(i,k) * bb(k, j) ;
686  }
687  resu.set(i,j) = sum ;
688  }
689 
690  }
691  }
692 
693  return resu ;
694 }
695 
696 Matrice operator/ (const Matrice& a, double x) {
697  assert (x != 0) ;
698  assert(a.std != 0x0) ;
699  Matrice res(*a.std/x);
700  return res ;
701 }
702 }
Tbl * lu
Pointer on the first array of the LU-representation.
Definition: matrice.h:173
void operator/=(double)
Division of this by a double.
Definition: matrice.C:630
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
Definition: matrice.C:395
Lorene prototypes.
Definition: app_hor.h:67
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
Definition: matrice.C:427
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
int get_etat() const
Returns the logical state.
Definition: matrice.h:213
Basic integer array class.
Definition: itbl.h:122
int get_etat() const
Gives the logical state.
Definition: tbl.h:414
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Definition: cmp_arithm.C:460
Tbl * band
Pointer on the array of the band representation of a square matrix.
Definition: matrice.h:170
void operator-=(const Matrice &)
Subtraction of a Matrice to this.
Definition: matrice.C:610
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
Definition: matrice.C:190
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: matrice.C:184
int ku
Number of upper-diagonals in the band representation.
Definition: matrice.h:161
int get_ndim() const
Gives the number of dimensions (ie dim.ndim)
Definition: tbl.h:420
void operator+=(const Matrice &)
Addition of a Matrice to this.
Definition: matrice.C:605
Tbl val_propre() const
Returns the eigenvalues of the matrix, calculated using LAPACK.
Definition: matrice.C:460
Cmp operator+(const Cmp &)
Definition: cmp_arithm.C:107
Matrix handling.
Definition: matrice.h:152
double determinant() const
Computes the determinant of the matrix, using LAPACK and the standard decomposition.
Definition: matrice.C:563
int kl
Number of lower-diagonals in the band representation.
Definition: matrice.h:162
double * t
The array of double.
Definition: tbl.h:176
void operator*=(double)
Multiplication of this by a double.
Definition: matrice.C:625
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: itbl.C:264
Itbl * permute
Pointer on the second array of the LU-representation.
Definition: matrice.h:174
void annule_hard()
Sets the logical state to ETATQCQ (undefined state).
Definition: matrice.C:196
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])
Definition: tbl.h:423
int get_dim(int i) const
Returns the dimension of the matrix.
Definition: matrice.C:263
Matrice transpose() const
Computes the transpose matrix.
Definition: matrice.C:581
int etat
logical state (ETATNONDEF, ETATQCQ or ETATZERO).
Definition: tbl.h:172
double & set(int j, int i)
Read/write of a particuliar element.
Definition: matrice.h:277
Tbl * std
Pointer on the array of the standard representation.
Definition: matrice.h:158
int get_etat() const
Gives the logical state.
Definition: itbl.h:317
void set_band(int up, int low) const
Calculate the band storage of *std.
Definition: matrice.C:367
void del_deriv()
Deletes the (mutable) derived members: band, lu, permute.
Definition: matrice.C:167
int get_taille() const
Gives the total size (ie dim.taille)
Definition: tbl.h:417
void operator=(double x)
Sets all the element of *std to x.
Definition: matrice.C:268
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: matrice.C:178
int etat
logical state (ETATZERO, ETATQCQ or ETATNONDEF)
Definition: matrice.h:156
Cmp operator-(const Cmp &)
- Cmp
Definition: cmp_arithm.C:111
int * t
The array of int &#39;s.
Definition: itbl.h:132
~Matrice()
Destructor.
Definition: matrice.C:258
Basic array class.
Definition: tbl.h:164
void annule_hard()
Sets the Tbl to zero in a hard way.
Definition: tbl.C:375
Matrice(int size1, int size2)
Standard constructor.
Definition: matrice.C:206
Matrice vect_propre() const
Returns the eigenvectors of the matrix, calculated using LAPACK.
Definition: matrice.C:510
void del_t()
Logical destructor : dellocates the memory of the various used representations.
Definition: matrice.C:159