Principal Component Analysis.
The following example shows how to apply PCA to an array of three samples, and obtain singular values as well as how much variance each component explains.
```rust use ndarray::arr2; use petal_decomposition::Pca;
let x = arr2(&[[0f64, 0f64], [1f64, 1f64], [2f64, 2f64]]); let pca = Pca::new(2); // Keep two dimensions. pca.fit(&x).unwrap();
let s = pca.singularvalues(); // [2f64, 0f64] let v = pca.explainedvarianceratio(); // [1f64, 0f64] let y = pca.transform(&x).unwrap(); // [-2f64.sqrt(), 0f64, 2f64.sqrt()] ```