]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Improve description of set function and say that setting can only be done once if...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Nov 2009 05:37:07 +0000 (05:37 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Nov 2009 05:37:07 +0000 (05:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@20153 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/solver_cg.h
deal.II/lac/include/lac/trilinos_sparse_matrix.h

index 81be4a62a72c269ea2d6bf28085cb715e77e1b52..a13dbd2afcae60105beaa9f15d90ca9fa17072e1 100644 (file)
@@ -102,7 +102,7 @@ class SolverCG : public Solver<VECTOR>
                                          * @note Requires LAPACK support.
                                          */
        bool compute_all_condition_numbers;
-       
+
                                         /**
                                          * Compute all eigenvalues of
                                          * the projected matrix.
@@ -110,7 +110,7 @@ class SolverCG : public Solver<VECTOR>
                                          * @note Requires LAPACK support.
                                          */
        bool compute_eigenvalues;
-       
+
                                          /**
                                           * Constructor. Initialize data
                                           * fields.  Confer the description of
@@ -186,7 +186,7 @@ class SolverCG : public Solver<VECTOR>
     VECTOR *Vp;
     VECTOR *Vz;
     VECTOR *VAp;
-    
+
                                     /**
                                      * Within the iteration loop, the
                                      * square of the residual vector is
@@ -227,7 +227,7 @@ AdditionalData (const bool log_coefficients,
                compute_all_condition_numbers(compute_all_condition_numbers),
                compute_eigenvalues(compute_eigenvalues)
 {}
-    
+
 
 
 template <class VECTOR>
@@ -300,7 +300,7 @@ SolverCG<VECTOR>::solve (const MATRIX         &A,
   SolverControl::State conv=SolverControl::iterate;
 
   deallog.push("cg");
-  
+
                                   // Memory allocation
   Vr  = this->memory.alloc();
   Vp  = this->memory.alloc();
@@ -312,17 +312,17 @@ SolverCG<VECTOR>::solve (const MATRIX         &A,
                        | additional_data.compute_all_condition_numbers
                        | additional_data.compute_eigenvalues;
   double eigen_beta_alpha = 0;
-  
+
                                   // vectors used for eigenvalue
                                   // computations
   std::vector<double> diagonal;
   std::vector<double> offdiagonal;
-  
+
   try {
                                     // define some aliases for simpler access
-    VECTOR& g  = *Vr; 
-    VECTOR& h  = *Vp; 
-    VECTOR& d  = *Vz; 
+    VECTOR& g  = *Vr;
+    VECTOR& h  = *Vp;
+    VECTOR& d  = *Vz;
     VECTOR& Ad = *VAp;
                                     // resize the vectors, but do not set
                                     // the values since they'd be overwritten
@@ -335,7 +335,7 @@ SolverCG<VECTOR>::solve (const MATRIX         &A,
                                     // library
     int  it=0;
     double res,gh,alpha,beta;
-    
+
                                     // compute residual. if vector is
                                     // zero, then short-circuit the
                                     // full computation
@@ -349,42 +349,42 @@ SolverCG<VECTOR>::solve (const MATRIX         &A,
     res = g.l2_norm();
 
     conv = this->control().check(0,res);
-    if (conv) 
+    if (conv)
       {
        cleanup();
        return;
       }
 
     precondition.vmult(h,g);
-    
+
     d.equ(-1.,h);
-    
+
     gh = g*h;
-    
+
     while (conv == SolverControl::iterate)
       {
        it++;
        A.vmult(Ad,d);
-       
+
        alpha = d*Ad;
        alpha = gh/alpha;
-       
+
        g.add(alpha,Ad);
        x.add(alpha,d );
        res = g.l2_norm();
-       
+
        print_vectors(it, x, g, d);
-       
+
        conv = this->control().check(it,res);
        if (conv)
          break;
 
        precondition.vmult(h,g);
-       
+
        beta = gh;
        gh   = g*h;
        beta = gh/beta;
-       
+
        if (additional_data.log_coefficients)
          deallog << "alpha-beta:" << alpha << '\t' << beta << std::endl;
                                         // set up the vectors
@@ -411,7 +411,7 @@ SolverCG<VECTOR>::solve (const MATRIX         &A,
            deallog << "Condition number estimate: " <<
              T.eigenvalue(T.n()-1)/T.eigenvalue(0) << std::endl;
          }
-       
+
        d.sadd(beta,-1.,h);
       }
   }
index 2b64416e3a816219084ed0eb72817842a9b1915e..6fb4356d7fa8905ac9476bcad09bd22a6fe414b2 100644 (file)
@@ -1160,18 +1160,27 @@ namespace TrilinosWrappers
                                         * Set the element (<i>i,j</i>)
                                         * to @p value.
                                        *
-                                       * This function is able to insert
-                                       * new elements into the matrix as
-                                       * long as compress() has not been
-                                       * called, so the sparsity pattern
-                                       * will be extended. When compress()
-                                       * is called for the first time, then
-                                       * this is no longer possible and an
-                                       * insertion of elements at positions
-                                       * which have not been initialized
-                                       * will throw an exception. Moreover,
-                                       * if <tt>value</tt> is not a finite
-                                       * number an exception is thrown.
+                                       * This function is able to insert new
+                                       * elements into the matrix as long as
+                                       * compress() has not been called, so
+                                       * the sparsity pattern will be
+                                       * extended. When compress() is called
+                                       * for the first time, then this is no
+                                       * longer possible and an insertion of
+                                       * elements at positions which have not
+                                       * been initialized will throw an
+                                       * exception. Note that in case
+                                       * elements need to be inserted, it is
+                                       * mandatory that elements are inserted
+                                       * only once. Otherwise, the elements
+                                       * will actually be added in the end
+                                       * (since it is not possible to
+                                       * efficiently find values to the same
+                                       * entry before compress() has been
+                                       * called). In the case that an element
+                                       * is set more than once, initialize
+                                       * the matrix with a sparsity pattern
+                                       * first.
                                        */
       void set (const unsigned int i,
                 const unsigned int j,

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.