boost.cxx 0.0.2 → 1.90.1

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 (327) hide show
  1. package/README.md +29 -2
  2. package/boost/cast.hpp +20 -0
  3. package/boost/numeric/conversion/bounds.hpp +24 -0
  4. package/boost/numeric/conversion/cast.hpp +61 -0
  5. package/boost/numeric/conversion/conversion_traits.hpp +32 -0
  6. package/boost/numeric/conversion/converter.hpp +68 -0
  7. package/boost/numeric/conversion/converter_policies.hpp +194 -0
  8. package/boost/numeric/conversion/detail/bounds.hpp +58 -0
  9. package/boost/numeric/conversion/detail/conversion_traits.hpp +97 -0
  10. package/boost/numeric/conversion/detail/converter.hpp +593 -0
  11. package/boost/numeric/conversion/detail/int_float_mixture.hpp +72 -0
  12. package/boost/numeric/conversion/detail/is_subranged.hpp +234 -0
  13. package/boost/numeric/conversion/detail/meta.hpp +120 -0
  14. package/boost/numeric/conversion/detail/numeric_cast_traits.hpp +138 -0
  15. package/boost/numeric/conversion/detail/old_numeric_cast.hpp +308 -0
  16. package/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp +1741 -0
  17. package/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp +347 -0
  18. package/boost/numeric/conversion/detail/sign_mixture.hpp +72 -0
  19. package/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +69 -0
  20. package/boost/numeric/conversion/int_float_mixture.hpp +30 -0
  21. package/boost/numeric/conversion/int_float_mixture_enum.hpp +29 -0
  22. package/boost/numeric/conversion/is_subranged.hpp +27 -0
  23. package/boost/numeric/conversion/numeric_cast_traits.hpp +31 -0
  24. package/boost/numeric/conversion/sign_mixture.hpp +30 -0
  25. package/boost/numeric/conversion/sign_mixture_enum.hpp +29 -0
  26. package/boost/numeric/conversion/udt_builtin_mixture.hpp +28 -0
  27. package/boost/numeric/conversion/udt_builtin_mixture_enum.hpp +26 -0
  28. package/boost/numeric/interval/arith.hpp +305 -0
  29. package/boost/numeric/interval/arith2.hpp +304 -0
  30. package/boost/numeric/interval/arith3.hpp +69 -0
  31. package/boost/numeric/interval/checking.hpp +130 -0
  32. package/boost/numeric/interval/compare/certain.hpp +113 -0
  33. package/boost/numeric/interval/compare/explicit.hpp +248 -0
  34. package/boost/numeric/interval/compare/lexicographic.hpp +122 -0
  35. package/boost/numeric/interval/compare/possible.hpp +113 -0
  36. package/boost/numeric/interval/compare/set.hpp +101 -0
  37. package/boost/numeric/interval/compare/tribool.hpp +138 -0
  38. package/boost/numeric/interval/compare.hpp +19 -0
  39. package/boost/numeric/interval/constants.hpp +85 -0
  40. package/boost/numeric/interval/detail/alpha_rounding_control.hpp +113 -0
  41. package/boost/numeric/interval/detail/bcc_rounding_control.hpp +57 -0
  42. package/boost/numeric/interval/detail/bugs.hpp +48 -0
  43. package/boost/numeric/interval/detail/c99_rounding_control.hpp +50 -0
  44. package/boost/numeric/interval/detail/c99sub_rounding_control.hpp +43 -0
  45. package/boost/numeric/interval/detail/division.hpp +194 -0
  46. package/boost/numeric/interval/detail/ia64_rounding_control.hpp +83 -0
  47. package/boost/numeric/interval/detail/interval_prototype.hpp +41 -0
  48. package/boost/numeric/interval/detail/msvc_rounding_control.hpp +113 -0
  49. package/boost/numeric/interval/detail/ppc_rounding_control.hpp +99 -0
  50. package/boost/numeric/interval/detail/sparc_rounding_control.hpp +112 -0
  51. package/boost/numeric/interval/detail/test_input.hpp +76 -0
  52. package/boost/numeric/interval/detail/x86_rounding_control.hpp +108 -0
  53. package/boost/numeric/interval/detail/x86gcc_rounding_control.hpp +51 -0
  54. package/boost/numeric/interval/ext/integer.hpp +70 -0
  55. package/boost/numeric/interval/ext/x86_fast_rounding_control.hpp +70 -0
  56. package/boost/numeric/interval/hw_rounding.hpp +73 -0
  57. package/boost/numeric/interval/interval.hpp +450 -0
  58. package/boost/numeric/interval/io.hpp +41 -0
  59. package/boost/numeric/interval/limits.hpp +49 -0
  60. package/boost/numeric/interval/policies.hpp +75 -0
  61. package/boost/numeric/interval/rounded_arith.hpp +120 -0
  62. package/boost/numeric/interval/rounded_transc.hpp +140 -0
  63. package/boost/numeric/interval/rounding.hpp +101 -0
  64. package/boost/numeric/interval/transc.hpp +232 -0
  65. package/boost/numeric/interval/utility.hpp +335 -0
  66. package/boost/numeric/interval/utility_fwd.hpp +172 -0
  67. package/boost/numeric/interval.hpp +32 -0
  68. package/boost/numeric/odeint/algebra/algebra_dispatcher.hpp +86 -0
  69. package/boost/numeric/odeint/algebra/array_algebra.hpp +293 -0
  70. package/boost/numeric/odeint/algebra/default_operations.hpp +599 -0
  71. package/boost/numeric/odeint/algebra/detail/extract_value_type.hpp +51 -0
  72. package/boost/numeric/odeint/algebra/detail/for_each.hpp +165 -0
  73. package/boost/numeric/odeint/algebra/detail/macros.hpp +35 -0
  74. package/boost/numeric/odeint/algebra/detail/norm_inf.hpp +46 -0
  75. package/boost/numeric/odeint/algebra/fusion_algebra.hpp +216 -0
  76. package/boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp +48 -0
  77. package/boost/numeric/odeint/algebra/multi_array_algebra.hpp +146 -0
  78. package/boost/numeric/odeint/algebra/norm_result_type.hpp +33 -0
  79. package/boost/numeric/odeint/algebra/operations_dispatcher.hpp +41 -0
  80. package/boost/numeric/odeint/algebra/range_algebra.hpp +142 -0
  81. package/boost/numeric/odeint/algebra/vector_space_algebra.hpp +175 -0
  82. package/boost/numeric/odeint/config.hpp +53 -0
  83. package/boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp +55 -0
  84. package/boost/numeric/odeint/external/blaze/blaze_resize.hpp +64 -0
  85. package/boost/numeric/odeint/external/compute/compute.hpp +27 -0
  86. package/boost/numeric/odeint/external/compute/compute_algebra.hpp +65 -0
  87. package/boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp +41 -0
  88. package/boost/numeric/odeint/external/compute/compute_operations.hpp +198 -0
  89. package/boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp +44 -0
  90. package/boost/numeric/odeint/external/compute/compute_resize.hpp +92 -0
  91. package/boost/numeric/odeint/external/eigen/eigen.hpp +27 -0
  92. package/boost/numeric/odeint/external/eigen/eigen_algebra.hpp +98 -0
  93. package/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp +49 -0
  94. package/boost/numeric/odeint/external/eigen/eigen_resize.hpp +103 -0
  95. package/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp +228 -0
  96. package/boost/numeric/odeint/external/mkl/mkl_operations.hpp +181 -0
  97. package/boost/numeric/odeint/external/mpi/mpi.hpp +25 -0
  98. package/boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp +62 -0
  99. package/boost/numeric/odeint/external/mpi/mpi_state.hpp +113 -0
  100. package/boost/numeric/odeint/external/mpi/mpi_vector_state.hpp +95 -0
  101. package/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp +161 -0
  102. package/boost/numeric/odeint/external/mtl4/mtl4.hpp +23 -0
  103. package/boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp +99 -0
  104. package/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp +134 -0
  105. package/boost/numeric/odeint/external/nt2/nt2_algebra_dispatcher.hpp +25 -0
  106. package/boost/numeric/odeint/external/nt2/nt2_copy.hpp +33 -0
  107. package/boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp +31 -0
  108. package/boost/numeric/odeint/external/nt2/nt2_resize.hpp +54 -0
  109. package/boost/numeric/odeint/external/openmp/openmp.hpp +31 -0
  110. package/boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp +281 -0
  111. package/boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp +276 -0
  112. package/boost/numeric/odeint/external/openmp/openmp_state.hpp +172 -0
  113. package/boost/numeric/odeint/external/thrust/thrust.hpp +27 -0
  114. package/boost/numeric/odeint/external/thrust/thrust_algebra.hpp +217 -0
  115. package/boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp +118 -0
  116. package/boost/numeric/odeint/external/thrust/thrust_operations.hpp +233 -0
  117. package/boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp +118 -0
  118. package/boost/numeric/odeint/external/thrust/thrust_resize.hpp +197 -0
  119. package/boost/numeric/odeint/external/vexcl/vexcl.hpp +28 -0
  120. package/boost/numeric/odeint/external/vexcl/vexcl_abs.hpp +61 -0
  121. package/boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp +51 -0
  122. package/boost/numeric/odeint/external/vexcl/vexcl_copy.hpp +55 -0
  123. package/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp +68 -0
  124. package/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp +96 -0
  125. package/boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp +58 -0
  126. package/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp +226 -0
  127. package/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp +68 -0
  128. package/boost/numeric/odeint/integrate/check_adapter.hpp +222 -0
  129. package/boost/numeric/odeint/integrate/detail/functors.hpp +70 -0
  130. package/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp +161 -0
  131. package/boost/numeric/odeint/integrate/detail/integrate_const.hpp +167 -0
  132. package/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp +161 -0
  133. package/boost/numeric/odeint/integrate/detail/integrate_times.hpp +179 -0
  134. package/boost/numeric/odeint/integrate/integrate.hpp +133 -0
  135. package/boost/numeric/odeint/integrate/integrate_adaptive.hpp +127 -0
  136. package/boost/numeric/odeint/integrate/integrate_const.hpp +195 -0
  137. package/boost/numeric/odeint/integrate/integrate_n_steps.hpp +178 -0
  138. package/boost/numeric/odeint/integrate/integrate_times.hpp +220 -0
  139. package/boost/numeric/odeint/integrate/max_step_checker.hpp +114 -0
  140. package/boost/numeric/odeint/integrate/null_observer.hpp +38 -0
  141. package/boost/numeric/odeint/integrate/observer_collection.hpp +55 -0
  142. package/boost/numeric/odeint/iterator/adaptive_iterator.hpp +183 -0
  143. package/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp +175 -0
  144. package/boost/numeric/odeint/iterator/const_step_iterator.hpp +180 -0
  145. package/boost/numeric/odeint/iterator/const_step_time_iterator.hpp +173 -0
  146. package/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp +199 -0
  147. package/boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp +251 -0
  148. package/boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp +228 -0
  149. package/boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp +239 -0
  150. package/boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp +369 -0
  151. package/boost/numeric/odeint/iterator/integrate/detail/functors.hpp +70 -0
  152. package/boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp +121 -0
  153. package/boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp +111 -0
  154. package/boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp +107 -0
  155. package/boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp +67 -0
  156. package/boost/numeric/odeint/iterator/integrate/integrate.hpp +111 -0
  157. package/boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp +127 -0
  158. package/boost/numeric/odeint/iterator/integrate/integrate_const.hpp +158 -0
  159. package/boost/numeric/odeint/iterator/integrate/integrate_n_steps.hpp +123 -0
  160. package/boost/numeric/odeint/iterator/integrate/integrate_times.hpp +131 -0
  161. package/boost/numeric/odeint/iterator/integrate/null_observer.hpp +38 -0
  162. package/boost/numeric/odeint/iterator/integrate/observer_collection.hpp +55 -0
  163. package/boost/numeric/odeint/iterator/n_step_iterator.hpp +168 -0
  164. package/boost/numeric/odeint/iterator/n_step_time_iterator.hpp +169 -0
  165. package/boost/numeric/odeint/iterator/times_iterator.hpp +189 -0
  166. package/boost/numeric/odeint/iterator/times_time_iterator.hpp +193 -0
  167. package/boost/numeric/odeint/stepper/adams_bashforth.hpp +418 -0
  168. package/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp +313 -0
  169. package/boost/numeric/odeint/stepper/adams_moulton.hpp +201 -0
  170. package/boost/numeric/odeint/stepper/adaptive_adams_bashforth_moulton.hpp +237 -0
  171. package/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp +91 -0
  172. package/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp +588 -0
  173. package/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp +677 -0
  174. package/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp +415 -0
  175. package/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp +431 -0
  176. package/boost/numeric/odeint/stepper/bulirsch_stoer.hpp +642 -0
  177. package/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp +838 -0
  178. package/boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp +322 -0
  179. package/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp +1018 -0
  180. package/boost/numeric/odeint/stepper/controlled_step_result.hpp +42 -0
  181. package/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp +476 -0
  182. package/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp +148 -0
  183. package/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp +168 -0
  184. package/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp +148 -0
  185. package/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp +168 -0
  186. package/boost/numeric/odeint/stepper/detail/adaptive_adams_coefficients.hpp +207 -0
  187. package/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp +247 -0
  188. package/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp +263 -0
  189. package/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp +252 -0
  190. package/boost/numeric/odeint/stepper/detail/pid_step_adjuster.hpp +199 -0
  191. package/boost/numeric/odeint/stepper/detail/pid_step_adjuster_coefficients.hpp +180 -0
  192. package/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp +84 -0
  193. package/boost/numeric/odeint/stepper/euler.hpp +166 -0
  194. package/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp +255 -0
  195. package/boost/numeric/odeint/stepper/explicit_generic_rk.hpp +246 -0
  196. package/boost/numeric/odeint/stepper/extrapolation_stepper.hpp +288 -0
  197. package/boost/numeric/odeint/stepper/generation/generation_controlled_adams_bashforth_moulton.hpp +59 -0
  198. package/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp +61 -0
  199. package/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp +65 -0
  200. package/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp +79 -0
  201. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp +47 -0
  202. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp +48 -0
  203. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp +56 -0
  204. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp +46 -0
  205. package/boost/numeric/odeint/stepper/generation/make_controlled.hpp +103 -0
  206. package/boost/numeric/odeint/stepper/generation/make_dense_output.hpp +100 -0
  207. package/boost/numeric/odeint/stepper/generation.hpp +37 -0
  208. package/boost/numeric/odeint/stepper/implicit_euler.hpp +170 -0
  209. package/boost/numeric/odeint/stepper/modified_midpoint.hpp +315 -0
  210. package/boost/numeric/odeint/stepper/rosenbrock4.hpp +346 -0
  211. package/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp +240 -0
  212. package/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp +204 -0
  213. package/boost/numeric/odeint/stepper/runge_kutta4.hpp +181 -0
  214. package/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp +232 -0
  215. package/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp +231 -0
  216. package/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp +289 -0
  217. package/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp +403 -0
  218. package/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp +374 -0
  219. package/boost/numeric/odeint/stepper/stepper_categories.hpp +66 -0
  220. package/boost/numeric/odeint/stepper/symplectic_euler.hpp +136 -0
  221. package/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp +160 -0
  222. package/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp +162 -0
  223. package/boost/numeric/odeint/stepper/velocity_verlet.hpp +375 -0
  224. package/boost/numeric/odeint/tools/assert.hpp +30 -0
  225. package/boost/numeric/odeint/tools/is_standalone.hpp +21 -0
  226. package/boost/numeric/odeint/tools/traits.hpp +39 -0
  227. package/boost/numeric/odeint/util/bind.hpp +35 -0
  228. package/boost/numeric/odeint/util/copy.hpp +88 -0
  229. package/boost/numeric/odeint/util/detail/is_range.hpp +127 -0
  230. package/boost/numeric/odeint/util/detail/less_with_sign.hpp +78 -0
  231. package/boost/numeric/odeint/util/is_pair.hpp +42 -0
  232. package/boost/numeric/odeint/util/is_resizeable.hpp +84 -0
  233. package/boost/numeric/odeint/util/multi_array_adaption.hpp +131 -0
  234. package/boost/numeric/odeint/util/n_ary_helper.hpp +96 -0
  235. package/boost/numeric/odeint/util/odeint_error.hpp +77 -0
  236. package/boost/numeric/odeint/util/resize.hpp +120 -0
  237. package/boost/numeric/odeint/util/resizer.hpp +94 -0
  238. package/boost/numeric/odeint/util/same_instance.hpp +56 -0
  239. package/boost/numeric/odeint/util/same_size.hpp +117 -0
  240. package/boost/numeric/odeint/util/split.hpp +64 -0
  241. package/boost/numeric/odeint/util/split_adaptor.hpp +103 -0
  242. package/boost/numeric/odeint/util/state_wrapper.hpp +50 -0
  243. package/boost/numeric/odeint/util/stepper_traits.hpp +63 -0
  244. package/boost/numeric/odeint/util/ublas_matrix_expression.patch +6 -0
  245. package/boost/numeric/odeint/util/ublas_wrapper.hpp +297 -0
  246. package/boost/numeric/odeint/util/unit_helper.hpp +151 -0
  247. package/boost/numeric/odeint/util/unwrap_reference.hpp +141 -0
  248. package/boost/numeric/odeint/version.hpp +55 -0
  249. package/boost/numeric/odeint.hpp +87 -0
  250. package/boost/numeric/ublas/assignment.hpp +1288 -0
  251. package/boost/numeric/ublas/banded.hpp +2372 -0
  252. package/boost/numeric/ublas/blas.hpp +499 -0
  253. package/boost/numeric/ublas/detail/concepts.hpp +1465 -0
  254. package/boost/numeric/ublas/detail/config.hpp +304 -0
  255. package/boost/numeric/ublas/detail/definitions.hpp +212 -0
  256. package/boost/numeric/ublas/detail/documentation.hpp +33 -0
  257. package/boost/numeric/ublas/detail/duff.hpp +56 -0
  258. package/boost/numeric/ublas/detail/iterator.hpp +1448 -0
  259. package/boost/numeric/ublas/detail/matrix_assign.hpp +1785 -0
  260. package/boost/numeric/ublas/detail/raw.hpp +878 -0
  261. package/boost/numeric/ublas/detail/returntype_deduction.hpp +174 -0
  262. package/boost/numeric/ublas/detail/temporary.hpp +33 -0
  263. package/boost/numeric/ublas/detail/vector_assign.hpp +609 -0
  264. package/boost/numeric/ublas/doxydoc.hpp +58 -0
  265. package/boost/numeric/ublas/exception.hpp +297 -0
  266. package/boost/numeric/ublas/experimental/sparse_view.hpp +317 -0
  267. package/boost/numeric/ublas/expression_types.hpp +506 -0
  268. package/boost/numeric/ublas/functional.hpp +2112 -0
  269. package/boost/numeric/ublas/fwd.hpp +229 -0
  270. package/boost/numeric/ublas/hermitian.hpp +2633 -0
  271. package/boost/numeric/ublas/io.hpp +355 -0
  272. package/boost/numeric/ublas/lu.hpp +350 -0
  273. package/boost/numeric/ublas/matrix.hpp +6013 -0
  274. package/boost/numeric/ublas/matrix_expression.hpp +5693 -0
  275. package/boost/numeric/ublas/matrix_proxy.hpp +5457 -0
  276. package/boost/numeric/ublas/matrix_sparse.hpp +5773 -0
  277. package/boost/numeric/ublas/matrix_vector.hpp +406 -0
  278. package/boost/numeric/ublas/opencl/elementwise.hpp +508 -0
  279. package/boost/numeric/ublas/opencl/library.hpp +38 -0
  280. package/boost/numeric/ublas/opencl/matrix.hpp +123 -0
  281. package/boost/numeric/ublas/opencl/misc.hpp +182 -0
  282. package/boost/numeric/ublas/opencl/operations.hpp +18 -0
  283. package/boost/numeric/ublas/opencl/prod.hpp +364 -0
  284. package/boost/numeric/ublas/opencl/transpose.hpp +142 -0
  285. package/boost/numeric/ublas/opencl/vector.hpp +90 -0
  286. package/boost/numeric/ublas/opencl.hpp +16 -0
  287. package/boost/numeric/ublas/operation/begin.hpp +318 -0
  288. package/boost/numeric/ublas/operation/c_array.hpp +41 -0
  289. package/boost/numeric/ublas/operation/end.hpp +318 -0
  290. package/boost/numeric/ublas/operation/num_columns.hpp +45 -0
  291. package/boost/numeric/ublas/operation/num_rows.hpp +44 -0
  292. package/boost/numeric/ublas/operation/size.hpp +350 -0
  293. package/boost/numeric/ublas/operation.hpp +830 -0
  294. package/boost/numeric/ublas/operation_blocked.hpp +266 -0
  295. package/boost/numeric/ublas/operation_sparse.hpp +198 -0
  296. package/boost/numeric/ublas/operations.hpp +26 -0
  297. package/boost/numeric/ublas/storage.hpp +2131 -0
  298. package/boost/numeric/ublas/storage_sparse.hpp +578 -0
  299. package/boost/numeric/ublas/symmetric.hpp +2309 -0
  300. package/boost/numeric/ublas/tags.hpp +37 -0
  301. package/boost/numeric/ublas/tensor/algorithms.hpp +345 -0
  302. package/boost/numeric/ublas/tensor/expression.hpp +181 -0
  303. package/boost/numeric/ublas/tensor/expression_evaluation.hpp +288 -0
  304. package/boost/numeric/ublas/tensor/extents.hpp +335 -0
  305. package/boost/numeric/ublas/tensor/functions.hpp +558 -0
  306. package/boost/numeric/ublas/tensor/index.hpp +89 -0
  307. package/boost/numeric/ublas/tensor/multi_index.hpp +110 -0
  308. package/boost/numeric/ublas/tensor/multi_index_utility.hpp +364 -0
  309. package/boost/numeric/ublas/tensor/multiplication.hpp +945 -0
  310. package/boost/numeric/ublas/tensor/operators_arithmetic.hpp +244 -0
  311. package/boost/numeric/ublas/tensor/operators_comparison.hpp +175 -0
  312. package/boost/numeric/ublas/tensor/ostream.hpp +122 -0
  313. package/boost/numeric/ublas/tensor/storage_traits.hpp +84 -0
  314. package/boost/numeric/ublas/tensor/strides.hpp +251 -0
  315. package/boost/numeric/ublas/tensor/tensor.hpp +734 -0
  316. package/boost/numeric/ublas/tensor.hpp +26 -0
  317. package/boost/numeric/ublas/traits/c_array.hpp +110 -0
  318. package/boost/numeric/ublas/traits/const_iterator_type.hpp +127 -0
  319. package/boost/numeric/ublas/traits/iterator_type.hpp +126 -0
  320. package/boost/numeric/ublas/traits.hpp +753 -0
  321. package/boost/numeric/ublas/triangular.hpp +2775 -0
  322. package/boost/numeric/ublas/vector.hpp +2947 -0
  323. package/boost/numeric/ublas/vector_expression.hpp +1762 -0
  324. package/boost/numeric/ublas/vector_of_vector.hpp +1347 -0
  325. package/boost/numeric/ublas/vector_proxy.hpp +1697 -0
  326. package/boost/numeric/ublas/vector_sparse.hpp +2246 -0
  327. package/package.json +3 -7
