diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Numeric/GSL/ODE.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Numeric/GSL/ODE.hs b/lib/Numeric/GSL/ODE.hs index 3450b91..7c711b7 100644 --- a/lib/Numeric/GSL/ODE.hs +++ b/lib/Numeric/GSL/ODE.hs | |||
@@ -84,7 +84,7 @@ odeSolveV method h epsAbs epsRel f mbjac xiv ts = unsafePerformIO $ do | |||
84 | Just jac -> mkDoubleVecMatfun (\t -> aux_vTom (checkdim2 n . jac t)) | 84 | Just jac -> mkDoubleVecMatfun (\t -> aux_vTom (checkdim2 n . jac t)) |
85 | Nothing -> return nullFunPtr | 85 | Nothing -> return nullFunPtr |
86 | sol <- withVector xiv $ \xiv' -> | 86 | sol <- withVector xiv $ \xiv' -> |
87 | withVector ts $ \ts' -> | 87 | withVector (checkTimes ts) $ \ts' -> |
88 | createMIO (dim ts) n | 88 | createMIO (dim ts) n |
89 | (ode_c (fi (fromEnum method)) h epsAbs epsRel fp jp // xiv' // ts' ) | 89 | (ode_c (fi (fromEnum method)) h epsAbs epsRel fp jp // xiv' // ts' ) |
90 | "ode" | 90 | "ode" |
@@ -105,3 +105,7 @@ checkdim2 n m | |||
105 | | rows m == n && cols m == n = m | 105 | | rows m == n && cols m == n = m |
106 | | otherwise = error $ "Error: "++ show n ++ "x" ++ show n | 106 | | otherwise = error $ "Error: "++ show n ++ "x" ++ show n |
107 | ++ " Jacobian expected in odeSolve" | 107 | ++ " Jacobian expected in odeSolve" |
108 | |||
109 | checkTimes ts | dim ts > 1 && all (>0) (zipWith subtract ts' (tail ts')) = ts | ||
110 | | otherwise = error "odeSolve requires increasing times" | ||
111 | where ts' = toList ts \ No newline at end of file | ||