]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a function which tells us whether a SparseMatrix is empty or not.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 1 Mar 1999 12:54:39 +0000 (12:54 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 1 Mar 1999 12:54:39 +0000 (12:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@934 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/include/lac/sparse_matrix.templates.h

index c686b4fa0065ba2beeb5eb674101379c1a805b19..90517d7c2dbcd9852796aca0b1a14bce90460a6b 100644 (file)
@@ -449,6 +449,14 @@ class SparseMatrix
                                      */
     virtual void clear ();
     
+                                    /**
+                                     * Return whether the object is empty. It
+                                     * is empty if either both dimensions
+                                     * are zero or no #SparseMatrixStruct#
+                                     * is associated.
+                                     */
+    bool empty () const;
+
                                     /**
                                      * Return the dimension of the image space.
                                      * To remember: the matrix is of dimension
index b12f40b4fa5dc9a3fedc3d7a7fca45712203fd26..f5742cc5d21a410b92b19e52665188825a04eba1 100644 (file)
@@ -90,6 +90,18 @@ SparseMatrix<number>::clear () {
 
 
 
+template <typename number>
+bool
+SparseMatrix<number>::empty () const
+{
+  if (cols == 0)
+    return true;
+  else
+    return cols->empty();
+};
+
+
+
 template <typename number>
 unsigned int
 SparseMatrix<number>::n_nonzero_elements () const {

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


Typeset in Trocchi and Trocchi Bold Sans Serif.