getfem-users
[Top][All Lists]
Advanced

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

[Getfem-users] row_matrix resizing in GMM


From: Vladimir
Subject: [Getfem-users] row_matrix resizing in GMM
Date: Tue, 8 Jan 2008 10:46:34 +0300
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)

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 ?

Thanks for your attention.

-- 
      Best Regards,
        Vladimir



reply via email to

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