aboutsummaryrefslogtreecommitdiff
path: root/aberth
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-06-30 11:17:37 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-06-30 11:17:37 +0200
commit2f1fa30265e98cbde4f1f5344b85c04f07f80379 (patch)
tree5a9fac585b61de7ca77abb4444a2e0b0f546236f /aberth
parentbd672e1f7aefc66e95c4e4a27388a99248358d8c (diff)
aberth: Less :>
Diffstat (limited to 'aberth')
-rw-r--r--aberth/aberth_kernel.fut4
1 files changed, 2 insertions, 2 deletions
diff --git a/aberth/aberth_kernel.fut b/aberth/aberth_kernel.fut
index 5d851f0..9d0c59e 100644
--- a/aberth/aberth_kernel.fut
+++ b/aberth/aberth_kernel.fut
@@ -29,8 +29,8 @@ let evaln_d (p: poly) (nterms: i32) (pt: f32): f32 =
let eval_d (p: poly) (pt: f32): f32 = evaln_d p (length p) pt
let derivative (p: poly): *poly =
- let res = map (\(i, v) -> f32.i32 i * v) (tail (zip (0..<PolyN) p)) ++ [0]
- in res :> poly
+ map2 (\i v -> f32.i32 (i32.bool (i != PolyN - 1) * (i + 1)) * v)
+ (0..<PolyN) (rotate 1 p)
-- Cauchy's bound: https://en.wikipedia.org/wiki/Geometrical_properties_of_polynomial_roots#Lagrange's_and_Cauchy's_bounds
let max_root_norm (p: poly): f32 =