<div dir="ltr"><div dir="ltr">On Thu, Feb 28, 2019 at 3:15 AM Eda Oktay via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello,<br></div><div><br></div><div>I am trying to use MatTranspose function as in below (last row) but I get an error like this:</div><div><div>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</div><div>[0]PETSC ERROR: Object is in wrong state</div><div>[0]PETSC ERROR: Not for unassembled matrix</div><div>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div><div>[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018 </div><div>[0]PETSC ERROR: ./FINAL on a arch-linux2-c-debug named localhost.localdomain by edaoktay Wed Feb 27 16:36:34 2019</div><div>[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas --download-metis --download-parmetis --download-superlu_dist --download-slepc --download-mpich</div><div>[0]PETSC ERROR: #1 MatTranspose() line 4821 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: #2 main() line 185 in /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/FINAL.c</div><div>[0]PETSC ERROR: PETSc Option Table entries:</div><div>[0]PETSC ERROR: -f /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/small</div><div>[0]PETSC ERROR: -unweighted</div><div>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------</div></div><div><br></div><div>I understood that error states that there is an unassembled matrix but there is not, as it can be seen below, I defined NSymmA and I want to get NSymmAtr. </div><div><br></div><div>This not the first time I use MatTranspose but I only get this error here. What can be the reason? </div><div><br></div><div>Best regards,</div><div><br></div><div>Eda</div><div><br></div><div><br></div><div>ierr = MatGetOwnershipRange(L,&mm,&nn);CHKERRQ(ierr); </div><div> </div><div> ierr = MatDuplicate(A,MAT_DO_NOT_COPY_VALUES,&NSymmA);CHKERRQ(ierr); </div><div> for(rw = mm; rw<nn; ++rw){ </div><div> ierr = MatGetRow(L,rw,&ncols,&cols,&vals);CHKERRQ(ierr); </div><div> s = sizeof(vals); </div><div> ierr = PetscMalloc1(s,&arr);CHKERRQ(ierr); </div><div> for(j=0;j<s;++j){ </div><div> arr[j]=-1;</div><div> }</div><div> ierr = MatSetValues(NSymmA,1,&rw,ncols,cols,arr,INSERT_VALUES);CHKERRQ(ierr);</div><div> ierr = MatRestoreRow(L,rw,&ncols,&cols,&vals);CHKERRQ(ierr);</div><div> } </div></div></div></div></blockquote><div><br></div><div> You have to assemble here since you called MatSetValues().</div><div><br></div><div> Matt</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div> ierr = MatTranspose(NSymmA,MAT_INITIAL_MATRIX,&NSymmAtr);CHKERRQ(ierr);</div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>