# [Trilinos-Users] Find multiplication of two symmetric CRS matrix with trucation.

Heroux, Mike MHeroux at csbsju.edu
Wed Nov 20 07:46:42 MST 2013

```Let me ask a few questions:

Is "x" your matrix?  Are you trying to explicitly build a new matrix that is the sum of two matrix powers?

If so, what are you going to do with x_{new}?  In other words what is the next step in your algorithm?

In many instances, it is best to not explicitly form matrix products if at all possible, for the reasons you observe.  It is very expensive to compute, and the resulting matrix become nearly dense.

Mike

From: Sunghwan Choi <sunghwanchoi91 at gmail.com<mailto:sunghwanchoi91 at gmail.com>>
Date: Wednesday, November 20, 2013 7:49 AM
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] Find multiplication of two symmetric CRS matrix with trucation.

Hi,
I am Sunghwan Choi. I want to multiply two symmetric matrix with truncation.
I tried MatrixMatrix::Multiply but it takes too much times. It takes more time than diagonalization of CRSMatrix.
I iteratively computed x_{new} = 3x^2-2x^3 with MatrixMatrix::Add and MatrixMatrix::Multiply. After few iterations, almost all elements of matrix is non-zero. I think that is the reason that increase the multiplication time.
Therefore I need to truncate very small values such as 10^-10. Is there function to do that?
I can program simple function but I am not good at optimization. This function will significantly takes time in my whole program so I want to use highly optimized one.
If someone can program the function with high optimization, please help me. I have no experience with optimization codes but I know how optimization deeply related to the performance.

Sincerely
Sunghwan Choi

```