Stability | experimental |
---|---|
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Safe Haskell | Safe-Inferred |
Tested with: GHC 7.6.3
This module defines basic functions for the Dynamics
monad.
- starttime :: Dynamics Double
- stoptime :: Dynamics Double
- dt :: Dynamics Double
- time :: Dynamics Double
- integTimes :: Specs -> [Double]
- isTimeInteg :: Dynamics Bool
- integIteration :: Dynamics Int
- integIterationBnds :: Specs -> (Int, Int)
- integIterationLoBnd :: Specs -> Int
- integIterationHiBnd :: Specs -> Int
- initDynamics :: Dynamics a -> Dynamics a
- discrete :: Dynamics a -> Dynamics a
- interpolate :: Dynamics a -> Dynamics a
- memo :: Dynamics e -> Simulation (Dynamics e)
- umemo :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)
- memo0 :: Dynamics e -> Simulation (Dynamics e)
- umemo0 :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)
- iterateDynamics :: Dynamics () -> Simulation (Dynamics ())
- foldDynamics1 :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> a -> a) -> Dynamics a -> Simulation (Dynamics a)
- foldDynamics :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> b -> a) -> a -> Dynamics b -> Simulation (Dynamics a)
- divideDynamics :: Dynamics Double -> Dynamics Double
Time Parameters
integTimes :: Specs -> [Double]Source
Return the integration time points.
isTimeInteg :: Dynamics BoolSource
Whether the current time is an integration time.
integIteration :: Dynamics IntSource
Return the integration iteration closest to the current simulation time.
integIterationBnds :: Specs -> (Int, Int)Source
Returns the first and last integration iterations.
integIterationLoBnd :: Specs -> IntSource
Returns the first integration iteration, i.e. zero.
integIterationHiBnd :: Specs -> IntSource
Returns the last integration iteration.
Interpolation and Initial Value
initDynamics :: Dynamics a -> Dynamics aSource
Return the initial value.
discrete :: Dynamics a -> Dynamics aSource
Discretize the computation in the integration time points.
interpolate :: Dynamics a -> Dynamics aSource
Interpolate the computation based on the integration time points only.
Unlike the discrete
function it knows about the intermediate time points
that are used in the Runge-Kutta method.
Memoization
memo :: Dynamics e -> Simulation (Dynamics e)Source
Memoize and order the computation in the integration time points using the interpolation that knows of the Runge-Kutta method.
umemo :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)Source
This is a more efficient version the memo
function which uses
an unboxed array to store the values.
memo0 :: Dynamics e -> Simulation (Dynamics e)Source
Memoize and order the computation in the integration time points using
the discrete
interpolation. It consumes less memory than the memo
function but it is not aware of the Runge-Kutta method. There is a subtle
difference when we request for values in the intermediate time points
that are used by this method to integrate. In general case you should
prefer the memo0
function above memo
.
umemo0 :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)Source
This is a more efficient version the memo0
function which uses
an unboxed array to store the values.
Iterating
iterateDynamics :: Dynamics () -> Simulation (Dynamics ())Source
Iterate sequentially the dynamic process with side effects in
the integration time points. It is equivalent to a call of the
memo0
function but significantly more efficient, for the array
is not created.
Fold
foldDynamics1 :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> a -> a) -> Dynamics a -> Simulation (Dynamics a)Source
foldDynamics :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> b -> a) -> a -> Dynamics b -> Simulation (Dynamics a)Source