aboutsummaryrefslogtreecommitdiff
path: root/aberth
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-04-20 16:56:35 +0200
committertomsmeding <tom.smeding@gmail.com>2019-04-20 16:58:04 +0200
commitd54358b5338495bc7b90dc1fcac5f2c9734e9e89 (patch)
treec7dc627b47bcf649488564fb32f3dc1057f2e6fb /aberth
parentda718c9fb4f7e29a89161b0814b7b183771ad4f1 (diff)
Use 'init' in max_root_norm in futhark
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 e1e7aa3..79d7cfa 100644
--- a/aberth/aberth_kernel.fut
+++ b/aberth/aberth_kernel.fut
@@ -29,11 +29,11 @@ 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 =
- map (\(i, v) -> f32.i32 i * v) (zip (1..<PolyN) (drop 1 p)) ++ [0]
+ map (\(i, v) -> f32.i32 i * v) (zip (1..<PolyN) (tail p)) ++ [0]
-- 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 =
- 1 + f32.maximum (map (\coef -> f32.abs (coef / p[PolyN-1])) p)
+ 1 + f32.maximum (map (\coef -> f32.abs (coef / p[PolyN-1])) (init p))
module aberth = {
type approx = [N]complex