[Trilinos-Users] Matrix-Matrix Multiplication (PtAP)

Alexander Heinlein aheinlei at uni-koeln.de
Tue Apr 28 10:36:29 EDT 2015


Dear Trilinos Users,

within my application I have to perform a matrix-matrix multiplication of P^tAP-type. Because, so far, I am mainly using the Epetra package, 
I tried to to use the MatrixMatrix::Multiply method which is provided in the EpetraExt package. Soon, I realized that the multiplication
P^tA is getting extremely slow when the size of the matrices and the number of MPI-processes increase.

First I tried to replace the MatrixMatrix::Multiply method by the ML_Epetra::ML_Epetra_PtAP method, but this led to segmentation faults for
any size of the matrices. Thus I tried to build up a very simple example with the matrices P 

   Processor    Row Index    Col Index           Value
       0             0             0                       1
       0             1             0                       1
       0             2             0                       1
       1             3             0                       1
       1             3             1                       1
       1             4             0                       1
       1             4             1                       1
       1             5             0                       1
       1             5             1                       1
       2             6             1                       1
       2             7             1                       1
       2             8             1                       1

and A

   Processor    Row Index    Col Index           Value
       0             0             0                       1
       0             0             1                       2
       0             1             0                       2
       0             1             1                       3
       0             1             2                       4
       0             2             1                       4
       0             2             2                       5
       0             2             3                       6
       1             3             2                       6
       1             3             3                       7
       1             3             4                       8
       1             4             3                       8
       1             4             4                       9
       1             4             5                      10
       1             5             4                      10
       1             5             5                      11
       1             5             6                      12
       2             6             5                      12
       2             6             6                      13
       2             6             7                      14
       2             7             6                      14
       2             7             7                      15
       2             7             8                      16
       2             8             7                      16
       2             8             8                      17.

For these matrices, again, using the multiplication of the EpetraExt package led to the correct result, while the method ML_Epetra::ML_Epetra_PtAP led to 
segmentation faults. (When I use ML_Epetra::ML_Epetra_PtAP on just one process, it works.)

Additionally I tried to transpose the matrix P explicitly using ML_Operator_Transpose_byrow, and then to do the multiplication using the EpetraExt package.
Unfortunately, this yielded the wrong result.

Does anyone have experiences with this kind of multiplication? Do you have any suggestions how to implement this multiplication for arbitrary matrices in an 
efficient way? Thank you a lot!

Best regards,
Alexander Heinlein


More information about the Trilinos-Users mailing list