[][src]Trait peroxide::structure::vector::FPVector

pub trait FPVector {
    type Scalar;
    fn fmap<F>(&self, f: F) -> Self
    where
        F: Fn(Self::Scalar) -> Self::Scalar
;
fn reduce<F, T>(&self, init: T, f: F) -> Self::Scalar
    where
        F: Fn(Self::Scalar, Self::Scalar) -> Self::Scalar,
        T: Into<Self::Scalar>
;
fn zip_with<F>(&self, f: F, other: &Self) -> Self
    where
        F: Fn(Self::Scalar, Self::Scalar) -> Self::Scalar
;
fn filter<F>(&self, f: F) -> Self
    where
        F: Fn(Self::Scalar) -> bool
;
fn take(&self, n: usize) -> Self;
fn skip(&self, n: usize) -> Self; }

Functional Programming tools for Vector

Associated Types

type Scalar

Loading content...

Required methods

fn fmap<F>(&self, f: F) -> Self where
    F: Fn(Self::Scalar) -> Self::Scalar

fn reduce<F, T>(&self, init: T, f: F) -> Self::Scalar where
    F: Fn(Self::Scalar, Self::Scalar) -> Self::Scalar,
    T: Into<Self::Scalar>, 

fn zip_with<F>(&self, f: F, other: &Self) -> Self where
    F: Fn(Self::Scalar, Self::Scalar) -> Self::Scalar

fn filter<F>(&self, f: F) -> Self where
    F: Fn(Self::Scalar) -> bool

fn take(&self, n: usize) -> Self

fn skip(&self, n: usize) -> Self

Loading content...

Implementations on Foreign Types

impl FPVector for Vec<Dual>[src]

type Scalar = Dual

Loading content...

Implementors

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));
Loading content...