[petsc-users] To store the matrix.

Xuefei (Rebecca) Yuan xyuan at lbl.gov
Thu Jul 14 14:19:12 CDT 2011


Dear Hong,

Thanks very much! I have aij, so it is the

MatConvertToTriples_seqaij_seqaij()

I need to call after get the global matrix?

Thanks,

Rebecca


On Jul 14, 2011, at 12:05 PM, Hong Zhang wrote:

> Rebecca,
> 
> We have  private routines MatConvertToTriples_xxx_xxx()
> in ~petsc/src/mat/impls/aij/mpi/mumps/mumps.c
> which convert petsc seqaij and mpiaij to triples: row[], col[], val[] .
> You may take a look at these routines.
> 
> Hong
> 
> On Thu, Jul 14, 2011 at 1:37 PM, Xuefei (Rebecca) Yuan <xyuan at lbl.gov> wrote:
>> Dear Matt and Jed,
>> Thanks very much! That helps!
>> Best regards,
>> Rebecca
>> 
>> 
>> On Jul 14, 2011, at 11:36 AM, Matthew Knepley wrote:
>> 
>> 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
>> 
>> 



More information about the petsc-users mailing list