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

_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users

Reply via email to