xc
ZMatrix.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //ZMatrix.h
22 
23 #ifndef ZMATRIX_H
24 #define ZMATRIX_H
25 
26 #include <iostream>
27 #include "vectorZ.h"
28 #include "TMatrix.h"
29 #include <cmath>
30 
31 template <class MATR>
32 MATR prod_vectorial(const MATR &v1,const MATR &v2);
33 
36 template <class numero>
37 class ZMatrix : public TMatrix<numero,vectorZ<numero> >
38  {
39  public:
42  //typedef vectorZ_allocator ZMatrix_allocator;
43  typedef typename vectorZ_numero::reference reference;
44  typedef typename vectorZ_numero::const_reference const_reference;
45  typedef typename vectorZ_numero::value_type value_type;
46  typedef typename vectorZ_numero::size_type size_type;
47  typedef typename mT_numero::lst_T lst_numero;
48 
49  private:
50  void TSRGT(numero eps,size_t *it,ZMatrix<numero> &C,ZMatrix<size_t> &Kp,ZMatrix<size_t> &Lp) const;
51  numero DMGT(const numero &eps) const;
52 
53  protected:
54  numero row_sum(size_type i) const;
55  numero column_sum(size_type j) const;
56  public:
57  ZMatrix(void) : mT_numero(1,1) {}
58  ZMatrix(size_type n_rows,size_type n_columns) : mT_numero(n_rows,n_columns) {}
59  ZMatrix(size_type n_rows,size_type n_columns,numero val) : mT_numero(n_rows,n_columns,val) {}
60  ZMatrix(size_type n_rows,size_type n_columns,const lst_numero &ln) : mT_numero(n_rows,n_columns)
61  { vectorZ_numero::operator=(vectorZ_numero(ln)); }
62  ZMatrix(const ZMatrix<numero> &other) : mT_numero(other) {}
63  template <class InputIterator>
64  ZMatrix(const size_t &n_rows,const size_t &n_columns,InputIterator b,InputIterator e);
65  ZMatrix<numero> &operator=(const ZMatrix<numero> &m)
66  {
68  return *this;
69  }
70  ZMatrix<numero>& operator=(const numero &n)
71  {
72  mT_numero::Con(n);
73  return *this;
74  }
75  ZMatrix<numero>& operator+=(const ZMatrix<numero> &m)
76  {
77  this->check_sto_sum(m);
78  this->Suma(m);
79  return *this;
80  }
81  ZMatrix<numero>& operator-=(const ZMatrix<numero> &m)
82  {
83  this->check_sto_dif(m);
84  this->Resta(m);
85  return *this;
86  }
87  ZMatrix<numero> &operator*=(const numero &n)
88  {
89  this->Prod(n);
90  return *this;
91  }
92  ZMatrix<numero> &operator*=(const ZMatrix<numero> &m)
93  {
94  *this= (*this)*m;
95  return *this;
96  }
97  numero row_maximum(size_type i) const;
98  numero column_maximum(size_type j) const;
99  void PutSuma(size_type i,size_type j,const numero &n)
100  //Le suma n a la posiciOn i,j.
101  { vectorZ_numero::PutSuma(Indice(i,j),n); }
102  void PutResta(size_type i,size_type j,const numero &n)
103  //Le resta n a la posici'on i,j.
104  { vectorZ_numero::PutResta(Indice(i,j),n); }
105  void PutProd(size_type i,size_type j,const numero &n)
106  //Multiplica la posici'on i por n.
107  { vectorZ_numero::PutProd(Indice(i,j),n); }
108  void swap(size_type f1,size_type c1,size_type f2, size_type c2)
109  { vectorZ_numero::swap(Indice(f1,c1),Indice(f2,c2)); }
110  ZMatrix<numero> &Trn(void)
111  {
112  mT_numero::Trn();
113  return *this;
114  }
115  ZMatrix<numero> GetTrn(void) const
116  {
117  ZMatrix<numero> m(*this);
118  m.Trn();
119  return m;
120  }
121  ZMatrix<numero> getBox(size_t f1, size_t c1, size_t f2, size_t c2) const;
122  ZMatrix<numero> getRow(size_type iRow) const
123  { return getBox(iRow,1,iRow,this->n_columns); }
124  ZMatrix<numero> getColumn(size_type col) const
125  { return getBox(1,col,this->n_rows,col); }
126  ZMatrix<numero> GetMenor(size_t f,size_t c) const;
127  void Idn(void);
128  void sumBox(size_t f,size_t c,const ZMatrix<numero> &box);
129  numero GetDetLento(void) const;
130  numero GetDet(const numero &eps= 1e-10) const;
131  numero Traza(void) const;
132  inline bool Nulo(const numero &tol= numero()) const
133  { return (this->Abs2()<(tol*tol)); }
134  numero getRowNorm(void) const;
135  numero getColumnNorm(void) const;
136  inline void Neg(void)
137  { return vectorZ<numero>::Neg(); }
138 
139  virtual void Input(std::istream &);
140  virtual void Input(const std::string &);
141 
142  friend bool operator==(const ZMatrix<numero> &m1,const ZMatrix<numero> &m2)
143  { return ((const mT_numero &) m1 == (const mT_numero &) m2); }
144 /* friend ZMatrix<numero> operator+(const ZMatrix<numero> &m1,const ZMatrix<numero> &m2) return suma(m1.n_rows,m1.n_columns); */
145 /* { */
146 /* check_sum(m1,m2); */
147 /* //ZMatrix<numero> suma(m1.n_rows,m1.n_columns); */
148 /* suma.Suma(m1,m2); */
149 /* return; */
150 /* } */
151  friend ZMatrix<numero> operator-(const ZMatrix<numero> &m1,const ZMatrix<numero> &m2)
152  {
153  check_dif(m1,m2);
154  ZMatrix<numero> resta(m1.n_rows,m1.n_columns);
155  resta.Resta(m1,m2);
156  return resta;
157  }
158  numero dot(const ZMatrix<numero> &v2) const;
159  //Producto escalar de este por v2.
160  //v2: column vector.
161 
162  numero Abs2(void) const;
163  numero Abs(void) const;
164 
165  inline friend numero dot(const ZMatrix<numero> &v1,const ZMatrix<numero> &v2)
166  //Producto escalar de dos vectores.
167  //v1: row vector.
168  //v2: column vector.
169  { return v1.dot(v2); }
170 
171 /* friend ZMatrix<numero> operator*(const ZMatrix<numero> &m1,const ZMatrix<numero> &m2) */
172 /* { */
173 /* check_prod(m1,m2); */
174 /* ZMatrix<numero> producto(m1.n_rows,m2.n_columns); */
175 /* for(size_type i=1;i<=m1.n_rows;i++) */
176 /* for(size_type j=1;j<=m2.n_columns;j++) */
177 /* { */
178 /* numero t=numero(); */
179 /* for(size_type k=1;k<= m1.n_columns;k++) */
180 /* t+= m1(i,k) * m2(k,j); */
181 /* producto(i,j)= t; */
182 /* } */
183 /* return producto; */
184 /* } */
185  friend ZMatrix<numero> operator*(const ZMatrix<numero> &m,const numero &p)
186  {
187  ZMatrix<numero> producto(m);
188  producto.Prod(p);
189  return producto;
190  }
191  friend ZMatrix<numero> operator*(const numero &p,const ZMatrix<numero> &m)
192  { return m*p; }
193  friend ZMatrix<numero> operator^(const ZMatrix<numero> &v1,const ZMatrix<numero> &v2)
194  //¡Ojo! está escrito para vectores de dimensión 3 xxx.
195  { return prod_vectorial(v1,v2); }
196 
197  };
198 
199 template <class numero> template<class InputIterator>
200 ZMatrix<numero>::ZMatrix(const size_t &n_rows,const size_t &n_columns,InputIterator b,InputIterator e)
201  : mT_numero(n_rows,n_columns,b,e) {}
202 
203 template <class numero>
204 ZMatrix<numero> operator-(const ZMatrix<numero> &m)
205  {
206  ZMatrix<numero> retval(m);
207  retval.Neg();
208  return retval;
209  }
210 
211 template <class numero>
212 ZMatrix<numero> ZMatrix<numero>::GetMenor(size_t f,size_t c) const
213  { return ::GetMenor(*this,f,c); }
214 
215 template <class numero>
216 void ZMatrix<numero>::sumBox(size_t f,size_t c,const ZMatrix<numero> &box)
217  {
218  size_type i,j;
219  for(i=1;i<=box.n_rows;i++)
220  for(j=1;j<=box.n_columns;j++)
221  PutSuma(i+f-1,j+c-1,box(i,j));
222  }
223 
224 template <class numero>
225 void ZMatrix<numero>::Idn(void)
226  {
227  size_type i;
228  if(this->Cuadrada())
229  {
230  vectorZ_numero::Con(numero());
231  for(i= 1;i<=this->n_rows;i++) (*this)(i,i)= neutro_producto(numero()); //Neutro del producto
232  }
233  }
234 
237 template <class MATR>
238 MATR prod_vectorial(const MATR &v1,const MATR &v2)
239  {
240  MATR v(v1.getNumberOfRows(),v1.getNumberOfColumns());
241  MATR m(v1.getNumberOfRows(),3);
242  m.PutCol(2,v1);
243  m.PutCol(3,v2);
244  MATR menor(2,2);
245  menor= GetMenor(m,1,1);
246  v(1,1)= menor.GetDet();
247  menor= GetMenor(m,2,1);
248  v(2,1)= -menor.GetDet();
249  menor= GetMenor(m,3,1);
250  v(3,1)= menor.GetDet();
251  return v;
252  }
253 
258 template <class numero>
260  {
261  this->check_traza();
262  numero p= neutro_suma(numero());
263  const numero cero= neutro_suma(p);
264  size_type n= this->getNumberOfRows();
265  switch(n)
266  {
267  case 0:
268  break;
269  case 1:
270  p= (*this)(1,1);
271  break;
272  case 2:
273  p= (*this)(1,1)*(*this)(2,2)-(*this)(1,2)*(*this)(2,1);
274  break;
275  case 3:
276  p= (*this)(1,1)*(*this)(2,2)*(*this)(3,3);
277  p+= (*this)(1,2)*(*this)(2,3)*(*this)(3,1);
278  p+= (*this)(1,3)*(*this)(2,1)*(*this)(3,2);
279  p-= (*this)(1,3)*(*this)(2,2)*(*this)(3,1);
280  p-= (*this)(1,2)*(*this)(2,1)*(*this)(3,3);
281  p-= (*this)(1,1)*(*this)(2,3)*(*this)(3,2);
282  break;
283  default:
284  {
285  for(size_type i= 1;i<= n;i++)
286  {
287  ZMatrix<numero> menor= (*this).GetMenor(i,1);
288  numero n= (*this)(i,1)*menor.GetDetLento();
289  if ((i+1)%2 == cero)
290  p+= n;
291  else
292  p-= n;
293  }
294  }
295  break;
296  }
297  return p;
298  }
299 
302 template <class numero>
303 numero ZMatrix<numero>::GetDet(const numero &eps) const
304  { return DMGT(eps); }
305 
306 template <class numero>
307 std::ostream &operator<<(std::ostream &os,const ZMatrix<numero> &m)
308  {
309  os << '[';
310  typename ZMatrix<numero>::size_type i,j;
311  typename ZMatrix<numero>::size_type n_rows= m.getNumberOfRows(),n_columns= m.getNumberOfColumns();
312  for(i= 1;i<=n_rows;i++)
313  {
314  os << '[';
315  if(n_columns > 0) os << m(i,1);
316  for(j= 2;j<=n_columns;j++)
317  os << ',' << m(i,j);
318  os << ']';
319  }
320  os << ']';
321  return os;
322  }
323 
324 template <class numero>
325 std::istream &operator>>(std::istream &is,ZMatrix<numero> &m)
326  {
327  m.Input(is);
328  return is;
329  }
330 
331 template<class numero>
332 inline ZMatrix<numero> operator+(const ZMatrix<numero> &m1,const ZMatrix<numero> &m2)
333  {
334  ZMatrix<numero> suma(m1);
335  check_sum(m1,m2);
336  suma.Suma(m2);
337  return suma;
338  }
339 
340 template<class numero>
341 inline ZMatrix<numero> operator*(const ZMatrix<numero> &m1,const ZMatrix<numero> &m2)
342  {
343  check_prod(m1,m2);
344  ZMatrix<numero> producto(m1.getNumberOfRows(),m2.getNumberOfColumns());
345  size_t n_rows= m1.getNumberOfRows();
346  size_t ncols_m1= m1.getNumberOfColumns();
347  size_t ncols= m2.getNumberOfColumns();
348  typedef typename ZMatrix<numero>::size_type sz_type;
349  for(sz_type i=1;i<=n_rows;i++)
350  for(sz_type j=1;j<=ncols;j++)
351  {
352  numero t= m1(i,1) * m2(1,j); //Initialize (they can be matrices of boxes).
353  for(sz_type k=2;k<= ncols_m1;k++)
354  t+= m1(i,k) * m2(k,j);
355  producto(i,j)= t;
356  }
357  return producto;
358  }
359 
360 template<class numero>
361 void ZMatrix<numero>::TSRGT(numero eps,size_t *it,ZMatrix<numero> &C,ZMatrix<size_t> &Kp,ZMatrix<size_t> &Lp) const
362 /*The function TSRGT applies to input real square matrix A(n,n) the upper
363 triangularization algorithm of Gauss method with full pivoting and keeps
364 trace of successive transformations done in integer vectors KP and LP.
365 ----------------------------------------------------------------------------
366  Input parameters:
367  eps precision (real)
368  n size of A matrix (integer)
369  A pointer to input real square matrix (double**)
370  Output parameters:
371  it flag=1 if A matrix ok, =0 if A matrix is singular (integer)
372  C pointer to table storing main diagonal elements and supra-
373  diagonal elements of upper triangular matrix and the multi-
374  plying coefficients used during triangularization process (double**)
375  KP table storing information concerning the column exchanges
376  during process (int*)
377  LP table storing information concerning the line exchanges
378  during process (int*)
379 -----------------------------------------------------------------------------
380 The table C is first initialized to A matrix, then receives at each step k
381 of the triangularization process, useful elements of A matrix at step k for
382 k=1,2,...n.
383 The variables po(real), lo and ko(integer) store respectively pivot at step k,
384 its line number and its column number.
385 -----------------------------------------------------------------------------*/
386  {
387  const size_t n= this->n_rows;
388  size_t i,j,k;
389  size_t ko,lo; numero po,t0;
390  //Copy this matrix into C
391  C= *this;
392  *it=1; k=1;
393  while (*it==1 && k<n)
394  {
395  po=C(k,k); lo=k; ko=k;
396  for(i=k; i<=n; i++)
397  for(j=k; j<=n; j++)
398  if(fabs(C(i,j))>fabs(po))
399  { po=C(i,j); lo=i; ko=j; }
400  Lp(k)=lo; Kp(k)=ko;
401  if(fabs(po)<eps)
402  {
403  *it=0;
404  std::cerr << std::endl
405  << "Error: pivot too small!" << std::endl;
406  }
407  else
408  {
409  if(lo!=k)
410  for(j=k; j<=n; j++)
411  { t0=C(k,j); C(k,j)=C(lo,j); C(lo,j)=t0; }
412  if(ko!=k)
413  for(i=1; i<=n; i++)
414  { t0=C(i,k); C(i,k)=C(i,ko); C(i,ko)=t0; }
415  for(i=k+1; i<=n; i++)
416  {
417  C(i,k)/= po;
418  for(j=k+1; j<=n; j++)
419  C(i,j)-= C(i,k)*C(k,j);
420  }
421  k++;
422  }
423  }
424  if(*it==1 && fabs(C(n,n))<eps) *it=0;
425  } //TSRGT()
426 
427 template <class numero>
428 numero ZMatrix<numero>::DMGT(const numero &eps) const
429 /*The function DMGT returns the determinant of a real square matrix
430 A(n,n) by Gauss method with full pivoting.
431 ----------------------------------------------------------------------------
432  Input parameters:
433  eps precision (double)
434  n size of A matrix (int)
435  A pointer to input real square matrix (double**)
436  Output parameters:
437  None
438 -----------------------------------------------------------------------------
439 The procedure TSRGT is used to reduce A matrix to an upper triangular matrix.
440 Output variables are it(integer), C(pMat), Kp and Lp(pVecI).
441 If it=0, matrix A is singular, if it=1, matrix A is regular. Table C contains
442 at location i,j (j>=i) the corresponding element of the upper triangular matrix.
443 Tables Lp and Kp contain information relative to exchanges of line or column
444 that occurred during the process. For instance, the element number k of Lp is
445 an integer <> k if an exchange of line has been made at step k (k=1,2,...,n).
446 The number of exchanges of lines and columns is stored in L(integer). the
447 determinant of A matrix is stored in d0(real).
448 Note: types pMat and pVecI must be declared and allocated for by main program,
449 except local variables C,Kp,Lp allocated (and disposed of) here.
450 -----------------------------------------------------------------------------*/
451  {
452  const size_t n= this->n_rows;
453  size_t it;
454  size_t k,l;
455  numero d0;
456  const numero cero= neutro_suma(d0);
457  const numero uno= neutro_producto(d0);
458  ZMatrix<numero> C(n,n);
459  ZMatrix<size_t> Kp(n,1,0), Lp(n,1,0);
460 
461  TSRGT(eps,&it,C,Kp,Lp); //call triangularization procedure
462 
463  if(it==0) //singular matrix, det=0
464  return cero;
465  else //regular matrix, det<>0
466  {
467  d0=uno;
468  for(k=1; k<=n; k++) d0 *= C(k,k);
469  l=0;
470  for(k=1; k<n; k++)
471  {
472  if (Lp(k)!=k) l++;
473  if (Kp(k)!=k) l++;
474  }
475  if ((l%2)!=0) d0=-d0;
476  }
477  return d0; //return el determinante
478  } //DMGT
479 
481 template <class numero>
482 ZMatrix<numero> ZMatrix<numero>::getBox(size_t f1, size_t c1, size_t f2, size_t c2) const
483  {
484  this->check_get_box(f1,c1,f2,c2);
485  ZMatrix<numero> box(f2-f1+1,c2-c1+1);
486  for(size_type i=1;i<=box.n_rows;i++)
487  for(size_type j=1;j<=box.n_columns;j++)
488  box(i,j)= ZMatrix<numero>::operator()(i+f1-1,j+c1-1);
489  return box;
490  }
491 
493 template <class numero>
494 numero ZMatrix<numero>::Traza(void) const
495  {
496  this->check_traza();
497  numero n= numero();
498  for(size_type i= 1;i<=this->n_rows;i++) n+= (*this)(i,i);
499  return n;
500  }
501 template <class numero>
502 numero ZMatrix<numero>::row_sum(size_type i) const
503  {
504  numero sumaf= (*this)(i,1);
505  for(size_t j=2;j<=this->n_columns;j++)
506  sumaf+= (*this)(i,j);
507  return sumaf;
508  }
509 template <class numero>
510 numero ZMatrix<numero>::column_sum(size_type j) const
511  {
512  numero sumac= (*this)(1,j);
513  for(size_t i=2;i<=this->n_columns;i++)
514  sumac+= (*this)(i,j);
515  return sumac;
516  }
517 template <class numero>
518 numero ZMatrix<numero>::row_maximum(size_type i) const
519  {
520  numero maxf= (*this)(i,1);
521  for(size_t j=2;j<=this->n_columns;j++)
522  maxf= std::max(maxf,(*this)(i,j));
523  return maxf;
524  }
525 template <class numero>
526 numero ZMatrix<numero>::column_maximum(size_type j) const
527  {
528  numero maxc= (*this)(1,j);
529  for(size_t i=2;i<=this->n_columns;i++)
530  maxc+= std::max(maxc,(*this)(i,j));
531  return maxc;
532  }
535 template <class numero>
536 numero ZMatrix<numero>::getRowNorm(void) const
537  {
538  numero maximo= row_sum(1);
539  for(size_t i=2;i<=this->n_rows;i++) maximo= max(maximo,row_sum(i));
540  return maximo;
541  }
544 template <class numero>
546  {
547  numero maximo= column_sum(1);
548  for(size_t j=2;j<=this->n_columns;j++) maximo= max(maximo,column_sum(j));
549  return maximo;
550  }
551 template <class numero>
552 numero ZMatrix<numero>::dot(const ZMatrix<numero> &v2) const
553 //Producto escalar de este por v2.
554 //v2: column vector.
555  {
556  check_dot(*this,v2);
557  numero retval((*this)(1,1)*v2(1,1));
558  typename ZMatrix<numero>::size_type i;
559  for(i=2;i<=this->n_columns;i++)
560  { retval+= (*this)(1,i) * v2(i,1); }
561  return retval;
562  }
563 
565 template <class numero>
566 numero ZMatrix<numero>::Abs2(void) const
567  {
568  numero r= numero();
569  const ZMatrix<numero> trn= this->GetTrn();
570  if(this->isRow()) //is a row matrix.
571  r= dot(trn);
572  else
573  if(this->isColumn()) //is a column matrix.
574  r= trn.dot(*this);
575  else //Es cualquiera
576  {
577  const ZMatrix<numero> prod= (*this)*trn;
578  r= prod.Traza();
579  }
580  return r;
581  }
582 
584 template <class numero>
585 numero ZMatrix<numero>::Abs(void) const
586  { return sqrt(Abs2()); }
587 
589 template <class numero>
590 void ZMatrix<numero>::Input(std::istream &is)
591  {
592  char c;
593  typename ZMatrix<numero>::lst_numero ln;
594  size_t n_rows=0,n_columns=1;
595  int sigue= 1;
596  numero ni;
597  is >> c;
598  if(c != '[') is.putback(c);
599  std::istream::sentry ipfx(is);
600  while(ipfx)
601  {
602  is >> c;
603  switch(c)
604  {
605  case '[':
606  n_rows++;
607  break;
608  case ']':
609  sigue= 0;
610  is >> c;
611  if(c != ']')
612  {
613  is.putback(c);
614  continue;
615  }
616  else
617  {
618  (*this)= ZMatrix<numero>(n_rows,n_columns,ln.begin(),ln.end());
619  return;
620  }
621  break;
622  case ',':
623  if(sigue) n_columns++;
624  break;
625  default:
626  break;
627  }
628  is >> ni;
629  ln.push_back(ni);
630  }
631  (*this)= ZMatrix<numero>(n_rows,n_columns,ln.begin(),ln.end());
632  return;
633  }
634 
636 template <class numero>
637 void ZMatrix<numero>::Input(const std::string &str)
638  {
639  std::istringstream iss(str);
640  Input(iss);
641  }
642 
644 template <class treal>
645 inline treal Abs(const ZMatrix<treal> &m)
646  { return m.Abs(); }
647 
648 
649 
650 #endif
651 
ZMatrix< numero > getBox(size_t f1, size_t c1, size_t f2, size_t c2) const
Return the box between the indices being passed as parameter.
Definition: ZMatrix.h:482
numero getColumnNorm(void) const
Return the maximum value of the components of the vector obtained by adding the components of the col...
Definition: ZMatrix.h:545
Definition: vectorZ.h:39
Matrix which element type has estructura de anillo respecto a las operaciones + y *...
Definition: ZMatrix.h:37
TMatrix< numero, vectorZ< numero > > & operator=(const TMatrix< numero, vectorZ< numero > > &m)
Assignment operator.
Definition: TMatrix.h:192
numero Abs(void) const
Return the norm (euclidean norm) of the matrix.
Definition: ZMatrix.h:585
numero getRowNorm(void) const
Return el valor máximo de los elementos del vector que resulta de sumar los rows elements.
Definition: ZMatrix.h:536
virtual void Input(std::istream &)
Lectura desde istream.
Definition: ZMatrix.h:590
Definition: TMatrix.h:37
numero GetDetLento(void) const
Return el determinante.
Definition: ZMatrix.h:259
numero Traza(void) const
Return the trace of the matrix.
Definition: ZMatrix.h:494
numero GetDet(const numero &eps=1e-10) const
Return el determinante.
Definition: ZMatrix.h:303
numero Abs2(void) const
Return the squared norm (euclidean norm) of the matrix.
Definition: ZMatrix.h:566