tensor-0.1: A completely type-safe library for linear algebra

Data.TypeList.MultiIndex

Description

We define the a multidimensional array of indices called `MultiIndex`. The canonical implementation of a `MultiIndex` is an heterogeneous list of `Ordinal`s. Below we illustrate some example of `MultiIndex` types and the elements they contain.

`Three :|: Nil` = {(1),(2),(3)}

`Three :|: (Two :|: Nil)` = {(1,1),(1,2),(2,1),(2,2),(3,1),(3,2)}

`Three :|: (Two :|: (Two :|: Nil))` = {(1,1,1),(1,1,2),(1,2,1),(1,2,2),(2,1,1),(2,1,2),(2,2,1),(2,2,2),(3,1,1),(3,1,2),(3,2,1),(3,2,2)}

Synopsis

# Documentation

data Nil Source

Constructors

 Nil

Instances

 Bounded Nil Eq Nil Ord Nil Show Nil Cardinality Nil ReverseList Nil TypeList Nil MultiIndex Nil TypeList l => TailRevList Nil l DropList Zero Nil TakeList Zero Nil TypeList l => AppendList Nil l (Bounded i, Ordinal i, Bounded j, Ordinal j) => Matrix i j (Tensor (:|: i (:|: j Nil)) e) (Bounded i, Ordinal i, Sum i i) => SquareMatrix (Tensor (:|: i (:|: i Nil))) (Ordinal i, Ordinal j) => Transpose (Tensor (:|: i (:|: j Nil)) e) (Eq e, Fractional e, Ordinal i, Ordinal j) => LinearSystem (Tensor (:|: i (:|: j Nil)) e) (Tensor (:|: i Nil) e) (Eq e, Fractional e, Ordinal i, Ordinal j, Ordinal k, Sum j k) => LinearSystem (Tensor (:|: i (:|: j Nil)) e) (Tensor (:|: i (:|: k Nil)) e)

data a :|: b Source

This is the constructor for heterogeneous lists, equivalent to `:` for standard lists. `Nil` is used to end the lists, just like `'[]'`.

Constructors

 a :|: b

Instances

 (Bounded i, Ordinal i, Bounded j, Ordinal j) => Matrix i j (Tensor (:|: i (:|: j Nil)) e) DropList Zero l => DropList Zero (:|: e l) TakeList Zero l => TakeList Zero (:|: e l) (Ordinal i1, Ordinal i2, Sum i1 i2, MultiIndex is) => MultiIndexConcat Zero (:|: i1 is) (:|: i2 is) (Bounded i, Ordinal i, Sum i i) => SquareMatrix (Tensor (:|: i (:|: i Nil))) DropList n l => DropList (Succ n) (:|: e l) TakeList n l => TakeList (Succ n) (:|: e l) (Cardinal n, Ordinal i, MultiIndex js, MultiIndex ks, MultiIndexConcat n js ks) => MultiIndexConcat (Succ n) (:|: i js) (:|: i ks) (Bounded e, Bounded l) => Bounded (:|: e l) (Eq a, Eq b) => Eq (:|: a b) (Ord e, Ord l) => Ord (:|: e l) (Ordinal i, MultiIndex is) => Show (:|: i is) (Ordinal i, Ordinal j) => Transpose (Tensor (:|: i (:|: j Nil)) e) (Cardinality e, Cardinality l, Cardinal (:*: (Card e) (Card l))) => Cardinality (:|: e l) (TailRevList l Nil, TailRevList (:|: e l) Nil) => ReverseList (:|: e l) TypeList l => TypeList (:|: e l) (Ordinal i, MultiIndex is) => MultiIndex (:|: i is) (TailRevList l (:|: e l'), TypeList l') => TailRevList (:|: e l) l' AppendList l l' => AppendList (:|: e l) l' (Eq e, Fractional e, Ordinal i, Ordinal j) => LinearSystem (Tensor (:|: i (:|: j Nil)) e) (Tensor (:|: i Nil) e) (Eq e, Fractional e, Ordinal i, Ordinal j, Ordinal k, Sum j k) => LinearSystem (Tensor (:|: i (:|: j Nil)) e) (Tensor (:|: i (:|: k Nil)) e)

class TypeList i => MultiIndex i whereSource

Methods

fromMultiIndex :: Num n => i -> [n]Source

toMultiIndex :: (Eq n, Num n) => [n] -> iSource

dimensions :: Num n => i -> [n]Source

Instances

 MultiIndex Nil (Ordinal i, MultiIndex is) => MultiIndex (:|: i is)

class (Cardinal n, MultiIndex is, MultiIndex js) => MultiIndexConcat n is js Source

Associated Types

type Concat n is js Source

Instances

 (Ordinal i1, Ordinal i2, Sum i1 i2, MultiIndex is) => MultiIndexConcat Zero (:|: i1 is) (:|: i2 is) (Cardinal n, Ordinal i, MultiIndex js, MultiIndex ks, MultiIndexConcat n js ks) => MultiIndexConcat (Succ n) (:|: i js) (:|: i ks)