Umut, Thanks for the offer I have the basics working with MatCreateSeqAIJWithArrays in case you need it you can use something like this.
using boost::numeric::ublas; typedef unbounded_array<PetscInt> IndexArrayType; typedef unbounded_array<PetscScalar> ValueArrayType; typedef compressed_matrix<PetscScalar,row_major,0,IndexArrayType,ValueArrayType> MatrixType; MatrixType L(10,10); //Fill L ierr = MatCreateSeqAIJWithArrays(PETSC_COMM_WORLD, 10, 10, L.index1_data().begin() ,L.index2_data().begin(),L.value_data().begin(),&A); this works so long as you use petscInt and petscScalar as the template parameters of MatrixType. -Luke On 06/29/2010 10:44 AM, Umut Tabak wrote: > Satish Balay wrote: >> On Tue, 29 Jun 2010, Luke Bloy wrote: >> >>> 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 >>> >>> > I did sth like this some time ago, where the matrices were in CSR > format "compressed matrix", I guess, in ublas, That was not that > difficult, I did that with MatSetValues, if I can find some code I > will post that, maybe that could help. > Best, > Umut