aboutsummaryrefslogtreecommitdiff
path: root/aberth
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-04-20 17:10:32 +0200
committertomsmeding <tom.smeding@gmail.com>2019-04-20 17:10:32 +0200
commit86f2bdfd5767ddb79d2404b1a13116d01690e1e6 (patch)
tree28ab9c6c43f3ae858302dc363113b60dadeb97fc /aberth
parentd54358b5338495bc7b90dc1fcac5f2c9734e9e89 (diff)
Fix blatant error in C++ code
Diffstat (limited to 'aberth')
-rw-r--r--aberth/aberth.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/aberth/aberth.cpp b/aberth/aberth.cpp
index c5b037d..42e3106 100644
--- a/aberth/aberth.cpp
+++ b/aberth/aberth.cpp
@@ -158,7 +158,7 @@ struct AberthState {
Com derivval = eval(deriv, poly.size() - 1, approx[i]);
Com quo = pval / derivval;
Com sum = 0;
- for (int j = 0; j < i; j++) sum += pairs[N * j + i];
+ for (int j = 0; j < i; j++) sum -= pairs[N * j + i];
for (int j = i + 1; j < N; j++) sum += pairs[N * i + j];
offsets[i] = quo / (1.0 - quo * sum);