pub fn rastrigin_a<T: Float + FromPrimitive + Sum>(param: &[T], a: T) -> T {
    a * T::from_usize(param.len()).unwrap()
        + param
            .iter()
            .map(|&x| x.powi(2) - a * (T::from_f64(2.0 * PI).unwrap() * x).cos())
            .sum()
}
/// Rastrigin test function
///
/// The same as `rastrigin`; however, it allows to set the parameter a.
Rastrigin test function
The same as `rastrigin`; however, it allows to set the parameter a.
Rastrigin test function The same as ` rastrigin ` ; however it allows to set the parameter a .
pub fn rastrigin_a<T: Float + FromPrimitive + Sum>(param: &[T], a: T) -> T {
    a * T::from_usize(param.len()).unwrap()
        + param
            .iter()
            .map(|&x| x.powi(2) - a * (T::from_f64(2.0 * PI).unwrap() * x).cos())
            .sum()
}
pub fn rastrigin_a < T : Float + FromPrimitive + Sum > ( param : & [ T ] , a : T ) -> T { a * T :: from_usize ( param . len ( ) ) . unwrap ( ) + param . iter ( ) . map ( | & x | x . powi ( 2 ) - a * ( T :: from_f64 ( 2.0 * PI ) . unwrap ( ) * x ) . cos ( ) ) . sum ( ) }
Rastrigin test function
The same as `rastrigin`; however, it allows to set the parameter a.
Rastrigin test function The same as ` rastrigin ` ; however it allows to set the parameter a .
param
&[T]
a
T
param
&[T]
a
T