matrix assembly

Matt Funk mafunk at nmsu.edu
Mon Jul 3 12:29:44 CDT 2006


Thanks for the reponse.

I am just starting to use PETsC so it might be a little while. But eventually 
i think it might be useful to have (for myself and maybe other people might 
find it useful as well).

The reason i need it, is that i have old codes that store the matrices in this 
format and i just wanted to "plug in" PETsC solvers. The old codes use 
solvers that we wrote ourselves. 

Anyway, thanks for the pointers. I have to see how i'll proceed.

thanks
mat


On Friday 30 June 2006 19:04, Barry Smith wrote:
>    Mat,
>
>      There is no routine like this. It would be possible for you or
> someone else to provide a routine that worked for a particular matrix
> format such as MatCreateSeqAIJFromCoordinates(comm,nz,i,j,values,&mat)
> It likely would be essentially like the code you have written except it
> would put the values directly into the data structure without having to use
> calls to MatSetValues()[You would need to look at MatSetValues_SeqAIJ() to
> see one way of getting the data directly in].
>
>     Similar code could be written for MPIAIJ though it gets more
> complicated because of the more complicated structure and if you place
> values off-processor. It could also be written for only PETSc matrix
> formats, BAIJ, SBAIJ, Bdiag etc.
>
>    We haven't written this codes because we haven't needed them and much
> prefer to simply put the matrix values into the matrix WHEN they are
> generated rather then store them in some data-structure that has to be then
> converted into the PETSc format.
>
>   If you would like to provide a routine like this we'd be glad to add it
> to PETSc and maintain it.
>
>      Barry
>
> On Fri, 30 Jun 2006, Matt Funk wrote:
> > Hi,
> >
> > i have a matrix stored in the matrix free format. I.e. an array
> > indicating the row number, an array storing the column number and the
> > array of corresponding values.
> >
> > I was wondering what the best way is to build the PETsC matrix using
> > this. I was hoping that there is call to some sparse matrix assembler
> > function to which is simply pass these three arrays and it builds the
> > matrix for me.
> >
> > However, i did not find anything that simple. So i guess i need to do it
> > row by row using the MatSetValues fcn() after allocating the memory for
> > the matrix (i.e. pretty much as the procedure described on p.54 of the
> > user manual)?
> >
> > mat
> >
> > On Friday 30 June 2006 14:30, Satish Balay wrote:
> >> Added to petsc-dev now.
> >>
> >> Satish
> >>
> >> On Fri, 30 Jun 2006, Barry Smith wrote:
> >>>    Mathieu,
> >>>
> >>>     Cool, thanks.
> >>>
> >>>    Satish,
> >>>
> >>>     Could you please apply the diff to petsc-dev now and then push
> >>> so any future changes anyone makes will be combatiable with the new
> >>> code.
> >>>
> >>>     Thanks
> >>>
> >>>      Barry
> >>>
> >>> On Fri, 30 Jun 2006, Mathieu Taillefumier wrote:
> >>>> Good morning everybody,
> >>>>
> >>>> I finished to modify the code of the library in order to compile the
> >>>> complex version with a C compiler. A few numbers of files have been
> >>>> modified. This modifications include a modification of the file
> >>>> language.py where I put in comment two lines forcing to compile the
> >>>> library with a c++ compiler. Since I don't really know python, I just
> >>>> put them as a comment, but i think it is better to put a message
> >>>> indicating that compiling the complex version of Petsc needs a C90
> >>>> compliant compiler (gcc 3.4 and after work, it works also with icc)
> >>>> and is experimental. Actually I am working with this modifications and
> >>>> it seems to work like a charm (I had no problem with it).
> >>>> I still need some time to convert the example programs which do not
> >>>> compile but it will be done soon.
> >>>> Note for all of us :
> >>>>    Don't use the name I as a variable anymore. It is a reserved word
> >>>> of the language.
> >>>>    For most of us, the modifications must be transparent.
> >>>>
> >>>> Regards
> >>>>
> >>>> Mathieu




More information about the petsc-users mailing list