//! Rotated Hyper Ellipsoid test function
use ndarray::Array1;
/// Rotated hyper-ellipsoid function - unimodal, non-separable
/// Global minimum: f(x) = 0 at x = (0, 0, ..., 0)
/// Bounds: x_i in [-65.536, 65.536]
pub fn rotated_hyper_ellipsoid(x: &Array1<f64>) -> f64 {
(0..x.len())
.map(|i| x.iter().take(i + 1).map(|&xi| xi.powi(2)).sum::<f64>())
.sum::<f64>()
}