aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-30 07:26:51 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-30 07:26:51 +0000
commitecb6bd90c01edc19165ff526ef15a59693b4f12f (patch)
tree3de11687882262cc3840c1231187c574d9a71b6a
parent18805586d9a524f0a351a1affd950e50166ed5e0 (diff)
downloadruby-ecb6bd90c01edc19165ff526ef15a59693b4f12f.tar.gz
* ext/bigdecimal/lib/bigdecimal/jacobian.rb (Jacobian#dfdxi):
fix jacobian to get stuck in an infinite loop when a solution is not found due to forget to increment nRetry counter. Patch by alperakgun from github.com/shyouhei/ruby/pull/8 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb3
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a77ab60fbc..c8de1e1c4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed May 30 16:20:00 2012 Kenta Murata <mrkn@cookpad.com>
+
+ * ext/bigdecimal/lib/bigdecimal/jacobian.rb (Jacobian#dfdxi):
+ fix jacobian to get stuck in an infinite loop when a solution is not
+ found due to forget to increment nRetry counter.
+ Patch by alperakgun from github.com/shyouhei/ruby/pull/8
+
Wed May 30 10:58:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* time.c (utc_offset_arg): utc offset can be precision in seconds.
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
index 8ab836259a..f53e5b1437 100644
--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -53,7 +53,8 @@ module Jacobian
until ok>0 do
s = f.zero
deriv = []
- if(nRetry>100) then
+ nRetry += 1
+ if nRetry > 100
raise "Singular Jacobian matrix. No change at x[" + i.to_s + "]"
end
dx = dx*f.two