16 static LoggerPtr logger(Logger::getLogger(
"pz.matrix.tpzsfmatrix"));
28 int64_t size =
Size();
29 fElem =
new TVar[ size ] ;
45 int64_t size =
Size();
46 fElem =
new TVar[size] ;
68 int64_t size =
Size();
69 fElem =
new TVar[size] ;
76 for ( int64_t r = 0; r < this->
Dim(); r++ )
77 for ( int64_t c = 0; c <= r; c++ )
104 if ( this->
Dim() != A.
Dim() )
110 int64_t size = A.
Size();
111 fElem =
new TVar[ size ] ;
139 if ( A.
Dim() != this->
Dim() )
145 TVar *pr = res.
fElem;
149 *pr++ = (*pm++) + (*pa++);
162 if ( A.
Dim() != this->
Dim() )
168 TVar *pr = res.
fElem;
172 *pr++ = (*pm++) - (*pa++);
186 if ( A.
Dim() != this->
Dim() )
208 if ( A.
Dim() != this->
Dim() )
233 int64_t size = newDim * (newDim + 1) / 2;
235 if ( newDim != this->
Dim() )
239 fElem =
new TVar[ size ] ;
244 for ( int64_t c = 0; c < newDim; c++ )
245 for ( int64_t r = 0; r <= c; r++ )
246 *dst++ = A.
Get( r, c );
267 if ( this->
Dim() != A.
Dim() )
272 TVar *pr = res.
fElem;
273 for ( int64_t c = 0; c < this->
Dim(); c++ )
274 for ( int64_t r = 0; r <= c; r++ )
275 *pr++ = (*pm++) + A.
Get( r, c );
289 if ( this->
Dim() != A.
Dim() )
294 TVar *pr = res.
fElem;
295 for ( int64_t c = 0; c < this->
Dim(); c++ )
296 for ( int64_t r = 0; r <= c; r++ )
297 *pr++ = (*pm++) - A.
Get( r, c );
310 if (this->
Dim() != A.
Dim() )
314 for ( int64_t c = 0; c < this->
Dim(); c++ )
315 for ( int64_t r = 0; r <= c; r++ )
316 *pm++ += A.
Get( r, c );
331 if ( this->
Dim() != A.
Dim() )
335 for ( int64_t c = 0; c < this->
Dim(); c++ )
336 for ( int64_t r = 0; r <= c; r++ )
337 *pm++ -= A.
Get( r, c );
374 TVar *dst = res.
fElem;
378 *dst++ = (*src++) + value;
394 TVar *dst = res.
fElem;
398 *dst++ = (*src++) * value;
445 if ( newDim == this->
Dim() )
448 int64_t newSize = newDim * (newDim + 1) / 2;
449 int64_t oldSize =
Size();
450 TVar *newElem =
new TVar[newSize] ;
451 if ( newElem == NULL )
454 int64_t minSize =
Min( newSize, oldSize );
457 TVar *end = &
fElem[ minSize ];
464 end = &newElem[ newSize ];
487 if ( newDim != this->
Dim() )
537 for ( int64_t k = 0; k < this->
Dim(); k++, ptr_k += k )
543 TVar *pkk = ptr_k + k;
544 for ( ; pk < pkk; pk++ )
545 sum += (*pk) * (*pk);
549 if ( (*pk -= sum) < 1.e-10 )
557 for ( int64_t i = k+1; i <this->
Dim(); i++ )
565 for ( int64_t p = 0; p < k; p++ )
566 sum += (*pk++) * (*pi++);
570 *pi = (*pi - sum) / *pk;
595 TPZMatrix<TVar> ::Error(__PRETTY_FUNCTION__,
"Decompose_LDLt <Matrix already Decomposed with a different scheme>" );
602 for ( j = 0; j < this->
Dim(); j++ )
612 for( l=j+1; l<this->
Dim();l++)
644 for ( int64_t k = 0; k < this->
Dim(); k++ )
646 for ( int64_t j = 0; j < B->
Cols(); j++ )
652 for ( int64_t i = 0; i < k; i++ )
653 sum += (*pk++) * B->
GetVal( i, j );
680 for ( int64_t k = this->
Dim()-1; k >= 0; k--, ptr_k-- )
681 for ( int64_t j = 0; j < B->
Cols(); j++ )
687 for ( int64_t i = this->
Dim()-1; i > k; i-- )
689 sum += *pk * B->
GetVal( i, j );
716 for ( int64_t k = 0; k < this->
Dim(); k++, ptr_k += k )
717 for ( int64_t j = 0; j < B->
Cols(); j++ )
723 for ( int64_t i = 0; i < k; i++ )
724 sum += (*pk++) * B->
GetVal( i, j );
750 for ( int64_t k = this->
Dim()-1; k >= 0; k--, ptr_k-- )
751 for ( int64_t j = 0; j < B->
Cols(); j++ )
757 for ( int64_t i = this->
Dim()-1; i > k; i-- )
759 sum += *pk * B->
GetVal( i, j );
784 for ( int64_t k = 0; k < this->
Dim(); k++ )
786 for ( int64_t j = 0; j < B->
Cols(); j++ )
839 TSaveable::Unpack(buf);
840 buf->UpkDouble(
fElem);
854 TSaveable::Pack(buf);
855 buf->PkDouble(
fElem);
861 return TSaveable::DerivedFrom(Classid);
866 if(!strcmp(ClassName(),classname))
return 1;
867 return TSaveable::DerivedFrom(classname);
int Zero() override
Resets all elements.
virtual int Subst_Forward(TPZFMatrix< TVar > *B) const override
Computes B = Y, where A*Y = B, A is lower triangular.
bool IsZero(long double a)
Returns if the value a is close Zero as the allowable tolerance.
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.
TPZSFMatrix operator*(const TVar val) const
int Clear() override
It clears data structure.
static int Error(const char *msg, const char *msg2=0)
Returns error messages.
int64_t fRow
Number of rows in matrix.
virtual const TVar & Get(const int64_t row, const int64_t col) const
Get value with bound checking.
void SetIsDecomposed(int val)
Sets current matrix to decomposed state.
virtual int Decompose_LDLt() override
Decomposes the current matrix using LDLt.
char fDecomposed
Decomposition type used to decompose the current matrix.
char fDefPositive
Definite Posistiveness of current matrix.
virtual int Subst_Backward(TPZFMatrix< TVar > *B) const override
Computes B = Y, where A*Y = B, A is upper triangular.
virtual const TVar & GetVal(const int64_t, const int64_t) const
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
TPZSFMatrix & operator-=(const TPZSFMatrix< TVar > &A)
TPZSFMatrix operator-() const
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.
virtual int IsSimetric() const
Checks if the current matrix is symmetric.
int IsDecomposed() const
Checks if current matrix is already decomposed.
Contains TPZMatrixclass which implements full matrix (using column major representation).
virtual int Subst_Diag(TPZFMatrix< TVar > *B) const override
Computes B = Y, where A*Y = B, A is diagonal matrix.
TPZSFMatrix & operator*=(const TVar val)
TPZSFMatrix & operator+=(const TPZSFMatrix< TVar > &A)
int64_t Rows() const
Returns number of rows.
static TPZSavable * CreateInstance(const int &classId)
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
virtual int Subst_LBackward(TPZFMatrix< TVar > *B) const override
Computes B = Y, where A*Y = B, A is upper triangular with A(i,i)=1.
const T & Min(const T &a, const T &b)
Returns the minimum value between a and b.
Full matrix class. Matrix.
virtual int64_t Dim() const
Returns the dimension of the matrix if the matrix is square.
int32_t Hash(std::string str)
virtual int Decompose_Cholesky() override
Decomposes the current matrix using Cholesky method. The current matrix has to be symmetric...
TPZSFMatrix & operator=(const TPZSFMatrix< TVar > &A)
int64_t fCol
Number of cols in matrix.
int Resize(const int64_t newDim, const int64_t) override
Resize the array but keeps its entirety.
virtual int Subst_LForward(TPZFMatrix< TVar > *B) const override
Computes B = Y, where A*Y = B, A is lower triangular with A(i,i)=1.
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.
int64_t Cols() const
Returns number of cols.
TPZSFMatrix operator+(const TPZSFMatrix< TVar > &A) const
Implements a symmetric full matrix. Matrix.
virtual int IsDefPositive() const
Checks if current matrix is definite positive.
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
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.
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.
int Redim(const int64_t newRows, const int64_t) override
Resize the array and resets ist entirety.
Contains TPZSFMatrix class which implements a symmetric full matrix.
int ClassId() const override
Define the class id associated with the class.
int ClassId() const override
Define the class id associated with the class.
Root matrix class (abstract). Matrix.