size_t SparseMatrix<CoeffType>::nnz() const { size_t result = 0 ; if(rows_are_stored()) { for(unsigned int i=0; i<m(); i++) { result += row(i).nb_coeffs() ; } } else if(columns_are_stored()) { for(unsigned int j=0; j<n(); j++) { result += column(j).nb_coeffs() ; } } else { assert(false) ; } return result ; }
size_t SparseMatrix::nnz() const { size_t result = 0 ; if(rows_are_stored()) { for(index_t i=0; i<m(); i++) { result += row(i).nb_coeffs() ; } } else if(columns_are_stored()) { for(index_t j=0; j<n(); j++) { result += column(j).nb_coeffs() ; } } else { gx_assert_not_reached ; } return result ; }