diff-grok 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/.claude/skills/license-updater/SKILL.md +149 -0
  2. package/.claude/skills/license-updater/references/compatibility.md +68 -0
  3. package/.claude/skills/license-updater/references/templates.md +151 -0
  4. package/.claude/skills/license-updater/scripts/generate_license_files.py +467 -0
  5. package/CLAUDE.md +10 -4
  6. package/LICENSE +1 -1
  7. package/README.MD +41 -23
  8. package/THIRD_PARTY_LICENSES +135 -0
  9. package/docs/.nojekyll +1 -0
  10. package/docs/assets/hierarchy.js +1 -0
  11. package/docs/assets/highlight.css +99 -0
  12. package/docs/assets/icons.js +18 -0
  13. package/docs/assets/icons.svg +1 -0
  14. package/docs/assets/main.js +60 -0
  15. package/docs/assets/navigation.js +1 -0
  16. package/docs/assets/search.js +1 -0
  17. package/docs/assets/style.css +1633 -0
  18. package/docs/classes/BasicModelPipelineCreator.html +10 -0
  19. package/docs/classes/Callback.html +7 -0
  20. package/docs/classes/CyclicModelPipelineCreator.html +10 -0
  21. package/docs/classes/IterCheckerCallback.html +8 -0
  22. package/docs/classes/PipelineCreator.html +6 -0
  23. package/docs/classes/TimeCheckerCallback.html +8 -0
  24. package/docs/classes/UpdatesModelPipelineCreator.html +10 -0
  25. package/docs/functions/ab4.html +8 -0
  26. package/docs/functions/ab5.html +8 -0
  27. package/docs/functions/applyPipeline.html +9 -0
  28. package/docs/functions/getCallback.html +3 -0
  29. package/docs/functions/getIVP.html +6 -0
  30. package/docs/functions/getInputVector.html +2 -0
  31. package/docs/functions/getIvp2WebWorker.html +6 -0
  32. package/docs/functions/getJScode.html +6 -0
  33. package/docs/functions/getOutputNames.html +4 -0
  34. package/docs/functions/getPipelineCreator.html +7 -0
  35. package/docs/functions/lsoda.html +8 -0
  36. package/docs/functions/mrt.html +11 -0
  37. package/docs/functions/printE5.html +76 -0
  38. package/docs/functions/printHires.html +76 -0
  39. package/docs/functions/printOrego.html +66 -0
  40. package/docs/functions/printPollution.html +163 -0
  41. package/docs/functions/printRobertson.html +60 -0
  42. package/docs/functions/printVdpol.html +66 -0
  43. package/docs/functions/rk3.html +8 -0
  44. package/docs/functions/rk4.html +8 -0
  45. package/docs/functions/rkdp.html +8 -0
  46. package/docs/functions/ros34prw.html +8 -0
  47. package/docs/functions/ros3prw.html +8 -0
  48. package/docs/functions/solveIvp.html +5 -0
  49. package/docs/hierarchy.html +1 -0
  50. package/docs/index.html +768 -0
  51. package/docs/media/CONTRIBUTING.md +74 -0
  52. package/docs/media/E5.png +0 -0
  53. package/docs/media/HIRES.png +0 -0
  54. package/docs/media/OREGO.png +0 -0
  55. package/docs/media/POLL-full.png +0 -0
  56. package/docs/media/POLL.png +0 -0
  57. package/docs/media/ROBER.png +0 -0
  58. package/docs/media/VDP0L.png +0 -0
  59. package/docs/media/VDPOL.png +0 -0
  60. package/docs/media/acid-prod.gif +0 -0
  61. package/docs/media/basic-use.js +40 -0
  62. package/docs/media/basic-use.js.map +1 -0
  63. package/docs/media/basic-use.ts +44 -0
  64. package/docs/media/check-methods.js +59 -0
  65. package/docs/media/check-methods.js.map +1 -0
  66. package/docs/media/check-methods.ts +81 -0
  67. package/docs/media/corr-probs.js +132 -0
  68. package/docs/media/corr-probs.js.map +1 -0
  69. package/docs/media/corr-probs.ts +155 -0
  70. package/docs/media/cyclic-model.js +102 -0
  71. package/docs/media/cyclic-model.js.map +1 -0
  72. package/docs/media/cyclic-model.ts +112 -0
  73. package/docs/media/e5.js +36 -0
  74. package/docs/media/e5.js.map +1 -0
  75. package/docs/media/e5.ts +36 -0
  76. package/docs/media/hires.js +39 -0
  77. package/docs/media/hires.js.map +1 -0
  78. package/docs/media/hires.ts +40 -0
  79. package/docs/media/model-updates.js +112 -0
  80. package/docs/media/model-updates.js.map +1 -0
  81. package/docs/media/model-updates.ts +122 -0
  82. package/docs/media/orego.js +24 -0
  83. package/docs/media/orego.js.map +1 -0
  84. package/docs/media/orego.ts +25 -0
  85. package/docs/media/pipeline-use.js +87 -0
  86. package/docs/media/pipeline-use.js.map +1 -0
  87. package/docs/media/pipeline-use.ts +98 -0
  88. package/docs/media/pollution.js +132 -0
  89. package/docs/media/pollution.js.map +1 -0
  90. package/docs/media/pollution.ts +133 -0
  91. package/docs/media/print-benchmark.js +581 -0
  92. package/docs/media/print-benchmark.js.map +1 -0
  93. package/docs/media/print-benchmark.ts +594 -0
  94. package/docs/media/robertson.js +19 -0
  95. package/docs/media/robertson.js.map +1 -0
  96. package/docs/media/robertson.ts +19 -0
  97. package/docs/media/scripting.js +30 -0
  98. package/docs/media/scripting.js.map +1 -0
  99. package/docs/media/scripting.ts +35 -0
  100. package/docs/media/vdpol.js +17 -0
  101. package/docs/media/vdpol.js.map +1 -0
  102. package/docs/media/vdpol.ts +17 -0
  103. package/docs/modules.html +1 -0
  104. package/docs/types/Arg.html +12 -0
  105. package/docs/types/DifEqs.html +8 -0
  106. package/docs/types/Func.html +7 -0
  107. package/docs/types/IVP.html +40 -0
  108. package/docs/types/IVP2WebWorker.html +12 -0
  109. package/docs/types/Input.html +8 -0
  110. package/docs/types/Loop.html +7 -0
  111. package/docs/types/ODEs.html +31 -0
  112. package/docs/types/Output.html +6 -0
  113. package/docs/types/Pipeline.html +6 -0
  114. package/docs/types/SolverOptions.html +8 -0
  115. package/docs/types/Update.html +9 -0
  116. package/docs/types/Wrapper.html +8 -0
  117. package/index.js +1 -1
  118. package/index.js.map +1 -1
  119. package/index.ts +1 -1
  120. package/package.json +4 -2
  121. package/src/examples/check-methods.js +15 -3
  122. package/src/examples/check-methods.js.map +1 -1
  123. package/src/examples/check-methods.ts +18 -3
  124. package/src/solver-tools/cvode/common.js +487 -0
  125. package/src/solver-tools/cvode/common.js.map +1 -0
  126. package/src/solver-tools/cvode/common.ts +549 -0
  127. package/src/solver-tools/cvode/cvode.js +1062 -0
  128. package/src/solver-tools/cvode/cvode.js.map +1 -0
  129. package/src/solver-tools/cvode/cvode.ts +1226 -0
  130. package/src/solver-tools/cvode/cvode_adams.js +124 -0
  131. package/src/solver-tools/cvode/cvode_adams.js.map +1 -0
  132. package/src/solver-tools/cvode/cvode_adams.ts +142 -0
  133. package/src/solver-tools/cvode/cvode_bdf.js +153 -0
  134. package/src/solver-tools/cvode/cvode_bdf.js.map +1 -0
  135. package/src/solver-tools/cvode/cvode_bdf.ts +164 -0
  136. package/src/solver-tools/cvode/cvode_class.js +158 -0
  137. package/src/solver-tools/cvode/cvode_class.js.map +1 -0
  138. package/src/solver-tools/cvode/cvode_class.ts +271 -0
  139. package/src/solver-tools/cvode/cvode_hin.js +119 -0
  140. package/src/solver-tools/cvode/cvode_hin.js.map +1 -0
  141. package/src/solver-tools/cvode/cvode_hin.ts +150 -0
  142. package/src/solver-tools/cvode/cvode_io.js +203 -0
  143. package/src/solver-tools/cvode/cvode_io.js.map +1 -0
  144. package/src/solver-tools/cvode/cvode_io.ts +258 -0
  145. package/src/solver-tools/cvode/cvode_ls.js +210 -0
  146. package/src/solver-tools/cvode/cvode_ls.js.map +1 -0
  147. package/src/solver-tools/cvode/cvode_ls.ts +249 -0
  148. package/src/solver-tools/cvode/cvode_nls.js +220 -0
  149. package/src/solver-tools/cvode/cvode_nls.js.map +1 -0
  150. package/src/solver-tools/cvode/cvode_nls.ts +259 -0
  151. package/src/solver-tools/cvode/cvode_root.js +415 -0
  152. package/src/solver-tools/cvode/cvode_root.js.map +1 -0
  153. package/src/solver-tools/cvode/cvode_root.ts +503 -0
  154. package/src/solver-tools/cvode/dense_linalg.js +131 -0
  155. package/src/solver-tools/cvode/dense_linalg.js.map +1 -0
  156. package/src/solver-tools/cvode/dense_linalg.ts +144 -0
  157. package/src/solver-tools/cvode/index.js +26 -0
  158. package/src/solver-tools/cvode/index.js.map +1 -0
  159. package/src/solver-tools/cvode/index.ts +64 -0
  160. package/src/solver-tools/cvode-method.js +114 -0
  161. package/src/solver-tools/cvode-method.js.map +1 -0
  162. package/src/solver-tools/cvode-method.ts +129 -0
  163. package/src/solver-tools/index.js +1 -0
  164. package/src/solver-tools/index.js.map +1 -1
  165. package/src/solver-tools/index.ts +1 -0
  166. package/src/solver-tools/lsoda/blas.js +11 -0
  167. package/src/solver-tools/lsoda/blas.js.map +1 -1
  168. package/src/solver-tools/lsoda/blas.ts +12 -0
  169. package/src/solver-tools/lsoda/cfode.js +11 -0
  170. package/src/solver-tools/lsoda/cfode.js.map +1 -1
  171. package/src/solver-tools/lsoda/cfode.ts +12 -0
  172. package/src/solver-tools/lsoda/corfailure.js +11 -0
  173. package/src/solver-tools/lsoda/corfailure.js.map +1 -1
  174. package/src/solver-tools/lsoda/corfailure.ts +12 -0
  175. package/src/solver-tools/lsoda/correction.js +11 -0
  176. package/src/solver-tools/lsoda/correction.js.map +1 -1
  177. package/src/solver-tools/lsoda/correction.ts +12 -0
  178. package/src/solver-tools/lsoda/dense.js +11 -0
  179. package/src/solver-tools/lsoda/dense.js.map +1 -1
  180. package/src/solver-tools/lsoda/dense.ts +12 -0
  181. package/src/solver-tools/lsoda/index.js +11 -0
  182. package/src/solver-tools/lsoda/index.js.map +1 -1
  183. package/src/solver-tools/lsoda/index.ts +12 -0
  184. package/src/solver-tools/lsoda/intdy.js +11 -0
  185. package/src/solver-tools/lsoda/intdy.js.map +1 -1
  186. package/src/solver-tools/lsoda/intdy.ts +12 -0
  187. package/src/solver-tools/lsoda/lsoda.js +11 -0
  188. package/src/solver-tools/lsoda/lsoda.js.map +1 -1
  189. package/src/solver-tools/lsoda/lsoda.ts +12 -0
  190. package/src/solver-tools/lsoda/methodswitch.js +11 -0
  191. package/src/solver-tools/lsoda/methodswitch.js.map +1 -1
  192. package/src/solver-tools/lsoda/methodswitch.ts +12 -0
  193. package/src/solver-tools/lsoda/orderswitch.js +11 -0
  194. package/src/solver-tools/lsoda/orderswitch.js.map +1 -1
  195. package/src/solver-tools/lsoda/orderswitch.ts +12 -0
  196. package/src/solver-tools/lsoda/prja.js +11 -0
  197. package/src/solver-tools/lsoda/prja.js.map +1 -1
  198. package/src/solver-tools/lsoda/prja.ts +12 -0
  199. package/src/solver-tools/lsoda/scaleh.js +11 -0
  200. package/src/solver-tools/lsoda/scaleh.js.map +1 -1
  201. package/src/solver-tools/lsoda/scaleh.ts +12 -0
  202. package/src/solver-tools/lsoda/solsy.js +11 -0
  203. package/src/solver-tools/lsoda/solsy.js.map +1 -1
  204. package/src/solver-tools/lsoda/solsy.ts +12 -0
  205. package/src/solver-tools/lsoda/stoda.js +11 -0
  206. package/src/solver-tools/lsoda/stoda.js.map +1 -1
  207. package/src/solver-tools/lsoda/stoda.ts +12 -0
  208. package/src/solver-tools/lsoda-method.js +23 -9
  209. package/src/solver-tools/lsoda-method.js.map +1 -1
  210. package/src/solver-tools/lsoda-method.ts +27 -9
  211. package/src/solver-tools/solver-defs.js +1 -0
  212. package/src/solver-tools/solver-defs.js.map +1 -1
  213. package/src/solver-tools/solver-defs.ts +1 -0
  214. package/src/tests/cvode-lib-correctness.test.js +404 -0
  215. package/src/tests/cvode-lib-correctness.test.js.map +1 -0
  216. package/src/tests/cvode-lib-correctness.test.ts +505 -0
  217. package/src/tests/cvode-lib-performance.test.js +103 -0
  218. package/src/tests/cvode-lib-performance.test.js.map +1 -0
  219. package/src/tests/cvode-lib-performance.test.ts +128 -0
  220. package/src/tests/performance.test.js +4 -2
  221. package/src/tests/performance.test.js.map +1 -1
  222. package/src/tests/performance.test.ts +4 -2
  223. package/src/tests/test-defs.js +7 -1
  224. package/src/tests/test-defs.js.map +1 -1
  225. package/src/tests/test-defs.ts +8 -1
  226. package/src/worker-tools/solving.js +3 -1
  227. package/src/worker-tools/solving.js.map +1 -1
  228. package/src/worker-tools/solving.ts +4 -1
  229. package/src/examples/bioreactor.js +0 -125
  230. package/src/examples/bioreactor.js.map +0 -1
  231. package/src/examples/bioreactor.ts +0 -132
