Hi, I was reading the Petsc manual pages and came across the following functions: MatCreateBlockMat, MatCreateSeqAIJWithArrays and MatCreateSeqBAIJ.
1> So, if I have the S1,S2,...,S5, and I want to build the B matrix as mentioned below, would the BAIJ matrix be better to use than the AIJ? How about BlockMat? 2> And which one of the above three methods would be best to create B ? I would appreciate any comments on this. Thanks, Manav On Sep 21, 2008, at 12:50 PM, Hong Zhang wrote: > > Manav, > > On Sun, 21 Sep 2008, Manav Bhatia wrote: > >> Hi, >> >> I have an application in which I have multiple sparse matrices, >> which together form one bigger matrix. For example: if S1, S2, S3, S4 >> and S5 are my sparse matrices, I need to create a matrix B of the >> following form >> >> B = 3 x 3 blocks >> >> row 1 of B = 0, S1, 0 >> row 2 of B = S2, 0 , S3 >> row 3 of B = S4, S5, 0 >> >> If I build the S1... S5 independently, is there a way for me to >> directly embed these matrices into B without having to explicitly >> copy >> the values from each matrix? > > No, we do not have this function. > You can use MatSetValues() > http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatSetValues.html > > to insert a block of values. > > Hong > >> I would appreciate any help. Please also, let me know if there is an >> example code somewhere about this. >> >> Regards, >> Manav >> >> >> >> >
