BLAS.Tensor.Immutable
 Stability experimental Maintainer Patrick Perry
Description
Synopsis
class (BLAS1 e, Tensor x i e) => ITensor x i e where
 size :: x e -> Int (//) :: x e -> [(i, e)] -> x e unsafeAt :: x e -> i -> e unsafeReplace :: x e -> [(i, e)] -> x e indices :: x e -> [i] elems :: x e -> [e] assocs :: x e -> [(i, e)] amap :: ITensor x i e' => (e -> e') -> x e -> x e'
(!) :: (ITensor x i e, Show i) => x e -> i -> e
Documentation
 class (BLAS1 e, Tensor x i e) => ITensor x i e where Source
A class for immutable tensors.
Methods
 size :: x e -> Int Source
Get the numer of elements stored in the tensor.
 (//) :: x e -> [(i, e)] -> x e Source
Get a new tensor by replacing the elements at the given indices.
 unsafeAt :: x e -> i -> e Source
Get the value at the given index, without doing any bounds-checking.
 unsafeReplace :: x e -> [(i, e)] -> x e Source
Same as '()' but doesn't do any bounds-checking.
 indices :: x e -> [i] Source
Get the indices of the elements stored in the tensor.
 elems :: x e -> [e] Source
Get the elements stored in the tensor.
 assocs :: x e -> [(i, e)] Source
Get the list of (index, element) pairs stored in the tensor.
 amap :: ITensor x i e' => (e -> e') -> x e -> x e' Source
Apply a function elementwise to a tensor.
Instances
 BLAS1 e => ITensor (DVector Imm n) Int e BLAS1 e => ITensor (DVector Imm n) Int e BLAS1 e => ITensor (DMatrix Imm ((,) m n)) ((,) Int Int) e BLAS1 e => ITensor (DMatrix Imm ((,) m n)) ((,) Int Int) e BLAS1 e => ITensor (BMatrix Imm ((,) m n)) ((,) Int Int) e BLAS1 e => ITensor (BMatrix Imm ((,) m n)) ((,) Int Int) e BLAS1 e => ITensor (DiagMatrix Imm ((,) n n)) ((,) Int Int) e BLAS1 e => ITensor (DiagMatrix Imm ((,) n n)) ((,) Int Int) e
 (!) :: (ITensor x i e, Show i) => x e -> i -> e Source
Get the value at the given index. Range-checks the argument.