[petsc-users] question about special matrix-matrix-matrix product
Kubis, Tillmann C
tkubis at purdue.edu
Wed Jul 31 07:36:59 CDT 2013
Hi,
Thanks a lot. The serial version is working fine now. It will take a while until I can try the parallel one.
Thanks,
Tillmann Kubis
____________________________________
Tillmann Kubis, PhD
Research Assistant Professor
Network for Computational Nanotechnology
207 S Martin Jischke Drive
Purdue University, DLR, room 441-5
West Lafayette, Indiana 47907-1971
phone: +1-765-496-7312
fax: +1-765-496-6026
-----Original Message-----
From: Barry Smith [mailto:bsmith at mcs.anl.gov]
Sent: Tuesday, July 30, 2013 3:08 PM
To: Kubis, Tillmann C
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] question about special matrix-matrix-matrix product
Tillman,
If you only need the diagonal of the product then computing just the diagonal is the way to go. Use MatGetRow() on Gamma but use MatDenseGetArray() on the dense matrix. Then each entry of the diagonal is one row of the Gamma (sparse) times one column of the dense matrix. (PETSc dense matrices are stored column oriented so a column is entries next to each other. Do this for Seq first. Once you have the seq understood and working well you can do the parallel.
The parallel is a bit more involved since on each process you will need parts of the dense matrix that are stored on other processes. I would start by using MatMPIAIJGetSeqAIJ(mat,&Ad,&Ao,&colmap) the final argument to this tells which off-processor rows of the dense matrix are needed on each process to compute the computation locally (each process will need all the columns of the dense matrix associated with its "owned/local" columns. You move those needed values over using MPI and then do two local products for each diagonal entry: row of Ad * local column of the dense matrix + row of Ao * (collected from other processes part of dense matrix).
Barry
On Jul 29, 2013, at 12:38 PM, "Kubis, Tillmann C" <tkubis at purdue.edu> wrote:
> Hello,
> I need the diagonal of GR*Gamma*GR^dagger , where Gamma is a sparse and GR is a dense matrix. Is there a good/already coded way to do that?
> I am up to write most of the product myself using the method MatGetRow on GR and Gamma and multiplying the elements directly. So far these are serial complex matrices, but all matrices will be distributed in the end.
> Thanks,
> Tillmann Kubis
> ____________________________________
> Tillmann Kubis, PhD
> Research Assistant Professor
> Network for Computational Nanotechnology
> 207 S Martin Jischke Drive
> Purdue University, DLR, room 441-1
> West Lafayette, Indiana 47907-1971
> phone: +1-765-496-7312
> fax: +1-765-496-6026
>
More information about the petsc-users
mailing list