pub trait VecVecg<T, U> {
Show 21 methods
fn leftmultv(self, v: &[U]) -> Result<Vec<f64>, RE>;
fn rightmultv(self, v: &[U]) -> Result<Vec<f64>, RE>;
fn matmult(self, m: &[Vec<U>]) -> Result<Vec<Vec<f64>>, RE>;
fn wsumv(self, ws: &[U]) -> Vec<f64>;
fn wacentroid(self, ws: &[U]) -> Vec<f64>;
fn trend(self, eps: f64, v: Vec<Vec<U>>) -> Vec<f64>;
fn translate(self, m: &[U]) -> Vec<Vec<f64>>;
fn zerogm(self, gm: &[f64]) -> Vec<Vec<f64>>;
fn dependencies(self, m: &[U]) -> Vec<f64>;
fn correlations(self, m: &[U]) -> Vec<f64>;
fn distsum(self, v: &[U]) -> f64;
fn dists(self, v: &[U]) -> Vec<f64>;
fn wsortedeccs(self, ws: &[U], gm: &[f64]) -> (Vec<f64>, Vec<f64>)
where
F64: From<T>;
fn wnxnonmember(self, ws: &[U], g: &[f64]) -> (Vec<f64>, Vec<f64>, f64);
fn wgmedian(self, ws: &[U], eps: f64) -> Vec<f64>;
fn wgmparts(self, ws: &[U], eps: f64) -> (Vec<f64>, Vec<f64>, f64);
fn wmadgm(self, ws: &[U], wgm: &[f64]) -> f64;
fn covar(self, med: &[U]) -> Vec<f64>;
fn wcovar(self, ws: &[U], m: &[f64]) -> Vec<f64>;
fn comed(self, m: &[U]) -> Vec<f64>;
fn wcomed(self, ws: &[U], m: &[f64]) -> Vec<f64>;
}
Expand description
Methods applicable to slice of vectors of generic end type, plus one other argument of a similar kind
Required Methods
Leftmultiply (column) vector v by matrix self
Rightmultiply (row) vector v by matrix self
fn wacentroid(self, ws: &[U]) -> Vec<f64>
fn wacentroid(self, ws: &[U]) -> Vec<f64>
Weighted Arithmetic Centre = weighted euclidian mean of a set of points
Subtract m from all points - e.g. transform to zero median form
fn dependencies(self, m: &[U]) -> Vec<f64>
fn dependencies(self, m: &[U]) -> Vec<f64>
Dependencies of vector m on each vector in self
fn correlations(self, m: &[U]) -> Vec<f64>
fn correlations(self, m: &[U]) -> Vec<f64>
(Median) correlations of m with each vector in self
Sum of distances from arbitrary point (v) to all the points in self
Individual distances from any point v (typically not in self) to all the points in self.
( wgm, sorted eccentricities magnitudes, associated cpdf )
Like wgmparts, except only does one iteration from any non-member point g
The weighted geometric median to accuracy eps
Like wgmedian
but returns also the sum of unit vecs and the sum of reciprocals.
wmadgm median of weighted absolute deviations from weighted gm: stable nd data spread estimator
Flattened lower triangular part of a covariance matrix of a Vec of f64 vectors.
Flattened lower triangular part of a covariance matrix for weighted f64 vectors.
Flattened comediance matrix for f64 vectors in self.
Similar to covar
above but medians instead of means are returned.
Implementations on Foreign Types
sourceimpl<T, U> VecVecg<T, U> for &[Vec<T>] where
T: Copy + PartialOrd + Display,
f64: From<T>,
U: Copy + PartialOrd + Display,
f64: From<U>,
impl<T, U> VecVecg<T, U> for &[Vec<T>] where
T: Copy + PartialOrd + Display,
f64: From<T>,
U: Copy + PartialOrd + Display,
f64: From<U>,
sourcefn leftmultv(self, v: &[U]) -> Result<Vec<f64>, RE>
fn leftmultv(self, v: &[U]) -> Result<Vec<f64>, RE>
Leftmultiply (column) vector v by matrix self
sourcefn rightmultv(self, v: &[U]) -> Result<Vec<f64>, RE>
fn rightmultv(self, v: &[U]) -> Result<Vec<f64>, RE>
Rightmultiply (row) vector v by matrix self
sourcefn matmult(self, m: &[Vec<U>]) -> Result<Vec<Vec<f64>>, RE>
fn matmult(self, m: &[Vec<U>]) -> Result<Vec<Vec<f64>>, RE>
Rectangular Matrices multiplication: self * m.
Returns DataError if lengths of rows of self: self[0].len()
and columns of m: m.len()
do not match.
Result dimensions are self.len() x m[0].len()
sourcefn wsumv(self, ws: &[U]) -> Vec<f64>
fn wsumv(self, ws: &[U]) -> Vec<f64>
Weighted sum of nd points (or vectors). Weights are associated with points, not coordinates
sourcefn wacentroid(self, ws: &[U]) -> Vec<f64>
fn wacentroid(self, ws: &[U]) -> Vec<f64>
Weighted Centre
sourcefn trend(self, eps: f64, v: Vec<Vec<U>>) -> Vec<f64>
fn trend(self, eps: f64, v: Vec<Vec<U>>) -> Vec<f64>
Trend computes the vector connecting the geometric medians of two sets of multidimensional points. This is a robust relationship between two unordered multidimensional sets. The two sets have to be in the same space but can have different numbers of points.
sourcefn translate(self, m: &[U]) -> Vec<Vec<f64>>
fn translate(self, m: &[U]) -> Vec<Vec<f64>>
Translates the whole set by subtracting vector m. Returns Vec of Vecs.
When m is set to the geometric median, this produces the zero median form.
The geometric median is invariant with respect to rotation,
unlike the often used mean (acentroid
here), or the quasi median,
both of which depend on the choice of axis.
sourcefn zerogm(self, gm: &[f64]) -> Vec<Vec<f64>>
fn zerogm(self, gm: &[f64]) -> Vec<Vec<f64>>
Transforms nd data to zeromedian form essentially the same as translate but specialised to f64 gms
sourcefn dependencies(self, m: &[U]) -> Vec<f64>
fn dependencies(self, m: &[U]) -> Vec<f64>
Dependencies of m on each vector in self m is typically a vector of outcomes. Factors out the entropy of m to save repetition of work
sourcefn correlations(self, m: &[U]) -> Vec<f64>
fn correlations(self, m: &[U]) -> Vec<f64>
(Median) correlations of m with each vector in self Factors out the unit vector of m to save repetition of work
sourcefn dists(self, v: &[U]) -> Vec<f64>
fn dists(self, v: &[U]) -> Vec<f64>
Individual distances from any point v, typically not a member, to all the members of self.
sourcefn distsum(self, v: &[U]) -> f64
fn distsum(self, v: &[U]) -> f64
Sum of distances from any single point v, typically not a member,
to all members of self.
Geometric Median (gm) is defined as the point which minimises this function.
This is relatively expensive measure to compute.
The radius (distance) from gm is far more efficient, once gm has been found.
sourcefn wsortedeccs(self, ws: &[U], gm: &[f64]) -> (Vec<f64>, Vec<f64>) where
F64: From<T>,
fn wsortedeccs(self, ws: &[U], gm: &[f64]) -> (Vec<f64>, Vec<f64>) where
F64: From<T>,
Sorted eccentricities magnitudes (radii), w.r.t. weighted geometric median. associated cummulative probability density function in [0,1] of the weights.
sourcefn wnxnonmember(self, ws: &[U], g: &[f64]) -> (Vec<f64>, Vec<f64>, f64)
fn wnxnonmember(self, ws: &[U], g: &[f64]) -> (Vec<f64>, Vec<f64>, f64)
Like wgmparts, except only does one iteration from any non-member point g
sourcefn wgmedian(self, ws: &[U], eps: f64) -> Vec<f64>
fn wgmedian(self, ws: &[U], eps: f64) -> Vec<f64>
Weighted Geometric Median (gm) is the point that minimises the sum of distances to a given set of points.
sourcefn wgmparts(self, ws: &[U], eps: f64) -> (Vec<f64>, Vec<f64>, f64)
fn wgmparts(self, ws: &[U], eps: f64) -> (Vec<f64>, Vec<f64>, f64)
Like gmedian
but returns also the sum of unit vecs and the sum of reciprocals.
sourcefn wmadgm(self, ws: &[U], wgm: &[f64]) -> f64
fn wmadgm(self, ws: &[U], wgm: &[f64]) -> f64
wmadgm median of weighted absolute deviations from weighted gm: stable nd data spread estimator
sourcefn covar(self, m: &[U]) -> Vec<f64>
fn covar(self, m: &[U]) -> Vec<f64>
Covariance matrix for f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
sourcefn wcovar(self, ws: &[U], m: &[f64]) -> Vec<f64>
fn wcovar(self, ws: &[U], m: &[f64]) -> Vec<f64>
Weighted covariance matrix for f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
sourcefn comed(self, m: &[U]) -> Vec<f64>
fn comed(self, m: &[U]) -> Vec<f64>
Covariance matrix for f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
Similar to covar
above but instead of averaging the covariances over n points,
their medians are returned.
sourcefn wcomed(self, ws: &[U], m: &[f64]) -> Vec<f64>
fn wcomed(self, ws: &[U], m: &[f64]) -> Vec<f64>
Covariance matrix for weighted f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
Similar to wcovar
above but instead of averaging the covariances over n points,
their median is returned.