repa-eval-4.0.0.1: Low-level parallel operators on bulk random-accessble arrays.

Safe HaskellNone
LanguageHaskell98

Data.Repa.Eval.Generic.Seq

Contents

Description

Generic sequential array computation operators.

Synopsis

Filling

fillLinear Source

Arguments

:: (Int# -> a -> IO ())

Update function to write into result buffer.

-> (Int# -> a)

Function to get the value at a given index.

-> Int#

Number of elements to fill.

-> IO () 

Fill something sequentially.

  • The array is filled linearly from start to finish.

fillBlock2 Source

Arguments

:: (Int# -> a -> IO ())

Update function to write into result buffer.

-> (Int# -> Int# -> a)

Function to get the value at an (x, y) index.

-> Int#

Width of the whole array.

-> Int#

x0 lower left corner of block to fill.

-> Int#

y0

-> Int#

w0 width of block to fill

-> Int#

h0 height of block to fill

-> IO () 

Fill a block in a rank-2 array, sequentially.

  • Blockwise filling can be more cache-efficient than linear filling for rank-2 arrays.
  • The block is filled in row major order from top to bottom.

fillCursoredBlock2 Source

Arguments

:: Elt a 
=> (Int# -> a -> IO ())

Update function to write into result buffer.

-> (Int# -> Int# -> cursor)

Make a cursor to a particular element from an (x, y) index.

-> (Int# -> Int# -> cursor -> cursor)

Shift the cursor by an (x, y) offset.

-> (cursor -> a)

Function to evaluate an element at the given index.

-> Int#

Width of the whole array.

-> Int#

x0 lower left corner of block to fill.

-> Int#

y0

-> Int#

w0 width of block to fill

-> Int#

h0 height of block to fill

-> IO () 

Fill a block in a rank-2 array, sequentially.

  • Blockwise filling can be more cache-efficient than linear filling for rank-2 arrays.
  • Using cursor functions can help to expose inter-element indexing computations to the GHC and LLVM optimisers.
  • Coordinates given are of the filled edges of the block.
  • The block is filled in row major order from top to bottom.
  • We need the Elt constraint so that we can use its touch function to provide an order of evaluation ammenable to the LLVM optimiser. You should compile your Haskell program with -fllvm -optlo-O3 to enable LLVM's Global Value Numbering optimisation.

Reduction

foldAll Source

Arguments

:: (Int# -> a)

Function to get an element from the source.

-> (a -> a -> a)

Binary associative combining function.

-> a

Neutral starting value.

-> Int#

Number of elements.

-> a 

Sequential reduction of all the elements in an array.

foldRange Source

Arguments

:: (Int# -> a)

Function to get an element from the source.

-> (a -> a -> a)

Binary associative combining function.

-> a

Neutral starting value.

-> Int#

Starting index.

-> Int#

Ending index.

-> a 

Sequentially reduce values between the given indices.

foldInner Source

Arguments

:: (Int# -> a -> IO ())

Function to write into the result buffer.

-> (Int# -> a)

Function to get an element from the source.

-> (a -> a -> a)

Binary associative combination function.

-> a

Neutral starting value.

-> Int#

Total length of source.

-> Int#

Inner dimension (length to fold over).

-> IO () 

Sequential reduction of a multidimensional array along the innermost dimension.