MatTranspose

Satish Balay balay at mcs.anl.gov
Tue Apr 8 08:52:06 CDT 2008


On Tue, 8 Apr 2008, Matthew Knepley wrote:

> On Tue, Apr 8, 2008 at 5:40 AM, Toby D. Young <tyoung at ippt.gov.pl> wrote:
> >
> >
> >  Hello all.
> >
> >  I confused about the statement on MatTranspose() on the manual pages at
> >
> >  http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatTranspose.html
> >
> >  where for
> >
> >  #include "petscmat.h"
> >  PetscErrorCode  MatTranspose(Mat mat,Mat *B)
> >
> >  is the statement:
> >
> >  Notes
> >  If you pass in PETSC_NULL for B an in-place transpose in mat will be
> >  done
> >
> >  Does this mean that if I pass PETSC_NULL then the matrix "A" will be
> >  returned as its own transpose? Does this save memory if I do not need
> 
> Yes.
> 
> >  the original matrix and only its transpose? If not, is there an
> 
> Yes.
> 
>    Matt
> 
> >  efficient way to destroy the original matrix, thus keeping the
> >  transpose only?


Jut a note: MatTranspose(A,PETSC_NULL) is *almost* equivalent to:

MatTranspose(A,&B) 
MatDestroy(A)
A=B

So there is temporary increase in memory usage - until the original
matrix is deallocated.

Satish




More information about the petsc-users mailing list