*/
unsigned int bandwidth () const;
+ /**
+ * Return the number of nonzero elements of
+ * this matrix. Actually, it returns the
+ * number of entries in the sparsity
+ * pattern; if any of the entries should
+ * happen to be zero, it is counted
+ * anyway.
+ *
+ * This function may only be called if the
+ * matrix struct is compressed. It does not
+ * make too much sense otherwise anyway.
+ */
+ unsigned int n_nonzero_elements () const;
+
/**
* Return whether the structure is
* compressed or not.
void clear ();
/**
- * Return the dimension of the imga space.
+ * Return the dimension of the image space.
* To remember: the matrix is of dimension
* $m \times n$.
*/
*/
unsigned int n () const;
+ /**
+ * Return the number of nonzero elements of
+ * this matrix. Actually, it returns the
+ * number of entries in the sparsity
+ * pattern; if any of the entries should
+ * happen to be zero, it is counted
+ * anyway.
+ */
+ unsigned int n_nonzero_elements () const;
+
/**
* Set the element #(i,j)# to #value#.
* Throws an error if the entry does
// the entries of this line
break;
return b;
-}
+};
+
+
+
+unsigned int
+dSMatrixStruct::n_nonzero_elements () const {
+ Assert (compressed, ExcNotCompressed());
+ return colnums[rows]-colnums[0];
+};
+unsigned int
+dSMatrix::n_nonzero_elements () const {
+ Assert (cols != 0, ExcMatrixNotInitialized());
+ return cols->n_nonzero_elements ();
+};
+
+
+
dSMatrix &
dSMatrix::copy_from (const dSMatrix &matrix) {
Assert (cols != 0, ExcMatrixNotInitialized());