getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 12:14:56 +0200

Dear Umut,

My "experience" tells me to just plagiarize as much as possible from
getfem itself.
In doing so you might find that a lot of the stiffness matrices are
declared with a type sparse_matrix, which comes from:

typedef getfem::modeling_standard_sparse_matrix sparse_matrix;

and this, in its turn comes from

typedef gmm::col_matrix<modeling_standard_sparse_vector>
  modeling_standard_sparse_matrix;

(where they also use:  typedef gmm::rsvector<scalar_type>
modeling_standard_sparse_vector;)

So, in my code ALL the global size matrices are "sparse_matrix" type.
It works quite fast, so I don't bother to check whether this is THE
fastest way, but, may be, the other getfemers will comment on this.


Best regards,
                       Andriy






2011/5/4 Umut Tabak <address@hidden>:
> On 05/04/2011 11:42 AM, Andriy Andreykiv wrote:
>>
>> 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. .
>>
>
> Hi Andriy,
>
> I could not really understand the internals of the library but there is a
> general rule-of-thumb, I suppose. If you are doing a write related operation
> than that should be done with copy and if you would like to do some kind of
> matrix-vector multiplication then you should use csr or csc formats where
> you should copy your gmm::row_matrix< gmm::wsvector<double> > K for instance
> into a csr matrix. Am I right on this?
>
> As an experienced user, could you please comment on this?
>
> Thanks for the above tip, by the way.
>
> Umut
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]