[][src]Trait peroxide::traits::sugar::ScalableMut

pub trait ScalableMut {
    type Vec;
    fn resize_mut(&mut self, size: (usize, usize), shape: Shape);
fn add_col_mut(&mut self, v: &Self::Vec);
fn add_row_mut(&mut self, v: &Self::Vec); }

Associated Types

type Vec

Loading content...

Required methods

fn resize_mut(&mut self, size: (usize, usize), shape: Shape)

fn add_col_mut(&mut self, v: &Self::Vec)

fn add_row_mut(&mut self, v: &Self::Vec)

Loading content...

Implementors

impl ScalableMut for Matrix[src]

type Vec = Vec<f64>

fn resize_mut(&mut self, (r, c): (usize, usize), shape: Shape)[src]

Resize matrix (Mutable)

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let mut a = ml_matrix("1 2 3;4 5 6"); // ml_matrix has shape `Row`
    a.resize_mut((3, 2), Row);
    assert_eq!(a, ml_matrix("1 2;3 4;5 6"));
    a.resize_mut((3, 2), Col);
    assert_eq!(a, ml_matrix("1 4;2 5;3 6"));
}

fn add_row_mut(&mut self, v: &Self::Vec)[src]

Add row (Mutable)

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let mut a = ml_matrix("1 2 3;4 5 6");
    let b = c!(7,8,9);
    a.add_row_mut(&b);
    assert_eq!(a, ml_matrix("1 2 3;4 5 6;7 8 9"));
}

fn add_col_mut(&mut self, v: &Self::Vec)[src]

Add column (Mutable)

#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let mut a = ml_matrix("1 2 3;4 5 6");
    let b = c!(7,8);
    a.add_col_mut(&b);
    assert_eq!(a, ml_matrix("1 2 3 7;4 5 6 8"));
}
Loading content...