[Trilinos-Users] extracting sub-matrix

Hoang Giang Bui hgbk2008 at gmail.com
Sat Mar 2 17:31:33 MST 2013


Great, thank you!

Bui



On Sat, Mar 2, 2013 at 2:23 PM, Bart Janssens <bart.janssens at lid.kviv.be>wrote:

> OK, attached is a slightly improved version of your program. It's
> better to get the GIDs from the RangeMap. Other than that, your code
> was OK, the crash was actually in the matrix gallery destructor. Also,
> WATCH doesn't print the matrix in the case of a block, apparently, so
> I'm using Thyra to print out the values.
>
> Cheers,
>
> Bart
>
> On Sat, Mar 2, 2013 at 11:43 AM, Hoang Giang Bui <hgbk2008 at gmail.com>
> wrote:
> >
> >
> > Yes, I try to add gids2 but it throws a segmentation fault error. Attach
> is
> > the full script. Maybe you take a look again.
> >
> > BR
> > Bui
> >
> >
> >
> > On Sat, Mar 2, 2013 at 9:24 AM, Bart Janssens <bart.janssens at lid.kviv.be
> >
> > wrote:
> >>
> >> On Sat, Mar 2, 2013 at 6:42 AM, Hoang Giang Bui <hgbk2008 at gmail.com>
> >> wrote:
> >> > Thank you very much for the tip. Below is a snippet that I used to
> test
> >> > the
> >> > method above, but it does not work as expected. Can you help to show
> me
> >> > the
> >> > error in this. Basically, I try to extract the first 4x4 block of the
> >> > matrix.
> >> >
> >> >     Epetra_CrsMatrix * Mat = Gal.GetMatrix();
> >> >
> >> >     std::vector<int> gids1;
> >> >     gids1.push_back(0);
> >> >     gids1.push_back(1);
> >> >     gids1.push_back(2);
> >> >     gids1.push_back(3);
> >>
> >> I think the problem here is that you have to cover all indices of the
> >> matrix. So if your complete matrix is 12x12, you need to add a gids2
> >> with GIDs 4...11, and then GetBlock(0,0) should give you the first
> >> 4x4, GetBlock(0,1) the 4x8 and so on.
> >>
> >> Cheers,
> >>
> >> --
> >> Bart
> >
> >
> >
> >
> > --
> > With Best Regards !
> > Giang Bui
> > To learn and to excel
> >
> >
> >
> > --
> > With Best Regards !
> > Giang Bui
> > To learn and to excel
>
>
>
> --
> Bart
>



-- 
With Best Regards !
Giang Bui
To learn and to excel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130303/cb24da4f/attachment.html 


More information about the Trilinos-Users mailing list