[Trilinos-Users] Epetra_SerialDenseSolver, Solve method.

Heroux, Mike MHeroux at csbsju.edu
Wed Nov 27 12:46:01 MST 2013


Luca,

The reason for wanting B and X to be the same array is that the next line of code:

    GETRS(TRANS_, N_, NRHS_, AF_, LDAF_, IPIV_, X_, LDX_, &INFO_);

 is a call to the LAPACK function DGETRS, which expects the RHS and solution vector to be the same array.

I think you can fix this issue by passing X in as both arguments to the SetVectors method.  Make sure that prior to calling Solve, X contains the right-hand-side values.

Does this help?

Mike

From: <Bertagna>, Luca <lbertag at emory.edu<mailto:lbertag at emory.edu>>
Date: Monday, November 25, 2013 6:46 PM
To: "trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>" <trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>>
Subject: [Trilinos-Users] Epetra_SerialDenseSolver, Solve method.


Dear all,

I have a question about Epetra_SerialDenseSolver, in particular about its Solve method.

I am calling Solve after setting as solution vector an Epetra_SerialDenseVector X which is the view of an array Y. However, when the Solve method is performed and the matrix is not inverted, the following piece of code is executed:


    if (B_!=X_) {

       *LHS_ = *RHS_; // Copy B to X if needed

       X_ = LHS_->A(); LDX_ = LHS_->LDA();

    }


This copies the rhs B into the solution vector X, which causes the loss of the view property of the vector X.

I'm having a hard time understanding what's the reason of this implementation choice. After all, if the matrix is already inverted, this copy X => B is not performed (there's even a comment specifying that B and X must be different in that case). And, even more, X and B might even have different dimensions, as far as I understand (otherwise the variable MinMN_ would have no meaning).

Thanks


Luca Bertagna
Math&CS, Emory University, Atlanta
www.mathcs.emory.edu/~lbertag



More information about the Trilinos-Users mailing list