getfem-users
[Top][All Lists]
Advanced

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

Re: [Getfem-users] row_matrix resizing in GMM


From: Yves Renard
Subject: Re: [Getfem-users] row_matrix resizing in GMM
Date: Tue, 8 Jan 2008 12:51:10 +0100
User-agent: KMail/1.9.5

On Tuesday 08 January 2008 08:46, Vladimir wrote:
> Hello,
>
> I'm using row_matrix in an algorithm that doesn't knows row count in
> advance and resizes row_matrix each time it wants to add a row. The
> row_matrix::resize() algorithm calls gmm::resize for each row of the matrix
> even if the column count is not changed. This can be easily optimized by
> adding resize_rows() method or by modifying resize() method as follows:
>
>   template<typename V> void row_matrix<V>::resize(size_type m, size_type n)
> { if(n != nc) {
>         li.resize(m);
>         for (size_type i=0; i < m; ++i) gmm::resize(li[i], n);
>         nc = n;
>     } else {
>         int m0 = li.size();
>         li.resize(m);
>         for (size_type i=m0; i < m; ++i) gmm::resize(li[i], n);
>     }
>   }
>
> The same could be done for col_matrix. Can such patch be accepted ?

Hi Vladimir,

No problem, this is an optimisation. I prefer to modify resize() method 
because i does not add a new method. I will commit the patch in a few moment.

Thank you for the patch.

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]