Struct rustlearn::array::dense::Array
[−]
[src]
pub struct Array { /* fields omitted */ }
Basic two-dimensional dense matrix type.
Methods
impl Array
[src]
pub fn zeros(rows: usize, cols: usize) -> Array
[src]
Create a rows
by cols
array of zeros.
pub fn ones(rows: usize, cols: usize) -> Array
[src]
Create a rows
by cols
array of ones.
pub fn reshape(&mut self, rows: usize, cols: usize)
[src]
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.
pub fn order(&self) -> &MatrixOrder
[src]
Return the order (row-major or column-major) of the array.
pub fn data(&self) -> &Vec<f32>
[src]
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.
pub fn as_slice(&self) -> &[f32]
[src]
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.
pub fn as_mut_slice(&mut self) -> &mut [f32]
[src]
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.
pub fn T(self) -> Array
[src]
Transpose the matrix.
pub fn sum(&self) -> f32
[src]
Compute the sum of the entries of the array.
pub fn mean(&self) -> f32
[src]
Compute the mean of the array.
Trait Implementations
impl Encodable for Array
[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>
[src]
Serialize a value using an Encoder
.
impl Decodable for Array
[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Array, __D::Error>
[src]
Deserialize a value using a Decoder
.
impl Clone for Array
[src]
fn clone(&self) -> Array
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Array
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a> RowIterable for &'a Array
[src]
type Item = ArrayView<'a>
type Output = ArrayIterator<'a>
ⓘImportant traits for ArrayIterator<'a>fn iter_rows(self) -> ArrayIterator<'a>
[src]
Iterate over rows of the matrix.
fn view_row(self, idx: usize) -> ArrayView<'a>
[src]
View a row of the matrix.
ⓘImportant traits for ArrayIterator<'a>fn iter_rows_range(self, range: Range<usize>) -> ArrayIterator<'a>
[src]
Iterate over a subset of rows of the matrix.
impl<'a> ColumnIterable for &'a Array
[src]
type Item = ArrayView<'a>
type Output = ArrayIterator<'a>
ⓘImportant traits for ArrayIterator<'a>fn iter_columns(self) -> ArrayIterator<'a>
[src]
Iterate over columns of a the matrix.
fn view_column(self, idx: usize) -> ArrayView<'a>
[src]
View a column of the matrix.
ⓘImportant traits for ArrayIterator<'a>fn iter_columns_range(self, range: Range<usize>) -> ArrayIterator<'a>
[src]
Iterate over a subset of columns of the matrix.
impl IndexableMatrix for Array
[src]
fn rows(&self) -> usize
[src]
Return the number of rows of the matrix.
fn cols(&self) -> usize
[src]
Return the number of columns of the matrix.
unsafe fn get_unchecked(&self, row: usize, col: usize) -> f32
[src]
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
[src]
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
[src]
Get the value of the entry at (row
, column
). Read more
fn get_mut(&mut self, row: usize, column: usize) -> &mut f32
[src]
Get a mutable reference to value of the entry at (row
, column
). Read more
fn set(&mut self, row: usize, column: usize, value: f32)
[src]
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)
[src]
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
[src]
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
[src]
fn add_inplace(&mut self, rhs: f32)
[src]
fn sub(&self, rhs: f32) -> Array
[src]
fn sub_inplace(&mut self, rhs: f32)
[src]
fn times(&self, rhs: f32) -> Array
[src]
fn times_inplace(&mut self, rhs: f32)
[src]
fn div(&self, rhs: f32) -> Array
[src]
fn div_inplace(&mut self, rhs: f32)
[src]
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.
type Output = Array
fn add(&self, rhs: &'a Array) -> Array
[src]
fn add_inplace(&mut self, rhs: &'a Array)
[src]
fn sub(&self, rhs: &'a Array) -> Array
[src]
fn sub_inplace(&mut self, rhs: &'a Array)
[src]
fn times(&self, rhs: &'a Array) -> Array
[src]
fn times_inplace(&mut self, rhs: &'a Array)
[src]
fn div(&self, rhs: &'a Array) -> Array
[src]
fn div_inplace(&mut self, rhs: &'a Array)
[src]
impl<'a> Dot<&'a Array> for Array
[src]
impl RowIndex<Vec<usize>> for Array
[src]
impl<'a> From<&'a Array> for SparseRowArray
[src]
fn from(array: &Array) -> SparseRowArray
[src]
Performs the conversion.
impl<'a> From<&'a Array> for SparseColumnArray
[src]
fn from(array: &Array) -> SparseColumnArray
[src]
Performs the conversion.
impl<'a> SupervisedModel<&'a Array> for RandomForest
[src]
fn fit(&mut self, X: &Array, y: &Array) -> Result<(), &'static str>
[src]
fn decision_function(&self, X: &Array) -> Result<Array, &'static str>
[src]
fn predict(&self, x: T) -> Result<Array, &'static str>
[src]
impl<'a> SupervisedModel<&'a Array> for SGDClassifier
[src]
fn fit(&mut self, X: &Array, y: &Array) -> Result<(), &'static str>
[src]
fn decision_function(&self, X: &Array) -> Result<Array, &'static str>
[src]
fn predict(&self, x: T) -> Result<Array, &'static str>
[src]
impl<'a> ParallelPredict<&'a Array> for SGDClassifier
[src]
fn decision_function_parallel(
&self,
X: &Array,
num_threads: usize
) -> Result<Array, &'static str>
[src]
&self,
X: &Array,
num_threads: usize
) -> Result<Array, &'static str>
fn predict_parallel(
&self,
X: T,
num_threads: usize
) -> Result<Array, &'static str>
[src]
&self,
X: T,
num_threads: usize
) -> Result<Array, &'static str>
impl<'a, T: SupervisedModel<&'a Array> + Clone> SupervisedModel<&'a Array> for OneVsRestWrapper<T>
[src]
fn fit(&mut self, X: &'a Array, y: &Array) -> Result<(), &'static str>
[src]
fn decision_function(&self, X: &'a Array) -> Result<Array, &'static str>
[src]
fn predict(&self, X: &'a Array) -> Result<Array, &'static str>
[src]
impl<'a, T: SupervisedModel<&'a Array> + Clone + Sync> ParallelPredict<&'a Array> for OneVsRestWrapper<T>
[src]
fn decision_function_parallel(
&self,
X: &'a Array,
num_threads: usize
) -> Result<Array, &'static str>
[src]
&self,
X: &'a Array,
num_threads: usize
) -> Result<Array, &'static str>
fn predict_parallel(
&self,
X: &'a Array,
num_threads: usize
) -> Result<Array, &'static str>
[src]
&self,
X: &'a Array,
num_threads: usize
) -> Result<Array, &'static str>
impl<'a, T: SupervisedModel<&'a Array> + Clone + Sync + Send> ParallelSupervisedModel<&'a Array> for OneVsRestWrapper<T>
[src]
fn fit_parallel(
&mut self,
X: &'a Array,
y: &Array,
num_threads: usize
) -> Result<(), &'static str>
[src]
&mut self,
X: &'a Array,
y: &Array,
num_threads: usize
) -> Result<(), &'static str>