diff options
author | Dominic Steinitz <dominic@steinitz.org> | 2018-04-17 14:32:47 +0100 |
---|---|---|
committer | Dominic Steinitz <dominic@steinitz.org> | 2018-04-17 14:32:47 +0100 |
commit | 51cac5fbc8571b11ac1841ec21cbff66150c7a62 (patch) | |
tree | 2f25a2746131dc5926143a9bbfb34ff4e7db2f0d /packages | |
parent | 4cfa8c60c7652302904e33dd7cb8120b4596e1e3 (diff) |
Mimic hmatrix-gsl some more
Diffstat (limited to 'packages')
-rw-r--r-- | packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs index 380b1d6..f6f6884 100644 --- a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs +++ b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs | |||
@@ -105,6 +105,7 @@ | |||
105 | module Numeric.Sundials.ARKode.ODE ( odeSolve | 105 | module Numeric.Sundials.ARKode.ODE ( odeSolve |
106 | , odeSolveV | 106 | , odeSolveV |
107 | , odeSolveVWith | 107 | , odeSolveVWith |
108 | , odeSolveVWith' | ||
108 | , ButcherTable(..) | 109 | , ButcherTable(..) |
109 | , butcherTable | 110 | , butcherTable |
110 | , ODEMethod(..) | 111 | , ODEMethod(..) |
@@ -289,6 +290,27 @@ odeSolve f y0 ts = | |||
289 | nC = length y0 | 290 | nC = length y0 |
290 | g t x0 = V.fromList $ f t (V.toList x0) | 291 | g t x0 = V.fromList $ f t (V.toList x0) |
291 | 292 | ||
293 | odeSolveVWith' :: | ||
294 | ODEMethod | ||
295 | -> StepControl | ||
296 | -> Maybe Double -- ^ initial step size - by default, ARKode | ||
297 | -- estimates the initial step size to be the | ||
298 | -- solution \(h\) of the equation | ||
299 | -- \(\|\frac{h^2\ddot{y}}{2}\| = 1\), where | ||
300 | -- \(\ddot{y}\) is an estimated value of the second | ||
301 | -- derivative of the solution at \(t_0\) | ||
302 | -> (Double -> V.Vector Double -> V.Vector Double) -- ^ The RHS of the system \(\dot{y} = f(t,y)\) | ||
303 | -> V.Vector Double -- ^ Initial conditions | ||
304 | -> V.Vector Double -- ^ Desired solution times | ||
305 | -> Matrix Double -- ^ Error code or solution | ||
306 | odeSolveVWith' method control initStepSize f y0 tt = | ||
307 | case odeSolveVWith method control initStepSize f y0 tt of | ||
308 | Left c -> error $ show c -- FIXME | ||
309 | Right (v, _d) -> (nR >< nC) (V.toList v) | ||
310 | where | ||
311 | nR = V.length tt | ||
312 | nC = V.length y0 | ||
313 | |||
292 | odeSolveVWith :: | 314 | odeSolveVWith :: |
293 | ODEMethod | 315 | ODEMethod |
294 | -> StepControl | 316 | -> StepControl |