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