Safe Haskell | Safe-Inferred |
---|
We define the a multidimensional array of indices called
. The canonical implementation of a MultiIndex
is
an heterogeneous list of MultiIndex
s. Below we illustrate some
example of Ordinal
types and the elements they contain.
MultiIndex
=
{(1,1),(1,2),(2,1),(2,2),(3,1),(3,2)}
Three
:|:
(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)}
Three
:|:
(Two
:|:
(Two
:|:
Nil
))
- data Nil = Nil
- data a :|: b = a :|: b
- module Data.TypeList
- class (Dimensions i, TypeList i) => MultiIndex i where
- fromMultiIndex :: Num n => i -> [n]
- toMultiIndex :: (Eq n, Num n) => [n] -> i
- multiIndex2Linear :: (MultiIndex i, Num n) => i -> n
- class Dimensions i where
- dimensions :: Num n => i -> [n]
- class (Cardinal n, MultiIndex is, MultiIndex js) => MultiIndexConcat n is js where
- type Concat n is js
Documentation
Bounded Nil | |
Eq Nil | |
Ord Nil | |
Show Nil | |
Generic Nil | |
Cardinality Nil | |
ReverseList Nil | |
TypeList Nil | |
Dimensions Nil | |
MultiIndex Nil | |
Extend Nil l' | |
(TypeList Nil, TypeList l) => TailRevList Nil l | |
DropList Zero Nil | |
TakeList Zero Nil | |
(TypeList Nil, TypeList l) => AppendList Nil l | |
(Tensor (Tensor (:|: i (:|: j Nil)) e), ~ * (Index (Tensor (:|: i (:|: j Nil)) e)) (:|: i (:|: j Nil)), Ordinal i, Ordinal j) => Matrix i j (Tensor (:|: i (:|: j Nil)) e) | |
(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) |
This is the constructor for heterogeneous lists, equivalent to
for standard lists. :
is used to end the lists, just
like Nil
'[]'
.
a :|: b |
module Data.TypeList
class (Dimensions i, TypeList i) => MultiIndex i whereSource
fromMultiIndex :: Num n => i -> [n]Source
toMultiIndex :: (Eq n, Num n) => [n] -> iSource
MultiIndex Nil | |
(Dimensions (:|: i is), TypeList (:|: i is), Ordinal i, MultiIndex is) => MultiIndex (:|: i is) |
multiIndex2Linear :: (MultiIndex i, Num n) => i -> nSource
class Dimensions i whereSource
Class for types having multiple dimensions, like
es
or MultiIndex
s.
Tensor
dimensions :: Num n => i -> [n]Source
Returns the dimensions list. It should always be independent
on its argument and work on
.
undefined
Dimensions Nil | |
(Ordinal i, Dimensions is) => Dimensions (:|: i is) | |
Dimensions i => Dimensions (Tensor i e) |
class (Cardinal n, MultiIndex is, MultiIndex js) => MultiIndexConcat n is js Source
(Cardinal Zero, MultiIndex (:|: i1 is), MultiIndex (:|: i2 is), Ordinal i1, Ordinal i2, Sum i1 i2, MultiIndex is) => MultiIndexConcat Zero (:|: i1 is) (:|: i2 is) | |
(Cardinal (Succ n), MultiIndex (:|: i js), MultiIndex (:|: i ks), Cardinal n, Ordinal i, MultiIndex js, MultiIndex ks, MultiIndexConcat n js ks) => MultiIndexConcat (Succ n) (:|: i js) (:|: i ks) |