Trait gad::array::ArrayAlgebra[][src]

pub trait ArrayAlgebra<Value> {
    type Dims;
    type Scalar;
    fn flat(&mut self, v: &Value) -> Value;
fn moddims(&mut self, v: &Value, dims: Self::Dims) -> Result<Value>;
fn tile_as(&mut self, v: &Value, dims: Self::Dims) -> Result<Value>;
fn sum_as(&mut self, v: &Value, dims: Self::Dims) -> Result<Value>;
fn constant_as(&mut self, v: &Self::Scalar, dims: Self::Dims) -> Value;
fn as_scalar(&mut self, v: &Value) -> Result<Self::Scalar>;
fn scale(&mut self, lambda: &Self::Scalar, v: &Value) -> Value;
fn dot(&mut self, v1: &Value, v2: &Value) -> Result<Self::Scalar>; fn norm2(&mut self, v: &Value) -> Self::Scalar { ... } }

Array operations.

Associated Types

Loading content...

Required methods

fn flat(&mut self, v: &Value) -> Value[src]

Re-shape the input into a single dimension array.

fn moddims(&mut self, v: &Value, dims: Self::Dims) -> Result<Value>[src]

Re-shape the input into an array of the given dimensions.

fn tile_as(&mut self, v: &Value, dims: Self::Dims) -> Result<Value>[src]

Repeats the input to match the given shape.

fn sum_as(&mut self, v: &Value, dims: Self::Dims) -> Result<Value>[src]

Sums some of the dimension of the input to fit the given shape.

fn constant_as(&mut self, v: &Self::Scalar, dims: Self::Dims) -> Value[src]

Fill an array of the given shape with the given scalar value.

fn as_scalar(&mut self, v: &Value) -> Result<Self::Scalar>[src]

Read the scalar value in a one-element array.

fn scale(&mut self, lambda: &Self::Scalar, v: &Value) -> Value[src]

Multiply the array element-wise by the given scalar.

fn dot(&mut self, v1: &Value, v2: &Value) -> Result<Self::Scalar>[src]

Compute the dot-product of two arrays of the same shape.

Loading content...

Provided methods

fn norm2(&mut self, v: &Value) -> Self::Scalar[src]

Compute the L2-norm of an array.

Loading content...

Implementors

impl<D, E, T, Dims> ArrayAlgebra<Value<D>> for Graph<Config1<E>> where
    E: Default + Clone + CoreAlgebra<D, Value = D> + CoreAlgebra<T, Value = T> + LinkedAlgebra<Value<D>, D> + LinkedAlgebra<Value<T>, T> + ArrayAlgebra<D, Scalar = T, Dims = Dims>,
    Dims: PartialEq + Clone + Copy + Debug + Default + 'static + Send + Sync,
    D: HasDims<Dims = Dims> + Clone + 'static + Send + Sync,
    T: Number
[src]

type Dims = Dims

type Scalar = Value<T>

impl<D, E, T, Dims> ArrayAlgebra<Value<D>> for Graph<ConfigN<E>> where
    E: Default + Clone + CoreAlgebra<D, Value = D> + CoreAlgebra<T, Value = T> + LinkedAlgebra<Value<D>, D> + LinkedAlgebra<Value<T>, T> + ArrayAlgebra<D, Scalar = T, Dims = Dims>,
    Dims: PartialEq + Clone + Copy + Debug + Default + 'static + Send + Sync,
    D: HasDims<Dims = Dims> + Clone + 'static + Send + Sync,
    T: Number
[src]

type Dims = Dims

type Scalar = Value<T>

Loading content...