Function normalize_vector

Source
pub fn normalize_vector<S>(
    array: &ArrayBase<S, Ix1>,
    method: NormalizationMethod,
) -> Result<Array1<f64>>
where S: Data, S::Elem: Float + NumCast,
Expand description

Normalizes a 1D array

§Arguments

  • array - The input 1D array to normalize
  • method - The normalization method to apply

§Returns

  • Result<Array1<f64>> - The normalized array

§Examples

use ndarray::array;
use scirs2_transform::normalize::{normalize_vector, NormalizationMethod};

let data = array![1.0, 2.0, 3.0, 4.0, 5.0];
                   
// Normalize vector using min-max normalization
let normalized = normalize_vector(&data, NormalizationMethod::MinMax).unwrap();