module Simulation.Aivika.Transform.Extra
(
initTransform,
discreteTransform,
interpolatingTransform,
scanTransform,
scan1Transform) where
import Simulation.Aivika.Dynamics
import Simulation.Aivika.Dynamics.Extra
import Simulation.Aivika.Transform
import Simulation.Aivika.Transform.Memo
initTransform :: Transform a a
initTransform :: Transform a a
initTransform = (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b.
(Dynamics a -> Simulation (Dynamics b)) -> Transform a b
Transform ((Dynamics a -> Simulation (Dynamics a)) -> Transform a a)
-> (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b. (a -> b) -> a -> b
$ Dynamics a -> Simulation (Dynamics a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Dynamics a -> Simulation (Dynamics a))
-> (Dynamics a -> Dynamics a)
-> Dynamics a
-> Simulation (Dynamics a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Dynamics a -> Dynamics a
forall a. Dynamics a -> Dynamics a
initDynamics
discreteTransform :: Transform a a
discreteTransform :: Transform a a
discreteTransform = (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b.
(Dynamics a -> Simulation (Dynamics b)) -> Transform a b
Transform ((Dynamics a -> Simulation (Dynamics a)) -> Transform a a)
-> (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b. (a -> b) -> a -> b
$ Dynamics a -> Simulation (Dynamics a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Dynamics a -> Simulation (Dynamics a))
-> (Dynamics a -> Dynamics a)
-> Dynamics a
-> Simulation (Dynamics a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Dynamics a -> Dynamics a
forall a. Dynamics a -> Dynamics a
discreteDynamics
interpolatingTransform :: Transform a a
interpolatingTransform :: Transform a a
interpolatingTransform = (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b.
(Dynamics a -> Simulation (Dynamics b)) -> Transform a b
Transform ((Dynamics a -> Simulation (Dynamics a)) -> Transform a a)
-> (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b. (a -> b) -> a -> b
$ Dynamics a -> Simulation (Dynamics a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Dynamics a -> Simulation (Dynamics a))
-> (Dynamics a -> Dynamics a)
-> Dynamics a
-> Simulation (Dynamics a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Dynamics a -> Dynamics a
forall a. Dynamics a -> Dynamics a
interpolateDynamics
scan1Transform :: (a -> a -> a) -> Transform a a -> Transform a a
scan1Transform :: (a -> a -> a) -> Transform a a -> Transform a a
scan1Transform a -> a -> a
f (Transform Dynamics a -> Simulation (Dynamics a)
tr) = (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b.
(Dynamics a -> Simulation (Dynamics b)) -> Transform a b
Transform ((Dynamics a -> Simulation (Dynamics a)) -> Transform a a)
-> (Dynamics a -> Simulation (Dynamics a)) -> Transform a a
forall a b. (a -> b) -> a -> b
$ (a -> a -> a)
-> (Dynamics a -> Simulation (Dynamics a))
-> Dynamics a
-> Simulation (Dynamics a)
forall a.
(a -> a -> a)
-> (Dynamics a -> Simulation (Dynamics a))
-> Dynamics a
-> Simulation (Dynamics a)
scan1Dynamics a -> a -> a
f Dynamics a -> Simulation (Dynamics a)
tr
scanTransform :: (a -> b -> a) -> a -> Transform a a -> Transform b a
scanTransform :: (a -> b -> a) -> a -> Transform a a -> Transform b a
scanTransform a -> b -> a
f a
acc (Transform Dynamics a -> Simulation (Dynamics a)
tr) = (Dynamics b -> Simulation (Dynamics a)) -> Transform b a
forall a b.
(Dynamics a -> Simulation (Dynamics b)) -> Transform a b
Transform ((Dynamics b -> Simulation (Dynamics a)) -> Transform b a)
-> (Dynamics b -> Simulation (Dynamics a)) -> Transform b a
forall a b. (a -> b) -> a -> b
$ (a -> b -> a)
-> a
-> (Dynamics a -> Simulation (Dynamics a))
-> Dynamics b
-> Simulation (Dynamics a)
forall a b.
(a -> b -> a)
-> a
-> (Dynamics a -> Simulation (Dynamics a))
-> Dynamics b
-> Simulation (Dynamics a)
scanDynamics a -> b -> a
f a
acc Dynamics a -> Simulation (Dynamics a)
tr