/**
* Return the number of actually
- * nonzero elements. Just counts
- * the number of actually nonzero
- * elements of all the blocks.
+ * nonzero elements. Just counts the
+ * number of actually nonzero elements
+ * (with absolute value larger than
+ * threshold) of all the blocks.
*/
- unsigned int n_actually_nonzero_elements () const;
+ unsigned int n_actually_nonzero_elements (const double threshold = 0.0) const;
/**
* Matrix-vector multiplication:
template <typename number>
unsigned int
-BlockSparseMatrix<number>::n_actually_nonzero_elements () const
+BlockSparseMatrix<number>::n_actually_nonzero_elements (const double threshold) const
{
unsigned int count = 0;
for (unsigned int i=0; i<this->n_block_rows(); ++i)
for (unsigned int j=0; j<this->n_block_cols(); ++j)
- count += this->sub_objects[i][j]->n_actually_nonzero_elements ();
+ count += this->sub_objects[i][j]->n_actually_nonzero_elements (threshold);
return count;
}
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams