[petsc-users] Creating SBAIJ matrix using 1-based csr arrays ia, ja and acsr
Matthew Knepley
knepley at gmail.com
Tue Nov 25 10:35:20 CST 2014
On Tue, Nov 25, 2014 at 9:07 AM, Kirill Voronin <kvoronin at labchem.sscc.ru>
wrote:
>
> Hello!
>
> I am trying to create a matrix for solving Ax = b with PETSC with given
> 1-based(!) indexed ia, ja and acsr arrays for a symmetric (only upper part
> is stored) complex matrix.
>
> Without memory preallocation it takes too long to fill in all the values
> of acsr into my Mat A object.
>
> But I failed to call
> ierr = MatSeqSBAIJSetPreallocationCSR(Afromcsr, dim, iaHSS, jaHSS, acHSS);
> because of the 1 based indexing. And I didn't find an option how to handle
> this issue.
>
> From the manual:
> "By default the internal data representation for the AIJ formats employs
> zero-based indexing. For compatibility
> with standard Fortran storage, thus enabling use of external Fortran
> software packages such as
> SPARSKIT, the option -mat_aij_oneindex enables one-based indexing, where
> the stored row and
> column indices begin at one, not zero. All user calls to PETSc routines,
> regardless of this option, use
> zero-based indexing."
>
> So, what can you recommend to do? I obviously don't want to double the
> memory for storing ia and ja arrays in 0-based indexing. I don't want to
> change the indexing everywhere to 0-based since I use a piece of external
> code which works only for 1-based indexing as a preconditioner in PETSC
> KSP solver.
>
Just decrement ja, make the call, and increment ja.
Thanks,
Matt
> Thanks in advance!
>
> With best regards,
>
> Kirill Voronin
>
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141125/30591d4c/attachment.html>
More information about the petsc-users
mailing list