The Feldspar core language
- data RealFloat a => Complex a = !a :+ !a
- module Data.Int
- module Data.Word
- module Feldspar.Set
- data Range a = Range {
- lowerBound :: a
- upperBound :: a
- data a :> b = a :> b
- newtype DefaultWord = DefaultWord Word32
- newtype DefaultInt = DefaultInt Int32
- type Length = DefaultWord
- type Index = DefaultWord
- class (Eq a, Show a, Typeable a, Eq (Size a), Show (Size a), Set (Size a)) => Type a where
- type Size a
- fullProp :: FullProp a => a
- data EdgeSize role a = (Type a, Eq (Size a), Show (Size a)) => EdgeSize {}
- data Data a
- class (MultiEdge a Feldspar EdgeSize, Set (Info a), Type (Internal a), MetaType (Role a) (Internal a)) => Syntactic a
- dataSize :: Type a => Data a -> Size a
- resizeData :: Type a => Size a -> Data a -> Data a
- force :: Syntactic a => a -> a
- eval :: Syntactic a => a -> Internal a
- viewLiteral :: Syntactic a => a -> Maybe (Internal a)
- drawExpr :: Syntactic a => a -> IO ()
- drawExpr2 :: (Syntactic a, Syntactic b) => (a -> b) -> IO ()
- value :: Type a => a -> Data a
- unit :: Data ()
- true :: Data Bool
- false :: Data Bool
- array :: Type a => Size a -> a -> Data a
- 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 :: Syntactic a => Data Bool -> a -> a -> a
- (?) :: Syntactic a => Data Bool -> (a, a) -> a
- ifThenElse :: Syntactic a => Data Bool -> a -> a -> a
- parallel'' :: Type a => Bool -> Data Length -> (Data Index -> Data a) -> Data [a] -> Data [a]
- parallel' :: Type a => Data Length -> (Data Index -> Data a) -> Data [a] -> Data [a]
- parallel :: Type a => Data Length -> (Data Index -> Data a) -> Data [a]
- forLoop :: Syntactic st => Data Length -> st -> (Data Index -> st -> st) -> st
- sequential :: (Type a, Syntactic st) => Data Length -> st -> (Data Index -> st -> (Data a, st)) -> (st -> Data [a]) -> Data [a]
- noinline :: (Syntactic a, Syntactic b) => String -> (a -> b) -> a -> b
- noinline2 :: (Syntactic a, Syntactic b, Syntactic c) => String -> (a -> b -> c) -> a -> b -> c
- setLength :: Type a => Data Length -> Data [a] -> Data [a]
- module Feldspar.Core.Functions
- module Feldspar.Core.Wrap
Reexported standard modules
Complex numbers are an algebraic type.
For a complex number z
,
is a number with the magnitude of abs
zz
,
but oriented in the positive real direction, whereas
has the phase of signum
zz
, but unit magnitude.
!a :+ !a | forms a complex number from its real and imaginary rectangular components. |
Typeable1 Complex | |
RealFloat a => Eq (Complex a) | |
RealFloat a => Floating (Complex a) | |
RealFloat a => Fractional (Complex a) | |
(Data a, RealFloat a) => Data (Complex a) | |
RealFloat a => Num (Complex a) | |
(Read a, RealFloat a) => Read (Complex a) | |
RealFloat a => Show (Complex a) | |
(RealFloat a, Arbitrary a) => Arbitrary (Complex a) | |
(RealFloat a, CoArbitrary a) => CoArbitrary (Complex a) | |
(Type a, RealFloat a) => Type (Complex a) | |
(Type a, RealFloat a) => Numeric (Complex a) | |
(Fractional' a, RealFloat a) => Fractional' (Complex a) | |
(Eq a, RealFloat a) => Eq (Complex a) |
module Data.Int
module Data.Word
DSL library
Feldspar types
module Feldspar.Set
A bounded range of values of type a
Range | |
|
Eq a => Eq (Range a) | |
BoundedInt a => Num (Range a) | Implements |
Show a => Show (Range a) | |
(BoundedInt a, Arbitrary a) => Arbitrary (Range a) | |
BoundedInt a => Set (Range a) | |
BoundedInt a => FullProp (Range a) |
Heterogeneous list
a :> b |
newtype DefaultWord Source
Platform-independent unsigned integers
newtype DefaultInt Source
Platform-independent signed integers
type Length = DefaultWordSource
type Index = DefaultWordSource
class (Eq a, Show a, Typeable a, Eq (Size a), Show (Size a), Set (Size a)) => Type a Source
Type Bool | |
Type Float | |
Type Int8 | |
Type Int16 | |
Type Int32 | |
Type Word8 | |
Type Word16 | |
Type Word32 | |
Type () | |
Type DefaultInt | |
Type DefaultWord | |
Type a => Type [a] | |
(Type a, RealFloat a) => Type (Complex a) | |
(Type a, Type b) => Type (a, b) | |
(Type a, Type b, Type c) => Type (a, b, c) | |
(Type a, Type b, Type c, Type d) => Type (a, b, c, d) |
fullProp :: FullProp a => aSource
Size propagation function that maps any number of arguments to
universal
.
Core constructs
A wrapper around Size
to make it look like an expression. The Type
constraint ensures that edges in a FeldNetwork
always have supported types.
ExprShow EdgeSize | |
Type a => MultiEdge (Data a) Feldspar EdgeSize | |
(Role a ~ (), Info a ~ EdgeSize () (Internal a), Syntactic a) => MultiEdge (Vector a) Feldspar EdgeSize | |
Type a => MultiEdge (Fix a) Feldspar EdgeSize | |
Eq (Size a) => Eq (EdgeSize role a) | |
Type a => Set (EdgeSize role a) | |
Type a => MultiEdge (Data' s a) Feldspar EdgeSize |
A Feldspar program computing a value of type a
Eq (Data a) | |
(Fractional' a, Floating a) => Floating (Data a) | |
Fractional' a => Fractional (Data a) | |
Numeric a => Num (Data a) | |
Show (Data a) | |
EdgeInfo (Data a) | |
Type a => Syntactic (Data a) | |
Type a => RandomAccess (Data [a]) | |
Type a => ElemWise (Data a) | |
Type a => Splittable (Data a) | |
Fixable (Data Float) | |
Type a => MultiEdge (Data a) Feldspar EdgeSize | |
Wrap (Data a) (Data a) | Basic instances to handle |
Type a => Wrap (Vector (Data a)) (Data [a]) | |
Type a => Wrap (Matrix a) (Data [[a]]) | |
Numeric a => Mul (Data a) (Matrix a) | |
Numeric a => Mul (Data a) (DVector a) | |
Numeric a => Mul (Data a) (Data a) | |
Numeric a => Mul (DVector a) (Matrix a) | |
Numeric a => Mul (DVector a) (DVector a) | |
Numeric a => Mul (DVector a) (Data a) | |
Numeric a => Mul (Matrix a) (Matrix a) | |
Numeric a => Mul (Matrix a) (DVector a) | |
Numeric a => Mul (Matrix a) (Data a) | |
Wrap t u => Wrap (Data a -> t) (Data a -> u) | |
(Wrap t u, Type a, Nat s) => Wrap (DVector a -> t) (Data' s [a] -> u) | |
(Wrap t u, Type a, Nat row, Nat col) => Wrap (Matrix a -> t) (Data' (row, col) [[a]] -> u) |
class (MultiEdge a Feldspar EdgeSize, Set (Info a), Type (Internal a), MetaType (Role a) (Internal a)) => Syntactic a Source
Type a => Syntactic (Data a) | |
(Role a ~ (), Info a ~ EdgeSize () (Internal a), Syntactic a) => Syntactic (Vector a) | |
Type a => Syntactic (Fix a) | |
(Syntactic a, Syntactic b) => Syntactic (a, b) | |
Type a => Syntactic (Data' s a) | |
(Syntactic a, Syntactic b, Syntactic c) => Syntactic (a, b, c) | |
(Syntactic a, Syntactic b, Syntactic c, Syntactic d) => Syntactic (a, b, c, d) |
viewLiteral :: Syntactic a => a -> Maybe (Internal a)Source
Yield the value of a constant program. If the value is not known
statically, the result is Nothing
.
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]
.
function :: (Syntactic a, Type b) => Bool -> String -> (Info a -> Size b) -> (Internal a -> b) -> 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
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
:: Type a | |
=> Data Length | Length of resulting array (outermost level) |
-> (Data Index -> Data a) | Function that maps each index in the range |
-> 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.
:: 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
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
Functions
module Feldspar.Core.Functions
Wrapping
module Feldspar.Core.Wrap