feat: a lot of stuff
This commit is contained in:
parent
dd6152833f
commit
6cec3d6c5d
22 changed files with 476 additions and 276 deletions
|
|
@ -156,7 +156,7 @@ struct (* {{{1 *)
|
|||
(* NB: y must be the initial state vector (y_0)
|
||||
* k(0) must be the initial deriviatives vector (dy_0) *)
|
||||
let initial_stepsize { initial_step_size; abs_tol; rel_tol; max_step;
|
||||
time; y; hmax; k } =
|
||||
time; y; hmax; k; _ } =
|
||||
let hmin = 16.0 *. epsilon_float *. abs_float time in
|
||||
match initial_step_size with
|
||||
| Some h -> minmax hmin max_step h
|
||||
|
|
@ -168,7 +168,8 @@ struct (* {{{1 *)
|
|||
in
|
||||
max hmin (if hmax *. rh > 1.0 then 1.0 /. rh else hmax)
|
||||
|
||||
let reinitialize ?rhsfn ({ stop_time; min_step; max_step; sysf } as s) t ny =
|
||||
let reinitialize
|
||||
?rhsfn ({ stop_time; min_step; max_step; sysf; _ } as s) t ny =
|
||||
Bigarray.Array1.blit ny s.y;
|
||||
s.time <- t;
|
||||
s.last_time <- t;
|
||||
|
|
@ -250,9 +251,9 @@ struct (* {{{1 *)
|
|||
|
||||
(* TODO: add stats: nfevals, nfailed, nsteps *)
|
||||
let step s t_limit user_y =
|
||||
let { stop_time; min_step; abs_tol; rel_tol;
|
||||
let { stop_time; abs_tol; rel_tol;
|
||||
sysf = f; time = t; h = h; hmax = hmax;
|
||||
k = k; y = y; yold = ynew; } = s in
|
||||
k = k; y = y; yold = ynew; _ } = s in
|
||||
|
||||
(* First Same As Last (FSAL) swap; doing it after the previous
|
||||
step invalidates the interpolation routine. *)
|
||||
|
|
@ -323,7 +324,7 @@ struct (* {{{1 *)
|
|||
s.h <- nexth;
|
||||
s.time
|
||||
|
||||
let get_dky { last_time = t; time = t'; h = h; yold = y; k = k } yi ti kd =
|
||||
let get_dky { last_time = t; time = t'; yold = y; k; _ } yi ti kd =
|
||||
|
||||
if kd > 0 then
|
||||
failwith
|
||||
|
|
@ -355,11 +356,11 @@ struct (* {{{1 *)
|
|||
done
|
||||
|
||||
(* copy functions *)
|
||||
let copy ({ last_time; time; h; yold; k } as s) =
|
||||
let copy ({ last_time; time; h; yold; k; _ } as s) =
|
||||
{ s with last_time; time; h; yold = Zls.copy yold; k = Zls.copy_matrix k }
|
||||
|
||||
let blit { last_time = l1; time = t1; h = h1; yold = yhold1; k = k1 }
|
||||
({ last_time; time; h; yold; k } as s2) =
|
||||
let blit { last_time = l1; time = t1; yold = yhold1; k = k1; _ }
|
||||
({ yold; k; _ } as s2) =
|
||||
s2.last_time <- l1; s2.time <- t1;
|
||||
Zls.blit yhold1 yold; Zls.blit_matrix k1 k
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue