]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement a way to get the actual maximum number of elements per row from the sparsit...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 1999 11:46:45 +0000 (11:46 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 1999 11:46:45 +0000 (11:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@1261 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/source/sparse_matrix.cc

index 3c215ec5c07748590452f697e537bdd3325904c6..23507bc94c0d9bd4ef737d1d51cb9bd66e97fb56 100644 (file)
@@ -174,7 +174,16 @@ class SparseMatrixStruct : public Subscriptor
                                      * dimensions are zero.
                                      */
     bool empty () const;
-    
+
+                                    /**
+                                     * Return the maximum number of entries per
+                                     * row. Before compression, this equals the
+                                     * number given to the constructor, while
+                                     * after compression, it equals the maximum
+                                     * number of entries actually allocated by
+                                     * the user.
+                                     */
+    unsigned int max_entries_per_row () const;
 
                                     /**
                                      * Return the index of the matrix
index ca35ddb28f5e1208c15f697c7682ab4389e32f07..4df57c18c7faee664b4abdaa12f02cadd322e431 100644 (file)
@@ -321,6 +321,18 @@ SparseMatrixStruct::empty () const {
 
 
 
+unsigned int
+SparseMatrixStruct::max_entries_per_row () const 
+{
+  unsigned int m = 0;
+  for (unsigned int i=1; i<rows; ++i)
+    m = max (m, rowstart[i]-rowstart[i-1]);
+
+  return m;
+};
+
+
+
 int
 SparseMatrixStruct::operator () (const unsigned int i, const unsigned int j) 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.