feldspar-language-0.4.0.2: A functional embedded language for DSP and parallelism

Feldspar.Core.Constructs

Synopsis

Documentation

value' :: Type a => Size a -> a -> Data a

value :: Type a => a -> Data a

A program that computes a constant value

array :: Type a => Size a -> a -> Data a

Like value but with an extra Size argument that can be used to increase the size beyond the given data.

Example 1:

 array (10 :> 20 :> universal) [] :: Data [[DefaultInt]]

gives an uninitialized 10x20 array of DefaultInt elements.

Example 2:

 array (10 :> 20 :> universal) [[1,2,3]] :: Data [[DefaultInt]]

gives a 10x20 array whose first row is initialized to [1,2,3].

cap :: Type a => Size a -> Data a -> Data a

function :: (Syntactic a, Type b) => Bool -> String -> (Info a -> Size b) -> (Internal a -> b) -> a -> Data b

function1 :: (Type a, Type b) => String -> (Size a -> Size b) -> (a -> b) -> Data a -> Data b

function2 :: (Type a, Type b, Type c) => String -> (Size a -> Size b -> Size c) -> (a -> b -> c) -> Data a -> Data b -> Data c

condition

Arguments

:: Syntactic a 
=> Data Bool

Condition

-> a

"Then" branch

-> a

"Else" branch

-> a 

(?)

Arguments

:: Syntactic a 
=> Data Bool

Condition

-> (a, a)

Alternatives

-> a 

ifThenElse

Arguments

:: Syntactic a 
=> Data Bool

Condition

-> a

"Then" branch

-> a

"Else" branch

-> a 

Identical to condition. Provided for backwards-compatibility, but will be removed in the future.

viewGetIx :: Typeable a => Data Index -> Data a -> Maybe (Data [a])

parallel'' :: Type a => Bool -> Data Length -> (Data Index -> Data a) -> Data [a] -> Data [a]

Parallel array with continuation

parallel' :: Type a => Data Length -> (Data Index -> Data a) -> Data [a] -> Data [a]

Parallel array with continuation

parallel

Arguments

:: Type a 
=> Data Length

Length of resulting array (outermost level)

-> (Data Index -> Data a)

Function that maps each index in the range [0 .. l-1] to its element

-> Data [a] 

Parallel array

Since there are no dependencies between the elements, the compiler is free to compute the elements in any order, or even in parallel.

forLoop

Arguments

:: Syntactic st 
=> Data Length

Number of iterations

-> st

Initial state

-> (Data Index -> st -> st)

Loop body (current index and state to next state)

-> st

Final state

For loop

sequential

Arguments

:: (Type a, Syntactic st) 
=> Data Length 
-> st

Initial state

-> (Data Index -> st -> (Data a, st))

Current loop index and current state to current element and next state

-> (st -> Data [a])

Continuation

-> Data [a] 

noinline :: (Syntactic a, Syntactic b) => String -> (a -> b) -> a -> b

Prevent a function from being inlined

noinline2 :: (Syntactic a, Syntactic b, Syntactic c) => String -> (a -> b -> c) -> a -> b -> c

setLength :: Type a => Data Length -> Data [a] -> Data [a]