<div dir="ltr"><div dir="ltr">Dear Matt,<div><br></div><div>I understood that you are right. I changed sizeof(values) with ncols, it gives matrix correctly. </div><div><br></div><div>However, now I get an error in EPSGetEigenpair:</div><div><br></div><div><div>0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</div><div>[0]PETSC ERROR: Argument out of range</div><div>[0]PETSC ERROR: Argument 2 out of range</div><div>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">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: ./ENYENI_FINAL on a arch-linux2-c-debug named <a href="http://70a.wls.metu.edu.tr">70a.wls.metu.edu.tr</a> by edaoktay Mon Mar 11 16:17:25 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 EPSGetEigenpair() line 398 in /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/externalpackages/git.slepc/src/eps/interface/epssolve.c</div></div><div><br></div><div>I understood from this error that the matrix does not converge. However, I tested in MATLAB and it converges. The matrix is true now, so this cannot be from the matrix.</div><div><br></div><div>Thanks,</div><div><br></div><div>Eda</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr">eda.oktay@metu.edu.tr</a>>, 11 Mar 2019 Pzt, 16:07 tarihinde şunu yazdı:<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">Dear Matt,<div><br></div><div>I printed in wrong state, ncols gives right solution.</div><div><br></div><div>But I still can't understand the first problem.</div><div><br></div><div>Eda</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr" target="_blank">eda.oktay@metu.edu.tr</a>>, 11 Mar 2019 Pzt, 16:05 tarihinde şunu yazdı:<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">Dear Matt,<div><br></div><div>Thank you for answering. First of all, sizeof(vals) returns to number of entries, I checked. Secondly, I found a problem:</div><div><br></div><div>ncols gives me 6.95328e-310. However, I checked the matrix L, it was computed properly. </div><div><br></div><div>Why can ncols give such a value?</div><div><br></div><div>Thanks,</div><div><br></div><div>Eda</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>, 11 Mar 2019 Pzt, 15:56 tarihinde şunu yazdı:<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">On Mon, Mar 11, 2019 at 8:27 AM Eda Oktay via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">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,</div><div><br></div><div>I have a following part of a code which tries to change the nonzero values of matrix L with -1. However in MatSetValues line, something happens and some of the values in matrix turns into 1.99665e-314 instead of -1. Type of arr is defined as PetscScalar and arr is produced correctly. What can be the problem, is there a mistake about types?</div><div><br></div><div>Thanks,</div><div><br></div><div>Eda</div><div><br></div><div><br></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></div></div></blockquote><div><br></div><div>This is wrong. sizeof(vals) gives bytes, not entries. Why don't you just use ncols here?</div><div><br></div><div>  Matt</div><div>                                                        </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 = PetscMalloc1(s,&arr);CHKERRQ(ierr);                              </div><div>            for(j=0;j<s;++j){                                                       </div><div>                arr[j]=-1.0;</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 clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_8914116894423763251gmail-m_-3665790989257196942gmail-m_-8640460491005429091gmail_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>
</blockquote></div>
</blockquote></div>
</blockquote></div>