Safe Haskell | None |
---|

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.

- data T sh0 sh1
- type Linear sh0 sh1 = T (Shape sh0) (Shape sh1)
- apply :: (C array, C sh0, C sh1, C a) => T sh0 sh1 -> array sh0 a -> array sh1 a
- passAny :: Linear sh sh
- pass :: Linear sh0 sh1 -> Linear (sh0 :. i) (sh1 :. i)
- pick :: Exp i -> Linear sh0 sh1 -> Linear (sh0 :. i) sh1
- extrude :: Exp i -> Linear sh0 sh1 -> Linear sh0 (sh1 :. i)
- ($:.) :: (Process proc0, Process proc1) => proc0 -> (proc0 -> proc1) -> proc1

# Documentation

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

This is essentially a `backpermute`

.

($:.) :: (Process proc0, Process proc1) => proc0 -> (proc0 -> proc1) -> proc1Source

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.