[][src]Type Definition peroxide::structure::vector::Vector

type Vector = Vec<f64>;

Trait Implementations

impl LinearOps for Vector[src]

fn to_matrix(&self) -> Matrix[src]

Vector to Column Matrix

fn transpose(&self) -> Matrix[src]

Vector to Row Matrix

fn t(&self) -> Matrix[src]

R-like Syntax

impl FPVector for Vector[src]

type Scalar = f64

fn fmap<F>(&self, f: F) -> Vector where
    F: Fn(f64) -> f64
[src]

fmap for Vector

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
assert_eq!(a.fmap(|x| x*2f64), seq!(2,10,2));

fn reduce<F, T>(&self, init: T, f: F) -> f64 where
    F: Fn(f64, f64) -> f64,
    T: Into<f64>, 
[src]

reduce for Vector

Examples

extern crate peroxide;
use peroxide::*;

let a = seq!(1,100,1);
assert_eq!(a.reduce(0, |x,y| x + y), 5050f64);

fn filter<F>(&self, f: F) -> Vector where
    F: Fn(f64) -> bool
[src]

Filter for Vector

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
let b = a.filter(|x| x > 3.);
assert_eq!(b, c!(4,5));

fn take(&self, n: usize) -> Vector[src]

Take for Vector

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
let b = a.take(3);
assert_eq!(b, c!(1,2,3));

fn skip(&self, n: usize) -> Vector[src]

Skip for Vector

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
let b = a.skip(3);
assert_eq!(b, c!(4,5));

impl Algorithm for Vector[src]

fn rank(&self) -> Vec<usize>[src]

Assign rank

Examples

extern crate peroxide;
use peroxide::*;

let v = c!(7, 5, 9, 2, 8);
assert_eq!(v.rank(), vec![2,3,0,4,1]);

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

Sign of Permutation

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,0,2);
let b = c!(1,2,0);
let c = c!(0,1,2);

assert_eq!((a.sign(), b.sign(), c.sign()), (-1f64, 1f64, 1f64));

fn arg_max(&self) -> usize[src]

arg max

Examples

extern crate peroxide;
use peroxide::*;

let v = c!(1,3,2,4,3,7);
assert_eq!(v.arg_max(),5);

let v2 = c!(1,3,2,5,6,6);
assert_eq!(v2.arg_max(),4);

impl VecOps for Vector[src]

Convenient Vector Operations (No Clone, No Copy)

type Scalar = f64

fn add(&self, other: &Vector) -> Vector[src]

Addition

fn sub(&self, other: &Vector) -> Vector[src]

Subtraction

fn mul(&self, other: &Vector) -> Vector[src]

Multiplication

fn div(&self, other: &Vector) -> Vector[src]

Division

fn dot(&self, other: &Vector) -> f64[src]

Dot product

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

Norm

impl Statistics for Vector[src]

type Array = Vector

type Value = f64

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

Mean

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
assert_eq!(a.mean(), 3.0);

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

Variance

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3,4,5);
assert_eq!(a.var(), 2.5);

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

Standard Deviation

Examples

extern crate peroxide;
use peroxide::*;

let a = c!(1,2,3);
assert!(nearly_eq(a.sd(), 1f64)); // Floating Number Error

impl Printable for Vector[src]

impl Pickle for Vector[src]

impl PowOps for Vector[src]

Power operation for Vector

type Output = Vector

fn pow(&self, n: usize) -> Vector[src]

Power usize

fn powf(&self, f: f64) -> Vector[src]

Power float

fn sqrt(&self) -> Vector[src]

Sqrt

impl Rem<Matrix> for Vector[src]

Matrix multiplication for Vector vs Matrix

Examples

extern crate peroxide;
use peroxide::*;

let a = matrix!(1;4;1, 2, 2, Row);
let v = c!(1,2);
assert_eq!(v % a, matrix(c!(7,10),1,2,Row));

type Output = Matrix

The resulting type after applying the % operator.