[Trilinos-Users] Symmetric Epetra_CrsMatrix ?

Heroux, Michael A maherou at sandia.gov
Mon Dec 1 10:58:35 MST 2008


Antoine,

Yes, you can use this with an iterative solver.  If you need just the action of the matrix, you can write an adapter class that derives from Epetra_Operator.  If you need the matrix coefficients (for example, if you are planning to use any Trilinos preconditioners) then you will want to write an adapter class that derives from Epetra_RowMatrix.  The easiest way to do this is to write an adapter for Epetra_BasicRowMatrix.  Since there are far fewer methods that you need to implement.  You can look at Epetra_JadMatrix as a good example for how you could do this.

Writing these adapters should be fairly straight-forward if you use the RowMap, ColMap, DomainMap and RangeMap of your original Epetra_CrsMatrix as maps for your new class.

The only tricky part will be for the Epetra_RowMatrix adapter.  You will need to provide an implementation of four methods (really three that are different, one is a const version of another) that will require knowledge of nonzero terms that are not locally stored because you are only storing the upper or lower triangle.

One approach to make things simpler would be to ignore nonzeros that are not local (since you are only doing preconditioner and don't necessarily need the exact matrix).

I hope this helps.

Mike


On 12/1/08 11:29 AM, "Antoine Dechaume" <boolegue at gmail.com> wrote:

Hi Mike,

thanks for your answer. Is there a way I could use this trick with an iterative solver ?

Antoine.


On 28-Nov-08, at 3:55 PM, Heroux, Michael A wrote:

Antoine,

 There is no explicit support for symmetric storage.  However, it is possible to realize the storage savings by storing the main diagonal as an Epetra_Vector object and the strictly upper or lower triangle as an Epetra_CrsMatrix object.  Then computing y = Ax would be approximatly as follows:

 // upperA and diagA were previously constructed

 Epetra_Vector Atx(y.Map());

 upperA.Multiply(false, x, y);
 upperA.Multiply(true, x, Atx);
 diagA.Multiply(1.0, diagA, x, y, 1.0);
 y.Update(1.0, Atx, 1.0);

 Note that if your x and y are Epetra_MultiVectors, the same sequence works if you make Atx a MultiVector.

 There are other combinations of functions that will work also.  This approach does not get the computational performance that a true symmetric matvec would get, but does save storage.   We have discussed a symmetric multiply function in the past, but have not followed through on its implementation.  When considered in the larger context of preconditioned iterative methods, full support for symmetric storage is a large effort and its payoff is hard to realize for our typical problem base that is primarily a broad set that is mostly nonsymmetric.

 We will continue to evaluate the value of native support for symmetric storage.

 I hope this helps.

 Mike


 On 11/27/08 2:43 PM, "Antoine Dechaume" <boolegue at gmail.com> wrote:


Hello,

 is there a way to specify a symmetric Epetra_CrsMatrix that will store
 only upper part for instance ?

 Antoine.

 _______________________________________________
 Trilinos-Users mailing list
 Trilinos-Users at software.sandia.gov
 http://software.sandia.gov/mailman/listinfo/trilinos-users








-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://software.sandia.gov/mailman/private/trilinos-users/attachments/20081201/40b8a791/attachment-0001.html 


More information about the Trilinos-Users mailing list