getfem-users
[Top][All Lists]
Advanced

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

Re: [Getfem-users] [GMM++] Resizing a matrix


From: Yves Renard
Subject: Re: [Getfem-users] [GMM++] Resizing a matrix
Date: Mon, 26 May 2008 12:23:24 +0200
User-agent: KMail/1.9.5

On Thursday 22 May 2008 17:30, Fem Dev wrote:
> Hello again,
>
> I have another question about GMM++. I want to resize a matrix without
> keeping old entries in it. In fact, all the entries have to be reset to
> zero. The documentation says:
>
>
> MATRIX_TYPE M(m1, n1);
> .... your code
> std::swap(M, MATRIX_TYPE(m2, n2)); // resize matrix M.My example code looks
> almost the same:
>
> gmm::dense_matrix<double> A(84,84);
> //...
> std::swap(A, gmm::dense_matrix<double>(24, 24))
>
>
> The compiler returns this error:
> ...\..\main.cpp no matching function for call to
> `swap(gmm::dense_matrix<double>&, gmm::dense_matrix<double>)'
>
> So, what wrong with it? Thanks a lot for your help.
>
> Regards.

You are right. The problem is that "gmm::dense_matrix<double>(24, 24)" is 
const. In fact, the right code is

{ gmm::dense_matrix<double> tmp(24, 24)
std::swap(A, tmp); }

Best regards,

Yves.


-- 

  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]