[petsc-users] how to use MatSetValues?
Gianluca Meneghello
gianmail at gmail.com
Tue Mar 8 02:56:03 CST 2011
I think m and n are the number of rows and columns you are inserting
in the matrix. If you insert one value at a time, that would be
MatSetValues(xx,1,row,1,col,val,INSERT_VALUES);
I hope it helps
Gianluca
On 8 March 2011 09:39, Tomasz Jankowski <tomjan at jay.au.poznan.pl> wrote:
> hello,
>
> Could someone give me a hand with MatSetValues function?
>
> suppose such example sparse matrix
>
> 0 1.1 0 0 0
> 2.2 0 0 0 0
> 0 0 0 0 3.3
> 0 0 4.4 0 0
> 0 0 0 5.5 0
>
> after storing it in row, col and val arrays we have
>
> row[0] = 0;col[0]=1;val[0]=1.1;
> row[1] = 1;col[1]=0;val[1]=2.2;
> row[2] = 2;col[2]=4;val[2]=3.3;
> row[3] = 3;col[3]=2;val[3]=4.4;
> row[3] = 4;col[3]=3;val[4]=5.5;
>
> question is: how to use MatSetValues with it?
>
> I thought that 'MatSetValues(xx,5,row,1,col,val,INSERT_VALUES);' would be
> good but it doesn't .(I suppose I don't fully anderstand how it works...)
>
> thanks,
>
> tom
>
> ########################################################
> # tomjan at jay.au.poznan.pl #
> # jay.au.poznan.pl/~tomjan/ #
> ########################################################
>
--
"[Je pense que] l'homme est un monde qui vaut des fois les mondes et
que les plus ardentes ambitions sont celles qui ont eu l'orgueil de
l'Anonymat" -- Non omnibus, sed mihi et tibi
Amedeo Modigliani
More information about the petsc-users
mailing list