# [Trilinos-Users] How to implement Kronecker product and sum of two matrix in Trilinos?

Heroux, Michael A maherou at sandia.gov
Tue Aug 5 12:41:49 MDT 2008

```John,

I have seen this operation before in other applications.  In those situations we have avoided forming the product matrix explicitly since we were really just interested in the application of the matrix to a vector as part of an iterative method, or interested in forming a preconditioner that we could build row-by-row.  Writing

C = A .kp. B

where .kp. is the Kronecker  product and A and B are existing Epetra_CrsMatrix objects,

we can compute y = Cx quite efficiently by applying B to a multivector containing segments of x using and scaling the resulting vectors with coefficients of A to get y.  To get a row of C, we can access a row of B and form the row of C by scaling replication of the B row.

It would be fairly straight-forward to develop an Epetra_RowMatrix adapter that would use the two factor matrices A and B to mimic the product matrix C without explicitly forming the product.  Since the rest of Trilinos preconditioners, solvers, etc., access matrices via the Epetra_RowMatrix interface, this might be the most attractive approach.

Mike

On 8/5/08 10:43 AM, "john" <ax.equal.b at gmail.com> wrote:

Micheal,
Here is a detail definition. It is very common in scientific computing.
http://en.wikipedia.org/wiki/Kronecker_product
I think Trilinos should support it.

2008/8/5 Heroux, Michael A <maherou at sandia.gov>
John,

Can you give more detail on the definition of the operations you want?

There are functions in EpetraExt for multiplying and adding matrices:

http://trilinos.sandia.gov/packages/docs/r8.0/packages/epetraext/doc/html/classEpetraExt_1_1MatrixMatrix.html

Mike

On 8/4/08 11:08 AM, "john" <ax.equal.b at gmail.com> wrote:

Hi,
Everybody, I am now using Trilinos working on solving PDE.
I need to perform Kronecker product and sum of two crs-matrix ,
but I can't find any related modules or codes, so I must code it by myself?
Anybody have similar codes? Please give some suggestions.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://software.sandia.gov/mailman/private/trilinos-users/attachments/20080805/8dab581f/attachment.html
```