[][src]Trait rstats::Vectors

pub trait Vectors {
    fn dotp(&self, other: &[f64]) -> f64;
fn vsub(&self, other: &[f64]) -> Vec<f64>;
fn vadd(&self, other: &[f64]) -> Vec<f64>;
fn vmag(&self) -> f64;
fn vdist(&self, other: &[f64]) -> f64;
fn smult(&self, s: f64) -> Vec<f64>;
fn vunit(&self) -> Vec<f64>; }

Implementing basic vector algebra.

Required methods

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

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

fn vadd(&self, other: &[f64]) -> Vec<f64>

fn vmag(&self) -> f64

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

fn smult(&self, s: f64) -> Vec<f64>

fn vunit(&self) -> Vec<f64>

Loading content...

Implementations on Foreign Types

impl Vectors for Vec<f64>[src]

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

Scalar multiplication of a vector, creates new vec

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

Scalar product of two f64 slices.
Must be of the same length - no error checking for speed

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

Vector subtraction, creates a new Vec result

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

Vector addition, creates a new Vec result

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

Euclidian distance between two n dimensional points (vectors)

fn vmag(&self) -> f64[src]

Vector magnitude

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

Unit vector

impl<'_> Vectors for &'_ [f64][src]

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

Scalar multiplication of a vector, creates new vec

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

Scalar product of two f64 slices.
Must be of the same length - no error checking for speed

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

Vector subtraction, creates a new Vec result

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

Vector addition, creates a new Vec result

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

Euclidian distance between two n dimensional points (vectors).
Slightly faster than vsub followed by vmag, as both are done in one loop

fn vmag(&self) -> f64[src]

Vector magnitude

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

Unit vector

Loading content...

Implementors

Loading content...