pub fn l2(nums: &[f64]) -> Option<f64> {
    if nums.is_empty() {
        Some(0.0)
    } else {
        let mut sum = 0.0;
        for i in &nums[..] {
            sum = sum + i.powf(2.0);
        }
        Some(sum.sqrt())
    }
}
/// L2 norm (Euclidean norm) of input values. The L2
/// norm of an empty list is 0.0.
///
/// # Examples:
///
/// ```
/// # use stats::*;
/// assert_eq!(Some(0.0), l2(&[]));
/// ```
/// ```
/// # use stats::*;
/// assert_eq!(Some(5.0), l2(&[-3.0, 4.0]));
/// ```
/// ```
/// # use stats::*;
/// assert_eq!(Some(5.0), l2(&[5.0]));
/// ```
L2 norm (Euclidean norm) of input values. The L2
norm of an empty list is 0.0.
L2 norm ( Euclidean norm ) of input values . The L2 norm of an empty list is 0 . 0 .
pub fn l2(nums: &[f64]) -> Option<f64> {
    if nums.is_empty() {
        Some(0.0)
    } else {
        let mut sum = 0.0;
        for i in &nums[..] {
            sum = sum + i.powf(2.0);
        }
        Some(sum.sqrt())
    }
}
pub fn l2 ( nums : & [ f64 ] ) -> Option < f64 > { if nums . is_empty ( ) { Some ( 0.0 ) } else { let mut sum = 0.0 ; for i in & nums [ .. ] { sum = sum + i . powf ( 2.0 ) ; } Some ( sum . sqrt ( ) ) } }
L2 norm (Euclidean norm) of input values.
L2 norm ( Euclidean norm ) of input values .
nums
&[f64]
nums
&[f64]
examples:
None
use stats::*;
None
use stats::*;
None
use stats::*;
None