fn polyiter_maker(v: Vec<Cx>) -> Box<dyn Fn(Cx, usize) -> usize> {
    let deg = v.len() - 1;
    let f = move |c, limit| {
        let mut z = c;
        for n in 0..limit {
            let mut tot = Cx { re: 0.0, im: 0.0 };
            let mut w = Cx { re: 1.0, im: 0.0 };
            for a in v[0..deg].iter() {
                tot = tot + (*a) * w;
                w = w * z;
            }
            tot = unsafe { tot + (*v.get_unchecked(deg) * w) };
            z = tot;
            if z.sqmod() > SQ_MOD_LIMIT {
                return n;
            }
        }
        limit
    };

    Box::new(f)
}
/*
Generate and return a function (a closure) to iterate a point using an
arbitrary polynomial iterator.

Given a vector `v` of complex coefficients, this function will generate
the iteration function

    f(z) = v[0]*z + v[1]*z^2 + v[2]*z^3 + ...

*/
Generate and return a function (a closure) to iterate a point using an
arbitrary polynomial iterator.

Given a vector `v` of complex coefficients, this function will generate
the iteration function


Generate and return a function ( a closure ) to iterate a point using an arbitrary polynomial iterator . Given a vector ` v ` of complex coefficients this function will generate the iteration function
fn polyiter_maker(v: Vec<Cx>) -> Box<dyn Fn(Cx, usize) -> usize> {
    let deg = v.len() - 1;
    let f = move |c, limit| {
        let mut z = c;
        for n in 0..limit {
            let mut tot = Cx { re: 0.0, im: 0.0 };
            let mut w = Cx { re: 1.0, im: 0.0 };
            for a in v[0..deg].iter() {
                tot = tot + (*a) * w;
                w = w * z;
            }
            tot = unsafe { tot + (*v.get_unchecked(deg) * w) };
            z = tot;
            if z.sqmod() > SQ_MOD_LIMIT {
                return n;
            }
        }
        limit
    };
    Box::new(f)
}
fn polyiter_maker ( v : Vec < Cx > ) -> Box < dyn Fn ( Cx , usize ) -> usize > { let deg = v . len ( ) - 1 ; let f = move | c , limit | { let mut z = c ; for n in 0 .. limit { let mut tot = Cx { re : 0.0 , im : 0.0 } ; let mut w = Cx { re : 1.0 , im : 0.0 } ; for a in v [ 0 .. deg ] . iter ( ) { tot = tot + ( * a ) * w ; w = w * z ; } tot = unsafe { tot + ( * v . get_unchecked ( deg ) * w ) } ; z = tot ; if z . sqmod ( ) > SQ_MOD_LIMIT { return n ; } } limit } ; Box :: new ( f ) }
Generate and return a function (a closure) to iterate a point using an
arbitrary polynomial iterator.
Generate and return a function ( a closure ) to iterate a point using an arbitrary polynomial iterator .
v
Vec<Cx>
v
Vec<Cx>