Safe Haskell | None |
---|---|
Language | Haskell2010 |
- contract :: MonadThrow m => [Int] -> Tensor i a -> Tensor i b -> ([Int] -> Tensor i a -> Tensor i b -> Phoas c) -> m (Phoas c)
- data Tensor i a where
- data Sh sh where
- newtype Dd i = Dd {
- dDim :: i
- data Sd i = Sd {}
- data Phoas a
- eval :: Phoas a -> a
- var :: a -> Phoas a
- let_ :: Phoas a -> (a -> Phoas b) -> Phoas b
- let2_ :: Phoas a -> Phoas b -> (a -> b -> Phoas c) -> Phoas c
- data CException
Documentation
:: MonadThrow m | |
=> [Int] | Tensor contraction indices |
-> Tensor i a | |
-> Tensor i b | |
-> ([Int] -> Tensor i a -> Tensor i b -> Phoas c) | Contraction function |
-> m (Phoas c) |
Tensor contraction
Inject two Tensor
constant into Var
s, while ensuring that all the contraction indices are compatible with those of the tensors.
Throws a CException
if any index is nonnegative or too large for the shape of the given tensor.
Tensor types
A statically-typed tensor shape parameter that supports both sparse and dense dimensions.
Dimensions are indexed with Int32
indices, which should be enough for most applications.
To define a dense dimension we only need the dimensionality parameter
To define a sparse dimension we need a cumulative array, an index array and a dimensionality parameter
Syntax
Parametric higher-order abstract syntax (PHOAS), after B. Oliveira, A. Loeh, `Abstract Syntax Graphs for Domain Specific Languages`
let2_ :: Phoas a -> Phoas b -> (a -> b -> Phoas c) -> Phoas c Source #
Bind two variables into a closure
Exceptions
data CException Source #
Exceptions