[petsc-users] To store the matrix.

Matthew Knepley knepley at gmail.com
Thu Jul 14 13:36:23 CDT 2011


On Thu, Jul 14, 2011 at 6:30 PM, Xuefei (Rebecca) Yuan <xyuan at lbl.gov>wrote:

> Hi Jed,
>
> I need to have this form for the simple input for PDSLin.
>
> What do you mean by "COO"?
>
> Any examples to show how to pull that new array for reading from the AIJ
> structure?
>

First use MatGetSubmatrix() to pull the whole matrix into proc 0 if you are
in parallel.
Then you MatGetRow() for each row, and write each entry in your form.

   Matt


> Thanks a lot!
>
> R
>
> On Jul 14, 2011, at 11:28 AM, Jed Brown wrote:
>
> On Thu, Jul 14, 2011 at 13:18, Xuefei (Rebecca) Yuan <xyuan at lbl.gov>wrote:
>
>> I would like to store this sparse MXN matrix A in the following form:
>> ....................................................
>>
>> line1:  M       N       numberofnonzeros
>> line2:  i       j       value
>> line3:  i       j       value
>>
>
> This "COO" format is not an efficient representation. Why do you want to
> store it this way?
>
> (You can produce this by getting the AIJ structure, allocating a new array
> for the row indices, and filling it redundantly from the AIJ structure.
>
>
>


-- 
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/20110714/114719c5/attachment-0001.htm>


More information about the petsc-users mailing list