getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] r5072 - /trunk/getfem/src/getfem/getfem_continuation.h


From: logari81
Subject: [Getfem-commits] r5072 - /trunk/getfem/src/getfem/getfem_continuation.h
Date: Tue, 18 Aug 2015 08:54:24 -0000

Author: logari81
Date: Tue Aug 18 10:54:24 2015
New Revision: 5072

URL: http://svn.gna.org/viewcvs/getfem?rev=5072&view=rev
Log:
gracefully discard Newton correction in numerical continuation at occurrence of 
NaN 

Modified:
    trunk/getfem/src/getfem/getfem_continuation.h

Modified: trunk/getfem/src/getfem/getfem_continuation.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_continuation.h?rev=5072&r1=5071&r2=5072&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_continuation.h       (original)
+++ trunk/getfem/src/getfem/getfem_continuation.h       Tue Aug 18 10:54:24 2015
@@ -56,7 +56,7 @@
     const double tau_bp_init = 1.e6;
     const double diffeps = 1.e-8;
 #else
-    static constexpr double tau_bp_init = 1.e6;
+    static constexpr double tau_bp_init = 1.e6;
     static constexpr double diffeps = 1.e-8;
 #endif
 
@@ -334,6 +334,10 @@
         solve_grad(X, Gamma, Delta_X, y, f, g);                // y = F_x(X, 
Gamma)^-1 * g
                                                                // Delta_X = 
F_x(X, Gamma)^-1 * f
         Delta_Gamma = sp(tX, Delta_X) / (sp(tX, y) - tGamma);  // Delta_Gamma 
= tX.Delta_X / (tX.y - tGamma)
+        if (isnan(Delta_Gamma)) {
+          if (noisy() > 0) cout << "Newton correction failed with NaN" << endl;
+          return false;
+        }
         gmm::add(gmm::scaled(y, -Delta_Gamma), Delta_X);       // Delta_X -= 
Delta_Gamma * y
         scaled_add(X, Gamma, Delta_X, Delta_Gamma, -1,
                    X, Gamma);                                  // [X,Gamma] -= 
[Delta_X,Delta_Gamma]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]