pub trait Array2<T: Debug + Display + Copy + Sized>: MutArrayView2<T> + Sized + Clone {
Show 42 methods
fn fill(nrows: usize, ncols: usize, value: T) -> Self;
fn slice<'a>(
&'a self,
rows: Range<usize>,
cols: Range<usize>
) -> Box<dyn ArrayView2<T> + 'a>
where
Self: Sized;
fn slice_mut<'a>(
&'a mut self,
rows: Range<usize>,
cols: Range<usize>
) -> Box<dyn MutArrayView2<T> + 'a>
where
Self: Sized;
fn from_iterator<I: Iterator<Item = T>>(
iter: I,
nrows: usize,
ncols: usize,
axis: u8
) -> Self;
fn get_row<'a>(&'a self, row: usize) -> Box<dyn ArrayView1<T> + 'a>
where
Self: Sized;
fn get_col<'a>(&'a self, col: usize) -> Box<dyn ArrayView1<T> + 'a>
where
Self: Sized;
fn zeros(nrows: usize, ncols: usize) -> Self
where
T: Number,
{ ... }
fn ones(nrows: usize, ncols: usize) -> Self
where
T: Number,
{ ... }
fn eye(size: usize) -> Self
where
T: Number,
{ ... }
fn rand(nrows: usize, ncols: usize) -> Self
where
T: RealNumber,
{ ... }
fn from_slice(slice: &dyn ArrayView2<T>) -> Self { ... }
fn from_row(slice: &dyn ArrayView1<T>) -> Self { ... }
fn from_column(slice: &dyn ArrayView1<T>) -> Self { ... }
fn transpose(&self) -> Self { ... }
fn reshape(&self, nrows: usize, ncols: usize, axis: u8) -> Self { ... }
fn matmul(&self, other: &dyn ArrayView2<T>) -> Self
where
T: Number,
{ ... }
fn ab(
&self,
a_transpose: bool,
b: &dyn ArrayView2<T>,
b_transpose: bool
) -> Self
where
T: Number,
{ ... }
fn ax(&self, a_transpose: bool, x: &dyn ArrayView1<T>) -> Self
where
T: Number,
{ ... }
fn concatenate_1d<'a>(arrays: &'a [&'a dyn ArrayView1<T>], axis: u8) -> Self { ... }
fn concatenate_2d<'a>(arrays: &'a [&'a dyn ArrayView2<T>], axis: u8) -> Self { ... }
fn merge_1d<'a>(
&'a self,
arrays: &'a [&'a dyn ArrayView1<T>],
axis: u8,
append: bool
) -> Self { ... }
fn v_stack(&self, other: &dyn ArrayView2<T>) -> Self { ... }
fn h_stack(&self, other: &dyn ArrayView2<T>) -> Self { ... }
fn map<O: Debug + Display + Copy + Sized, A: Array2<O>, F: FnMut(&T) -> O>(
self,
f: F
) -> A { ... }
fn row_iter<'a>(
&'a self
) -> Box<dyn Iterator<Item = Box<dyn ArrayView1<T> + 'a>> + 'a> { ... }
fn col_iter<'a>(
&'a self
) -> Box<dyn Iterator<Item = Box<dyn ArrayView1<T> + 'a>> + 'a> { ... }
fn take(&self, index: &[usize], axis: u8) -> Self { ... }
fn take_column(&self, column_index: usize) -> Self { ... }
fn add_scalar(&self, x: T) -> Self
where
T: Number,
{ ... }
fn sub_scalar(&self, x: T) -> Self
where
T: Number,
{ ... }
fn div_scalar(&self, x: T) -> Self
where
T: Number,
{ ... }
fn mul_scalar(&self, x: T) -> Self
where
T: Number,
{ ... }
fn add(&self, other: &dyn Array<T, (usize, usize)>) -> Self
where
T: Number,
{ ... }
fn sub(&self, other: &dyn Array<T, (usize, usize)>) -> Self
where
T: Number,
{ ... }
fn mul(&self, other: &dyn Array<T, (usize, usize)>) -> Self
where
T: Number,
{ ... }
fn div(&self, other: &dyn Array<T, (usize, usize)>) -> Self
where
T: Number,
{ ... }
fn abs(&self) -> Self
where
T: Number + Signed,
{ ... }
fn neg(&self) -> Self
where
T: Number + Neg<Output = T>,
{ ... }
fn pow(&self, p: T) -> Self
where
T: RealNumber,
{ ... }
fn column_mean(&self) -> Vec<f64>
where
T: Number + ToPrimitive,
{ ... }
fn copy_col_as_vec(&self, col: usize, result: &mut Vec<T>) { ... }
fn approximate_eq(&self, other: &Self, error: T) -> bool
where
T: Number + RealNumber,
{ ... }
}Expand description
Trait for mutable 2D-array view
Required Methods
sourcefn slice<'a>(
&'a self,
rows: Range<usize>,
cols: Range<usize>
) -> Box<dyn ArrayView2<T> + 'a>where
Self: Sized,
fn slice<'a>(
&'a self,
rows: Range<usize>,
cols: Range<usize>
) -> Box<dyn ArrayView2<T> + 'a>where
Self: Sized,
sourcefn slice_mut<'a>(
&'a mut self,
rows: Range<usize>,
cols: Range<usize>
) -> Box<dyn MutArrayView2<T> + 'a>where
Self: Sized,
fn slice_mut<'a>(
&'a mut self,
rows: Range<usize>,
cols: Range<usize>
) -> Box<dyn MutArrayView2<T> + 'a>where
Self: Sized,
Provided Methods
sourcefn rand(nrows: usize, ncols: usize) -> Selfwhere
T: RealNumber,
fn rand(nrows: usize, ncols: usize) -> Selfwhere
T: RealNumber,
sourcefn from_slice(slice: &dyn ArrayView2<T>) -> Self
fn from_slice(slice: &dyn ArrayView2<T>) -> Self
sourcefn from_row(slice: &dyn ArrayView1<T>) -> Self
fn from_row(slice: &dyn ArrayView1<T>) -> Self
sourcefn from_column(slice: &dyn ArrayView1<T>) -> Self
fn from_column(slice: &dyn ArrayView1<T>) -> Self
sourcefn matmul(&self, other: &dyn ArrayView2<T>) -> Selfwhere
T: Number,
fn matmul(&self, other: &dyn ArrayView2<T>) -> Selfwhere
T: Number,
sourcefn ab(&self, a_transpose: bool, b: &dyn ArrayView2<T>, b_transpose: bool) -> Selfwhere
T: Number,
fn ab(&self, a_transpose: bool, b: &dyn ArrayView2<T>, b_transpose: bool) -> Selfwhere
T: Number,
sourcefn ax(&self, a_transpose: bool, x: &dyn ArrayView1<T>) -> Selfwhere
T: Number,
fn ax(&self, a_transpose: bool, x: &dyn ArrayView1<T>) -> Selfwhere
T: Number,
sourcefn concatenate_1d<'a>(arrays: &'a [&'a dyn ArrayView1<T>], axis: u8) -> Self
fn concatenate_1d<'a>(arrays: &'a [&'a dyn ArrayView1<T>], axis: u8) -> Self
sourcefn concatenate_2d<'a>(arrays: &'a [&'a dyn ArrayView2<T>], axis: u8) -> Self
fn concatenate_2d<'a>(arrays: &'a [&'a dyn ArrayView2<T>], axis: u8) -> Self
sourcefn merge_1d<'a>(
&'a self,
arrays: &'a [&'a dyn ArrayView1<T>],
axis: u8,
append: bool
) -> Self
fn merge_1d<'a>(
&'a self,
arrays: &'a [&'a dyn ArrayView1<T>],
axis: u8,
append: bool
) -> Self
sourcefn v_stack(&self, other: &dyn ArrayView2<T>) -> Self
fn v_stack(&self, other: &dyn ArrayView2<T>) -> Self
sourcefn h_stack(&self, other: &dyn ArrayView2<T>) -> Self
fn h_stack(&self, other: &dyn ArrayView2<T>) -> Self
sourcefn take_column(&self, column_index: usize) -> Self
fn take_column(&self, column_index: usize) -> Self
Take an individual column from the matrix.
sourcefn add_scalar(&self, x: T) -> Selfwhere
T: Number,
fn add_scalar(&self, x: T) -> Selfwhere
T: Number,
sourcefn sub_scalar(&self, x: T) -> Selfwhere
T: Number,
fn sub_scalar(&self, x: T) -> Selfwhere
T: Number,
sourcefn div_scalar(&self, x: T) -> Selfwhere
T: Number,
fn div_scalar(&self, x: T) -> Selfwhere
T: Number,
sourcefn mul_scalar(&self, x: T) -> Selfwhere
T: Number,
fn mul_scalar(&self, x: T) -> Selfwhere
T: Number,
sourcefn pow(&self, p: T) -> Selfwhere
T: RealNumber,
fn pow(&self, p: T) -> Selfwhere
T: RealNumber,
sourcefn column_mean(&self) -> Vec<f64>where
T: Number + ToPrimitive,
fn column_mean(&self) -> Vec<f64>where
T: Number + ToPrimitive,
compute mean for each column
sourcefn copy_col_as_vec(&self, col: usize, result: &mut Vec<T>)
fn copy_col_as_vec(&self, col: usize, result: &mut Vec<T>)
copy coumn as a vector
sourcefn approximate_eq(&self, other: &Self, error: T) -> boolwhere
T: Number + RealNumber,
fn approximate_eq(&self, other: &Self, error: T) -> boolwhere
T: Number + RealNumber,
appriximate equality of the elements of a matrix according to a given error