NeoPZ
pzbndmat.cpp
Go to the documentation of this file.
1 
6 #include <math.h>
7 #include "pzfmatrix.h"
8 #include "pzbndmat.h"
9 #ifdef USING_LAPACK
10 
11 #include "TPZLapack.h"
12 
13 #endif
14 
15 #include <stdlib.h>
16 
17 #include "pzlog.h"
18 #ifdef LOG4CXX
19 static LoggerPtr logger(Logger::getLogger("pz.matrix.tpzfbmatrix"));
20 #endif
21 
22 using namespace std;
23 
24 /*******************/
25 /*** Constructor ***/
26 template<class TVar>
28 : TPZRegisterClassId(&TPZFBMatrix::ClassId),
29 TPZMatrix<TVar>( 0, 0 ), fElem()
30 {
31  fBandLower = 0;
32  fBandUpper = 0;
33 }
34 
35 /********************/
36 /*** Constructors ***/
37 
38 template<class TVar>
39 TPZFBMatrix<TVar>::TPZFBMatrix( int64_t dim, int64_t band_width )
41 TPZMatrix<TVar>( dim, dim ), fElem(dim*(3*band_width+1),0.), fBandLower(band_width), fBandUpper(band_width)
42 {
43 }
44 
45 
46 
47 /*********************************/
48 /*** Constructor( TPZFBMatrix& ) ***/
49 
50 template<class TVar>
54 {
55 }
56 
57 
58 
59 /******************/
60 /*** Destructor ***/
61 template<class TVar>
63 {
64 }
65 
66 
67 
68 /***********/
69 /*** Put ***/
70 
71 template<class TVar>
72 int
73 TPZFBMatrix<TVar>::Put(const int64_t row,const int64_t col,const TVar& value )
74 {
75  if ( (row >= Dim()) || (col >= Dim()) || row<0 || col<0 || row-col > fBandLower || col-row > fBandUpper)
76  {
77  cout << "TPZFBMatrix::Put: " << row << "," << col << "," << Dim();
78  cout << "\n";
79  DebugStop();
80  return( 0 );
81  }
82 
83  return( PutVal( row, col, value ) );
84 }
85 
86 
87 
88 /***********/
89 /*** Get ***/
90 
91 template<class TVar>
92 const TVar&
93 TPZFBMatrix<TVar>::Get(const int64_t row,const int64_t col ) const
94 {
95  if ( (row >= Dim()) || (col >= Dim()) )
96  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "Get <indices out of band matrix range>" );
97 
98  return( GetVal( row, col ) );
99 }
100 
101 
102 
103 /******** Operacoes com matrizes FULL BAND ********/
104 
105 /******************/
106 /*** Operator = ***/
107 
108 
109 template<class TVar>
112 {
113  if(this == &A) return *this;
114 
118  fElem = A.fElem;
119  return *this;
120 }
121 
122 
123 
124 /*******************************/
125 /*** Operator+( TPZFBMatrix & ) ***/
126 // DEPENDS ON THE STORAGE FORMAT
127 template<class TVar>
130 {
131  if ( A.Dim() != Dim() || A.fBandLower != fBandLower || A.fBandUpper != fBandUpper )
132  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "Operator+ <matrixs with different dimensions>" );
133 
134  TPZFBMatrix<TVar> res(*this);
135  int64_t sz = fElem.size();
136  for (int64_t i=0; i<sz; i++) {
137  res.fElem[i] += A.fElem[i];
138  }
139  return( res );
140 }
141 
142 
143 
144 /*******************************/
145 /*** Operator-( TPZFBMatrix & ) ***/
146 // DEPENDS ON THE STORAGE FORMAT
147 
148 template<class TVar>
151 {
152  if ( A.Dim() != Dim() || A.fBandLower != fBandLower || A.fBandUpper != fBandUpper )
153  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "Operator- <matrixs with different dimensions>" );
154 
155  TPZFBMatrix<TVar> res(*this);
156  int64_t sz = fElem.size();
157  for (int64_t i=0; i<sz; i++) {
158  res.fElem[i] -= A.fElem[i];
159  }
160  return( res );
161 
162 }
163 
164 
165 
166 /*******************************/
167 /*** Operator*( TPZFBMatrix & ) ***/
168 
169 
170 
171 /********************************/
172 /*** Operator+=( TPZFBMatrix & ) ***/
173 // DEPENDS ON THE STORAGE FORMAT
174 
175 template <class TVar>
178 {
179  if ( A.Dim() != Dim() || A.fBandLower != fBandLower || A.fBandUpper != fBandUpper )
180  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "Operator+= <matrixs with different dimensions>" );
181 
182  int64_t sz = fElem.size();
183  for (int64_t i=0; i<sz; i++) {
184  fElem[i] += A.fElem[i];
185  }
186  return( *this );
187 }
188 
189 
190 
191 /*******************************/
192 /*** Operator-=( TPZFBMatrix & ) ***/
193 // DEPENDS ON THE STORAGE FORMAT
194 
195 template<class TVar>
198 {
199  if ( A.Dim() != Dim() || A.fBandLower != fBandLower || A.fBandUpper != fBandUpper )
200  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "Operator-= <matrixs with different dimensions>" );
201 
202  int64_t sz = fElem.size();
203  for (int64_t i=0; i<sz; i++) {
204  fElem[i] -= A.fElem[i];
205  }
206  return( *this );
207 }
208 
209 
210 
211 /******** Operacoes com MATRIZES GENERICAS ********/
212 
213 
214 /*******************/
215 /*** MultiplyAdd ***/
216 //
217 // perform a multiply add operation to be used by iterative solvers
218 //
219 
220 template<class TVar>
222  const TVar alpha,const TVar beta ,const int opt) const {
223  // Computes z = beta * y + alpha * opt(this)*x
224  // z and x cannot overlap in memory
225  if ((!opt && this->Cols() != x.Rows()) || this->Rows() != x.Rows())
226  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "TPZFBMatrix::MultAdd <matrixs with incompatible dimensions>" );
227  if(x.Cols() != y.Cols() || x.Cols() != z.Cols() || x.Rows() != y.Rows() || x.Rows() != z.Rows()) {
228  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__,"TPZFBMatrix::MultAdd incompatible dimensions\n");
229  }
230  this->PrepareZ(y,z,beta,opt);
231  int64_t rows = this->Rows();
232  int64_t xcols = x.Cols();
233  int64_t ic, r;
234  if(opt == 0) {
235  for (ic = 0; ic < xcols; ic++) {
236  int64_t begin, end;
237  for ( r = 0; r < rows; r++ ) {
238  begin = MAX( r - fBandLower, 0 );
239  end = MIN( r + fBandUpper + 1, Dim() );
240  TVar val = z.GetVal(r,ic);
241  // Calcula um elemento da resposta.
242  for ( int64_t i = begin ; i < end; i++ ) val += alpha * GetVal( r, i ) * x.GetVal( i, ic );
243  z.PutVal( r, ic, val );
244  }
245  }
246  } else {
247  for (ic = 0; ic < xcols; ic++) {
248  int64_t begin, end;
249  for ( r = 0; r < rows; r++ ) {
250  begin = MAX( r - fBandLower, 0 );
251  end = MIN( r + fBandUpper + 1, Dim() );
252  TVar val = z.GetVal(r,ic);
253  // Calcula um elemento da resposta.
254  for ( int64_t i = begin ; i < end; i++ ) val += alpha * GetVal( i, r ) * x.GetVal( i, ic );
255  z.PutVal( r, ic, val );
256  }
257  }
258  }
259 }
260 
261 
262 
263 
264 /*******************/
265 /*** Operator += ***/
266 //
267 
268 template<class TVar>
270  TPZFBMatrix<TVar> temp(*this);
271  temp *= (TVar)(-1.);
272  return temp;
273 }
274 
275 
276 /******** Operacoes com valores NUMERICOS ********/
277 
278 
279 
280 /**************************/
281 /*** Operator*( value ) ***/
282 
283 template<class TVar>
285 TPZFBMatrix<TVar>::operator*(const TVar value ) const
286 {
287  TPZFBMatrix<TVar> res(*this);
288 
289  int64_t sz = fElem.size();
290  for (int64_t i=0; i<sz; i++) {
291  fElem[i] *= value;
292  }
293  return( res );
294 }
295 
296 
297 
298 
299 
300 /***************************/
301 /*** Operator*=( value ) ***/
302 
303 template<>
305 TPZFBMatrix<std::complex<float> >::operator*=(const std::complex<float> value )
306 {
307  if ( value.real() != 1.0 || value.imag() != 0. )
308  {
309  int64_t sz = fElem.size();
310  for (int64_t i=0; i<sz; i++) {
311  fElem[i] *= value;
312  }
313  }
314 
315  return( *this );
316 }
317 
318 template<>
320 TPZFBMatrix<std::complex<double> >::operator*=(const std::complex<double> value )
321 {
322  if ( value.real() != 1.0 || value.imag() != 0. )
323  {
324  int64_t sz = fElem.size();
325  for (int64_t i=0; i<sz; i++) {
326  fElem[i] *= value;
327  }
328  }
329 
330  return( *this );
331 }
332 
333 
334 
335 template<class TVar>
338 {
339  if ( value != (TVar)1.0 )
340  {
341  int64_t sz = fElem.size();
342  for (int64_t i=0; i<sz; i++) {
343  fElem[i] *= value;
344  }
345  }
346 
347  return( *this );
348 }
349 
350 template <class TVar>
351 void TPZFBMatrix<TVar>::AutoFill(int64_t nrow, int64_t ncol, int symmetric) {
352 
353  if (nrow != ncol) {
354  DebugStop();
355  }
356  int Band = nrow/3;
357  if (Band == 0) {
358  Band = nrow;
359  }
360  TPZFBMatrix A(nrow, Band);
361  *this = A;
362 
363  for (int64_t i=0; i<nrow; i++) {
364  int64_t jmin = i-Band;
365  if (jmin< 0) {
366  jmin = 0;
367  }
368  int64_t jmax = i+Band+1;
369  if (jmax > nrow) {
370  jmax = nrow;
371  }
372  TVar sum = 0.;
373  int64_t j = jmin;
374  if (symmetric) {
375  for (; j<i; j++) {
376  PutVal(i,j,GetVal(j,i));
377  sum += GetVal(i, j);
378  }
379  }
380  for (; j<jmax; j++) {
381  TVar val = ((TVar) rand())/((TVar)RAND_MAX);
382  PutVal(i, j, val);
383  if(i!=j) sum += val;
384  }
385  PutVal(i, i, sum+(TVar)1.);
386  }
387 
388 // this->Print("AutoFill = ",std::cout,EMathematicaInput);
389 }
390 /**************/
391 /*** Resize ***/
392 // DEPENDS ON THE STORAGE FORMAT
393 
394 template<class TVar>
395 int
396 TPZFBMatrix<TVar>::Resize(const int64_t newRows,const int64_t newCols)
397 {
398  if ( newRows != newCols )
399  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "Resize <Band matrix must be NxN>" );
400 
401 
402  Redim(newRows,newRows);
403  return( 1 );
404 }
405 
406 
407 
408 /*************/
409 /*** Redim ***/
410 template<class TVar>
411 int
412 TPZFBMatrix<TVar>::Redim(const int64_t newRows,const int64_t newCols )
413 {
414  if ( newRows != newCols )
415  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "Resize <Band matrix must be NxN>" );
416 
417  // if ( !fBand ) TPZMatrix::Error(__PRETTY_FUNCTION__, "Bandwith = NULL" );
418 
419 
420  if (fBandLower > newRows-1) {
421  fBandLower = newRows-1;
422  }
423  if (fBandUpper > newRows-1) {
424  fBandUpper = newRows-1;
425  }
426  TPZMatrix<TVar>::Redim(newRows,newRows);
427  uint64_t size = newRows*(2*fBandLower+fBandUpper + 1);
428  fElem.Resize(size);
429  Zero();
430 
431  return( 1 );
432 }
433 
434 
435 /***************/
436 /**** Zero ****/
437 template<class TVar>
438 int
440 {
441  uint64_t size = fElem.size();
442 
443  for (int64_t i=0; i<size; i++) {
444  fElem[i] = (TVar)0.;
445  }
446 
447  this->fDecomposed = 0;
448 
449  return( 1 );
450 }
451 
452 
453 /***************/
454 /*** SetBand ***/
455 // DEPENDS ON THE STORAGE FORMAT
456 template<class TVar>
457 int
458 TPZFBMatrix<TVar>::SetBand( int64_t newBand )
459 {
460  if ( newBand >= Dim() )
461  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__, "SetBand <the band must be lower than the matrix dimension " );
462 
463  uint64_t newSize = Dim()*(3 * newBand + 1);
464  fBandLower = newBand;
465  fBandUpper = newBand;
466  fElem.resize(newSize);
467  Zero();
468  return( 1 );
469 }
470 
471 
472 
473 /********************/
474 /*** Transpose () ***/
475 template<class TVar>
476 void
478 {
479  T->Resize( Dim(), Dim() );
480 
481  int64_t end, begin;
482  //REAL *p = fElem;
483  for ( int64_t r = 0; r < Dim(); r++ )
484  {
485  begin = MAX( r - fBandLower, 0 );
486  end = MIN( r + fBandUpper + 1, Dim() );
487  for ( int64_t c = begin; c < end; c++ )
488  {
489  T->PutVal( c, r, GetVal( r, c ) );
490  // cout<<"(r,c)= "<<r<<" "<<c<<"\n";
491  }
492  }
493 }
494 
495 #ifdef USING_LAPACK
496 
497 template<class TVar>
498 int TPZFBMatrix<TVar>::Decompose_LU(std::list<int64_t> &singular)
499 {
500  Decompose_LU();
501  return ELU;
502 }
503 
504 
505 template<>
506 int
508 {
509  if ( this->fDecomposed && this->fDecomposed == ELU) {
510  return ELU;
511  } else if(this->fDecomposed) {
512  TPZMatrix<float>::Error(__PRETTY_FUNCTION__,"TPZFBMatrix::Decompose_LU is already decomposed with other scheme");
513  }
514  int rows = Rows();
515  int bandlower = fBandLower;
516  int bandupper = fBandUpper;
517  int nrhs = 0;
518  int ldab = 1+2*fBandLower+fBandUpper;
519  fPivot.Resize(rows, 0);
520  float B;
521  int info;
522 
523 // sgbsv_(<#__CLPK_integer *__n#>, <#__CLPK_integer *__kl#>, <#__CLPK_integer *__ku#>, <#__CLPK_integer *__nrhs#>, <#__CLPK_real *__ab#>, <#__CLPK_integer *__ldab#>, <#__CLPK_integer *__ipiv#>, <#__CLPK_real *__b#>, <#__CLPK_integer *__ldb#>, <#__CLPK_integer *__info#>)
524 // lapack_int LAPACKE_sgbsv( int matrix_layout, lapack_int n, lapack_int kl,
525 // lapack_int ku, lapack_int nrhs, float* ab,
526 // lapack_int ldab, lapack_int* ipiv, float* b,
527 // lapack_int ldb );
528 
529  sgbsv_(&rows, &bandlower, &bandupper, &nrhs, &fElem[0], &ldab,&fPivot[0], &B,&rows, &info);
530  //int matrix_layout = 0;
531 // LAPACKE_sgbsv(matrix_layout,rows, bandlower, bandupper, nrhs, &fElem[0], ldab,&fPivot[0], &B,rows);
532 
533  if (info != 0) {
534  DebugStop();
535  }
536  this->fDecomposed = ELU;
537  return 1;
538 }
539 template<>
540 int
542 {
543  if ( this->fDecomposed && this->fDecomposed == ELU) {
544  return ELU;
545  } else if(this->fDecomposed) {
546  TPZMatrix<float>::Error(__PRETTY_FUNCTION__,"TPZFBMatrix::Decompose_LU is already decomposed with other scheme");
547  }
548  int rows = Rows();
549  int bandlower = fBandLower;
550  int bandupper = fBandUpper;
551  int nrhs = 0;
552  int ldab = 1+2*fBandLower+fBandUpper;
553  fPivot.Resize(rows, 0);
554  double B;
555  int info;
556 
557  // sgbsv_(<#__CLPK_integer *__n#>, <#__CLPK_integer *__kl#>, <#__CLPK_integer *__ku#>, <#__CLPK_integer *__nrhs#>, <#__CLPK_real *__ab#>, <#__CLPK_integer *__ldab#>, <#__CLPK_integer *__ipiv#>, <#__CLPK_real *__b#>, <#__CLPK_integer *__ldb#>, <#__CLPK_integer *__info#>)
558  dgbsv_(&rows, &bandlower, &bandupper, &nrhs, &fElem[0], &ldab,&fPivot[0], &B,&rows, &info);
559 
560  if (info != 0) {
561  DebugStop();
562  }
563  this->fDecomposed = ELU;
564  return 1;
565 }
566 
567 
568 
569 template<class TVar>
571 {
572  if ( this->fDecomposed && this->fDecomposed == ELU) {
573  return ELU;
574  } else if(this->fDecomposed) {
575  TPZMatrix<TVar>::Error(__PRETTY_FUNCTION__,"TPZFBMatrix::Decompose_LU is already decomposed with other scheme");
576  }
578 }
579 
580 template<>
582 
583  if (this->fDecomposed != ELU) {
584  DebugStop();
585  }
586  int rows = Rows();
587  int bandlower = fBandLower;
588  int bandupper = fBandUpper;
589  int nrhs = B->Cols();
590  int ldab = 1+2*fBandLower+fBandUpper;
591  int info;
592  char notrans[]="No Transpose";
593 
594 
595 // sgbtrs_(<#char *__trans#>, <#__CLPK_integer *__n#>, <#__CLPK_integer *__kl#>, <#__CLPK_integer *__ku#>, <#__CLPK_integer *__nrhs#>, <#__CLPK_real *__ab#>, <#__CLPK_integer *__ldab#>, <#__CLPK_integer *__ipiv#>, <#__CLPK_real *__b#>, <#__CLPK_integer *__ldb#>, <#__CLPK_integer *__info#>)
596  sgbtrs_(notrans, &rows, &bandlower, &bandupper, &nrhs, &fElem[0], &ldab, &fPivot[0], &B->s(0,0), &rows, &info);
597  return( 1 );
598 }
599 
600 template<>
602 
603  if (this->fDecomposed != ELU) {
604  DebugStop();
605  }
606  int rows = Rows();
607  int bandlower = fBandLower;
608  int bandupper = fBandUpper;
609  int nrhs = B->Cols();
610  int ldab = 1+2*fBandLower+fBandUpper;
611  int info;
612  char notrans[]="No Transpose";
613 
614 
615  // sgbtrs_(<#char *__trans#>, <#__CLPK_integer *__n#>, <#__CLPK_integer *__kl#>, <#__CLPK_integer *__ku#>, <#__CLPK_integer *__nrhs#>, <#__CLPK_real *__ab#>, <#__CLPK_integer *__ldab#>, <#__CLPK_integer *__ipiv#>, <#__CLPK_real *__b#>, <#__CLPK_integer *__ldb#>, <#__CLPK_integer *__info#>)
616  dgbtrs_(notrans, &rows, &bandlower, &bandupper, &nrhs, &fElem[0], &ldab, &fPivot[0], &B->s(0,0), &rows, &info);
617  return( 1 );
618 }
619 
620 
621 #endif
622 
623 template<class TVar>
625 
626  if (this->fDecomposed != ELU) {
627  DebugStop();
628  }
630  return( 1 );
631 }
632 
633 template<class TVar>
635  return Hash("TPZFBMatrix") ^ TPZMatrix<TVar>::ClassId() << 1;
636 }
637 
638 /************************** Private **************************/
639 
640 /*************/
641 /*** Clear ***/
642 
643 template<class TVar>
644 int
646 {
647  fElem.resize(0);
648  this->fRow = this->fCol = 0;
649  fBandLower = 0;
650  fBandUpper = 0;
651  return( 1 );
652 }
653 
654 
655 template class TPZFBMatrix<long double>;
656 template class TPZFBMatrix<double>;
657 template class TPZFBMatrix<float>;
658 template class TPZFBMatrix<int64_t>;
659 template class TPZFBMatrix<int>;
661 template class TPZFBMatrix<std::complex<double> >;
662 template class TPZFBMatrix<std::complex<float> >;
virtual TVar & s(const int64_t row, const int64_t col) override
The operators check on the bounds if the DEBUG variable is defined.
Definition: pzfmatrix.h:588
void Transpose(TPZMatrix< TVar > *const T) const override
It makes *T the transpose of current matrix.
Definition: pzbndmat.cpp:477
const TVar & Get(const int64_t row, const int64_t col) const override
Get value with bound checking.
Definition: pzbndmat.cpp:93
void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha=1, const TVar beta=0, const int opt=0) const override
It computes z = beta * y + alpha * opt(this)*x but z and x can not overlap in memory.
Definition: pzbndmat.cpp:221
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
int SetBand(const int64_t newBand)
Sets band size.
Definition: pzbndmat.cpp:458
void AutoFill(int64_t nrow, int64_t ncol, int symmetric)
Definition: pzbndmat.cpp:351
static int Error(const char *msg, const char *msg2=0)
Returns error messages.
Definition: pzmatrix.cpp:1402
virtual void resize(const int64_t newsize)
Definition: pzvec.h:213
int Resize(const int64_t newRows, const int64_t newCols) override
Redimension the matrix preserving its elements.
Definition: pzbndmat.cpp:396
TPZVec< TVar > fElem
Definition: pzbndmat.h:154
TPZFBMatrix & operator+=(const TPZFBMatrix< TVar > &A)
Definition: pzbndmat.cpp:177
virtual int Resize(const int64_t newRows, const int64_t newCols)
Redimensions a matriz keeping the previous values.
Definition: pzmatrix.h:278
int64_t fRow
Number of rows in matrix.
Definition: pzmatrix.h:779
TPZFBMatrix & operator*=(const TVar val)
Definition: pzbndmat.cpp:337
void PrepareZ(const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar beta, const int opt) const
Is an auxiliar method used by MultiplyAdd.
Definition: pzmatrix.cpp:135
TPZFBMatrix operator*(const TVar val) const
Definition: pzbndmat.cpp:285
char fDecomposed
Decomposition type used to decompose the current matrix.
Definition: pzmatrix.h:783
int64_t Dim() const override
Returns the dimension of the matrix if the matrix is square.
Definition: pzbndmat.h:103
TPZFBMatrix()
Simple constructor.
Definition: pzbndmat.cpp:27
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
#define MAX(a, b)
Gets maxime value between a and b.
Definition: pzreal.h:81
virtual int Substitution(TPZFMatrix< TVar > *B) const override
Computes Forward and Backward substitution for a "LU" decomposed matrix.
Definition: pzbndmat.cpp:624
int64_t fBandUpper
Definition: pzbndmat.h:155
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Definition: pzvec.h:373
TPZFBMatrix & operator-=(const TPZFBMatrix< TVar > &A)
Definition: pzbndmat.cpp:197
int ClassId() const override
Define the class id associated with the class.
Definition: pzbndmat.cpp:634
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
int64_t fBandLower
Definition: pzbndmat.h:155
TPZFBMatrix operator+(const TPZFBMatrix< TVar > &A) const
Definition: pzbndmat.cpp:129
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension the matrix and make zero its elements.
Definition: pzbndmat.cpp:412
Definition: pzmatrix.h:52
~TPZFBMatrix()
Simple destructor.
Definition: pzbndmat.cpp:62
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
int Put(const int64_t row, const int64_t col, const TVar &value) override
Put values with bounds checking if DEBUG variable is defined.
Definition: pzbndmat.cpp:73
string res
Definition: test.py:151
int Clear() override
It clears data structure.
Definition: pzbndmat.cpp:645
#define MIN(a, b)
Gets minime value between a and b.
Definition: pzreal.h:85
virtual int Redim(const int64_t newRows, const int64_t newCols)
Redimensions the matrix reinitializing it with zero.
Definition: pzmatrix.h:289
TPZFBMatrix & operator=(const TPZFBMatrix< TVar > &A)
Definition: pzbndmat.cpp:111
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
int PutVal(const int64_t row, const int64_t col, const TVar &value) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Definition: pzbndmat.h:170
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
int Zero() override
Zeroes the matrix.
Definition: pzbndmat.cpp:439
int64_t fCol
Number of cols in matrix.
Definition: pzmatrix.h:781
Contains TPZFBMatrix class which defines a non symmetric banded matrix.
virtual int PutVal(const int64_t, const int64_t, const TVar &val)
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Definition: pzmatrix.h:154
Defines a non symmetric banded matrix. Matrix.
Definition: pzbndmat.h:25
virtual int Decompose_LU()
Definition: pzmatrix.cpp:1126
TPZFBMatrix operator-() const
Definition: pzbndmat.cpp:269
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual int Substitution(TPZFMatrix< TVar > *B) const
Computes Forward and Backward substitution for a "LU" decomposed matrix.
Definition: pzmatrix.cpp:1151
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Definition: pzbndmat.h:190
int PutVal(const int64_t row, const int64_t col, const TVar &value) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Definition: pzfmatrix.h:548
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Definition: pzfmatrix.h:566
int ClassId() const override
Define the class id associated with the class.
Definition: pzmatrix.h:957
Root matrix class (abstract). Matrix.
Definition: pzmatrix.h:60