On Sat, Jul 30, 2011 at 11:11 AM, Shitij Bhargava <span dir="ltr"><<a href="mailto:shitij.cse@gmail.com">shitij.cse@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi !!<br><br>I have just started using SLEPc/PETSc.<br><br>The problem that I am trying to solve is that I have some routines calculating one row at a time of a matrix, which I want to insert in some sparse matrix representation, and then find the next row, insert it, and so on. (This is being done to avoid the need to have one big NxN matrix in memory).The matrix is also symmetric, so the row that the subroutines produce is such that any non-zero element can be present only in that part of the row corresponding to the upper triangle of the matrix. (all others are zero). After I have the matrix in sparse format, I want to find all the eigenvalues and eigenvectors.<br>
<br>Till now I have been using the SeqAij matrix and MatSetValues method with preallocation set appropriately, but I am not satisfied with its performance (the way I am doing it). When one row is produced, I insert it into the AIJ matrix, so there are total of N calls to MatSetValues. Also even though the matrix is symmetric, i have to enter the full matrix, as otherwise the eigensolver doesnt seem to produce the right answer (Why ? I set the problem type to EPS_HEP, but still it requires me to store the full matrix ? It is written in documentation that problem type should always be specified so that the eigensolver can take advantage of it (symmetry in this case), but considering that I still have to store the full matrix, it meant 'advantage' only in time, not memory ?....when I set the problem type to EPS_HEP, it means that it will take only the upper or lower triangle right ? why should it require both ? Is this because the matrix type is not symmetric, unlike SBAIJ ?)<br>
</blockquote><div><br></div><div>You must set the type to SBAIJ in order to enter only the symmetric part.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
So, if I use SBAIJ and say, enter some bs rows at a time into the SBAIJ matrix, will it be faster ? Also, in that case would I still have to enter both upper and lower triangle or only one (I hope only one, otherwise the 'S' doesnt make sense to me, but in that case, which one ? The eigensolver doesnt give me an option to specify if the upper or lower triangle is stored in the matrix in case the problem type is EPS_HEP). Will the eigensolver produce the right answers in this case ? (say, storing only upper triangle in SBAIJ, instead of both)<br>
</blockquote><div><br></div><div>I do not think it will be noticeably faster. Value entry is usually not a large part of the time. YOu can check this using -log_summary.</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MATSEQSBAIJ.html#MATSEQSBAIJ">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MATSEQSBAIJ.html#MATSEQSBAIJ</a></div>
<div><br></div><div>show that only the upper triangle is stored.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Otherwise, while using AIJ, if I insert multiple rows at a time instead of just one (thus reducing the number of calls to MatSetValues, at the cost of more memory), will this be much beneficial ? (Please note that the matrix is not very sparse)<br>
</blockquote><div><br></div><div>I cannot say anything until we see the timing from -log_summary. It is very rare that matrix construction is a factor,</div><div>if it has been properly allocated, which you can check using -info.</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Thank you very much in advance !!!<br><font color="#888888"><br><br>Shitij<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>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>