<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 25, 2014 at 9:07 AM, Kirill Voronin <span dir="ltr"><<a href="mailto:kvoronin@labchem.sscc.ru" target="_blank">kvoronin@labchem.sscc.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello!<br>
<br>
I am trying to create a matrix for solving Ax = b with PETSC with given<br>
1-based(!) indexed ia, ja and acsr arrays for a symmetric (only upper part<br>
is stored) complex matrix.<br>
<br>
Without memory preallocation it takes too long to fill in all the values<br>
of acsr into my Mat A object.<br>
<br>
But I failed to call<br>
ierr = MatSeqSBAIJSetPreallocationCSR(Afromcsr, dim, iaHSS, jaHSS, acHSS);<br>
because of the 1 based indexing. And I didn't find an option how to handle<br>
this issue.<br>
<br>
>From the manual:<br>
"By default the internal data representation for the AIJ formats employs<br>
zero-based indexing. For compatibility<br>
with standard Fortran storage, thus enabling use of external Fortran<br>
software packages such as<br>
SPARSKIT, the option -mat_aij_oneindex enables one-based indexing, where<br>
the stored row and<br>
column indices begin at one, not zero. All user calls to PETSc routines,<br>
regardless of this option, use<br>
zero-based indexing."<br>
<br>
So, what can you recommend to do? I obviously don't want to double the<br>
memory for storing ia and ja arrays in 0-based indexing. I don't want to<br>
change the indexing everywhere to 0-based since I use a piece of external<br>
code which works only for 1-based indexing as a preconditioner in PETSC<br>
KSP solver.<br></blockquote><div><br></div><div>Just decrement ja, make the call, and increment ja.</div><div><br></div><div>  Thanks,</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">
Thanks in advance!<br>
<br>
With best regards,<br>
<br>
Kirill Voronin<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>