getfem-users
[Top][All Lists]
Advanced

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

Re: [Getfem-users] [gmm] apparent bug in csr_matrix_ref


From: Yves Renard
Subject: Re: [Getfem-users] [gmm] apparent bug in csr_matrix_ref
Date: Wed, 1 Oct 2008 09:28:17 +0200
User-agent: KMail/1.9.5

Hi Mani,

You are right, there is an error here. The point is that this type permits to 
interface csr matrix coming from other codes (matlab, fortran codes ...) and 
it seems that nobody used the operator () on this type. In particular, this 
type is not involve in an operation such as
 gmm::scaled(a, 2.)
Each operation has its own light structure. See gmm_scaled.h.

Yves.




On Tuesday 30 September 2008 20:26, you wrote:
> Hi,
>   The csr_matrix_ref in gmm_interface.h (gmm Ver 3.1) has the following
> member fn.
>
> struct csr_matrix_ref {
>
>   ...<snp>...
>
>   value_type operator()(size_type i, size_type j) const
>       { return mat_col(*this, i)[j]; }
> };
>
>   I am fairly sure that the mat_col above should be mat_row, since
> csr_matrix is a row_major matrix, isn't it?
>
>   But I am very new to gmm and don't claim to understand the source
> code, so I have not been able to exercise this bug in a program. I tried
> the following code below (scaled() fn to get a reference to csr_matrix),
> but the operator() on the reference returned by scaled() works
> correctly!! Could someone experienced please help me understand?
>
>
> Thanks,
> Mani
>
>
> code to exercise bug (unsucessfully!!):
>
> #include <iostream>
> #include <gmm/gmm.h>
>
> using namespace std;
> using namespace gmm;
>
> int main()
> {
>   row_matrix< wsvector<double> > wa(10, 10);
>   csr_matrix<double> a(10, 10);
>
>   wa(1,1) = 1;
>   wa(1,3) = 2;
>   cout << wa;
>
>   copy(wa, a);
>   cout << scaled(a, 2);
>   cout << (scaled(a, 2))(1,3) << endl;
>   //(what should be the type of b??) b = scaled(a, 2); //doesn't
> compile!
>   //cout << b;
>   //cout << b(1,1) << " " << b(1,3) << endl;
> }
>
>
> Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
> New Jersey, USA 08889), and/or its affiliates (which may be known
> outside the United States as Merck Frosst, Merck Sharp & Dohme or
> MSD and in Japan, as Banyu - direct contact information for affiliates is
> available at http://www.merck.com/contact/contacts.html) that may be
> confidential, proprietary copyrighted and/or legally privileged. It is
> intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and
> then delete it from your system.
>
>
> _______________________________________________
> Getfem-users mailing list
> address@hidden
> https://mail.gna.org/listinfo/getfem-users

-- 

  Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
  Pole de Mathematiques, INSA de Lyon          fax : (33) 04.72.43.85.29
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE
  http://math.univ-lyon1.fr/~renard

---------



reply via email to

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