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: &[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 vsim(self, v: &[f64]) -> f64;
fn vdisim(self, v: &[f64]) -> f64;
fn varc(self, v: &[f64]) -> 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

fn smult(self, s: f64) -> Vec<f64>[src]

Scalar multiplication of a vector

fn sadd(self, s: f64) -> Vec<f64>[src]

Scalar addition to vector

fn dotp(self, v: &[f64]) -> f64[src]

Scalar product of u8 and f64 vectors

fn dotpu8(self, v: &[u8]) -> u64[src]

Scalar product of two u8 vectors -> u64

fn cosine(self, v: &[f64]) -> f64[src]

Cosine between u8 and f64 vectors

fn cosineu8(self, v: &[u8]) -> f64[src]

Cosine between two u8 vectors

fn vsub(self, v: &[f64]) -> Vec<f64>[src]

Vector subtraction

fn vsubu8(self, v: &[u8]) -> Vec<f64>[src]

Vector subtraction

fn vadd(self, v: &[u8]) -> Vec<f64>[src]

Vector addition

fn vmag(self) -> f64[src]

Vector magnitude

fn vmagsq(self) -> f64[src]

Vector magnitude squared (sum of squares)

fn vdist(self, v: &[f64]) -> f64[src]

Euclidian distance to &f64

fn vdistu8(self, v: &[u8]) -> f64[src]

Euclidian distance to &u8

fn vdistsq(self, v: &[u8]) -> u64[src]

Euclidian distance between byte vectors

fn vsim(self, v: &[f64]) -> f64[src]

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

fn vdisim(self, v: &[f64]) -> f64[src]

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

fn varc(self, v: &[f64]) -> f64[src]

Area proportional to the swept arc

fn pdf(self) -> Vec<f64>[src]

Probability density function (pdf) of bytes data

fn entropy(self) -> f64[src]

Information (entropy) in nats of &u8

fn jointpdf(self, v: &[u8]) -> Vec<Vec<u32>>[src]

Counts of joint bytes values

fn jointentropy(self, v: &[u8]) -> f64[src]

Joint entropy of &u8,&u8 in nats

fn dependence(self, v: &[u8]) -> f64[src]

Statistical independence measure based on joint entropy

fn vecu8asvecf64(self) -> Vec<f64>[src]

cast vector of u8s to vector of f64s

Implementations on Foreign Types

impl Vecu8 for &[u8][src]

fn smult(self, s: f64) -> Vec<f64>[src]

Scalar multiplication of a vector, creates new vec

fn sadd(self, s: f64) -> Vec<f64>[src]

Scalar addition to a vector, creates new vec

fn dotp(self, v: &[f64]) -> f64[src]

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

fn dotpu8(self, v: &[u8]) -> u64[src]

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

fn cosine(self, v: &[f64]) -> f64[src]

Cosine between &u8 and &f64.

fn cosineu8(self, v: &[u8]) -> f64[src]

Cosine between two (positive) u8 slices.

fn vsub(self, v: &[f64]) -> Vec<f64>[src]

Vector subtraction

fn vsubu8(self, v: &[u8]) -> Vec<f64>[src]

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

fn vadd(self, v: &[u8]) -> Vec<f64>[src]

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

fn vmag(self) -> f64[src]

Vector magnitude

fn vmagsq(self) -> f64[src]

Vector magnitude squared

fn vdist(self, v: &[f64]) -> f64[src]

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

fn vdistu8(self, v: &[u8]) -> f64[src]

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

fn vdistsq(self, v: &[u8]) -> u64[src]

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

fn varc(self, v: &[f64]) -> f64[src]

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

fn vsim(self, v: &[f64]) -> f64[src]

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

fn vdisim(self, v: &[f64]) -> f64[src]

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

fn pdf(self) -> Vec<f64>[src]

Probability density function of bytes data

fn entropy(self) -> f64[src]

Information (entropy) of &u8 (in nats)

fn jointpdf(self, v: &[u8]) -> Vec<Vec<u32>>[src]

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.

fn jointentropy(self, v: &[u8]) -> f64[src]

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

fn dependence(self, v: &[u8]) -> f64[src]

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

fn vecu8asvecf64(self) -> Vec<f64>[src]

Potentially useful clone-recast of &u8 to &f64

Implementors