[petsc-users] ublas sparse matrix bindings?

Luke Bloy luke.bloy at gmail.com
Tue Jun 29 09:24:42 CDT 2010


Thanks for the quick responses.

my matrices are fairly large 80,000 x 80,000 and not too sparse so I'd 
like to avoid any serialization if possible.

I've worked out how to use MatCreateSeqAIJWithArrays so long as i 
control the types  used in my ublas matrix, which is something i'd like 
to avoid doing if possible.

unfortunately I'm not sure how to control the types petscscalar and 
petscint.
I've looked through
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/include/petsc.h.html#PetscScalar 
and 
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/Sys/PetscScalar.html

which seem to suggest that I can use command line flags  
--with-scalar-type etc to control these typedefs is it possible to 
control these in the code directly if so how?

Thanks
Luke




On 06/29/2010 09:52 AM, Satish Balay wrote:
> 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