diff options
Diffstat (limited to 'src/CHAD.hs')
-rw-r--r-- | src/CHAD.hs | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/CHAD.hs b/src/CHAD.hs index 04e3ac4..aa5bd4c 100644 --- a/src/CHAD.hs +++ b/src/CHAD.hs @@ -320,61 +320,9 @@ indexTupD1Id (SS n) | Refl <- indexTupD1Id n = Refl zero :: STy t -> Ex env (D2 t) zero = EZero --- TODO: this original definition needs to be used as the post-processing after --- simplification, to eliminate the monoid operations from the AST --- zero STNil = ENil ext --- zero (STPair t1 t2) = EInl ext (STPair (d2 t1) (d2 t2)) (ENil ext) --- zero (STEither t1 t2) = EInl ext (STEither (d2 t1) (d2 t2)) (ENil ext) --- zero (STArr n t) = EBuild ext n (eTup (sreplicate n (EConst ext STI64 0))) (zero t) --- zero (STScal t) = case t of --- STI32 -> ENil ext --- STI64 -> ENil ext --- STF32 -> EConst ext STF32 0.0 --- STF64 -> EConst ext STF64 0.0 --- STBool -> ENil ext --- zero STAccum{} = error "Accumulators not allowed in input program" plus :: STy t -> Ex env (D2 t) -> Ex env (D2 t) -> Ex env (D2 t) plus = EPlus --- plus STNil _ _ = ENil ext --- plus (STPair t1 t2) a b = --- let t = STPair (d2 t1) (d2 t2) --- in plusSparse t a b $ --- EPair ext (plus t1 (EFst ext (EVar ext t (IS IZ))) --- (EFst ext (EVar ext t IZ))) --- (plus t2 (ESnd ext (EVar ext t (IS IZ))) --- (ESnd ext (EVar ext t IZ))) --- plus (STEither t1 t2) a b = --- let t = STEither (d2 t1) (d2 t2) --- in plusSparse t a b $ --- ECase ext (EVar ext t (IS IZ)) --- (ECase ext (EVar ext t (IS IZ)) --- (EInl ext (d2 t2) (plus t1 (EVar ext (d2 t1) (IS IZ)) (EVar ext (d2 t1) IZ))) --- (EError t "plus l+r")) --- (ECase ext (EVar ext t (IS IZ)) --- (EError t "plus r+l") --- (EInr ext (d2 t1) (plus t2 (EVar ext (d2 t2) (IS IZ)) (EVar ext (d2 t2) IZ)))) --- plus STArr{} _ _ = error "TODO plus on arrays" --- plus (STScal t) a b = case t of --- STI32 -> ENil ext --- STI64 -> ENil ext --- STF32 -> EOp ext (OAdd STF32) (EPair ext a b) --- STF64 -> EOp ext (OAdd STF64) (EPair ext a b) --- STBool -> ENil ext --- plus STAccum{} _ _ = error "Accumulators not allowed in input program" - --- plusSparse :: STy a --- -> Ex env (TEither TNil a) -> Ex env (TEither TNil a) --- -> Ex (a : a : env) a --- -> Ex env (TEither TNil a) --- plusSparse t a b adder = --- ELet ext b $ --- ECase ext (weakenExpr WSink a) --- (EVar ext (STEither STNil t) (IS IZ)) --- (EInr ext STNil --- (ECase ext (EVar ext (STEither STNil t) (IS IZ)) --- (EVar ext t (IS IZ)) --- (weakenExpr (WCopy (WCopy WSink)) adder))) zeroTup :: SList STy env0 -> Ex env (Tup (D2E env0)) zeroTup SNil = ENil ext |