Struct rustlearn::array::dense::Array
[−]
[src]
pub struct Array {
// some fields omitted
}Basic two-dimensional dense matrix type.
Methods
impl Array[src]
fn zeros(rows: usize, cols: usize) -> Array
Create a rows by cols array of zeros.
fn ones(rows: usize, cols: usize) -> Array
Create a rows by cols array of ones.
fn reshape(&mut self, rows: usize, cols: usize)
Change the shape of the array to rows by cols.
Panics
If the number of elements implied by the new shape is different from the current number of elements.
fn order(&self) -> &MatrixOrder
Return the order (row-major or column-major) of the array.
fn data(&self) -> &Vec<f32>
Return an immutable reference to the underlying data buffer of the array.
The arrangement of the elements in that vector is dependent on whether this is a row-major or a column-major array.
fn as_slice(&self) -> &[f32]
Return an immutable reference to the underlying data buffer of the array.
The arrangement of the elements in that vector is dependent on whether this is a row-major or a column-major array.
fn as_mut_slice(&mut self) -> &mut [f32]
Return an mutable reference to the underlying data buffer of the array.
The arrangement of the elements in that vector is dependent on whether this is a row-major or a column-major array.
fn T(self) -> Array
Transpose the matrix.
fn sum(&self) -> f32
Compute the sum of the entries of the array.
fn mean(&self) -> f32
Compute the mean of the array.
Trait Implementations
impl Decodable for Array[src]
impl Encodable for Array[src]
impl Debug for Array[src]
impl Clone for Array[src]
fn clone(&self) -> Array
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl<'a> RowIterable for &'a Array[src]
type Item = ArrayView<'a>
type Output = ArrayIterator<'a>
fn iter_rows(self) -> ArrayIterator<'a>
Iterate over rows of the matrix.
fn view_row(self, idx: usize) -> ArrayView<'a>
View a row of the matrix.
fn iter_rows_range(self, range: Range<usize>) -> ArrayIterator<'a>
Iterate over a subset of rows of the matrix.
impl<'a> ColumnIterable for &'a Array[src]
type Item = ArrayView<'a>
type Output = ArrayIterator<'a>
fn iter_columns(self) -> ArrayIterator<'a>
Iterate over columns of a the matrix.
fn view_column(self, idx: usize) -> ArrayView<'a>
View a column of the matrix.
fn iter_columns_range(self, range: Range<usize>) -> ArrayIterator<'a>
Iterate over a subset of columns of the matrix.
impl IndexableMatrix for Array[src]
fn rows(&self) -> usize
Return the number of rows of the matrix.
fn cols(&self) -> usize
Return the number of columns of the matrix.
unsafe fn get_unchecked(&self, row: usize, col: usize) -> f32
Get the value of the entry at (row, column) without bounds checking.
unsafe fn get_unchecked_mut(&mut self, row: usize, col: usize) -> &mut f32
Get a mutable reference to the value of the entry at (row, column) without bounds checking. Read more
fn get(&self, row: usize, column: usize) -> f32
Get the value of the entry at (row, column). Read more
fn get_mut(&mut self, row: usize, column: usize) -> &mut f32
Get a mutable reference to value of the entry at (row, column). Read more
fn set(&mut self, row: usize, column: usize, value: f32)
Set the value of the entry at (row, column) to value. Read more
unsafe fn set_unchecked(&mut self, row: usize, column: usize, value: f32)
Set the value of the entry at (row, column) to value without bounds checking.
impl From<Vec<f32>> for Array[src]
impl<'a> From<&'a Vec<Vec<f32>>> for Array[src]
fn from(input: &Vec<Vec<f32>>) -> Array
Construct an array from a vector of vectors.
Panics
This will panic if the input vector is emtpy or if its rows are of unequal length.
impl ElementwiseArrayOps<f32> for Array[src]
type Output = Array
fn add(&self, rhs: f32) -> Array
fn add_inplace(&mut self, rhs: f32)
fn sub(&self, rhs: f32) -> Array
fn sub_inplace(&mut self, rhs: f32)
fn times(&self, rhs: f32) -> Array
fn times_inplace(&mut self, rhs: f32)
fn div(&self, rhs: f32) -> Array
fn div_inplace(&mut self, rhs: f32)
impl<'a> ElementwiseArrayOps<&'a Array> for Array[src]
Perform elementwise operations between two arrays.
Panics
Will panic if the two operands are not of the same shape.