@@ -0,0 +1,467 @@
1
+ #!/usr/bin/env python3
2
+ """Generate license attribution files for ported third-party code.
3
+
4
+ This script produces three files:
5
+ 1. THIRD_PARTY_LICENSES — for the repo root
6
+ 2. HEADER_TEMPLATE.txt — comment block to prepend to each ported file
7
+ 3. LICENSE_GUIDE.md — human-readable instructions
8
+
9
+ Usage:
10
+ python3 generate_license_files.py \
11
+ --license-type "MIT" \
12
+ --copyright-holders "Copyright (c) 2011 Foo;Copyright (c) 2020 Bar" \
13
+ --project-name "liblsoda" \
14
+ --project-url "https://github.com/sdwfrost/liblsoda" \
15
+ --ported-files-path "src/solver-tools/lsoda" \
16
+ --target-copyright "Copyright (c) 2025 Datagrok" \
17
+ --output-dir "./license-output"
18
+
19
+ Optional:
20
+ --provenance Semicolon-separated provenance chain
21
+ --description Brief description of what the ported code does
22
+ --license-text Full license text (if not a well-known SPDX type)
23
+ --target-license Target project license type (default: MIT)
24
+ --file-ext File extension for header comment style (default: ts)
25
+ --append If set, append to existing THIRD_PARTY_LICENSES
26
+ """
27
+
28
+ import argparse
29
+ import os
30
+ import sys
31
+ import textwrap
32
+
33
+ # Well-known license texts keyed by SPDX identifier
34
+ KNOWN_LICENSES = {
35
+ "MIT": textwrap.dedent("""\
36
+ The MIT License
37
+
38
+ {COPYRIGHT}
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining
41
+ a copy of this software and associated documentation files (the
42
+ "Software"), to deal in the Software without restriction, including
43
+ without limitation the rights to use, copy, modify, merge, publish,
44
+ distribute, sublicense, and/or sell copies of the Software, and to
45
+ permit persons to whom the Software is furnished to do so, subject to
46
+ the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be
49
+ included in all copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
52
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
54
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
55
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
56
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
57
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."""),
58
+
59
+ "BSD-2-Clause": textwrap.dedent("""\
60
+ BSD 2-Clause License
61
+
62
+ {COPYRIGHT}
63
+
64
+ Redistribution and use in source and binary forms, with or without
65
+ modification, are permitted provided that the following conditions are met:
66
+
67
+ 1. Redistributions of source code must retain the above copyright notice,
68
+ this list of conditions and the following disclaimer.
69
+
70
+ 2. Redistributions in binary form must reproduce the above copyright notice,
71
+ this list of conditions and the following disclaimer in the documentation
72
+ and/or other materials provided with the distribution.
73
+
74
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
75
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
76
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
77
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
78
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
79
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
80
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
81
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
82
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
83
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."""),
84
+
85
+ "BSD-3-Clause": textwrap.dedent("""\
86
+ BSD 3-Clause License
87
+
88
+ {COPYRIGHT}
89
+
90
+ Redistribution and use in source and binary forms, with or without
91
+ modification, are permitted provided that the following conditions are met:
92
+
93
+ 1. Redistributions of source code must retain the above copyright notice,
94
+ this list of conditions and the following disclaimer.
95
+
96
+ 2. Redistributions in binary form must reproduce the above copyright notice,
97
+ this list of conditions and the following disclaimer in the documentation
98
+ and/or other materials provided with the distribution.
99
+
100
+ 3. Neither the name of the copyright holder nor the names of its
101
+ contributors may be used to endorse or promote products derived from
102
+ this software without specific prior written permission.
103
+
104
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
105
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
106
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
107
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
108
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
109
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
110
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
111
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
112
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
113
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."""),
114
+
115
+ "Apache-2.0": textwrap.dedent("""\
116
+ Apache License, Version 2.0
117
+
118
+ {COPYRIGHT}
119
+
120
+ Licensed under the Apache License, Version 2.0 (the "License");
121
+ you may not use this file except in compliance with the License.
122
+ You may obtain a copy of the License at
123
+
124
+ http://www.apache.org/licenses/LICENSE-2.0
125
+
126
+ Unless required by applicable law or agreed to in writing, software
127
+ distributed under the License is distributed on an "AS IS" BASIS,
128
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129
+ See the License for the specific language governing permissions and
130
+ limitations under the License."""),
131
+
132
+ "ISC": textwrap.dedent("""\
133
+ ISC License
134
+
135
+ {COPYRIGHT}
136
+
137
+ Permission to use, copy, modify, and/or distribute this software for any
138
+ purpose with or without fee is hereby granted, provided that the above
139
+ copyright notice and this permission notice appear in all copies.
140
+
141
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
142
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
143
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
144
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
145
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
146
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
147
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""),
148
+ }
149
+
150
+ # Compatibility matrix: (upstream, target) -> compatible?
151
+ # True = compatible, False = incompatible, None = conditional
152
+ COMPAT = {
153
+ ("MIT", "MIT"): True,
154
+ ("MIT", "BSD-2-Clause"): True,
155
+ ("MIT", "BSD-3-Clause"): True,
156
+ ("MIT", "Apache-2.0"): True,
157
+ ("BSD-2-Clause", "MIT"): True,
158
+ ("BSD-2-Clause", "BSD-2-Clause"): True,
159
+ ("BSD-2-Clause", "BSD-3-Clause"): True,
160
+ ("BSD-2-Clause", "Apache-2.0"): True,
161
+ ("BSD-3-Clause", "MIT"): True,
162
+ ("BSD-3-Clause", "BSD-2-Clause"): True,
163
+ ("BSD-3-Clause", "BSD-3-Clause"): True,
164
+ ("BSD-3-Clause", "Apache-2.0"): True,
165
+ ("Apache-2.0", "MIT"): True,
166
+ ("Apache-2.0", "BSD-2-Clause"): True,
167
+ ("Apache-2.0", "BSD-3-Clause"): True,
168
+ ("Apache-2.0", "Apache-2.0"): True,
169
+ ("ISC", "MIT"): True,
170
+ ("ISC", "BSD-2-Clause"): True,
171
+ ("ISC", "BSD-3-Clause"): True,
172
+ ("ISC", "Apache-2.0"): True,
173
+ }
174
+
175
+ COMMENT_STYLES = {
176
+ "ts": ("/**", " *", " */"),
177
+ "js": ("/**", " *", " */"),
178
+ "tsx": ("/**", " *", " */"),
179
+ "jsx": ("/**", " *", " */"),
180
+ "py": ("#", "#", "#"),
181
+ "c": ("/*", " *", " */"),
182
+ "cpp": ("/*", " *", " */"),
183
+ "h": ("/*", " *", " */"),
184
+ "rs": ("//!", "//!", "//!"),
185
+ "go": ("//", "//", "//"),
186
+ }
187
+
188
+
189
+ def parse_list(value: str) -> list[str]:
190
+ """Split a semicolon-separated string into a list of stripped items."""
191
+ if not value:
192
+ return []
193
+ return [item.strip() for item in value.split(";") if item.strip()]
194
+
195
+
196
+ def get_license_text(license_type: str, copyright_holders: list[str],
197
+ custom_text: str | None = None) -> str:
198
+ """Return the full license text with copyright holders inserted."""
199
+ if custom_text:
200
+ return custom_text
201
+
202
+ template = KNOWN_LICENSES.get(license_type)
203
+ if not template:
204
+ return (f"[License text for {license_type} not available.\n"
205
+ f"Please paste the full license text here manually.]")
206
+
207
+ copyright_block = "\n".join(copyright_holders)
208
+ return template.replace("{COPYRIGHT}", copyright_block)
209
+
210
+
211
+ def check_compatibility(upstream: str, target: str) -> tuple[bool, str]:
212
+ """Check license compatibility and return (ok, message)."""
213
+ key = (upstream, target)
214
+ if key in COMPAT:
215
+ if COMPAT[key]:
216
+ return True, f"{upstream} is compatible with {target}."
217
+ else:
218
+ return False, (f"⚠️ {upstream} is NOT compatible with {target}. "
219
+ f"The ported code cannot be included under {target}.")
220
+
221
+ # Assume copyleft is incompatible with permissive
222
+ copyleft = {"GPL-2.0-only", "GPL-3.0-only", "AGPL-3.0-only",
223
+ "GPL-2.0-or-later", "GPL-3.0-or-later", "AGPL-3.0-or-later"}
224
+ if upstream in copyleft:
225
+ return False, (f"⚠️ {upstream} is copyleft and cannot be included "
226
+ f"in a {target} project without the entire project "
227
+ f"adopting {upstream}.")
228
+
229
+ return True, (f"Compatibility between {upstream} and {target} is not in "
230
+ f"the built-in matrix. Manual review recommended.")
231
+
232
+
233
+ def generate_third_party(args, copyright_holders: list[str],
234
+ provenance: list[str]) -> str:
235
+ """Generate the THIRD_PARTY_LICENSES content."""
236
+ lines = []
237
+ lines.append("Third-Party Licenses")
238
+ lines.append("=" * 20)
239
+ lines.append("")
240
+ lines.append("This file documents the licenses for third-party code included in or adapted")
241
+ lines.append("by this project.")
242
+ lines.append("")
243
+ lines.append("")
244
+ lines.append("=" * 80)
245
+ lines.append(f"{args.project_name}")
246
+ lines.append("=" * 80)
247
+ lines.append("")
248
+ lines.append(f"Source: {args.project_url}")
249
+ lines.append(f"License: {args.license_type}")
250
+ lines.append(f"Files: {args.ported_files_path}")
251
+ lines.append("")
252
+
253
+ if args.description:
254
+ lines.append(args.description)
255
+ lines.append("")
256
+
257
+ if provenance:
258
+ lines.append("Provenance chain:")
259
+ lines.append("")
260
+ for i, step in enumerate(provenance, 1):
261
+ lines.append(f" {i}. {step}")
262
+ lines.append("")
263
+
264
+ license_text = get_license_text(
265
+ args.license_type, copyright_holders, args.license_text
266
+ )
267
+ lines.append(license_text)
268
+ lines.append("")
269
+
270
+ return "\n".join(lines)
271
+
272
+
273
+ def generate_header(args, copyright_holders: list[str]) -> str:
274
+ """Generate the header template for ported files."""
275
+ ext = args.file_ext
276
+ start, mid, end = COMMENT_STYLES.get(ext, ("/**", " *", " */"))
277
+
278
+ lines = []
279
+ lines.append(start)
280
+
281
+ if args.description:
282
+ lines.append(f"{mid} {args.description}")
283
+ lines.append(f"{mid}")
284
+
285
+ lines.append(f"{mid} Port of {args.project_name} ({args.project_url})")
286
+ lines.append(f"{mid}")
287
+
288
+ for holder in copyright_holders:
289
+ lines.append(f"{mid} {holder}")
290
+ if args.target_copyright:
291
+ lines.append(f"{mid} {args.target_copyright}")
292
+
293
+ lines.append(f"{mid}")
294
+ lines.append(f"{mid} Licensed under the {args.license_type} License.")
295
+ lines.append(f"{mid} See THIRD_PARTY_LICENSES for the full license text and provenance.")
296
+ lines.append(end)
297
+ lines.append("")
298
+
299
+ return "\n".join(lines)
300
+
301
+
302
+ def generate_guide(args, copyright_holders: list[str],
303
+ compat_ok: bool, compat_msg: str) -> str:
304
+ """Generate the LICENSE_GUIDE.md content."""
305
+ status = "✅ Compatible" if compat_ok else "❌ Incompatible"
306
+ target_lic = args.target_license
307
+
308
+ lines = []
309
+ lines.append(f"# License Attribution Guide for {args.project_name}")
310
+ lines.append("")
311
+ lines.append("## File structure")
312
+ lines.append("")
313
+ lines.append("```")
314
+ lines.append("your-repo/")
315
+ lines.append("├── LICENSE ← do not modify")
316
+ lines.append("├── THIRD_PARTY_LICENSES ← add/update this file")
317
+
318
+ # Show the ported files path
319
+ parts = args.ported_files_path.split("/")
320
+ indent = "│ "
321
+ for i, part in enumerate(parts[:-1]):
322
+ lines.append(f"{indent}└── {part}/")
323
+ indent += " "
324
+ lines.append(f"{indent}└── {parts[-1]}/")
325
+ lines.append(f"{indent} └── *.{args.file_ext} ← add header to each file")
326
+
327
+ lines.append("```")
328
+ lines.append("")
329
+ lines.append("## Steps")
330
+ lines.append("")
331
+ lines.append("### 1. Add `THIRD_PARTY_LICENSES` to the repository root")
332
+ lines.append("")
333
+
334
+ if args.append:
335
+ lines.append("Append the provided section to your existing `THIRD_PARTY_LICENSES` file.")
336
+ else:
337
+ lines.append("Place the provided `THIRD_PARTY_LICENSES` file next to your existing `LICENSE`.")
338
+
339
+ lines.append("")
340
+ lines.append(f"### 2. Add header to each `.{args.file_ext}` file in `{args.ported_files_path}/`")
341
+ lines.append("")
342
+ lines.append("Prepend the content of `HEADER_TEMPLATE.txt` to the top of every")
343
+ lines.append(f"`.{args.file_ext}` file in the `{args.ported_files_path}/` directory.")
344
+ lines.append("")
345
+ lines.append("### 3. `LICENSE` — no changes needed")
346
+ lines.append("")
347
+ lines.append(f"Your project license ({target_lic}) stays as-is.")
348
+ lines.append("`THIRD_PARTY_LICENSES` handles attribution for ported code separately.")
349
+ lines.append("")
350
+ lines.append("### 4. README — optional")
351
+ lines.append("")
352
+ lines.append("Consider adding a note in your README's License section:")
353
+ lines.append("")
354
+ lines.append("```markdown")
355
+ lines.append("## License")
356
+ lines.append("")
357
+ lines.append(f"This project is licensed under the [{target_lic} License](LICENSE).")
358
+ lines.append("")
359
+ lines.append(f"Some components are ported from [{args.project_name}]({args.project_url}).")
360
+ lines.append("See [THIRD_PARTY_LICENSES](THIRD_PARTY_LICENSES) for details.")
361
+ lines.append("```")
362
+ lines.append("")
363
+ lines.append("## Compatibility check")
364
+ lines.append("")
365
+ lines.append(f"- Upstream license: **{args.license_type}**")
366
+ lines.append(f"- Target license: **{target_lic}**")
367
+ lines.append(f"- Status: {status}")
368
+ lines.append("")
369
+ lines.append(compat_msg)
370
+
371
+ # Special notes
372
+ if args.license_type == "BSD-3-Clause":
373
+ lines.append("")
374
+ lines.append("### BSD-3-Clause special condition")
375
+ lines.append("")
376
+ lines.append("You may NOT use the names of the original copyright holders")
377
+ lines.append("to endorse or promote your product without their written permission.")
378
+
379
+ if args.license_type == "Apache-2.0":
380
+ lines.append("")
381
+ lines.append("### Apache-2.0 special conditions")
382
+ lines.append("")
383
+ lines.append("- The patent grant from Apache-2.0 applies to the ported code")
384
+ lines.append("- If the upstream repo has a NOTICE file, its contents must be preserved")
385
+ lines.append("- You must state significant changes made to the ported files")
386
+
387
+ lines.append("")
388
+ return "\n".join(lines)
389
+
390
+
391
+ def main():
392
+ parser = argparse.ArgumentParser(
393
+ description="Generate license attribution files for ported code."
394
+ )
395
+ parser.add_argument("--license-type", required=True,
396
+ help="SPDX license identifier (e.g., MIT, BSD-3-Clause)")
397
+ parser.add_argument("--copyright-holders", required=True,
398
+ help="Semicolon-separated copyright lines")
399
+ parser.add_argument("--project-name", required=True,
400
+ help="Name of the upstream project")
401
+ parser.add_argument("--project-url", required=True,
402
+ help="URL to the upstream project")
403
+ parser.add_argument("--ported-files-path", required=True,
404
+ help="Relative path in target repo to ported files")
405
+ parser.add_argument("--target-copyright", default="",
406
+ help="Copyright line for the target project")
407
+ parser.add_argument("--target-license", default="MIT",
408
+ help="Target project license (default: MIT)")
409
+ parser.add_argument("--provenance", default="",
410
+ help="Semicolon-separated provenance chain")
411
+ parser.add_argument("--description", default="",
412
+ help="Brief description of the ported code")
413
+ parser.add_argument("--license-text", default=None,
414
+ help="Full custom license text (if not a known SPDX type)")
415
+ parser.add_argument("--file-ext", default="ts",
416
+ help="File extension for comment style (default: ts)")
417
+ parser.add_argument("--output-dir", default="./license-output",
418
+ help="Output directory for generated files")
419
+ parser.add_argument("--append", action="store_true",
420
+ help="Append to existing THIRD_PARTY_LICENSES")
421
+
422
+ args = parser.parse_args()
423
+
424
+ copyright_holders = parse_list(args.copyright_holders)
425
+ provenance = parse_list(args.provenance)
426
+
427
+ if not copyright_holders:
428
+ print("Error: at least one copyright holder is required.", file=sys.stderr)
429
+ sys.exit(1)
430
+
431
+ # Check compatibility
432
+ compat_ok, compat_msg = check_compatibility(args.license_type, args.target_license)
433
+ if not compat_ok:
434
+ print(f"\n⚠️ LICENSE COMPATIBILITY WARNING:\n{compat_msg}\n", file=sys.stderr)
435
+ print("Files will still be generated, but review carefully before using.",
436
+ file=sys.stderr)
437
+
438
+ # Create output directory
439
+ os.makedirs(args.output_dir, exist_ok=True)
440
+
441
+ # Generate files
442
+ third_party = generate_third_party(args, copyright_holders, provenance)
443
+ header = generate_header(args, copyright_holders)
444
+ guide = generate_guide(args, copyright_holders, compat_ok, compat_msg)
445
+
446
+ # Write files
447
+ tp_path = os.path.join(args.output_dir, "THIRD_PARTY_LICENSES")
448
+ with open(tp_path, "w") as f:
449
+ f.write(third_party)
450
+ print(f"✅ Created: {tp_path}")
451
+
452
+ header_path = os.path.join(args.output_dir, "HEADER_TEMPLATE.txt")
453
+ with open(header_path, "w") as f:
454
+ f.write(header)
455
+ print(f"✅ Created: {header_path}")
456
+
457
+ guide_path = os.path.join(args.output_dir, "LICENSE_GUIDE.md")
458
+ with open(guide_path, "w") as f:
459
+ f.write(guide)
460
+ print(f"✅ Created: {guide_path}")
461
+
462
+ print(f"\n{'✅' if compat_ok else '⚠️'} License compatibility: {compat_msg}")
463
+ print(f"\nAll files written to: {args.output_dir}/")
464
+
465
+
466
+ if __name__ == "__main__":
467
+ main()
package/CLAUDE.md CHANGED
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
 
5
5
  ## Project Overview
6
6
 
7
- **diff-grok** is a zero-dependency TypeScript library for solving initial value problems (IVPs) for ordinary differential equations (ODEs), focused on stiff equations. It implements Rosenbrock-Wanner type numerical methods and includes a declarative model scripting system.
7
+ **diff-grok** is a zero-dependency TypeScript library for solving initial value problems (IVPs) for ordinary differential equations (ODEs), focused on stiff equations. It implements Rosenbrock-Wanner type numerical methods, a port of SUNDIALS CVODE, and includes a declarative model scripting system.
8
8
 
9
9
  ## Build & Development Commands
10
10
 
@@ -31,9 +31,12 @@ npx jest src/tests/correctness.test.ts
31
31
  - **Implicit methods** (for stiff ODEs): `mrt` (Modified Rosenbrock Triple), `ros3prw`, `ros34prw`
32
32
  - Require Jacobian computation and linear system solves
33
33
  - Use LU decomposition for solving W*k = b at each stage
34
- - **Automatic methods** (stiffness-detecting): `lsoda` (variable-order Nordsieck Adams/BDF with automatic switching)
34
+ - **Automatic methods** (stiffness-detecting): `lsoda` (variable-order Nordsieck Adams/BDF with automatic switching), `cvode` (SUNDIALS CVODE variable-order Adams/BDF)
35
35
  - Automatically switch between non-stiff (Adams) and stiff (BDF) modes
36
- - Use consecutive rejection counting (Adams→BDF) and periodic trial steps (BDF→Adams)
36
+ - `lsoda`: consecutive rejection counting (Adams→BDF) and periodic trial steps (BDF→Adams)
37
+ - `cvode`: TypeScript port of SUNDIALS CVODE v7.5.0; variable-order variable-step with Newton iteration + dense LU; supports rootfinding and dense output (`getDky`); wrapper uses BDF mode with warmup for extremely stiff problems
38
+ - CVODE module in `src/solver-tools/cvode/` (12 files): `cvode.ts` (main loop), `cvode_class.ts` (high-level `Cvode` class), `cvode_adams.ts`/`cvode_bdf.ts` (method coefficients), `cvode_nls.ts` (Newton solver), `cvode_ls.ts` (linear solver), `cvode_hin.ts` (initial step estimation), `cvode_root.ts` (rootfinding), `cvode_io.ts` (config/stats), `dense_linalg.ts` (LU), `common.ts` (types/constants)
39
+ - CVODE standard interface wrapper in `src/solver-tools/cvode-method.ts`
37
40
  - **Explicit methods** (for non-stiff ODEs): `rk3` (Bogacki-Shampine 3(2)), `rk4` (Runge-Kutta-Fehlberg 4(5)), `ab5` (Adams-Bashforth-Moulton 5), `ab4` (Adams-Bashforth-Moulton 4), `rkdp` (Dormand-Prince 5(4))
38
41
  - Only require function evaluations (no Jacobian)
39
42
  - Include `hMax` constraint to prevent poor interpolation
@@ -61,7 +64,7 @@ npx jest src/tests/correctness.test.ts
61
64
  ### Data Flow
62
65
 
63
66
  1. Define problem as `ODEs` object (programmatic) or parse model string via `getIVP()`
64
- 2. Call solver method (`mrt`/`ros3prw`/`ros34prw`/`rk3`/`rk4`/`ab5`/`ab4`/`rkdp`/`lsoda`) → returns `Float64Array[]` (argument values + solution columns)
67
+ 2. Call solver method (`mrt`/`ros3prw`/`ros34prw`/`rk3`/`rk4`/`ab5`/`ab4`/`rkdp`/`lsoda`/`cvode`) → returns `Float64Array[]` (argument values + solution columns)
65
68
  3. For complex models: create pipeline via `getPipelineCreator()` → `applyPipeline()`
66
69
 
67
70
  ### Performance Patterns
@@ -86,6 +89,9 @@ Tests are in `src/tests/` using Jest with ts-jest:
86
89
  - `performance.test.ts` — Benchmarks solver speed on stiff problems (timeout: 10,000ms)
87
90
  - Tests implicit and automatic methods (MRT, ROS3PRw, ROS34PRw, LSODA)
88
91
  - Test problems: Robertson, HIRES, VDPOL, OREGO, E5, Pollution
92
+ - `cvode-lib-correctness.test.ts` — CVODE-specific validation (low-level procedural API + high-level `Cvode` class)
93
+ - Robertson kinetics, non-stiff (Adams) and stiff (BDF) problems, rootfinding, dense output, error handling, re-initialization
94
+ - `cvode-lib-performance.test.ts` — CVODE benchmarks on stiff problems (Robertson, HIRES, VDPOL, OREGO, E5, Pollution)
89
95
  - `pipeline.test.ts` — Pipeline integration tests (3 model types)
90
96
  - Method definitions in `test-defs.ts`: `methods` map (all 11 solvers), `implicitMethods` map (stiff-capable only)
91
97
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Datagrok
3
+ Copyright (c) 2026 Datagrok
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.MD CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Build Status](https://github.com/datagrok-ai/diff-grok/actions/workflows/libraries.yaml/badge.svg)](https://github.com/datagrok-ai/diff-grok/actions/workflows/libraries.yaml)
7
7
  [![Run tests](https://github.com/datagrok-ai/diff-grok/actions/workflows/test.yaml/badge.svg)](https://github.com/datagrok-ai/diff-grok/actions/workflows/test.yaml)
8
8
 
9
- A lightweight TypeScript library for solving initial value problem ([IVP](https://en.wikipedia.org/wiki/Initial_value_problem)) for ordinary differential equations ([ODEs](https://en.wikipedia.org/wiki/Ordinary_differential_equation)) using numerical methods. The primary solver is [LSODA](https://doi.org/10.1137/0904010) — a variable-order method that automatically detects stiffness and switches between Adams (non-stiff) and BDF (stiff) formulations.
9
+ A lightweight TypeScript library for solving initial value problem ([IVP](https://en.wikipedia.org/wiki/Initial_value_problem)) for ordinary differential equations ([ODEs](https://en.wikipedia.org/wiki/Ordinary_differential_equation)) using numerical methods. The primary solvers are [LSODA](https://doi.org/10.1137/0904010) — a variable-order method that automatically detects stiffness and switches between Adams (non-stiff) and BDF (stiff) formulations — and [CVODE](https://sundials.readthedocs.io/en/latest/cvode/index.html) — a variable-order, variable-step solver from the SUNDIALS suite supporting both Adams and BDF methods.
10
10
 
11
11
  ## Features
12
12
 
@@ -14,6 +14,8 @@ A lightweight TypeScript library for solving initial value problem ([IVP](https:
14
14
  * Fast computations
15
15
  * Automatic stiffness-detecting method:
16
16
  * [LSODA](https://doi.org/10.1137/0904010) - variable-order Nordsieck-based solver with automatic switching between Adams (non-stiff) and BDF (stiff) methods ([Petzold, 1983](https://doi.org/10.1137/0904010); [Hindmarsh, 1983](https://computing.llnl.gov/sites/default/files/ODEPACK_pub1_u88007.pdf)). Ported to TypeScript from the C library [liblsoda](https://github.com/sdwfrost/liblsoda)
17
+ * Variable-order multistep method:
18
+ * [CVODE](https://sundials.readthedocs.io/en/latest/cvode/index.html) - variable-order, variable-step solver from the [SUNDIALS](https://github.com/LLNL/sundials) suite with BDF (stiff) and Adams (non-stiff) modes ([Hindmarsh et al., 2005](https://doi.org/10.1145/1089014.1089020); [Cohen & Hindmarsh, 1996](https://doi.org/10.1063/1.4822377)). Ported to TypeScript from SUNDIALS CVODE v7.5.0
17
19
  * Implicit methods (for stiff ODEs) - Rosenbrock–Wanner type:
18
20
  * The modified Rosenbrock triple ([MRT](https://doi.org/10.1137/S1064827594276424))
19
21
  * The [ROS3PRw](https://doi.org/10.1016/j.cam.2015.03.010) method
@@ -45,20 +47,20 @@ Minimal "Hello World" example:
45
47
  ```typescript
46
48
  // example.ts
47
49
 
48
- import {ODEs, mrt} from 'diff-grok';
50
+ import {ODEs, cvode} from 'diff-grok';
49
51
 
50
52
  const task: ODEs = {
51
53
  name: 'Example',
52
54
  arg: {name: 't', start: 0, finish: 1, step: 0.1},
53
- initial: [1, -1],
55
+ initial: [1],
54
56
  func: (t: number, y: Float64Array, output: Float64Array) => {
55
- out[0] = y[0] - t;
57
+ output[0] = y[0] - t;
56
58
  },
57
59
  tolerance: 1e-7,
58
60
  solutionColNames: ['y(t)'],
59
61
  };
60
62
 
61
- const solution = mrt(task);
63
+ const solution = cvode(task);
62
64
 
63
65
  console.log('t:', solution[0]);
64
66
  console.log('y(t):', solution[1]);
@@ -80,6 +82,9 @@ on the segment $[t_0, t_1]$ with the step $h$:
80
82
  Automatic method:
81
83
  * `lsoda` - [LSODA](https://doi.org/10.1137/0904010) variable-order solver with automatic switching between Adams (non-stiff) and BDF (stiff)
82
84
 
85
+ Variable-order multistep method:
86
+ * `cvode` - [CVODE](https://sundials.readthedocs.io/en/latest/cvode/index.html) variable-order BDF solver from the SUNDIALS suite
87
+
83
88
  Implicit methods (for stiff ODEs):
84
89
  * `mrt` - the [MRT](https://doi.org/10.1137/S1064827594276424) method
85
90
  * `ros3prw`- the [ROS3PRw](https://doi.org/10.1016/j.cam.2015.03.010) method
@@ -196,27 +201,29 @@ The following [classic problems](https://archimede.uniba.it/~testset/testsetivps
196
201
  * describes a chemical reaction part of the air pollution model designed at The Dutch National Institute of Public Health and Environmental Protection
197
202
  * [pollution.ts](./src/examples/pollution.ts)
198
203
 
199
- The LSODA, MRT, ROS3PRw and ROS34PRw methods demonstrate the following time performance (AMD Ryzen 5 5600H 3.30 GHz CPU):
204
+ The LSODA, CVODE, MRT, ROS3PRw and ROS34PRw methods demonstrate the following time performance (AMD Ryzen 5 5600H 3.30 GHz CPU):
205
+
206
+ |Problem|Segment|Points|Tolerance|LSODA, ms|CVODE, ms|MRT, ms|ROS3PRw, ms|ROS34PRw, ms|
207
+ |-|-|-|-|-|-|-|-|-|
208
+ |[Rober](https://archimede.uniba.it/~testset/report/rober.pdf)|[0, 10E+11]|40K|1E-7|67|85|175|446|285|
209
+ |[HIRES](https://archimede.uniba.it/~testset/report/hires.pdf)|[0, 321.8122]|32K|1E-10|125|142|122|362|215|
210
+ |[VDPOL](https://archimede.uniba.it/~testset/report/vdpol.pdf)|[0, 2000]|20K|1E-12|268|352|492|1576|760|
211
+ |[OREGO](https://archimede.uniba.it/~testset/report/orego.pdf)|[0, 360]|36K|1E-8|76|98|205|483|199|
212
+ |[E5](https://archimede.uniba.it/~testset/report/e5.pdf)|[0, 10E+13]|40K|1E-6|7|*|6|17|8|
213
+ |[Pollution](https://archimede.uniba.it/~testset/report/pollu.pdf)|[0, 60]|30K|1E-6|12|15|18|50|23|
200
214
 
201
- |Problem|Segment|Points|Tolerance|LSODA, ms|MRT, ms|ROS3PRw, ms|ROS34PRw, ms|
202
- |-|-|-|-|-|-|-|-|
203
- |[Rober](https://archimede.uniba.it/~testset/report/rober.pdf)|[0, 10E+11]|40K|1E-7|67|175|446|285|
204
- |[HIRES](https://archimede.uniba.it/~testset/report/hires.pdf)|[0, 321.8122]|32K|1E-10|125|122|362|215|
205
- |[VDPOL](https://archimede.uniba.it/~testset/report/vdpol.pdf)|[0, 2000]|20K|1E-12|268|492|1576|760|
206
- |[OREGO](https://archimede.uniba.it/~testset/report/orego.pdf)|[0, 360]|36K|1E-8|76|205|483|199|
207
- |[E5](https://archimede.uniba.it/~testset/report/e5.pdf)|[0, 10E+13]|40K|1E-6|7|6|17|8|
208
- |[Pollution](https://archimede.uniba.it/~testset/report/pollu.pdf)|[0, 60]|30K|1E-6|12|18|50|23|
215
+ \* E5 is skipped for CVODE: the extremely stiff rate constants (spanning 20 orders of magnitude) cause convergence failures with the dense direct linear solver.
209
216
 
210
217
  Maximum absolute deviations (MADs) from the reference solutions obtained using SciPy (Radau) are summarized in the table below:
211
218
 
212
- |Problem|LSODA|MRT|ROS3PRw|ROS34PRw|
213
- |-|-|-|-|-|
214
- |[Rober](https://archimede.uniba.it/~testset/report/rober.pdf)|1.87e-8|1.87e-8|1.88e-8|1.88e-8|
215
- |[HIRES](https://archimede.uniba.it/~testset/report/hires.pdf)|1.51e-11|4.80e-11|1.05e-14|2.87e-14|
216
- |[VDPOL](https://archimede.uniba.it/~testset/report/vdpol.pdf)|5.12e-4|5.12e-4|5.12e-4|5.12e-4|
217
- |[OREGO](https://archimede.uniba.it/~testset/report/orego.pdf)|3.84e-6|3.05e-5|3.45e-7|2.31e-6|
218
- |[E5](https://archimede.uniba.it/~testset/report/e5.pdf)|3.02e-19|1.12e-19| 1.33e-19|3.40e-17|
219
- |[Pollution](https://archimede.uniba.it/~testset/report/pollu.pdf)|1.23e-10|4.06e-10|9.16e-12|1.58e-10|
219
+ |Problem|LSODA|CVODE|MRT|ROS3PRw|ROS34PRw|
220
+ |-|-|-|-|-|-|
221
+ |[Rober](https://archimede.uniba.it/~testset/report/rober.pdf)|1.87e-8|1.87e-8|1.87e-8|1.88e-8|1.88e-8|
222
+ |[HIRES](https://archimede.uniba.it/~testset/report/hires.pdf)|1.51e-11|2.10e-11|4.80e-11|1.05e-14|2.87e-14|
223
+ |[VDPOL](https://archimede.uniba.it/~testset/report/vdpol.pdf)|5.12e-4|5.12e-4|5.12e-4|5.12e-4|5.12e-4|
224
+ |[OREGO](https://archimede.uniba.it/~testset/report/orego.pdf)|3.84e-6|5.20e-6|3.05e-5|3.45e-7|2.31e-6|
225
+ |[E5](https://archimede.uniba.it/~testset/report/e5.pdf)|3.02e-19|*|1.12e-19| 1.33e-19|3.40e-17|
226
+ |[Pollution](https://archimede.uniba.it/~testset/report/pollu.pdf)|1.23e-10|2.15e-10|4.06e-10|9.16e-12|1.58e-10|
220
227
 
221
228
  Run [check-methods.ts](./src/examples/check-methods.ts) to reproduce these results (see [here](#examples) how to run scripts standalone).
222
229
 
@@ -585,7 +592,7 @@ Diff Grok contains a set of examples located in the folder [src/examples](./src/
585
592
 
586
593
  |File|Features|
587
594
  |-|-|
588
- |[basic-use.ts](./src/examples/basic-use.ts)|Minimal "Hello World" example. Illustrates the use of the [LSODA](https://doi.org/10.1137/0904010) method.|
595
+ |[basic-use.ts](./src/examples/basic-use.ts)|Minimal "Hello World" example. Illustrates the use of the [MRT](https://doi.org/10.1137/S1064827594276424) method.|
589
596
  |[check-methods.ts](./src/examples/check-methods.ts)| Checks the [performance](#performance) of numerical methods.|
590
597
  |[corr-probs.ts](./src/examples/corr-probs.ts)|Solves a set of problems with exact solutions and evaluate the deviation.|
591
598
  |[cyclic-model.ts](./src/examples/cyclic-model.ts)| Considers pharmacokinetic-pharmacodynamic (PK-PD) simulation and shows how to apply pipelines and cyclic models.|
@@ -640,6 +647,9 @@ node src/examples/basic-use.js
640
647
  * L. Petzold, "Automatic Selection of Methods for Solving Stiff and Nonstiff Systems of Ordinary Differential Equations," *SIAM J. Sci. Stat. Comput.*, 4(1), 136–148, 1983. [doi:10.1137/0904010](https://doi.org/10.1137/0904010)
641
648
  * A. C. Hindmarsh, "ODEPACK, A Systematized Collection of ODE Solvers," *Scientific Computing*, R. S. Stepleman et al. (eds.), North-Holland, Amsterdam, pp. 55–64, 1983. [link](https://computing.llnl.gov/sites/default/files/ODEPACK_pub1_u88007.pdf)
642
649
  * The LSODA solver is ported to TypeScript from the C library [liblsoda](https://github.com/sdwfrost/liblsoda)
650
+ * A. C. Hindmarsh et al., "SUNDIALS: Suite of Nonlinear and Differential/Algebraic Equation Solvers," *ACM Trans. Math. Softw.*, 31(3), 363–396, 2005. [doi:10.1145/1089014.1089020](https://doi.org/10.1145/1089014.1089020)
651
+ * S. D. Cohen and A. C. Hindmarsh, "CVODE, a Stiff/Nonstiff ODE Solver in C," *Computers in Physics*, 10(2), 138–143, 1996. [doi:10.1063/1.4822377](https://doi.org/10.1063/1.4822377)
652
+ * The CVODE solver is ported to TypeScript from [SUNDIALS CVODE v7.5.0](https://github.com/LLNL/sundials)
643
653
  * T. Rang and L. Angermann, "New Rosenbrock W-Methods of Order 3 for Partial Differential Algebraic Equations of Index 1," *BIT Numer. Math.*, 45, 761–787, 2005. [doi:10.1007/s10543-005-0035-y](https://doi.org/10.1016/j.cam.2015.03.010)
644
654
  * E. Hairer and G. Wanner, *Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems*, Springer, 1996. [doi:10.1137/S1064827594276424](https://doi.org/10.1137/S1064827594276424)
645
655
 
@@ -648,3 +658,11 @@ node src/examples/basic-use.js
648
658
  We welcome contributions of all kinds - bug reports, feature requests, documentation updates, and pull requests.
649
659
 
650
660
  Before contributing, please read our [Contributing Guidelines](./CONTRIBUTING.md).
661
+
662
+ ## License
663
+
664
+ This project is licensed under the [MIT License](./LICENSE).
665
+
666
+ The LSODA solver is a TypeScript port of [liblsoda](https://github.com/sdwfrost/liblsoda).
667
+ The CVODE solver is a TypeScript port of [SUNDIALS CVODE](https://github.com/LLNL/sundials).
668
+ See [THIRD_PARTY_LICENSES](./THIRD_PARTY_LICENSES) for details on third-party code provenance.