[Trilinos-Users] Problem with EpetraExt::MatrixMatrix::Multiply

bender calculon calculondonbot777 at hotmail.com
Sun Sep 20 04:32:22 MDT 2009


Hi,

I have this problem with EpetraExt:MatrixMatrix::Multiply. I
want to multiply two Epetra_CrsMatrix get from
Trilinos_Util::CrsMatrixGallery.
If I multiply two full matrix ( for
example Hilber Matrix, Cauchy matrix or kms matrix ) or two diagonal
matrix I obtain a correct result, but if I multiply two sparse matrix i
obtain an absurd result.

I explain my problem with a part of my code:

Trilinos_Util::CrsMatrixGallery Problem(problem, Comm);   // problem = "laplace_2d"
            Problem.Set("problem_size",size);                               // size = 4
            Problem.Set("map_type","linear");
            read_A = Problem.GetMatrix();                                   // Epetra_CrsMatrix *read_A
            Num_Glob = read_A->Map().NumGlobalElements();    // int Num_Glob
            Epetra_Map Map_func(Num_Glob,0,Comm);                 
            Epetra_Export exporter(read_A -> Map(), Map_func);     // I want to export  data from *read_A to matrix_A
            Epetra_CrsMatrix Matrix_A(Copy, Map_func, 0);
                        Matrix_A.Export(*read_A,exporter, Zero);
                        Matrix_A.FillComplete();        
            cout << Matrix_A;                                                                
            Epetra_CrsMatrix Matrix_C(Matrix_A);                             // copy of Matrix_A;
            Matrix_C.PutScalar(0);
            Matrix_C.FillComplete();
           
EpetraExt::MatrixMatrix::Multiply(Matrix_A,false,Matrix_A,false,Matrix_C);  
// This operation make Matrix_C = Matrix_A*Matrix_A +C not C = A*A 
           
If i put problem = "laplace_2d" and "problem_size" = 4 I obtain this result:

./ex2.exe -problem laplace_2d -size 4
Epetra::CrsMatrix

Number of Global Rows        = 4
Number of Global Cols        = 4
Number of Global Diagonals   = 4
Number of Global Nonzeros    = 12
Global Maximum Num Entries   = 3

Number of My Rows        = 4
Number of My Cols        = 4
Number of My Diagonals   = 4
Number of My Nonzeros    = 12
My Maximum Num Entries   = 3

   Processor    Row Index    Col Index           Value     
       0             0             0                      17    
       0             0             1                      -8    
       0             0             2                      -4    
       0             1             0                       0    
       0             1             1                       0    
       0             1             3                       0    
       0             2             0                       0    
       0             2             2                       0    
       0             2             3                       0    
       0             3             1                       0    
       0             3             2                       0    
       0             3             3                       0  

and you can see that is not correct.

I have trilinos release 9.0.

T

Best regards

Maurizio 
_________________________________________________________________
Condividi i tuoi ricordi online con chi vuoi tu.
http://www.microsoft.com/italy/windows/windowslive/products/photos-share.aspx?tab=1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20090920/7af6a020/attachment.html 


More information about the Trilinos-Users mailing list