@@ -0,0 +1,838 @@
1
+ /*
2
+ [auto_generated]
3
+ boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp
4
+
5
+ [begin_description]
6
+ Implementaiton of the Burlish-Stoer method with dense output
7
+ [end_description]
8
+
9
+ Copyright 2011-2015 Mario Mulansky
10
+ Copyright 2011-2013 Karsten Ahnert
11
+ Copyright 2012 Christoph Koke
12
+
13
+ Distributed under the Boost Software License, Version 1.0.
14
+ (See accompanying file LICENSE_1_0.txt or
15
+ copy at http://www.boost.org/LICENSE_1_0.txt)
16
+ */
17
+
18
+
19
+ #ifndef BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED
20
+ #define BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_DENSE_OUT_HPP_INCLUDED
21
+
22
+
23
+ #include <iostream>
24
+
25
+ #include <algorithm>
26
+
27
+ #include <boost/config.hpp> // for min/max guidelines
28
+
29
+ #include <boost/numeric/odeint/util/bind.hpp>
30
+
31
+ #include <boost/math/special_functions/binomial.hpp>
32
+
33
+ #include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
34
+ #include <boost/numeric/odeint/stepper/modified_midpoint.hpp>
35
+ #include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
36
+ #include <boost/numeric/odeint/algebra/range_algebra.hpp>
37
+ #include <boost/numeric/odeint/algebra/default_operations.hpp>
38
+ #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
39
+ #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
40
+
41
+ #include <boost/numeric/odeint/util/state_wrapper.hpp>
42
+ #include <boost/numeric/odeint/util/is_resizeable.hpp>
43
+ #include <boost/numeric/odeint/util/resizer.hpp>
44
+ #include <boost/numeric/odeint/util/unit_helper.hpp>
45
+
46
+ #include <boost/numeric/odeint/integrate/max_step_checker.hpp>
47
+
48
+ namespace boost {
49
+ namespace numeric {
50
+ namespace odeint {
51
+
52
+ template<
53
+ class State ,
54
+ class Value = double ,
55
+ class Deriv = State ,
56
+ class Time = Value ,
57
+ class Algebra = typename algebra_dispatcher< State >::algebra_type ,
58
+ class Operations = typename operations_dispatcher< State >::operations_type ,
59
+ class Resizer = initially_resizer
60
+ >
61
+ class bulirsch_stoer_dense_out {
62
+
63
+
64
+ public:
65
+
66
+ typedef State state_type;
67
+ typedef Value value_type;
68
+ typedef Deriv deriv_type;
69
+ typedef Time time_type;
70
+ typedef Algebra algebra_type;
71
+ typedef Operations operations_type;
72
+ typedef Resizer resizer_type;
73
+ typedef dense_output_stepper_tag stepper_category;
74
+ #ifndef DOXYGEN_SKIP
75
+ typedef state_wrapper< state_type > wrapped_state_type;
76
+ typedef state_wrapper< deriv_type > wrapped_deriv_type;
77
+
78
+ typedef bulirsch_stoer_dense_out< State , Value , Deriv , Time , Algebra , Operations , Resizer > controlled_error_bs_type;
79
+
80
+ typedef typename inverse_time< time_type >::type inv_time_type;
81
+
82
+ typedef std::vector< value_type > value_vector;
83
+ typedef std::vector< time_type > time_vector;
84
+ typedef std::vector< inv_time_type > inv_time_vector; //should be 1/time_type for boost.units
85
+ typedef std::vector< value_vector > value_matrix;
86
+ typedef std::vector< size_t > int_vector;
87
+ typedef std::vector< wrapped_state_type > state_vector_type;
88
+ typedef std::vector< wrapped_deriv_type > deriv_vector_type;
89
+ typedef std::vector< deriv_vector_type > deriv_table_type;
90
+ #endif //DOXYGEN_SKIP
91
+
92
+ const static size_t m_k_max = 8;
93
+
94
+
95
+
96
+ bulirsch_stoer_dense_out(
97
+ value_type eps_abs = 1E-6 , value_type eps_rel = 1E-6 ,
98
+ value_type factor_x = 1.0 , value_type factor_dxdt = 1.0 ,
99
+ time_type max_dt = static_cast<time_type>(0) ,
100
+ bool control_interpolation = false )
101
+ : m_error_checker( eps_abs , eps_rel , factor_x, factor_dxdt ) ,
102
+ m_max_dt(max_dt) ,
103
+ m_control_interpolation( control_interpolation) ,
104
+ m_last_step_rejected( false ) , m_first( true ) ,
105
+ m_current_state_x1( true ) ,
106
+ m_error( m_k_max ) ,
107
+ m_interval_sequence( m_k_max+1 ) ,
108
+ m_coeff( m_k_max+1 ) ,
109
+ m_cost( m_k_max+1 ) ,
110
+ m_facmin_table( m_k_max+1 ) ,
111
+ m_table( m_k_max ) ,
112
+ m_mp_states( m_k_max+1 ) ,
113
+ m_derivs( m_k_max+1 ) ,
114
+ m_diffs( 2*m_k_max+2 ) ,
115
+ STEPFAC1( 0.65 ) , STEPFAC2( 0.94 ) , STEPFAC3( 0.02 ) , STEPFAC4( 4.0 ) , KFAC1( 0.8 ) , KFAC2( 0.9 )
116
+ {
117
+ BOOST_USING_STD_MIN();
118
+ BOOST_USING_STD_MAX();
119
+
120
+ for( unsigned short i = 0; i < m_k_max+1; i++ )
121
+ {
122
+ /* only this specific sequence allows for dense output */
123
+ m_interval_sequence[i] = 2 + 4*i; // 2 6 10 14 ...
124
+ m_derivs[i].resize( m_interval_sequence[i] );
125
+ if( i == 0 )
126
+ {
127
+ m_cost[i] = m_interval_sequence[i];
128
+ } else
129
+ {
130
+ m_cost[i] = m_cost[i-1] + m_interval_sequence[i];
131
+ }
132
+ m_facmin_table[i] = pow BOOST_PREVENT_MACRO_SUBSTITUTION( STEPFAC3 , static_cast< value_type >(1) / static_cast< value_type >( 2*i+1 ) );
133
+ m_coeff[i].resize(i);
134
+ for( size_t k = 0 ; k < i ; ++k )
135
+ {
136
+ const value_type r = static_cast< value_type >( m_interval_sequence[i] ) / static_cast< value_type >( m_interval_sequence[k] );
137
+ m_coeff[i][k] = 1.0 / ( r*r - static_cast< value_type >( 1.0 ) ); // coefficients for extrapolation
138
+ }
139
+ // crude estimate of optimal order
140
+
141
+ m_current_k_opt = 4;
142
+ /* no calculation because log10 might not exist for value_type!
143
+ const value_type logfact( -log10( max BOOST_PREVENT_MACRO_SUBSTITUTION( eps_rel , static_cast< value_type >( 1.0E-12 ) ) ) * 0.6 + 0.5 );
144
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 1 , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>( m_k_max-1 ) , static_cast<int>( logfact ) ));
145
+ */
146
+ }
147
+ int num = 1;
148
+ for( int i = 2*(m_k_max)+1 ; i >=0 ; i-- )
149
+ {
150
+ m_diffs[i].resize( num );
151
+ num += (i+1)%2;
152
+ }
153
+ }
154
+
155
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
156
+ controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , DerivOut &dxdt_new , time_type &dt )
157
+ {
158
+ if( m_max_dt != static_cast<time_type>(0) && detail::less_with_sign(m_max_dt, dt, dt) )
159
+ {
160
+ // given step size is bigger then max_dt
161
+ // set limit and return fail
162
+ dt = m_max_dt;
163
+ return fail;
164
+ }
165
+
166
+ BOOST_USING_STD_MIN();
167
+ BOOST_USING_STD_MAX();
168
+ using std::pow;
169
+
170
+ static const value_type val1( 1.0 );
171
+
172
+ bool reject( true );
173
+
174
+ time_vector h_opt( m_k_max+1 );
175
+ inv_time_vector work( m_k_max+1 );
176
+
177
+ m_k_final = 0;
178
+ time_type new_h = dt;
179
+
180
+ //std::cout << "t=" << t <<", dt=" << dt << ", k_opt=" << m_current_k_opt << ", first: " << m_first << std::endl;
181
+
182
+ for( size_t k = 0 ; k <= m_current_k_opt+1 ; k++ )
183
+ {
184
+ m_midpoint.set_steps( m_interval_sequence[k] );
185
+ if( k == 0 )
186
+ {
187
+ m_midpoint.do_step( system , in , dxdt , t , out , dt , m_mp_states[k].m_v , m_derivs[k]);
188
+ }
189
+ else
190
+ {
191
+ m_midpoint.do_step( system , in , dxdt , t , m_table[k-1].m_v , dt , m_mp_states[k].m_v , m_derivs[k] );
192
+ extrapolate( k , m_table , m_coeff , out );
193
+ // get error estimate
194
+ m_algebra.for_each3( m_err.m_v , out , m_table[0].m_v ,
195
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 , -val1 ) );
196
+ const value_type error = m_error_checker.error( m_algebra , in , dxdt , m_err.m_v , dt );
197
+ h_opt[k] = calc_h_opt( dt , error , k );
198
+ work[k] = static_cast<value_type>( m_cost[k] ) / h_opt[k];
199
+
200
+ m_k_final = k;
201
+
202
+ if( (k == m_current_k_opt-1) || m_first )
203
+ { // convergence before k_opt ?
204
+ if( error < 1.0 )
205
+ {
206
+ //convergence
207
+ reject = false;
208
+ if( (work[k] < KFAC2*work[k-1]) || (m_current_k_opt <= 2) )
209
+ {
210
+ // leave order as is (except we were in first round)
211
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k)+1 ) );
212
+ new_h = h_opt[k] * static_cast<value_type>( m_cost[k+1] ) / static_cast<value_type>( m_cost[k] );
213
+ } else {
214
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(k) ) );
215
+ new_h = h_opt[k];
216
+ }
217
+ break;
218
+ }
219
+ else if( should_reject( error , k ) && !m_first )
220
+ {
221
+ reject = true;
222
+ new_h = h_opt[k];
223
+ break;
224
+ }
225
+ }
226
+ if( k == m_current_k_opt )
227
+ { // convergence at k_opt ?
228
+ if( error < 1.0 )
229
+ {
230
+ //convergence
231
+ reject = false;
232
+ if( (work[k-1] < KFAC2*work[k]) )
233
+ {
234
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
235
+ new_h = h_opt[m_current_k_opt];
236
+ }
237
+ else if( (work[k] < KFAC2*work[k-1]) && !m_last_step_rejected )
238
+ {
239
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(m_current_k_opt)+1 );
240
+ new_h = h_opt[k]*static_cast<value_type>( m_cost[m_current_k_opt] ) / static_cast<value_type>( m_cost[k] );
241
+ } else
242
+ new_h = h_opt[m_current_k_opt];
243
+ break;
244
+ }
245
+ else if( should_reject( error , k ) )
246
+ {
247
+ reject = true;
248
+ new_h = h_opt[m_current_k_opt];
249
+ break;
250
+ }
251
+ }
252
+ if( k == m_current_k_opt+1 )
253
+ { // convergence at k_opt+1 ?
254
+ if( error < 1.0 )
255
+ { //convergence
256
+ reject = false;
257
+ if( work[k-2] < KFAC2*work[k-1] )
258
+ m_current_k_opt = max BOOST_PREVENT_MACRO_SUBSTITUTION( 2 , static_cast<int>(m_current_k_opt)-1 );
259
+ if( (work[k] < KFAC2*work[m_current_k_opt]) && !m_last_step_rejected )
260
+ m_current_k_opt = min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<int>(m_k_max)-1 , static_cast<int>(k) );
261
+ new_h = h_opt[m_current_k_opt];
262
+ } else
263
+ {
264
+ reject = true;
265
+ new_h = h_opt[m_current_k_opt];
266
+ }
267
+ break;
268
+ }
269
+ }
270
+ }
271
+
272
+ if( !reject )
273
+ {
274
+
275
+ //calculate dxdt for next step and dense output
276
+ typename odeint::unwrap_reference< System >::type &sys = system;
277
+ sys( out , dxdt_new , t+dt );
278
+
279
+ //prepare dense output
280
+ value_type error = prepare_dense_output( m_k_final , in , dxdt , out , dxdt_new , dt );
281
+
282
+ if( error > static_cast<value_type>(10) ) // we are not as accurate for interpolation as for the steps
283
+ {
284
+ reject = true;
285
+ new_h = dt * pow BOOST_PREVENT_MACRO_SUBSTITUTION( error , static_cast<value_type>(-1)/(2*m_k_final+2) );
286
+ } else {
287
+ t += dt;
288
+ }
289
+ }
290
+ //set next stepsize
291
+ if( !m_last_step_rejected || (new_h < dt) )
292
+ {
293
+ // limit step size
294
+ if( m_max_dt != static_cast<time_type>(0) )
295
+ {
296
+ new_h = detail::min_abs(m_max_dt, new_h);
297
+ }
298
+ dt = new_h;
299
+ }
300
+
301
+ m_last_step_rejected = reject;
302
+ if( reject )
303
+ return fail;
304
+ else
305
+ return success;
306
+ }
307
+
308
+ template< class StateType >
309
+ void initialize( const StateType &x0 , const time_type &t0 , const time_type &dt0 )
310
+ {
311
+ m_resizer.adjust_size(x0, [this](auto&& arg) { return this->resize_impl<StateType>(std::forward<decltype(arg)>(arg)); });
312
+ boost::numeric::odeint::copy( x0 , get_current_state() );
313
+ m_t = t0;
314
+ m_dt = dt0;
315
+ reset();
316
+ }
317
+
318
+
319
+ /* =======================================================
320
+ * the actual step method that should be called from outside (maybe make try_step private?)
321
+ */
322
+ template< class System >
323
+ std::pair< time_type , time_type > do_step( System system )
324
+ {
325
+ if( m_first )
326
+ {
327
+ typename odeint::unwrap_reference< System >::type &sys = system;
328
+ sys( get_current_state() , get_current_deriv() , m_t );
329
+ }
330
+
331
+ failed_step_checker fail_checker; // to throw a runtime_error if step size adjustment fails
332
+ controlled_step_result res = fail;
333
+ m_t_last = m_t;
334
+ while( res == fail )
335
+ {
336
+ res = try_step( system , get_current_state() , get_current_deriv() , m_t , get_old_state() , get_old_deriv() , m_dt );
337
+ m_first = false;
338
+ fail_checker(); // check for overflow of failed steps
339
+ }
340
+ toggle_current_state();
341
+ return std::make_pair( m_t_last , m_t );
342
+ }
343
+
344
+ /* performs the interpolation from a calculated step */
345
+ template< class StateOut >
346
+ void calc_state( time_type t , StateOut &x ) const
347
+ {
348
+ do_interpolation( t , x );
349
+ }
350
+
351
+ const state_type& current_state( void ) const
352
+ {
353
+ return get_current_state();
354
+ }
355
+
356
+ time_type current_time( void ) const
357
+ {
358
+ return m_t;
359
+ }
360
+
361
+ const state_type& previous_state( void ) const
362
+ {
363
+ return get_old_state();
364
+ }
365
+
366
+ time_type previous_time( void ) const
367
+ {
368
+ return m_t_last;
369
+ }
370
+
371
+ time_type current_time_step( void ) const
372
+ {
373
+ return m_dt;
374
+ }
375
+
376
+ /** \brief Resets the internal state of the stepper. */
377
+ void reset()
378
+ {
379
+ m_first = true;
380
+ m_last_step_rejected = false;
381
+ }
382
+
383
+ template< class StateIn >
384
+ void adjust_size( const StateIn &x )
385
+ {
386
+ resize_impl( x );
387
+ m_midpoint.adjust_size( x );
388
+ }
389
+
390
+
391
+ protected:
392
+
393
+ time_type m_max_dt;
394
+
395
+
396
+ private:
397
+
398
+ template< class StateInOut , class StateVector >
399
+ void extrapolate( size_t k , StateVector &table , const value_matrix &coeff , StateInOut &xest , size_t order_start_index = 0 )
400
+ //polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
401
+ {
402
+ static const value_type val1( 1.0 );
403
+ for( int j=k-1 ; j>0 ; --j )
404
+ {
405
+ m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v ,
406
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index] ,
407
+ -coeff[k + order_start_index][j + order_start_index] ) );
408
+ }
409
+ m_algebra.for_each3( xest , table[0].m_v , xest ,
410
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][0 + order_start_index] ,
411
+ -coeff[k + order_start_index][0 + order_start_index]) );
412
+ }
413
+
414
+
415
+ template< class StateVector >
416
+ void extrapolate_dense_out( size_t k , StateVector &table , const value_matrix &coeff , size_t order_start_index = 0 )
417
+ //polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
418
+ {
419
+ // result is written into table[0]
420
+ static const value_type val1( 1.0 );
421
+ for( int j=k ; j>1 ; --j )
422
+ {
423
+ m_algebra.for_each3( table[j-1].m_v , table[j].m_v , table[j-1].m_v ,
424
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][j + order_start_index - 1] ,
425
+ -coeff[k + order_start_index][j + order_start_index - 1] ) );
426
+ }
427
+ m_algebra.for_each3( table[0].m_v , table[1].m_v , table[0].m_v ,
428
+ typename operations_type::template scale_sum2< value_type , value_type >( val1 + coeff[k + order_start_index][order_start_index] ,
429
+ -coeff[k + order_start_index][order_start_index]) );
430
+ }
431
+
432
+ time_type calc_h_opt( time_type h , value_type error , size_t k ) const
433
+ {
434
+ BOOST_USING_STD_MIN();
435
+ BOOST_USING_STD_MAX();
436
+ using std::pow;
437
+
438
+ value_type expo = static_cast<value_type>(1)/(m_interval_sequence[k-1]);
439
+ value_type facmin = m_facmin_table[k];
440
+ value_type fac;
441
+ if (error == 0.0)
442
+ fac = static_cast<value_type>(1)/facmin;
443
+ else
444
+ {
445
+ fac = STEPFAC2 / pow BOOST_PREVENT_MACRO_SUBSTITUTION( error / STEPFAC1 , expo );
446
+ fac = max BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>( facmin/STEPFAC4 ) , min BOOST_PREVENT_MACRO_SUBSTITUTION( static_cast<value_type>(static_cast<value_type>(1)/facmin) , fac ) );
447
+ }
448
+ return h*fac;
449
+ }
450
+
451
+ bool in_convergence_window( size_t k ) const
452
+ {
453
+ if( (k == m_current_k_opt-1) && !m_last_step_rejected )
454
+ return true; // decrease order only if last step was not rejected
455
+ return ( (k == m_current_k_opt) || (k == m_current_k_opt+1) );
456
+ }
457
+
458
+ bool should_reject( value_type error , size_t k ) const
459
+ {
460
+ if( k == m_current_k_opt-1 )
461
+ {
462
+ const value_type d = m_interval_sequence[m_current_k_opt] * m_interval_sequence[m_current_k_opt+1] /
463
+ (m_interval_sequence[0]*m_interval_sequence[0]);
464
+ //step will fail, criterion 17.3.17 in NR
465
+ return ( error > d*d );
466
+ }
467
+ else if( k == m_current_k_opt )
468
+ {
469
+ const value_type d = m_interval_sequence[m_current_k_opt+1] / m_interval_sequence[0];
470
+ return ( error > d*d );
471
+ } else
472
+ return error > 1.0;
473
+ }
474
+
475
+ template< class StateIn1 , class DerivIn1 , class StateIn2 , class DerivIn2 >
476
+ value_type prepare_dense_output( int k , const StateIn1 &x_start , const DerivIn1 &dxdt_start ,
477
+ const StateIn2 & /* x_end */ , const DerivIn2 & /*dxdt_end */ , time_type dt )
478
+ /* k is the order to which the result was approximated */
479
+ {
480
+
481
+ /* compute the coefficients of the interpolation polynomial
482
+ * we parametrize the interval t .. t+dt by theta = -1 .. 1
483
+ * we use 2k+3 values at the interval center theta=0 to obtain the interpolation coefficients
484
+ * the values are x(t+dt/2) and the derivatives dx/dt , ... d^(2k+2) x / dt^(2k+2) at the midpoints
485
+ * the derivatives are approximated via finite differences
486
+ * all values are obtained from interpolation of the results from the increasing orders of the midpoint calls
487
+ */
488
+
489
+ // calculate finite difference approximations to derivatives at the midpoint
490
+ for( int j = 0 ; j<=k ; j++ )
491
+ {
492
+ /* not working with boost units... */
493
+ const value_type d = m_interval_sequence[j] / ( static_cast<value_type>(2) * dt );
494
+ value_type f = 1.0; //factor 1/2 here because our interpolation interval has length 2 !!!
495
+ for( int kappa = 0 ; kappa <= 2*j+1 ; ++kappa )
496
+ {
497
+ calculate_finite_difference( j , kappa , f , dxdt_start );
498
+ f *= d;
499
+ }
500
+
501
+ if( j > 0 )
502
+ extrapolate_dense_out( j , m_mp_states , m_coeff );
503
+ }
504
+
505
+ time_type d = dt/2;
506
+
507
+ // extrapolate finite differences
508
+ for( int kappa = 0 ; kappa<=2*k+1 ; kappa++ )
509
+ {
510
+ for( int j=1 ; j<=(k-kappa/2) ; ++j )
511
+ extrapolate_dense_out( j , m_diffs[kappa] , m_coeff , kappa/2 );
512
+
513
+ // extrapolation results are now stored in m_diffs[kappa][0]
514
+
515
+ // divide kappa-th derivative by kappa because we need these terms for dense output interpolation
516
+ m_algebra.for_each1( m_diffs[kappa][0].m_v , typename operations_type::template scale< time_type >( static_cast<time_type>(d) ) );
517
+
518
+ d *= dt/(2*(kappa+2));
519
+ }
520
+
521
+ // dense output coefficients a_0 is stored in m_mp_states[0], a_i for i = 1...2k are stored in m_diffs[i-1][0]
522
+
523
+ // the error is just the highest order coefficient of the interpolation polynomial
524
+ // this is because we use only the midpoint theta=0 as support for the interpolation (remember that theta = -1 .. 1)
525
+
526
+ value_type error = 0.0;
527
+ if( m_control_interpolation )
528
+ {
529
+ boost::numeric::odeint::copy( m_diffs[2*k+1][0].m_v , m_err.m_v );
530
+ error = m_error_checker.error( m_algebra , x_start , dxdt_start , m_err.m_v , dt );
531
+ }
532
+
533
+ return error;
534
+ }
535
+
536
+ template< class DerivIn >
537
+ void calculate_finite_difference( size_t j , size_t kappa , value_type fac , const DerivIn &dxdt )
538
+ {
539
+ const int m = m_interval_sequence[j]/2-1;
540
+ if( kappa == 0) // no calculation required for 0th derivative of f
541
+ {
542
+ m_algebra.for_each2( m_diffs[0][j].m_v , m_derivs[j][m].m_v ,
543
+ typename operations_type::template scale_sum1< value_type >( fac ) );
544
+ }
545
+ else
546
+ {
547
+ // calculate the index of m_diffs for this kappa-j-combination
548
+ const int j_diffs = j - kappa/2;
549
+
550
+ m_algebra.for_each2( m_diffs[kappa][j_diffs].m_v , m_derivs[j][m+kappa].m_v ,
551
+ typename operations_type::template scale_sum1< value_type >( fac ) );
552
+ value_type sign = -1.0;
553
+ int c = 1;
554
+ //computes the j-th order finite difference for the kappa-th derivative of f at t+dt/2 using function evaluations stored in m_derivs
555
+ for( int i = m+static_cast<int>(kappa)-2 ; i >= m-static_cast<int>(kappa) ; i -= 2 )
556
+ {
557
+ if( i >= 0 )
558
+ {
559
+ m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , m_derivs[j][i].m_v ,
560
+ typename operations_type::template scale_sum2< value_type , value_type >( 1.0 ,
561
+ sign * fac * boost::math::binomial_coefficient< value_type >( kappa , c ) ) );
562
+ }
563
+ else
564
+ {
565
+ m_algebra.for_each3( m_diffs[kappa][j_diffs].m_v , m_diffs[kappa][j_diffs].m_v , dxdt ,
566
+ typename operations_type::template scale_sum2< value_type , value_type >( 1.0 , sign * fac ) );
567
+ }
568
+ sign *= -1;
569
+ ++c;
570
+ }
571
+ }
572
+ }
573
+
574
+ template< class StateOut >
575
+ void do_interpolation( time_type t , StateOut &out ) const
576
+ {
577
+ // interpolation polynomial is defined for theta = -1 ... 1
578
+ // m_k_final is the number of order-iterations done for the last step - it governs the order of the interpolation polynomial
579
+ const value_type theta = 2 * get_unit_value( (t - m_t_last) / (m_t - m_t_last) ) - 1;
580
+ // we use only values at interval center, that is theta=0, for interpolation
581
+ // our interpolation polynomial is thus of order 2k+2, hence we have 2k+3 terms
582
+
583
+ boost::numeric::odeint::copy( m_mp_states[0].m_v , out );
584
+ // add remaining terms: x += a_1 theta + a2 theta^2 + ... + a_{2k} theta^{2k}
585
+ value_type theta_pow( theta );
586
+ for( size_t i=0 ; i<=2*m_k_final+1 ; ++i )
587
+ {
588
+ m_algebra.for_each3( out , out , m_diffs[i][0].m_v ,
589
+ typename operations_type::template scale_sum2< value_type >( static_cast<value_type>(1) , theta_pow ) );
590
+ theta_pow *= theta;
591
+ }
592
+ }
593
+
594
+ /* Resizer methods */
595
+ template< class StateIn >
596
+ bool resize_impl( const StateIn &x )
597
+ {
598
+ bool resized( false );
599
+
600
+ resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
601
+ resized |= adjust_size_by_resizeability( m_x2 , x , typename is_resizeable<state_type>::type() );
602
+ resized |= adjust_size_by_resizeability( m_dxdt1 , x , typename is_resizeable<state_type>::type() );
603
+ resized |= adjust_size_by_resizeability( m_dxdt2 , x , typename is_resizeable<state_type>::type() );
604
+ resized |= adjust_size_by_resizeability( m_err , x , typename is_resizeable<state_type>::type() );
605
+
606
+ for( size_t i = 0 ; i < m_k_max ; ++i )
607
+ resized |= adjust_size_by_resizeability( m_table[i] , x , typename is_resizeable<state_type>::type() );
608
+ for( size_t i = 0 ; i < m_k_max+1 ; ++i )
609
+ resized |= adjust_size_by_resizeability( m_mp_states[i] , x , typename is_resizeable<state_type>::type() );
610
+ for( size_t i = 0 ; i < m_k_max+1 ; ++i )
611
+ for( size_t j = 0 ; j < m_derivs[i].size() ; ++j )
612
+ resized |= adjust_size_by_resizeability( m_derivs[i][j] , x , typename is_resizeable<deriv_type>::type() );
613
+ for( size_t i = 0 ; i < 2*m_k_max+2 ; ++i )
614
+ for( size_t j = 0 ; j < m_diffs[i].size() ; ++j )
615
+ resized |= adjust_size_by_resizeability( m_diffs[i][j] , x , typename is_resizeable<deriv_type>::type() );
616
+
617
+ return resized;
618
+ }
619
+
620
+
621
+ state_type& get_current_state( void )
622
+ {
623
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
624
+ }
625
+
626
+ const state_type& get_current_state( void ) const
627
+ {
628
+ return m_current_state_x1 ? m_x1.m_v : m_x2.m_v ;
629
+ }
630
+
631
+ state_type& get_old_state( void )
632
+ {
633
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
634
+ }
635
+
636
+ const state_type& get_old_state( void ) const
637
+ {
638
+ return m_current_state_x1 ? m_x2.m_v : m_x1.m_v ;
639
+ }
640
+
641
+ deriv_type& get_current_deriv( void )
642
+ {
643
+ return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
644
+ }
645
+
646
+ const deriv_type& get_current_deriv( void ) const
647
+ {
648
+ return m_current_state_x1 ? m_dxdt1.m_v : m_dxdt2.m_v ;
649
+ }
650
+
651
+ deriv_type& get_old_deriv( void )
652
+ {
653
+ return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
654
+ }
655
+
656
+ const deriv_type& get_old_deriv( void ) const
657
+ {
658
+ return m_current_state_x1 ? m_dxdt2.m_v : m_dxdt1.m_v ;
659
+ }
660
+
661
+
662
+ void toggle_current_state( void )
663
+ {
664
+ m_current_state_x1 = ! m_current_state_x1;
665
+ }
666
+
667
+
668
+
669
+ default_error_checker< value_type, algebra_type , operations_type > m_error_checker;
670
+ modified_midpoint_dense_out< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , resizer_type > m_midpoint;
671
+
672
+ bool m_control_interpolation;
673
+
674
+ bool m_last_step_rejected;
675
+ bool m_first;
676
+
677
+ time_type m_t;
678
+ time_type m_dt;
679
+ time_type m_dt_last;
680
+ time_type m_t_last;
681
+
682
+ size_t m_current_k_opt;
683
+ size_t m_k_final;
684
+
685
+ algebra_type m_algebra;
686
+
687
+ resizer_type m_resizer;
688
+
689
+ wrapped_state_type m_x1 , m_x2;
690
+ wrapped_deriv_type m_dxdt1 , m_dxdt2;
691
+ wrapped_state_type m_err;
692
+ bool m_current_state_x1;
693
+
694
+
695
+
696
+ value_vector m_error; // errors of repeated midpoint steps and extrapolations
697
+ int_vector m_interval_sequence; // stores the successive interval counts
698
+ value_matrix m_coeff;
699
+ int_vector m_cost; // costs for interval count
700
+ value_vector m_facmin_table; // for precomputed facmin to save pow calls
701
+
702
+ state_vector_type m_table; // sequence of states for extrapolation
703
+
704
+ //for dense output:
705
+ state_vector_type m_mp_states; // sequence of approximations of x at distance center
706
+ deriv_table_type m_derivs; // table of function values
707
+ deriv_table_type m_diffs; // table of function values
708
+
709
+ //wrapped_state_type m_a1 , m_a2 , m_a3 , m_a4;
710
+
711
+ value_type STEPFAC1 , STEPFAC2 , STEPFAC3 , STEPFAC4 , KFAC1 , KFAC2;
712
+ };
713
+
714
+
715
+
716
+ /********** DOXYGEN **********/
717
+
718
+ /**
719
+ * \class bulirsch_stoer_dense_out
720
+ * \brief The Bulirsch-Stoer algorithm.
721
+ *
722
+ * The Bulirsch-Stoer is a controlled stepper that adjusts both step size
723
+ * and order of the method. The algorithm uses the modified midpoint and
724
+ * a polynomial extrapolation compute the solution. This class also provides
725
+ * dense output facility.
726
+ *
727
+ * \tparam State The state type.
728
+ * \tparam Value The value type.
729
+ * \tparam Deriv The type representing the time derivative of the state.
730
+ * \tparam Time The time representing the independent variable - the time.
731
+ * \tparam Algebra The algebra type.
732
+ * \tparam Operations The operations type.
733
+ * \tparam Resizer The resizer policy type.
734
+ */
735
+
736
+ /**
737
+ * \fn bulirsch_stoer_dense_out::bulirsch_stoer_dense_out( value_type eps_abs , value_type eps_rel , value_type factor_x , value_type factor_dxdt , bool control_interpolation )
738
+ * \brief Constructs the bulirsch_stoer class, including initialization of
739
+ * the error bounds.
740
+ *
741
+ * \param eps_abs Absolute tolerance level.
742
+ * \param eps_rel Relative tolerance level.
743
+ * \param factor_x Factor for the weight of the state.
744
+ * \param factor_dxdt Factor for the weight of the derivative.
745
+ * \param control_interpolation Set true to additionally control the error of
746
+ * the interpolation.
747
+ */
748
+
749
+ /**
750
+ * \fn bulirsch_stoer_dense_out::try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , DerivOut &dxdt_new , time_type &dt )
751
+ * \brief Tries to perform one step.
752
+ *
753
+ * This method tries to do one step with step size dt. If the error estimate
754
+ * is to large, the step is rejected and the method returns fail and the
755
+ * step size dt is reduced. If the error estimate is acceptably small, the
756
+ * step is performed, success is returned and dt might be increased to make
757
+ * the steps as large as possible. This method also updates t if a step is
758
+ * performed. Also, the internal order of the stepper is adjusted if required.
759
+ *
760
+ * \param system The system function to solve, hence the r.h.s. of the ODE.
761
+ * It must fulfill the Simple System concept.
762
+ * \param in The state of the ODE which should be solved.
763
+ * \param dxdt The derivative of state.
764
+ * \param t The value of the time. Updated if the step is successful.
765
+ * \param out Used to store the result of the step.
766
+ * \param dt The step size. Updated.
767
+ * \return success if the step was accepted, fail otherwise.
768
+ */
769
+
770
+ /**
771
+ * \fn bulirsch_stoer_dense_out::initialize( const StateType &x0 , const time_type &t0 , const time_type &dt0 )
772
+ * \brief Initializes the dense output stepper.
773
+ *
774
+ * \param x0 The initial state.
775
+ * \param t0 The initial time.
776
+ * \param dt0 The initial time step.
777
+ */
778
+
779
+ /**
780
+ * \fn bulirsch_stoer_dense_out::do_step( System system )
781
+ * \brief Does one time step. This is the main method that should be used to
782
+ * integrate an ODE with this stepper.
783
+ * \note initialize has to be called before using this method to set the
784
+ * initial conditions x,t and the stepsize.
785
+ * \param system The system function to solve, hence the r.h.s. of the
786
+ * ordinary differential equation. It must fulfill the Simple System concept.
787
+ * \return Pair with start and end time of the integration step.
788
+ */
789
+
790
+ /**
791
+ * \fn bulirsch_stoer_dense_out::calc_state( time_type t , StateOut &x ) const
792
+ * \brief Calculates the solution at an intermediate point within the last step
793
+ * \param t The time at which the solution should be calculated, has to be
794
+ * in the current time interval.
795
+ * \param x The output variable where the result is written into.
796
+ */
797
+
798
+ /**
799
+ * \fn bulirsch_stoer_dense_out::current_state( void ) const
800
+ * \brief Returns the current state of the solution.
801
+ * \return The current state of the solution x(t).
802
+ */
803
+
804
+ /**
805
+ * \fn bulirsch_stoer_dense_out::current_time( void ) const
806
+ * \brief Returns the current time of the solution.
807
+ * \return The current time of the solution t.
808
+ */
809
+
810
+ /**
811
+ * \fn bulirsch_stoer_dense_out::previous_state( void ) const
812
+ * \brief Returns the last state of the solution.
813
+ * \return The last state of the solution x(t-dt).
814
+ */
815
+
816
+ /**
817
+ * \fn bulirsch_stoer_dense_out::previous_time( void ) const
818
+ * \brief Returns the last time of the solution.
819
+ * \return The last time of the solution t-dt.
820
+ */
821
+
822
+ /**
823
+ * \fn bulirsch_stoer_dense_out::current_time_step( void ) const
824
+ * \brief Returns the current step size.
825
+ * \return The current step size.
826
+ */
827
+
828
+ /**
829
+ * \fn bulirsch_stoer_dense_out::adjust_size( const StateIn &x )
830
+ * \brief Adjust the size of all temporaries in the stepper manually.
831
+ * \param x A state from which the size of the temporaries to be resized is deduced.
832
+ */
833
+
834
+ }
835
+ }
836
+ }
837
+
838
+ #endif // BOOST_NUMERIC_ODEINT_STEPPER_BULIRSCH_STOER_HPP_INCLUDED