blas-0.7.2: Bindings to the BLAS library

Stabilityexperimental
MaintainerPatrick Perry <patperry@stanford.edu>

Data.Tensor.Class.ITensor

Description

Overloaded interface for immutable tensors.

Synopsis

Documentation

class Shaped x i => ITensor x i e whereSource

A class for immutable tensors.

Methods

size :: x n e -> IntSource

Get the numer of elements stored in the tensor.

(//) :: x n e -> [(i, e)] -> x n eSource

Get a new tensor by replacing the elements at the given indices.

unsafeAt :: x n e -> i -> eSource

Get the value at the given index, without doing any bounds-checking.

unsafeReplace :: x n e -> [(i, e)] -> x n eSource

Same as '()' but doesn't do any bounds-checking.

indices :: x n e -> [i]Source

Get the indices of the elements stored in the tensor.

elems :: x n e -> [e]Source

Get the elements stored in the tensor.

assocs :: x n e -> [(i, e)]Source

Get the list of (index, element) pairs stored in the tensor.

tmap :: (e -> e) -> x n e -> x n eSource

Apply a function elementwise to a tensor.

(*>) :: Num e => e -> x n e -> x n eSource

Scale every element by the given value.

shift :: Num e => e -> x n e -> x n eSource

Add a constant to every element.

Instances

(!) :: ITensor x i e => x n e -> i -> eSource

Get the value at the given index. Range-checks the argument.