getfem-users
[Top][All Lists]

## Re: [Getfem-users] submatrix addressing and assignment of this to a csr

 From: Andriy Andreykiv Subject: Re: [Getfem-users] submatrix addressing and assignment of this to a csr matrix Date: Wed, 4 May 2011 11:42:05 +0200

```Hi Umut,

Regarding the assignment, probably the easiest way is:
if A and B are your matrices and you want to place a part of A into a
part of B (or the whole A into part of B, or any combinations)
do:

gmm::copy(  gmm::sub_matrix(A, gmm::sub_interval(startAX, sizeAX),
gmm::sub_interval(startAY, sizeAY)),
gmm::sub_matrix(B, gmm::sub_interval(startBX,
sizeBX), gmm::sub_interval(startBY, sizeBY))   )
of course the sizes should match: sizeAXY=sizeBXY etc. .

besides the intervals you can use sorted and unsorted indices

regarding the iterating on the components of a matrix read:

Best regards,
Andriy

> Dear all,
>
> I was using ublas for some matrix interfacing operations however they lack
> an efficient addressing scheme for a submatrix. Since gmm++ is designed to
> be used in a FE framework, I thought that it could give me what  I like.
>
> Here is my goal: I would like assign to some sparse matrices which I have
> the structure, the nnz info for rows or so, I also read the documentation
> and sub_index seems to be the answer and later on sub_matrix returns a
> reference to a matrix.
>
> So the questions are
>
> + what would be the most efficient way to assign this matrix(or the
> reference) to a csr or csc matrix?
> + what would be the most efficient way to iterate over the nnz of this newly
> generated matrix?
>
> Best wishes,
> Umut
>
> _______________________________________________
> Getfem-users mailing list