Hi,

On Thursday, May 24, 2018 at 11:34:10 AM UTC-4, zeng wrote:
>
> Actually I want to solve an equation as: A^T x = b. I already know A, how 
> should I get its transpose? 
>
> I note that there is a member function of SparseDirectUMFPACK solver:
> void Tvmult (Vector<double>& dst, const Vector<double>& src), 
> which can fulfil my purpose, since this function multiplies with A^{-T}, 
> i.e. it returns an approximate solution of *A^Tx = b.*
>
> *But what if I want to use a gmres solver? I didn't find in the manual 
> such a function to get the transpose of a sparse matrix. can someone help 
> me out? Many thanks!*
>
deal.II's own matrices do not have an easy way to get the transpose. The 
easiest is to use a Trilinos matrix instead because it allows you to simply 
switch to the transpose version (see here 
<http://dealii.org/9.0.0/doxygen/deal.II/classTrilinosWrappers_1_1SparseMatrix.html#a1a7a578fb46241991114a6ffa99cd3fe>).
 
The other solution is to create your own matrix type which calls dealii's 
Tvmult when you call vmult on your matrix. Something like:

class MyMatrix
{
  public:
  MyMatrix(SparseMatrix<double> &m) 
 :
dealii_matrix(m)
{}

   void vmult(Vector &dst, const Vector &src) {dealii_matrix.Tvmult(dst, 
src);}
   // a few other functions needed by gmres
 
private:
   SparseMatrix<double> &dealii_matrix;
};

Best,

Bruno

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to