knead-1.0.1.1: Repa-like array processing using LLVM JIT
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Array.Knead.Symbolic.Slice

Description

Generate and apply index maps. This unifies the replicate and slice functions of the accelerate package. However the structure of slicing and replicating cannot depend on parameters. If you need that, you must use backpermute and friends.

Synopsis

Documentation

data T sh0 sh1 Source #

type Cubic rank0 rank1 = T (Shape rank0) (Shape rank1) Source #

apply :: (C array, C sh0, C sh1, C a) => T sh0 sh1 -> array sh0 a -> array sh1 a Source #

This is essentially a backpermute.

passAny :: Cubic rank rank Source #

Like Any in accelerate.

pass :: (Natural rank0, Natural rank1) => Cubic rank0 rank1 -> Cubic (Succ rank0) (Succ rank1) Source #

Like All in accelerate.

pick :: (Natural rank0, Natural rank1) => Exp Int -> Cubic rank0 rank1 -> Cubic (Succ rank0) rank1 Source #

Like Int in accelerate/slice.

pickFst :: Exp (Index n) -> T (n, sh) sh Source #

pickSnd :: Exp (Index n) -> T (sh, n) sh Source #

extrude :: (Natural rank0, Natural rank1) => Exp Int -> Cubic rank0 rank1 -> Cubic rank0 (Succ rank1) Source #

Like Int in accelerate/replicate.

extrudeFst :: Exp n -> T sh (n, sh) Source #

Extrusion has the potential to do duplicate work. Only use it to add dimensions of size 1, e.g. numeric 1 or unit () or to duplicate slices of physical arrays.

extrudeSnd :: Exp n -> T sh (sh, n) Source #

transpose :: T (sh0, sh1) (sh1, sh0) Source #

($:.) :: (Process proc0, Process proc1) => proc0 -> (proc0 -> proc1) -> proc1 infixl 3 Source #

Use this for combining several dimension manipulators. E.g.

apply (passAny $:. pick 3 $:. pass $:. replicate 10) array

The constraint (Process proc0, Process proc1) is a bit weak. We like to enforce that the type constructor like Slice.T is the same in proc0 and proc1, and only the parameters differ. Currently this coherence is achieved, because we only provide functions of type proc0 -> proc1 with this condition.

id :: T sh sh Source #

first :: T sh0 sh1 -> T (sh0, sh) (sh1, sh) Source #

second :: T sh0 sh1 -> T (sh, sh0) (sh, sh1) Source #

compose :: T sh0 sh1 -> T sh1 sh2 -> T sh0 sh2 infixr 1 Source #