Copyright | (c) Andrey Mulik 2019 |
---|---|
License | BSD-style |
Maintainer | work.a.mulik@gmail.com |
Portability | non-portable (a lot of GHC extensions) |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
SDP.Finite provide generalized finite-dimensional index type (:&
) based on
repa
(:.)
.
Since sdp-0.2
, for (:&
) available OverloadedLists
-based syntactic sugar.
For example, instead of the inconvenient es!(ind4 0 1 2 3)
or just awful
es!(E:&0:&1:&1:&2:&3)
you can write: es![0, 1, 2, 3]
.
Note that OverloadedLists
instances requires a strictly defined number of
subindexes.
Synopsis
- data E = E
- data tail :& head = !tail :& !head
- type I1 i = E :& i
- type I2 i = (E :& i) :& i
- type I3 i = I2 i :& i
- type I4 i = I3 i :& i
- type I5 i = I4 i :& i
- type I6 i = I5 i :& i
- type I7 i = I6 i :& i
- type I8 i = I7 i :& i
- type I9 i = I8 i :& i
- type I10 i = I9 i :& i
- type I11 i = I10 i :& i
- type I12 i = I11 i :& i
- type I13 i = I12 i :& i
- type I14 i = I13 i :& i
- type I15 i = I14 i :& i
- ind2 :: i -> i -> I2 i
- ind3 :: i -> i -> i -> I3 i
- ind4 :: i -> i -> i -> i -> I4 i
- ind5 :: i -> i -> i -> i -> i -> I5 i
- ind6 :: i -> i -> i -> i -> i -> i -> I6 i
- ind7 :: i -> i -> i -> i -> i -> i -> i -> I7 i
- ind8 :: i -> i -> i -> i -> i -> i -> i -> i -> I8 i
- ind9 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> I9 i
- ind10 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I10 i
- ind11 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I11 i
- ind12 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I12 i
- ind13 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I13 i
- ind14 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I14 i
- ind15 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I15 i
Generalized index
Service type, that represents zero-dimensional index.
Instances
N-dimensional index type. The type (head :& tail) allows working with any finite dimension number.
!tail :& !head |
Instances
(Item (i' :& i) ~~ i, IsList (i' :& i)) => IsList ((i' :& i) :& i) Source # | |
IsList (E :& i) Source # | |
Enum i => Enum (E :& i) Source # | |
(Eq tail, Eq head) => Eq (tail :& head) Source # | |
(Ord tail, Ord head) => Ord (tail :& head) Source # | |
Defined in SDP.Finite compare :: (tail :& head) -> (tail :& head) -> Ordering # (<) :: (tail :& head) -> (tail :& head) -> Bool # (<=) :: (tail :& head) -> (tail :& head) -> Bool # (>) :: (tail :& head) -> (tail :& head) -> Bool # (>=) :: (tail :& head) -> (tail :& head) -> Bool # | |
(IsList (i' :& i), Item (i' :& i) ~~ i, Read i) => Read (i' :& i) Source # | |
(IsList (i' :& i), Item (i' :& i) ~~ i, Show i) => Show (i' :& i) Source # | |
(Default d, Default d') => Default (d :& d') Source # | |
Defined in SDP.Finite | |
(Shape i, Enum i, Bounded i, Shape (i' :& i)) => Shape ((i' :& i) :& i) Source # | |
Defined in SDP.Shape fromGIndex :: GIndex ((i' :& i) :& i) -> (i' :& i) :& i Source # toGIndex :: ((i' :& i) :& i) -> GIndex ((i' :& i) :& i) Source # rank :: ((i' :& i) :& i) -> Int Source # consDim :: DimInit ((i' :& i) :& i) -> DimLast ((i' :& i) :& i) -> (i' :& i) :& i Source # initDim :: ((i' :& i) :& i) -> DimInit ((i' :& i) :& i) Source # lastDim :: ((i' :& i) :& i) -> DimLast ((i' :& i) :& i) Source # unconsDim :: ((i' :& i) :& i) -> (DimInit ((i' :& i) :& i), DimLast ((i' :& i) :& i)) Source # | |
Shape i => Shape (E :& i) Source # | |
Defined in SDP.Shape fromGIndex :: GIndex (E :& i) -> E :& i Source # toGIndex :: (E :& i) -> GIndex (E :& i) Source # rank :: (E :& i) -> Int Source # consDim :: DimInit (E :& i) -> DimLast (E :& i) -> E :& i Source # initDim :: (E :& i) -> DimInit (E :& i) Source # lastDim :: (E :& i) -> DimLast (E :& i) Source # unconsDim :: (E :& i) -> (DimInit (E :& i), DimLast (E :& i)) Source # | |
(Index i, Enum i, Bounded i, Index (i' :& i)) => Index ((i' :& i) :& i) Source # | |
Defined in SDP.Index size :: ((i' :& i) :& i, (i' :& i) :& i) -> Int Source # sizes :: ((i' :& i) :& i, (i' :& i) :& i) -> [Int] Source # safeElem :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> (i' :& i) :& i Source # ordBounds :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i, (i' :& i) :& i) Source # defLimit :: ((i' :& i) :& i) -> Integer Source # defaultBounds :: Int -> ((i' :& i) :& i, (i' :& i) :& i) Source # unsafeIndex :: Int -> (i' :& i) :& i Source # isEmpty :: ((i' :& i) :& i, (i' :& i) :& i) -> Bool Source # inBounds :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> InBounds Source # isOverflow :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> Bool Source # isUnderflow :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> Bool Source # inRange :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> Bool Source # prev :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> (i' :& i) :& i Source # next :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> (i' :& i) :& i Source # offset :: ((i' :& i) :& i, (i' :& i) :& i) -> ((i' :& i) :& i) -> Int Source # index :: ((i' :& i) :& i, (i' :& i) :& i) -> Int -> (i' :& i) :& i Source # range :: ((i' :& i) :& i, (i' :& i) :& i) -> [(i' :& i) :& i] Source # subshape :: (Sub ((i' :& i) :& i) j, Index (((i' :& i) :& i) :|: j)) => ((i' :& i) :& i, (i' :& i) :& i) -> (((i' :& i) :& i) :|: j) -> (j, j) Source # slice :: (Sub ((i' :& i) :& i) j, ij ~ (((i' :& i) :& i) :|: j), Index j) => ((i' :& i) :& i, (i' :& i) :& i) -> ij -> ((ij, ij), (j, j)) Source # | |
Index i => Index (E :& i) Source # | |
Defined in SDP.Index size :: (E :& i, E :& i) -> Int Source # sizes :: (E :& i, E :& i) -> [Int] Source # safeElem :: (E :& i, E :& i) -> (E :& i) -> E :& i Source # ordBounds :: (E :& i, E :& i) -> (E :& i, E :& i) Source # defLimit :: (E :& i) -> Integer Source # defaultBounds :: Int -> (E :& i, E :& i) Source # unsafeIndex :: Int -> E :& i Source # isEmpty :: (E :& i, E :& i) -> Bool Source # inBounds :: (E :& i, E :& i) -> (E :& i) -> InBounds Source # isOverflow :: (E :& i, E :& i) -> (E :& i) -> Bool Source # isUnderflow :: (E :& i, E :& i) -> (E :& i) -> Bool Source # inRange :: (E :& i, E :& i) -> (E :& i) -> Bool Source # prev :: (E :& i, E :& i) -> (E :& i) -> E :& i Source # next :: (E :& i, E :& i) -> (E :& i) -> E :& i Source # offset :: (E :& i, E :& i) -> (E :& i) -> Int Source # index :: (E :& i, E :& i) -> Int -> E :& i Source # range :: (E :& i, E :& i) -> [E :& i] Source # subshape :: (Sub (E :& i) j, Index ((E :& i) :|: j)) => (E :& i, E :& i) -> ((E :& i) :|: j) -> (j, j) Source # slice :: (Sub (E :& i) j, ij ~ ((E :& i) :|: j), Index j) => (E :& i, E :& i) -> ij -> ((ij, ij), (j, j)) Source # | |
type Item ((i' :& i) :& i) Source # | |
Defined in SDP.Finite | |
type Item (E :& i) Source # | |
Defined in SDP.Finite | |
type DimLast ((i' :& i) :& i) Source # | |
type DimLast (E :& i) Source # | |
type DimInit ((i' :& i) :& i) Source # | |
type DimInit (E :& i) Source # | |
Type synonyms
Old constructors
ind10 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I10 i Source #
10-dimensional index constructor.
ind11 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I11 i Source #
11-dimensional index constructor.
ind12 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I12 i Source #
12-dimensional index constructor.
ind13 :: i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> i -> I13 i Source #
13-dimensional index constructor.