[petsc-users] Inverse matrix of MATMPIDENSE matrix

Barry Smith bsmith at mcs.anl.gov
Tue Sep 17 13:28:53 CDT 2013


On Sep 17, 2013, at 1:24 PM, Joon Hee Choi <choi240 at purdue.edu> wrote:

> Thank you for your reply.
> The 10x10 matrix is the result of product between large matrices with 10 different processors.

   Yupe

> So I think I need to gather entries into a processor and create SeqDense matrix.

   Since these are just dense arrays use MatDenseGetArray() /MatDenseRestoreArray() (previously called MatGetArray()/MatRestoreArray() in older versions of PETSc) and then MPI_Gatherv() to get them into a single array on process 0 then MatCreateSeqDense() to create the sequential matrix on process 0.

   Barry


> Could you let me know what to do for gathering entries saved on several processors?
> 
> Sincerely,
> Joon
> 
> ----- Original Message -----
> From: "Barry Smith" <bsmith at mcs.anl.gov>
> To: "Joon Hee Choi" <choi240 at purdue.edu>
> Cc: petsc-users at mcs.anl.gov
> Sent: Tuesday, September 17, 2013 2:10:15 PM
> Subject: Re: [petsc-users] Inverse matrix of MATMPIDENSE matrix
> 
> 
> For parallel dense you need to use MatType MATELEMENTAL and configure PETSc with ../download-elemental
> 
>  Note that if N is 10 then it is insane to do the inverse in parallel. Just use SeqDense. If you want it on two processes just do it on one and send there result to the other or do it on both.
> 
>  Unless the matrix is at least 100s by 100s maybe more I don't see doing it in parallel as saving any time, rather it will be slower
> 
> 
>   Barry
> 
> 
> 
> On Sep 17, 2013, at 1:04 PM, Joon Hee Choi <choi240 at purdue.edu> wrote:
> 
>> Thank you for your reply.
>> However, I followed the manual using MatLUFactor() and MatMatSolve(). However, MatLUFactor() did not support MATMPIDENSE. If my code is wrong, then please let me know. My code is following:
>> 
>> MatGetOrdering(invM2T, MATORDERINGNATURAL, &isr, &isc);
>> MatFactorInfoInitialize(&info);
>> MatLUFactor(invM2T, isr, isc, &info);
>> MatMatSolve(invM2T, M1T, *M3T);
>> 
>> If not so, then please let me know which function I have to use. Thank you.
>> 
>> Sincerely,
>> Joon
>> 
>> ----- Original Message -----
>> From: "Barry Smith" <bsmith at mcs.anl.gov>
>> To: "Joon Hee Choi" <choi240 at purdue.edu>
>> Cc: petsc-users at mcs.anl.gov
>> Sent: Tuesday, September 17, 2013 7:59:42 AM
>> Subject: Re: [petsc-users] Inverse matrix of MATMPIDENSE matrix
>> 
>> http://www.mcs.anl.gov/petsc/documentation/faq.html#invertmatrix
>> 
>> 
>> On Sep 17, 2013, at 1:07 AM, Joon Hee Choi <choi240 at purdue.edu> wrote:
>> 
>>> Hello,
>>> 
>>> I want to get the inverse matrix of 10 x 10 MATMPIDENSE matrix. I know I cannot use MatLUFactor() for MATMPIDENSE. Is there any other method? Could you let me know the fastest way to get the inverse? Also, I don't want to rebuild or configure something for the inverse because I use petsc in my school server and I don't have permission to configure.
>>> 
>>> Thanks,
>>> Joon
>> 
> 



More information about the petsc-users mailing list