<div dir="ltr">I am trying to understand how to use a transposed matrix view along the lines of Numpy (<a href="https://github.com/ParRes/Kernels/blob/master/PYTHON/transpose-numpy.py#L99">https://github.com/ParRes/Kernels/blob/master/PYTHON/transpose-numpy.py#L99</a>).<br><br><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateTranspose.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateTranspose.html</a> says<br><br>"Creates a new matrix object that behaves like A'"<br><br>But later it seems to suggest that this is only true when performance a matrix-vector product:<br><br>"Rather the new matrix object performs the matrix-vector product by using the MatMultTranspose() on the original matrix"<br><br>I got the idea to use this view concept from <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatTranspose.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatTranspose.html</a>, which says:<br><br>"Consider using MatCreateTranspose() instead if you only need a matrix that behaves like the transpose, but don't need the storage to be changed."<div><br></div><div>When I try to use the transpose view in MatAXPY using this code:</div><div>    Mat AT;<br>    ierr = MatCreateTranspose(A, &AT); // create transpose view of A<br>    ierr = MatAXPY(B, one, AT, SAME_NONZERO_PATTERN);<br></div><div><br></div><div>I get an error suggesting that I am doing something bad:</div><div><br></div><div>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>[0]PETSC ERROR: Object is in wrong state<br>[0]PETSC ERROR: Not for unassembled matrix (Y)<br>[0]PETSC ERROR: See <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html">https://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>[0]PETSC ERROR: Petsc Release Version 3.13.1, unknown <br>[0]PETSC ERROR: ./transpose-petsc on a  named jrhammon-nuc by jrhammon Mon Jun  1 15:38:20 2020<br>[0]PETSC ERROR: Configure options --prefix=/home/jrhammon/PRK/deps/petsc --with-blaslapack-dir=/opt/intel/inteloneapi/mkl/2021.1-beta06 --with-mpi-dir=/opt/intel/inteloneapi/mpi/2021.1-beta06 --with-cxx=0 --with-fc=0<br>[0]PETSC ERROR: #1 MatAXPY() line 74 in /home/jrhammon/PRK/deps/petsc-src/src/mat/utils/axpy.c<br>[0]PETSC ERROR: #2 main() line 170 in transpose-petsc.c<br>[0]PETSC ERROR: PETSc Option Table entries:<br>[0]PETSC ERROR: -i 10<br>[0]PETSC ERROR: -n 100<br>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------<br></div><div><br></div><div>What do I need to do to use a transpose view properly outside of M*V?</div><div><br>Thanks,</div><div><br></div><div>Jeff</div><div><br></div><div>--<br>Jeff Hammond<br><a href="mailto:jeff.science@gmail.com">jeff.science@gmail.com</a><br><a href="http://jeffhammond.github.io/">http://jeffhammond.github.io/</a><br></div></div>