[petsc-users] MatMatMult with dense matrices.

James A Charles charlesj at purdue.edu
Sun Apr 5 17:15:50 CDT 2015


Hi Hong, 

A is also dense. It was converted to dense in an intermediate calculation before this particular multiplication. So far I have only been doing this in our code. Let me write a stand alone PETSc cdoe and I will get back to you. 

Thanks,
James

----- Original Message -----
From: "Hong" <hzhang at mcs.anl.gov>
To: "Barry Smith" <bsmith at mcs.anl.gov>
Cc: "James A Charles" <charlesj at purdue.edu>, "Hong" <hzhang at mcs.anl.gov>, dlemus at purdue.edu, "PETSc users list" <petsc-users at mcs.anl.gov>, "Daniel Mejia" <denphi at denphi.com>, "Tillmann Kubis" <tkubis at purdue.edu>
Sent: Sunday, April 5, 2015 6:13:42 PM
Subject: Re: [petsc-users] MatMatMult with dense matrices.


James, 


My understanding is that 
you call MatMatMult in sequential for computing C = A*B, in which 
A is in aij format, and B is dense, and the product C is dense, but gives different values than what you got from Matlab. 


Do you have a stand-alone petsc code to reproduce this so I can investigate what goes wrong? 


Hong 



On Sun, Apr 5, 2015 at 3:44 PM, Barry Smith < bsmith at mcs.anl.gov > wrote: 



We would need to see the PETSc side of the code to see if there is anything wrong there. 



> On Apr 5, 2015, at 3:35 PM, James A Charles < charlesj at purdue.edu > wrote: 
> 
> Hi Hong, 
> 
> You can open up matmatmult_comparison.mat in MATLAB ( load matmatmult_comparison.mat ). That .mat contains A, B, C, and C_MATLAB. I called matmatmult in sequential. We use AIJ when A2 was sparse but at the time of this multiplication everything was dense. 
> 
> Thanks, 
> James 
> 
> 
> ----- Original Message ----- 
> From: "Hong" < hzhang at mcs.anl.gov > 
> To: "James A Charles" < charlesj at purdue.edu > 
> Cc: "PETSc users list" < petsc-users at mcs.anl.gov >, dlemus at purdue.edu , "Daniel Mejia" < denphi at denphi.com >, "Tillmann Kubis" < tkubis at purdue.edu > 
> Sent: Sunday, April 5, 2015 4:25:39 PM 
> Subject: Re: [petsc-users] MatMatMult with dense matrices. 
> 
> 
> 
> 
> James: 
> 
> 
> I'm multiplying two dense matrices. I compared the results against MATLAB and I am getting different results. Attached you will see a zip that contains a .mat file that has the A, B, and C. C_MATLAB is the multiplication of A*B in MATLAB and C is the PETSc 3.4.3 result. I also attached the .m files A, B, and C that were saved from PETSc. Is there something I'm doing wrong or 
> 
> 
> What is the file type of matmatmult_comparison.mat? 
> How to read it? 
> I need to see how it defers from C.m. 
> 
> 
> 
> any reason due to the shape of the matrices that this would fail? If it gives any more information we convert the previous matrix that A is formed of A2 (A = A1*A2) to dense prior to the multiplication using MatConvert. 
> 
> 
> 
> It seems both A and B are dense, complex square matrices. 
> Did you call MatMatMult() in sequential or parallel? What matrix format did you use? 
> 
> 
> Hong 




More information about the petsc-users mailing list