[petsc-users] MatCreateTranspose

Carl-Johan Thore carljohanthore at gmail.com
Tue Apr 9 09:19:40 CDT 2024


Thanks for the suggestion. I don't have a factored matrix (and can't really
use direct linear solvers) so MatSolveTranspose doesn't seem to be an
option.
I should have mentioned that I've also tried KSPSolveTranspose but that
doesn't work with pcredistribute
/Carl-Johan

On Tue, Apr 9, 2024 at 3:59 PM Zhang, Hong <hzhang at mcs.anl.gov> wrote:

> Carl-Johan,
> You can use MatSolveTranspose() to solve A'*x = b. See
> petsc/src/ksp/ksp/tutorials/ex79.c
>
> `MatCreateTranspose()` is used if you only need a matrix that behaves like
> the transpose, but don't need the storage to be changed, i.e., A and A'
> share same matrix storage, thus MatGetRow() needs to get columns of A,
> which is not supported.
>
> Hong
> ------------------------------
> *From:* petsc-users <petsc-users-bounces at mcs.anl.gov> on behalf of
> Carl-Johan Thore <carljohanthore at gmail.com>
> *Sent:* Tuesday, April 9, 2024 6:38 AM
> *To:* petsc-users <petsc-users at mcs.anl.gov>
> *Subject:* [petsc-users] MatCreateTranspose
>
> Hi, I have a matrix A with transpose A' and would like to solve the linear
> system A'*x = b using the pcredistribute preconditioner. It seemed like a
> good idea to use MatCreateTranspose, but this leads to [0]PETSC ERROR:
> ---------------------
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>
> ZjQcmQRYFpfptBannerEnd
> Hi,
>
> I have a matrix A with transpose A' and would like to solve the linear
> system A'*x = b using the pcredistribute preconditioner. It seemed like a
> good idea to use MatCreateTranspose, but this leads to
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: No support for this operation for this object type
> [0]PETSC ERROR: No method getrow for Mat of type transpose
> [0]PETSC ERROR: See https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!ep5IoJ3UZoQ62Wb4ElaMmi9G3Svqdr3ldXVnCRd-47InZQBv34SgL7WDdEFLYJDtFYzCdxXGf4WaQ9U5JwPTNHtq_gyDKw$ 
> <https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!bVYrcPfbXSXCcthSH37OClTgnf7RxkizULEW1ZZJ5yYG3-50366x_OFSPmOgGWEcOeFyOmAMSFewAyCnxIUg7K8W_neRPw$>
> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.21.0, unknown
> [0]PETSC ERROR: Configure options COPTFLAGS="-O3 -march=native"
> CXXOPTFLAGS="-O3 -march=native" --with-fortran-bindings=0 FOPTFLAGS="-O3
> -march=native" CUDAOPTFLAGS=-O3 --with-cuda --with-cusp --with-debugging=0
> --download-scalapack --download-hdf5 --download-zlib --download-mumps
> --download-parmetis --download-metis --download-ptscotch --download-hypre
> --download-spai
> [0]PETSC ERROR: #1 MatGetRow() at
> /mnt/c/mathware/petsc/petsc-v3-21-0/src/mat/interface/matrix.c:573
> [0]PETSC ERROR: #2 PCSetUp_Redistribute() at
> /mnt/c/mathware/petsc/petsc-v3-21-0/src/ksp/pc/impls/redistribute/redistribute.c:111
> [0]PETSC ERROR: #3 PCSetUp() at
> /mnt/c/mathware/petsc/petsc-v3-21-0/src/ksp/pc/interface/precon.c:1079
> [0]PETSC ERROR: #4 KSPSetUp() at
> /mnt/c/mathware/petsc/petsc-v3-21-0/src/ksp/ksp/interface/itfunc.c:415
>
> MatTranspose is a working alternative, but MatCreateTranspose would be
> preferable. In principle the solution seems straightforward -- just add a
> getrow method -- but is it, and is it a good idea (performancewise etc)?
>
> Kind regards,
> Carl-Johan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240409/e3be13a0/attachment.html>


More information about the petsc-users mailing list