package owl-ode

  1. Overview
  2. Docs

Source file native_s.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 1 "src/ode/native/native_s.ml"
(*
 * OWL - OCaml Scientific and Engineering Computing
 * OWL-ODE - Ordinary Differential Equation Solvers
 *
 * Copyright (c) 2019 Ta-Chu Kao <tck29@cam.ac.uk>
 * Copyright (c) 2019 Marcello Seri <m.seri@rug.nl>
 *)

type mat = Owl_dense_matrix_s.mat

include Native_generic.Make (Owl_dense_ndarray.S)

module Euler = struct
  type s = mat
  type t = mat
  type step_output = mat * float
  type output = mat * mat

  let step = euler_s
  let solve = prepare step
end

module Midpoint = struct
  type s = mat
  type t = mat
  type step_output = mat * float
  type output = mat * mat

  let step = midpoint_s
  let solve = prepare step
end

module RK4 = struct
  type s = mat
  type t = mat
  type step_output = mat * float
  type output = mat * mat

  let step = rk4_s
  let solve = prepare step
end

module RK23 = struct
  type s = mat
  type t = mat
  type step_output = mat * float * float * bool
  type output = mat * mat

  let step = rk23_s ~tol:1E-7 ~dtmax:1E-4
  let solve = adaptive_prepare (rk23_s ~tol:1E-7)
end

module RK45 = struct
  type s = mat
  type t = mat
  type step_output = mat * float * float * bool
  type output = mat * mat

  let step = rk45_s ~tol:1e-7 ~dtmax:1E-4
  let solve = adaptive_prepare (rk45_s ~tol:1E-7)
end
OCaml

Innovation. Community. Security.