Trait rstats::Vecu8[][src]

pub trait Vecu8 {
Show methods fn smult(self, s: f64) -> Vec<f64>;
fn sadd(self, s: f64) -> Vec<f64>;
fn dotp(self, v: &[f64]) -> f64;
fn dotpu8(self, v: &[u8]) -> u64;
fn cosine(self, v: &[f64]) -> f64;
fn cosineu8(self, v: &[u8]) -> f64;
fn vsub(self, v: &[f64]) -> Vec<f64>;
fn vsubu8(self, v: &[u8]) -> Vec<f64>;
fn vadd(self, v: &[f64]) -> Vec<f64>;
fn vaddu8(self, v: &[u8]) -> Vec<f64>;
fn vmag(self) -> f64;
fn vmagsq(self) -> f64;
fn vdist(self, v: &[f64]) -> f64;
fn vdistu8(self, v: &[u8]) -> f64;
fn vdistsq(self, v: &[u8]) -> u64;
fn cityblockd(self, v: &[f64]) -> f64;
fn cityblockdu8(self, v: &[u8]) -> f64;
fn vsim(self, v: &[f64]) -> f64;
fn vdisim(self, v: &[f64]) -> f64;
fn varc(self, v: &[f64]) -> f64;
fn covone(self, m: &[f64]) -> Vec<f64>;
fn pdf(self) -> Vec<f64>;
fn entropy(self) -> f64;
fn jointpdf(self, v: &[u8]) -> Vec<Vec<u32>>;
fn jointentropy(self, v: &[u8]) -> f64;
fn dependence(self, v: &[u8]) -> f64;
fn vecu8asvecf64(self) -> Vec<f64>;
}
Expand description

Some support for Vec (vector of bytes)

Required methods

Scalar multiplication of a vector

Scalar addition to vector

Scalar product of u8 and f64 vectors

Scalar product of two u8 vectors -> u64

Cosine between u8 and f64 vectors

Cosine between two u8 vectors

Vector subtraction

Vector subtraction

Vector addition

Vector addition ( converts results to f64, as they can exceed 255 )

Vector magnitude

Vector magnitude squared (sum of squares)

Euclidian distance to &f64

Euclidian distance to &u8

Euclidian distance between byte vectors

cityblock distance

cityblock distance

Vector similarity S in the interval [0,1]: S = (1+cos(theta))/2

We define vector dissimilarity D in the interval [0,1]: D = 1-S = (1-cos(theta))/2

Area proportional to the swept arc

Lower triangular part of a covariance matrix for a single f64 vector.

Probability density function (pdf) of bytes data

Information (entropy) in nats of &u8

Counts of joint bytes values

Joint entropy of &u8,&u8 in nats

Statistical independence measure based on joint entropy

cast vector of u8s to vector of f64s

Implementations on Foreign Types

Scalar multiplication of a vector, creates new vec

Scalar addition to a vector, creates new vec

Scalar product.
Must be of the same length - no error checking (for speed)

Scalar product of two (positive) u8 slices.
Must be of the same length - no error checking (for speed)

Cosine between &u8 and &f64.

Cosine between two (positive) u8 slices.

Vector subtraction

Vector subtraction (converts results to f64 as they can be negative)

Vector addition

Vector addition ( converts results to f64, as they can exceed 255 )

Vector magnitude

Vector magnitude squared

Euclidian distance between self &u8 and v:&f64.

Euclidian distance between self &u8 and v:&u8.
Faster than vsub followed by vmag, as both are done in one loop

cityblock distance

cityblock distance

Euclidian distance squared, the arguments are both of &u8 type

Area of swept arc between self &u8 and v:&f64 = |a||b|(1-cos(theta)) = 2|a||b|D

We define vector similarity S in the interval [0,1] as S = (1+cos(theta))/2

We define vector dissimilarity D in the interval [0,1] as D = 1-S = (1-cos(theta))/2

Flattened lower triangular part of a covariance matrix for a single u8 vector. Since covariance matrix is symmetric (positive semi definite), the upper triangular part can be trivially added for all j>i by: c(j,i) = c(i,j). N.b. the indexing is always assumed to be in this order: row,column. The items of the resulting lower triangular array c[i][j] are pushed flat into a single vector in this double loop order: left to right, top to bottom

Probability density function of bytes data

Information (entropy) of &u8 (in nats)

Joint probability density function (here just co-occurence counts) of paired values in two vectors of bytes of the same length. Needs n^2 x 32bits of memory. Do not use for very long vectors, those need hashing implementation.

Joint entropy of &u8,&u8 (in nats)

Dependence of two &u8 variables, the range is [0,1], i.e. it returns 0 iff they are statistically independent and 1 when they are identical

Potentially useful clone-recast of &u8 to &f64

Implementors