[petsc-users] ublas sparse matrix bindings?

Satish Balay balay at mcs.anl.gov
Tue Jun 29 08:52:32 CDT 2010


On Tue, 29 Jun 2010, Luke Bloy wrote:

> Hi,
> 
> In one of my projects I use the ublas compressed row major format for storing
> sparse matricies. One of the reasons i chose this format was interoperability
> with other packages. I'd like to use some petsc and slepc functionality in my
> project but I haven't found any bindings between the 2 formats.
> 
> It seems like MatCreateSeqAIJWithArrays is the optimal way to link the two
> types of objects but i thought I would see if anyone has done this and could
> point me in the most optimal direction.

The format expected by MatCreateSeqAIJWithArrays() is listed in its man page.

http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatCreateSeqAIJWithArrays.html

I guess you can use this routine if ublas sparse format  is same as this.

One alternative - is to convert these matrices into petsc binary
format.  Then you can load them up to petsc code even parallely - say
with src/ksp/ksp/examples/tutorials/ex10.c

For converting to petsc binary format - you can follow the example
src/mat/examples/tests/ex50.c.

Satish


More information about the petsc-users mailing list