repa-3.0.0.1: High performance, regular, shape polymorphic parallel arrays.

Safe HaskellSafe-Infered

Data.Array.Repa.Operators.Mapping

Contents

Synopsis

Generic maps

map :: (Shape sh, Repr r a) => (a -> b) -> Array r sh a -> Array D sh bSource

Apply a worker function to each element of an array, yielding a new array with the same extent.

zipWith :: (Shape sh, Repr r1 a, Repr r2 b) => (a -> b -> c) -> Array r1 sh a -> Array r2 sh b -> Array D sh cSource

Combine two arrays, element-wise, with a binary operator. If the extent of the two array arguments differ, then the resulting array's extent is their intersection.

(+^) :: (Num c, Shape sh, Repr r2 c, Repr r1 c) => Array r1 sh c -> Array r2 sh c -> Array D sh cSource

(-^) :: (Num c, Shape sh, Repr r2 c, Repr r1 c) => Array r1 sh c -> Array r2 sh c -> Array D sh cSource

(*^) :: (Num c, Shape sh, Repr r2 c, Repr r1 c) => Array r1 sh c -> Array r2 sh c -> Array D sh cSource

(/^) :: (Fractional c, Shape sh, Repr r2 c, Repr r1 c) => Array r1 sh c -> Array r2 sh c -> Array D sh cSource

Combining maps

class Combine r1 a r2 b | r1 -> r2 whereSource

Combining versions of map and zipWith that preserve the representation of cursored and partitioned arrays.

For cursored (C) arrays, the cursoring of the source array is preserved.

For partitioned (P) arrays, the worker function is fused with each array partition separately, instead of treating the whole array as a single bulk object.

Preserving the cursored and/or paritioned representation of an array is will make follow-on computation more efficient than if the array was converted to a vanilla Delayed (D) array as with plain map and zipWith.

If the source array is not cursored or partitioned then cmap and czipWith are identical to the plain functions.

Methods

cmap :: Shape sh => (a -> b) -> Array r1 sh a -> Array r2 sh bSource

Combining map.

czipWith :: (Shape sh, Repr r c) => (c -> a -> b) -> Array r sh c -> Array r1 sh a -> Array r2 sh bSource

Combining zipWith. If you have a cursored or partitioned source array then use that as the third argument (corresponding to r1 here)

Instances

Combine X a D b 
Combine D a D b 
Combine B Word8 D b 
Combine C a C b 
Storable a => Combine F a D b 
Unbox a => Combine U a D b 
(Combine r11 a r21 b, Combine r12 a r22 b) => Combine (P r11 r12) a (P r21 r22) b