<div>These are definitely not dense matrices (>99% zeros). </div><div><br></div><div>The way I described storing them just happened to be a way I found that worked (for EPS = LAPACK). But I want to use methods intended for sparse matrices + MPI.<br>
</div><div><br></div><div>Which is the best canonical PETSc form (for the matrices) and best EPS?</div><div><br></div><div>---John</div><div><br></div><br><div class="gmail_quote">On Mon, Aug 1, 2011 at 2:27 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Mon, Aug 1, 2011 at 6:22 PM, John Chludzinski <span dir="ltr"><<a href="mailto:jchludzinski@gmail.com" target="_blank">jchludzinski@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>I'm a newbie with both PETSc & SLEPc and have had some trouble finding examples/tutorials for newbies. I've looked through the examples in the PETSc and SLEPc directories but still am having "issues" seeing how to set this up for the type of problem I have. </div>
<div><br></div><div>SLEPc ex7.c is a good place to start but there's still how best to store the matrices and which EPS to use (besides LAPACK).</div><div><br></div><div>Found a PDF, "MATRICES IN PETSc", (after much googling) but not sure which of the many forms will work and which is best.</div>
</blockquote><div><br></div></div><div>1) PETSc and SLEPc are designed to be efficient for sparse matrices. If you want eigenvalues of dense matrices, use Elemental (as I pointed out in a previous message)</div><div><br>
</div><div>
2) If you generate matrices with C code, why not just call MatSetValues() for each row in that code?</div><div><br></div><div> Matt</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font color="#888888"><div>---John</div><div><br></div><br></font><div class="gmail_quote"><div>On Mon, Aug 1, 2011 at 2:12 PM, John Chludzinski <span dir="ltr"><<a href="mailto:jchludzinski@gmail.com" target="_blank">jchludzinski@gmail.com</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><font face="courier new,monospace">I have 2 files (matrices) in simply binary form (IEEE-754, generated by some C code) and wished to get them into canonical "PETSc binary form". So I did:</font></div>
<div><font face="courier new,monospace"><br>
</font></div><div style="margin-left:40px !important"><font face="courier new,monospace">Mat A;</font></div><div style="margin-left:40px !important"><font face="courier new,monospace">PetscScalar *a;</font></div>
<div style="margin-left:40px !important"><font face="courier new,monospace"><br></font></div><div style="margin-left:40px !important"><font face="courier new,monospace">ierr = PetscMalloc(SIZE*SIZE*sizeof(PetscScalar),&a);CHKERRQ(ierr);</font></div>
<div style="margin-left:40px !important"><font face="courier new,monospace">// stored the file into the space malloc'ed for 'a'.</font></div><div><div style="margin-left:40px !important"><font face="courier new,monospace">MatCreateSeqDense(PETSC_COMM_SELF, n, n, a, &A);<div>
MatView(A,PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD));</div></font></div><div><br></div></div><div style="margin-left:0px !important"><font face="courier new,monospace">This works when I use: -eps_type lapack. As long as I store the matrix in column major order.</font></div>
<div style="margin-left:0px !important"><font face="courier new,monospace"><br></font></div></div><div><font color="#888888"><div style="margin-left:0px !important"><font face="courier new,monospace">---John</font></div>
</font><div>
<div><div style="margin-left:40px !important">
<br></div><div class="gmail_quote" style="margin-left:40px !important">On Mon, Aug 1, 2011 at 1:40 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<div>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Mon, Aug 1, 2011 at 5:27 PM, John Chludzinski <span dir="ltr"><<a href="mailto:jchludzinski@gmail.com" target="_blank">jchludzinski@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>I create 2 matrices using: </div><div><br></div><div>MatCreateSeqDense(PETSC_COMM_SELF, n, n, Ka, &A);<br></div><div>MatCreateSeqDense(PETSC_COMM_SELF, n, n, Kb, &B);</div><div><br></div><div>These matrices are 99% zeros ( 16,016,004 entries and 18660 non-zeros). They are symmetric and real. Their tri-diagonal elements are non-zero plus a few other entries.</div>
</blockquote><div><br></div></div><div>Please give some justification for doing this? On the surface, it just seems perverse.</div><div><br></div><div> Matt</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>I tried to use ex7 for the generalized eigenvalue problem:</div><div><br></div><div>./ex7.exe -f1 k.dat -f2 m.dat -eps_gen_hermitian -eps_smallest_real > x.out 2>&1</div><div><br></div><div>
without specifying an EPS and get:</div><div><br></div><div style="margin-left:40px !important">Generalized eigenproblem stored in file.<div><br></div><div> Reading REAL matrices from binary files...</div><div> Number of iterations of the method: 500</div>
<div> Number of linear iterations of the method: 4009</div><div> Solution method: krylovschur</div><div><br></div><div> Number of requested eigenvalues: 1</div><div> Stopping condition: tol=1e-07, maxit=500</div><div> Number of converged approximate eigenpairs: 0</div>
</div><div><br></div><div>Is krylovschur inappropriate for this problem or have I set up the problem incorrectly by using
MatCreateSeqDense(...) to create the matrix input files in PETSc binary form?</div><div><br></div><font color="#888888"><div>---John </div>
</font></blockquote></div></div><font color="#888888"><div><br></div><div clear="all"><br></div><div>-- </div><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.</div>
<div>-- Norbert Wiener</div></font></blockquote></div><div>
<br></div><div style="margin-left:40px !important"><br></div>
</div></div></div></blockquote></div><br>
</blockquote></div></div></div><br><br clear="all"><br>-- <br><div><div class="h5">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<br>
</div></div></blockquote></div><br>