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 aSource

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

A program that computes a constant value

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

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 aSource

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

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

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

conditionSource

Arguments

:: Syntactic a 
=> Data Bool

Condition

-> a

"Then" branch

-> a

"Else" branch

-> a 

(?)Source

Arguments

:: Syntactic a 
=> Data Bool

Condition

-> (a, a)

Alternatives

-> a 

ifThenElseSource

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.

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

Parallel array with continuation

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

Parallel array with continuation

parallelSource

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.

forLoopSource

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

sequentialSource

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 -> bSource

Prevent a function from being inlined

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

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