On Mar 21, 2011, at 6:43 AM, Alejandro Marcos Arag?n wrote:

> Hi everyone,
> 
> I'm new to the list and to PETSc. I was wondering if this is possible: in my 
> code I have my own sparse matrix data structure, so instead of creating a 
> sparse matrix from PETSc and copying all the elements, I was wondering if 
> there is a way to specify the storage of the elements. My custom data 
> structure is a three-array compressed row format (or compressed column 
> storage).

   If it truly is CSR you an use MatCreateSeqAIJWithArrays() or 
MatCreateMPIAIJWithArrays(). Otherwise you can use MatCreateShell() and provide 
your own function operations for MatMult() and whatever you will need. 

   Generally keeping your own sparse matrix data structure is overrated, yes 
you may save a little time and a little memory but then you use all the 
flexibility and power of PETSc sparse matrices; why bother with PETSc in that 
case.

   Barry

> 
> Thank you,
> 
> Alejandro M. Arag?n, Ph.D.

Reply via email to