pub trait Input: Sized {
type InVector: Sized;
type OutVector;
fn to_dmatrix(m: &Self) -> DMatrix<f64>;
fn to_dvector(v: &Self::InVector) -> DVector<f64>;
fn from_dvector(v: &DVector<f64>) -> Self::OutVector;
fn into_dmatrix(m: Self) -> DMatrix<f64> { ... }
fn into_dvector(v: Self::InVector) -> DVector<f64> { ... }
}
Expand description
Implemented by Input -> Output
type pairs
Handles conversion to DMatrix type and stores information on associated output type.
Most methods of this library can currently work with the following input -> output
pairs :
Input | Output | Description |
---|---|---|
Vec<f64> | f64 | A single, multidimensional, sample. |
Vec<Vec<f64>> | Vec<f64> | Each inner vector is a training sample. |
DMatrix<f64> | DVector<f64> | Using a nalgebra matrix with one row per sample. |
Array1<f64> | f64 | A single sample stored in a ndarray array (using the friedrich_ndarray feature). |
Array2<f64> | Array1<f64> | Each row is a sample (using the friedrich_ndarray feature). |
User-defined input type should implement this trait.
Required Associated Types§
Required Methods§
sourcefn to_dmatrix(m: &Self) -> DMatrix<f64>
fn to_dmatrix(m: &Self) -> DMatrix<f64>
Converts an input matrix to a DMatrix.
sourcefn to_dvector(v: &Self::InVector) -> DVector<f64>
fn to_dvector(v: &Self::InVector) -> DVector<f64>
Converts an input vector to a DVector.
sourcefn from_dvector(v: &DVector<f64>) -> Self::OutVector
fn from_dvector(v: &DVector<f64>) -> Self::OutVector
Converts a DVector to an output vector.
Provided Methods§
sourcefn into_dmatrix(m: Self) -> DMatrix<f64>
fn into_dmatrix(m: Self) -> DMatrix<f64>
Optional: converts an owned input matrix to a DMatrix. This function is used for to reduce copies when the input type is compatible with DMatrix.
sourcefn into_dvector(v: Self::InVector) -> DVector<f64>
fn into_dvector(v: Self::InVector) -> DVector<f64>
Optional: converts an owned input vector to a DVector. This function is used for to reduce copies when the input type is compatible with DVector.
Implementations on Foreign Types§
source§impl Input for DMatrix<f64>
impl Input for DMatrix<f64>
Direct implementation.
source§impl Input for Vec<Vec<f64>>
impl Input for Vec<Vec<f64>>
Multiple rows, base rust type.