42 #include "Ifpack_SerialTriDiSolver.h"
43 #include "Ifpack_SerialTriDiMatrix.h"
44 #include "Epetra_SerialDenseVector.h"
53 EstimateSolutionErrors_(false),
54 SolutionErrorsEstimated_(false),
57 ReciprocalConditionEstimated_(false),
58 RefineSolution_(false),
59 SolutionRefined_(false),
98 void Ifpack_SerialTriDiSolver::InitPointers()
112 void Ifpack_SerialTriDiSolver::DeleteArrays()
114 if (IWORK_ != 0) {
delete [] IWORK_;IWORK_ = 0;}
115 if (FERR_ != 0) {
delete [] FERR_; FERR_ = 0;}
116 if (BERR_ != 0) {
delete [] BERR_; BERR_ = 0;}
117 if (Factor_ != Matrix_ && Factor_ != 0) {
delete Factor_; Factor_ = 0;}
118 if (Factor_ !=0) Factor_ = 0;
120 if (IPIV_ != 0) {
delete [] IPIV_;IPIV_ = 0;}
121 if (WORK_ != 0) {
delete [] WORK_;WORK_ = 0;}
123 if (AF_ !=0) AF_ = 0;
129 void Ifpack_SerialTriDiSolver::ResetMatrix()
161 void Ifpack_SerialTriDiSolver::ResetVectors()
167 ReciprocalConditionEstimated_ =
false;
168 SolutionRefined_ =
false;
170 SolutionErrorsEstimated_ =
false;
178 if (B_in.
N() != X_in.
N()) EPETRA_CHK_ERR(-1);
179 if (B_in.
A()==0) EPETRA_CHK_ERR(-2);
180 if (X_in.
A()==0) EPETRA_CHK_ERR(-4);
193 EstimateSolutionErrors_ = Flag;
195 RefineSolution_ = RefineSolution_ || Flag;
201 if (
Inverted()) EPETRA_CHK_ERR(-100);
211 if (RefineSolution_ ) {
215 LDAF_ = Factor_->LDA();
218 if (IPIV_==0) IPIV_ =
new int[N_];
220 double * DL_ = F->
DL();
221 double * D_ = F->D();
222 double * DU_ = F->DU();
223 double * DU2_ = F->DU2();
225 lapack.GTTRF(N_, DL_, D_, DU_, DU2_, IPIV_, &INFO_);
231 EPETRA_CHK_ERR(INFO_);
249 if (B_==0) EPETRA_CHK_ERR(-3);
250 if (X_==0) EPETRA_CHK_ERR(-4);
253 double DNRHS = NRHS_;
256 EPETRA_CHK_ERR(-101);
274 double * DL_ = F->
DL();
275 double * D_ = F->D();
276 double * DU_ = F->DU();
277 double * DU2_ = F->DU2();
279 lapack.GTTRS(TRANS_,N_,NRHS_,DL_,D_,DU_,DU2_,IPIV_,X_,N_,&INFO_);
281 if (INFO_!=0) EPETRA_CHK_ERR(INFO_);
288 if (ierr1!=0) EPETRA_CHK_ERR(ierr1)
290 EPETRA_CHK_ERR(ierr);
297 std::cout<<
" SerialTriDiSolver::ApplyRefinement this function is not supported"<<std::endl;
298 EPETRA_CHK_ERR(-102);
310 lapack.GETRI ( N_, AF_, LDAF_, IPIV_, WORK_, LWORK_, &INFO_);
317 EPETRA_CHK_ERR(INFO_);
330 if (ANORM_<0.0) ANORM_ = Matrix_->
OneNorm();
332 if (ierr!=0) EPETRA_CHK_ERR(ierr-2);
337 lapack.GECON(
'1', N_, AF_, LDAF_, ANORM_, &RCOND_, WORK_, IWORK_, &INFO_);
338 ReciprocalConditionEstimated_ =
true;
341 EPETRA_CHK_ERR(INFO_);
347 if (Matrix_!=0) os <<
"Solver Matrix" << std::endl << *Matrix_ << std::endl;
348 if (Factor_!=0) os <<
"Solver Factored Matrix" << std::endl << *Factor_ << std::endl;
349 if (LHS_ !=0) os <<
"Solver LHS" << std::endl << *LHS_ << std::endl;
350 if (RHS_ !=0) os <<
"Solver RHS" << std::endl << *RHS_ << std::endl;