Control-Monad-MultiPass-0.1.0.0: A Library for Writing Multi-Pass Algorithms.

Safe HaskellSafe

Control.Monad.MultiPass.Instrument.CreateST2Array

Description

The CreateST2Array instrument is stateless and provides a similar interface to parallelMP. The difference is that it produces the new array in a specific pass.

Synopsis

Documentation

data CreateST2Array r w p1 tc Source

Abstract datatype for the instrument.

Instances

Instrument tc () () (CreateST2Array r w On tc) 
Instrument tc () () (CreateST2Array r w Off tc) 

createST2ArraySource

Arguments

:: (Ix i, Num i, Monad p1) 
=> CreateST2Array r w p1 tc

CreateST2Array instrument

-> NumThreads

Number of threads to spawn

-> (i, i)

Element range

-> (i -> MultiPass r w tc (p1 a))

Initialisation function

-> MultiPass r w tc (p1 (ST2Array r w i a))

New array

Create a new array during pass p1, using the initialisation function to initialise the elements. The initialisation is done in parallel, using the specified number of threads.

pmapST2ArrayMPSource

Arguments

:: (Ix i, Num i, Monad p1) 
=> CreateST2Array r w p1 tc

CreateST2Array instrument

-> NumThreads

Number of threads to spawn

-> ST2Array r w i a

Input array

-> (a -> MultiPass r w tc (p1 b))

Function to apply to each element

-> MultiPass r w tc (p1 (ST2Array r w i b))

Output array

pmapST2ArrayMP is a simple application of createST2Array. It provides a similar interface to mapST2ArrayMP. The difference is that it only executes the map operation once the specified pass is reached.