[][src]Trait gulali::builders::TwoDimensional

pub trait TwoDimensional<T> where
    T: Num + FromPrimitive + Copy
{ fn two_dim() -> TwoDimensionalVectorParams<T>; }

Two-dimensional vector builder

Required methods

fn two_dim() -> TwoDimensionalVectorParams<T>

Two-dimensional vector builder. It returns TwoDimensionalVectorParams with default value:

This example is not tested
TwoDimensionalVectorParams{
    shape: None,
    default_value: None,
}

The parameter can be configured using the following methods: with_shape(), full_of(), ones() and zeros(). After the two-dimensional vector parameters are configured, use generate() to generate the two-dimensional vector.

Examples

// Generate a two-dimensional vector with shape [2, 2]
// filled with zeros; f64 can be changed into any
// numeric data types.
let v: Vec<Vec<f64>> = Vec::two_dim()
    .with_shape([2, 2])
    .zeros()
    .generate();

assert_eq!(v, [[0.0, 0.0], [0.0, 0.0]]);
Loading content...

Implementations on Foreign Types

impl<T> TwoDimensional<T> for Vec<Vec<T>> where
    T: Num + FromPrimitive + Copy
[src]

Loading content...

Implementors

Loading content...