[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Getfem-users] row_matrix resizing in GMM
From: |
Vladimir |
Subject: |
Re: [Getfem-users] row_matrix resizing in GMM |
Date: |
Tue, 8 Jan 2008 15:39:38 +0300 |
User-agent: |
KMail/1.9.6 (enterprise 0.20070907.709405) |
On Tuesday 08 January 2008 14:51:10 Yves Renard wrote:
> 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.
Hello Yves,
Thanks a lot for applying the patch !
--
Best Regards,
Vladimir