@lakutata/math 0.0.0-stage → 3.1.3

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 (1728) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +954 -2
  3. package/README.zh-CN.md +578 -0
  4. package/THIRD_PARTY_NOTICES.md +553 -0
  5. package/binding.gyp +89 -0
  6. package/dist/cjs/exceptions/MathArgumentException.d.ts +11 -0
  7. package/dist/cjs/exceptions/MathArgumentException.js +18 -0
  8. package/dist/cjs/exceptions/MathCancelledException.d.ts +10 -0
  9. package/dist/cjs/exceptions/MathCancelledException.js +17 -0
  10. package/dist/cjs/exceptions/MathDefinitionException.d.ts +11 -0
  11. package/dist/cjs/exceptions/MathDefinitionException.js +18 -0
  12. package/dist/cjs/exceptions/MathDivisionByZeroException.d.ts +10 -0
  13. package/dist/cjs/exceptions/MathDivisionByZeroException.js +17 -0
  14. package/dist/cjs/exceptions/MathDomainException.d.ts +11 -0
  15. package/dist/cjs/exceptions/MathDomainException.js +18 -0
  16. package/dist/cjs/exceptions/MathException.d.ts +19 -0
  17. package/dist/cjs/exceptions/MathException.js +22 -0
  18. package/dist/cjs/exceptions/MathNotSupportedException.d.ts +11 -0
  19. package/dist/cjs/exceptions/MathNotSupportedException.js +18 -0
  20. package/dist/cjs/exceptions/MathSyntaxException.d.ts +11 -0
  21. package/dist/cjs/exceptions/MathSyntaxException.js +18 -0
  22. package/dist/cjs/exceptions/MathTimeoutException.d.ts +10 -0
  23. package/dist/cjs/exceptions/MathTimeoutException.js +17 -0
  24. package/dist/cjs/exceptions/MathUnitException.d.ts +11 -0
  25. package/dist/cjs/exceptions/MathUnitException.js +18 -0
  26. package/dist/cjs/exceptions/MathUnknownFunctionException.d.ts +12 -0
  27. package/dist/cjs/exceptions/MathUnknownFunctionException.js +19 -0
  28. package/dist/cjs/exports/Math.d.ts +28 -0
  29. package/dist/cjs/exports/Math.js +84 -0
  30. package/dist/cjs/lib/Addon.d.ts +5 -0
  31. package/dist/cjs/lib/Addon.js +9 -0
  32. package/dist/cjs/lib/Context.d.ts +90 -0
  33. package/dist/cjs/lib/Context.js +134 -0
  34. package/dist/cjs/lib/Decimal.d.ts +276 -0
  35. package/dist/cjs/lib/Decimal.js +402 -0
  36. package/dist/cjs/lib/Defaults.d.ts +273 -0
  37. package/dist/cjs/lib/Defaults.js +308 -0
  38. package/dist/cjs/lib/Distribution.d.ts +177 -0
  39. package/dist/cjs/lib/Distribution.js +195 -0
  40. package/dist/cjs/lib/Expression.d.ts +791 -0
  41. package/dist/cjs/lib/Expression.js +991 -0
  42. package/dist/cjs/lib/ExpressionMatrix.d.ts +284 -0
  43. package/dist/cjs/lib/ExpressionMatrix.js +412 -0
  44. package/dist/cjs/lib/LinearAlgebra.d.ts +613 -0
  45. package/dist/cjs/lib/LinearAlgebra.js +712 -0
  46. package/dist/cjs/lib/MathScope.d.ts +268 -0
  47. package/dist/cjs/lib/MathScope.js +316 -0
  48. package/dist/cjs/lib/MathSet.d.ts +139 -0
  49. package/dist/cjs/lib/MathSet.js +376 -0
  50. package/dist/cjs/lib/Matrix.d.ts +212 -0
  51. package/dist/cjs/lib/Matrix.js +393 -0
  52. package/dist/cjs/lib/Native.d.ts +80 -0
  53. package/dist/cjs/lib/Native.js +61 -0
  54. package/dist/cjs/lib/NumberTheory.d.ts +356 -0
  55. package/dist/cjs/lib/NumberTheory.js +524 -0
  56. package/dist/cjs/lib/Numeric.d.ts +363 -0
  57. package/dist/cjs/lib/Numeric.js +243 -0
  58. package/dist/cjs/lib/Polynomials.d.ts +140 -0
  59. package/dist/cjs/lib/Polynomials.js +167 -0
  60. package/dist/cjs/lib/SparseMatrix.d.ts +125 -0
  61. package/dist/cjs/lib/SparseMatrix.js +341 -0
  62. package/dist/cjs/lib/Statistics.d.ts +366 -0
  63. package/dist/cjs/lib/Statistics.js +380 -0
  64. package/dist/cjs/lib/Unit.d.ts +342 -0
  65. package/dist/cjs/lib/Unit.js +1027 -0
  66. package/dist/cjs/lib/UnitTable.d.ts +39 -0
  67. package/dist/cjs/lib/UnitTable.js +634 -0
  68. package/dist/cjs/package.json +1 -0
  69. package/dist/esm/exceptions/MathArgumentException.js +14 -0
  70. package/dist/esm/exceptions/MathCancelledException.js +13 -0
  71. package/dist/esm/exceptions/MathDefinitionException.js +14 -0
  72. package/dist/esm/exceptions/MathDivisionByZeroException.js +13 -0
  73. package/dist/esm/exceptions/MathDomainException.js +14 -0
  74. package/dist/esm/exceptions/MathException.js +18 -0
  75. package/dist/esm/exceptions/MathNotSupportedException.js +14 -0
  76. package/dist/esm/exceptions/MathSyntaxException.js +14 -0
  77. package/dist/esm/exceptions/MathTimeoutException.js +13 -0
  78. package/dist/esm/exceptions/MathUnitException.js +14 -0
  79. package/dist/esm/exceptions/MathUnknownFunctionException.js +15 -0
  80. package/dist/esm/exports/Math.js +26 -0
  81. package/dist/esm/lib/Addon.js +10 -0
  82. package/dist/esm/lib/Context.js +128 -0
  83. package/dist/esm/lib/Decimal.js +397 -0
  84. package/dist/esm/lib/Defaults.js +290 -0
  85. package/dist/esm/lib/Distribution.js +190 -0
  86. package/dist/esm/lib/Expression.js +979 -0
  87. package/dist/esm/lib/ExpressionMatrix.js +407 -0
  88. package/dist/esm/lib/LinearAlgebra.js +708 -0
  89. package/dist/esm/lib/MathScope.js +311 -0
  90. package/dist/esm/lib/MathSet.js +370 -0
  91. package/dist/esm/lib/Matrix.js +382 -0
  92. package/dist/esm/lib/Native.js +56 -0
  93. package/dist/esm/lib/NumberTheory.js +520 -0
  94. package/dist/esm/lib/Numeric.js +239 -0
  95. package/dist/esm/lib/Polynomials.js +163 -0
  96. package/dist/esm/lib/SparseMatrix.js +332 -0
  97. package/dist/esm/lib/Statistics.js +376 -0
  98. package/dist/esm/lib/Unit.js +1018 -0
  99. package/dist/esm/lib/UnitTable.js +631 -0
  100. package/dist/types/exceptions/MathArgumentException.d.ts +11 -0
  101. package/dist/types/exceptions/MathCancelledException.d.ts +10 -0
  102. package/dist/types/exceptions/MathDefinitionException.d.ts +11 -0
  103. package/dist/types/exceptions/MathDivisionByZeroException.d.ts +10 -0
  104. package/dist/types/exceptions/MathDomainException.d.ts +11 -0
  105. package/dist/types/exceptions/MathException.d.ts +19 -0
  106. package/dist/types/exceptions/MathNotSupportedException.d.ts +11 -0
  107. package/dist/types/exceptions/MathSyntaxException.d.ts +11 -0
  108. package/dist/types/exceptions/MathTimeoutException.d.ts +10 -0
  109. package/dist/types/exceptions/MathUnitException.d.ts +11 -0
  110. package/dist/types/exceptions/MathUnknownFunctionException.d.ts +12 -0
  111. package/dist/types/exports/Math.d.ts +28 -0
  112. package/dist/types/lib/Addon.d.ts +5 -0
  113. package/dist/types/lib/Context.d.ts +90 -0
  114. package/dist/types/lib/Decimal.d.ts +276 -0
  115. package/dist/types/lib/Defaults.d.ts +273 -0
  116. package/dist/types/lib/Distribution.d.ts +177 -0
  117. package/dist/types/lib/Expression.d.ts +791 -0
  118. package/dist/types/lib/ExpressionMatrix.d.ts +284 -0
  119. package/dist/types/lib/LinearAlgebra.d.ts +613 -0
  120. package/dist/types/lib/MathScope.d.ts +268 -0
  121. package/dist/types/lib/MathSet.d.ts +139 -0
  122. package/dist/types/lib/Matrix.d.ts +212 -0
  123. package/dist/types/lib/Native.d.ts +80 -0
  124. package/dist/types/lib/NumberTheory.d.ts +356 -0
  125. package/dist/types/lib/Numeric.d.ts +363 -0
  126. package/dist/types/lib/Polynomials.d.ts +140 -0
  127. package/dist/types/lib/SparseMatrix.d.ts +125 -0
  128. package/dist/types/lib/Statistics.d.ts +366 -0
  129. package/dist/types/lib/Unit.d.ts +342 -0
  130. package/dist/types/lib/UnitTable.d.ts +39 -0
  131. package/native/addon.cpp +1374 -0
  132. package/native/async/Pool.cpp +133 -0
  133. package/native/async/Pool.h +59 -0
  134. package/native/config/boost_math_policy.h +26 -0
  135. package/native/config/mpdecimal/mpdecimal.h +809 -0
  136. package/native/config/symengine/symengine_config.h +44 -0
  137. package/native/config/symengine/symengine_export.h +19 -0
  138. package/native/core/Errors.cpp +77 -0
  139. package/native/core/Errors.h +72 -0
  140. package/native/core/Handle.cpp +109 -0
  141. package/native/core/Handle.h +72 -0
  142. package/native/core/Scope.cpp +122 -0
  143. package/native/core/Scope.h +36 -0
  144. package/native/functions/Functions.cpp +468 -0
  145. package/native/functions/Functions.h +115 -0
  146. package/native/functions/Gosper.cpp +429 -0
  147. package/native/functions/Gosper.h +20 -0
  148. package/native/functions/SpecialIntegrals.cpp +329 -0
  149. package/native/functions/SpecialIntegrals.h +53 -0
  150. package/native/functions/Summation.cpp +645 -0
  151. package/native/functions/Summation.h +42 -0
  152. package/native/integrals/Integrals.cpp +1428 -0
  153. package/native/integrals/Integrals.h +32 -0
  154. package/native/limits/Gruntz.cpp +1332 -0
  155. package/native/limits/Gruntz.h +24 -0
  156. package/native/linalg/Decompositions.cpp +159 -0
  157. package/native/linalg/Functions.cpp +199 -0
  158. package/native/linalg/Linalg.cpp +123 -0
  159. package/native/linalg/Linalg.h +67 -0
  160. package/native/linalg/LinalgSupport.h +69 -0
  161. package/native/linalg/Sparse.cpp +172 -0
  162. package/native/matrix/Matrices.cpp +766 -0
  163. package/native/matrix/Matrices.h +74 -0
  164. package/native/ntheory/NumberTheory.cpp +754 -0
  165. package/native/ntheory/NumberTheory.h +56 -0
  166. package/native/numeric/Compiled.cpp +93 -0
  167. package/native/numeric/Compiled.h +49 -0
  168. package/native/numeric/Integrate.cpp +718 -0
  169. package/native/numeric/Numeric.h +95 -0
  170. package/native/numeric/ODE.cpp +542 -0
  171. package/native/numeric/Roots.cpp +402 -0
  172. package/native/ops/Decimal.cpp +776 -0
  173. package/native/ops/Decimal.h +182 -0
  174. package/native/ops/DecimalComplex.cpp +738 -0
  175. package/native/ops/DecimalEvaluator.h +79 -0
  176. package/native/ops/DecimalFunctions.cpp +439 -0
  177. package/native/ops/DecimalOperations.cpp +236 -0
  178. package/native/ops/DecimalSpecial.cpp +1028 -0
  179. package/native/ops/DecimalSupport.h +109 -0
  180. package/native/ops/Operations.cpp +969 -0
  181. package/native/ops/Operations.h +120 -0
  182. package/native/ops/Piecewise.cpp +195 -0
  183. package/native/ops/Piecewise.h +40 -0
  184. package/native/parser/Parser.cpp +853 -0
  185. package/native/parser/Parser.h +56 -0
  186. package/native/poly/Convert.cpp +210 -0
  187. package/native/poly/Convert.h +40 -0
  188. package/native/poly/Dense.cpp +1008 -0
  189. package/native/poly/Dense.h +136 -0
  190. package/native/poly/Euclid.cpp +446 -0
  191. package/native/poly/Euclid.h +44 -0
  192. package/native/poly/Factor.cpp +919 -0
  193. package/native/poly/Factor.h +36 -0
  194. package/native/poly/Galois.cpp +439 -0
  195. package/native/poly/Galois.h +86 -0
  196. package/native/poly/Inequalities.cpp +227 -0
  197. package/native/poly/Inequalities.h +21 -0
  198. package/native/poly/Poly.cpp +338 -0
  199. package/native/poly/Poly.h +46 -0
  200. package/native/poly/Rational.cpp +403 -0
  201. package/native/poly/Rational.h +33 -0
  202. package/native/poly/RealRoots.cpp +136 -0
  203. package/native/poly/RealRoots.h +35 -0
  204. package/native/printer/Printer.cpp +973 -0
  205. package/native/printer/Printer.h +23 -0
  206. package/native/simplify/Simplify.cpp +921 -0
  207. package/native/simplify/Simplify.h +21 -0
  208. package/native/stats/Distributions.cpp +392 -0
  209. package/native/stats/Distributions.h +33 -0
  210. package/native/stats/Statistics.cpp +255 -0
  211. package/native/stats/Statistics.h +25 -0
  212. package/package.json +85 -4
  213. package/scripts/sources.mjs +35 -0
  214. package/vendor/PATCHES.md +169 -0
  215. package/vendor/boost/config/README.md +43 -0
  216. package/vendor/boost/config/include/boost/config/abi/borland_prefix.hpp +27 -0
  217. package/vendor/boost/config/include/boost/config/abi/borland_suffix.hpp +12 -0
  218. package/vendor/boost/config/include/boost/config/abi/msvc_prefix.hpp +22 -0
  219. package/vendor/boost/config/include/boost/config/abi/msvc_suffix.hpp +8 -0
  220. package/vendor/boost/config/include/boost/config/abi_prefix.hpp +25 -0
  221. package/vendor/boost/config/include/boost/config/abi_suffix.hpp +25 -0
  222. package/vendor/boost/config/include/boost/config/assert_cxx03.hpp +211 -0
  223. package/vendor/boost/config/include/boost/config/assert_cxx11.hpp +212 -0
  224. package/vendor/boost/config/include/boost/config/assert_cxx14.hpp +47 -0
  225. package/vendor/boost/config/include/boost/config/assert_cxx17.hpp +65 -0
  226. package/vendor/boost/config/include/boost/config/assert_cxx20.hpp +59 -0
  227. package/vendor/boost/config/include/boost/config/assert_cxx23.hpp +41 -0
  228. package/vendor/boost/config/include/boost/config/assert_cxx98.hpp +23 -0
  229. package/vendor/boost/config/include/boost/config/auto_link.hpp +530 -0
  230. package/vendor/boost/config/include/boost/config/compiler/borland.hpp +342 -0
  231. package/vendor/boost/config/include/boost/config/compiler/clang.hpp +370 -0
  232. package/vendor/boost/config/include/boost/config/compiler/clang_version.hpp +98 -0
  233. package/vendor/boost/config/include/boost/config/compiler/codegear.hpp +389 -0
  234. package/vendor/boost/config/include/boost/config/compiler/comeau.hpp +59 -0
  235. package/vendor/boost/config/include/boost/config/compiler/common_edg.hpp +185 -0
  236. package/vendor/boost/config/include/boost/config/compiler/compaq_cxx.hpp +19 -0
  237. package/vendor/boost/config/include/boost/config/compiler/cray.hpp +446 -0
  238. package/vendor/boost/config/include/boost/config/compiler/diab.hpp +26 -0
  239. package/vendor/boost/config/include/boost/config/compiler/digitalmars.hpp +146 -0
  240. package/vendor/boost/config/include/boost/config/compiler/gcc.hpp +386 -0
  241. package/vendor/boost/config/include/boost/config/compiler/gcc_xml.hpp +115 -0
  242. package/vendor/boost/config/include/boost/config/compiler/greenhills.hpp +28 -0
  243. package/vendor/boost/config/include/boost/config/compiler/hp_acc.hpp +153 -0
  244. package/vendor/boost/config/include/boost/config/compiler/intel.hpp +577 -0
  245. package/vendor/boost/config/include/boost/config/compiler/kai.hpp +33 -0
  246. package/vendor/boost/config/include/boost/config/compiler/metrowerks.hpp +201 -0
  247. package/vendor/boost/config/include/boost/config/compiler/mpw.hpp +143 -0
  248. package/vendor/boost/config/include/boost/config/compiler/nvcc.hpp +64 -0
  249. package/vendor/boost/config/include/boost/config/compiler/pathscale.hpp +141 -0
  250. package/vendor/boost/config/include/boost/config/compiler/pgi.hpp +23 -0
  251. package/vendor/boost/config/include/boost/config/compiler/sgi_mipspro.hpp +29 -0
  252. package/vendor/boost/config/include/boost/config/compiler/sunpro_cc.hpp +225 -0
  253. package/vendor/boost/config/include/boost/config/compiler/vacpp.hpp +189 -0
  254. package/vendor/boost/config/include/boost/config/compiler/visualc.hpp +400 -0
  255. package/vendor/boost/config/include/boost/config/compiler/xlcpp.hpp +303 -0
  256. package/vendor/boost/config/include/boost/config/compiler/xlcpp_zos.hpp +174 -0
  257. package/vendor/boost/config/include/boost/config/detail/cxx_composite.hpp +218 -0
  258. package/vendor/boost/config/include/boost/config/detail/posix_features.hpp +95 -0
  259. package/vendor/boost/config/include/boost/config/detail/select_compiler_config.hpp +157 -0
  260. package/vendor/boost/config/include/boost/config/detail/select_platform_config.hpp +147 -0
  261. package/vendor/boost/config/include/boost/config/detail/select_stdlib_config.hpp +121 -0
  262. package/vendor/boost/config/include/boost/config/detail/suffix.hpp +1334 -0
  263. package/vendor/boost/config/include/boost/config/header_deprecated.hpp +26 -0
  264. package/vendor/boost/config/include/boost/config/helper_macros.hpp +37 -0
  265. package/vendor/boost/config/include/boost/config/no_tr1/cmath.hpp +28 -0
  266. package/vendor/boost/config/include/boost/config/no_tr1/complex.hpp +28 -0
  267. package/vendor/boost/config/include/boost/config/no_tr1/functional.hpp +28 -0
  268. package/vendor/boost/config/include/boost/config/no_tr1/memory.hpp +28 -0
  269. package/vendor/boost/config/include/boost/config/no_tr1/utility.hpp +28 -0
  270. package/vendor/boost/config/include/boost/config/platform/aix.hpp +33 -0
  271. package/vendor/boost/config/include/boost/config/platform/amigaos.hpp +15 -0
  272. package/vendor/boost/config/include/boost/config/platform/beos.hpp +26 -0
  273. package/vendor/boost/config/include/boost/config/platform/bsd.hpp +83 -0
  274. package/vendor/boost/config/include/boost/config/platform/cloudabi.hpp +18 -0
  275. package/vendor/boost/config/include/boost/config/platform/cray.hpp +18 -0
  276. package/vendor/boost/config/include/boost/config/platform/cygwin.hpp +71 -0
  277. package/vendor/boost/config/include/boost/config/platform/haiku.hpp +31 -0
  278. package/vendor/boost/config/include/boost/config/platform/hpux.hpp +87 -0
  279. package/vendor/boost/config/include/boost/config/platform/irix.hpp +31 -0
  280. package/vendor/boost/config/include/boost/config/platform/linux.hpp +106 -0
  281. package/vendor/boost/config/include/boost/config/platform/macos.hpp +87 -0
  282. package/vendor/boost/config/include/boost/config/platform/qnxnto.hpp +31 -0
  283. package/vendor/boost/config/include/boost/config/platform/solaris.hpp +31 -0
  284. package/vendor/boost/config/include/boost/config/platform/symbian.hpp +97 -0
  285. package/vendor/boost/config/include/boost/config/platform/vms.hpp +25 -0
  286. package/vendor/boost/config/include/boost/config/platform/vxworks.hpp +422 -0
  287. package/vendor/boost/config/include/boost/config/platform/wasm.hpp +23 -0
  288. package/vendor/boost/config/include/boost/config/platform/win32.hpp +90 -0
  289. package/vendor/boost/config/include/boost/config/platform/zos.hpp +32 -0
  290. package/vendor/boost/config/include/boost/config/pragma_message.hpp +31 -0
  291. package/vendor/boost/config/include/boost/config/requires_threads.hpp +92 -0
  292. package/vendor/boost/config/include/boost/config/stdlib/dinkumware.hpp +324 -0
  293. package/vendor/boost/config/include/boost/config/stdlib/libcomo.hpp +93 -0
  294. package/vendor/boost/config/include/boost/config/stdlib/libcpp.hpp +185 -0
  295. package/vendor/boost/config/include/boost/config/stdlib/libstdcpp3.hpp +482 -0
  296. package/vendor/boost/config/include/boost/config/stdlib/modena.hpp +79 -0
  297. package/vendor/boost/config/include/boost/config/stdlib/msl.hpp +98 -0
  298. package/vendor/boost/config/include/boost/config/stdlib/roguewave.hpp +208 -0
  299. package/vendor/boost/config/include/boost/config/stdlib/sgi.hpp +168 -0
  300. package/vendor/boost/config/include/boost/config/stdlib/stlport.hpp +258 -0
  301. package/vendor/boost/config/include/boost/config/stdlib/vacpp.hpp +74 -0
  302. package/vendor/boost/config/include/boost/config/stdlib/xlcpp_zos.hpp +61 -0
  303. package/vendor/boost/config/include/boost/config/user.hpp +133 -0
  304. package/vendor/boost/config/include/boost/config/warning_disable.hpp +47 -0
  305. package/vendor/boost/config/include/boost/config/workaround.hpp +310 -0
  306. package/vendor/boost/config/include/boost/config.hpp +67 -0
  307. package/vendor/boost/config/include/boost/cstdint.hpp +556 -0
  308. package/vendor/boost/config/include/boost/cxx11_char_types.hpp +70 -0
  309. package/vendor/boost/config/include/boost/detail/workaround.hpp +10 -0
  310. package/vendor/boost/config/include/boost/limits.hpp +146 -0
  311. package/vendor/boost/config/include/boost/static_assert.hpp +179 -0
  312. package/vendor/boost/config/include/boost/version.hpp +32 -0
  313. package/vendor/boost/math/LICENSE +23 -0
  314. package/vendor/boost/math/README.md +184 -0
  315. package/vendor/boost/math/include/boost/cstdfloat.hpp +58 -0
  316. package/vendor/boost/math/include/boost/math/bindings/detail/big_digamma.hpp +297 -0
  317. package/vendor/boost/math/include/boost/math/bindings/detail/big_lanczos.hpp +777 -0
  318. package/vendor/boost/math/include/boost/math/bindings/mpfr.hpp +974 -0
  319. package/vendor/boost/math/include/boost/math/bindings/mpreal.hpp +921 -0
  320. package/vendor/boost/math/include/boost/math/bindings/rr.hpp +876 -0
  321. package/vendor/boost/math/include/boost/math/ccmath/abs.hpp +89 -0
  322. package/vendor/boost/math/include/boost/math/ccmath/ccmath.hpp +45 -0
  323. package/vendor/boost/math/include/boost/math/ccmath/ceil.hpp +78 -0
  324. package/vendor/boost/math/include/boost/math/ccmath/copysign.hpp +81 -0
  325. package/vendor/boost/math/include/boost/math/ccmath/detail/config.hpp +52 -0
  326. package/vendor/boost/math/include/boost/math/ccmath/detail/swap.hpp +21 -0
  327. package/vendor/boost/math/include/boost/math/ccmath/div.hpp +86 -0
  328. package/vendor/boost/math/include/boost/math/ccmath/fabs.hpp +41 -0
  329. package/vendor/boost/math/include/boost/math/ccmath/fdim.hpp +93 -0
  330. package/vendor/boost/math/include/boost/math/ccmath/floor.hpp +131 -0
  331. package/vendor/boost/math/include/boost/math/ccmath/fma.hpp +130 -0
  332. package/vendor/boost/math/include/boost/math/ccmath/fmax.hpp +89 -0
  333. package/vendor/boost/math/include/boost/math/ccmath/fmin.hpp +89 -0
  334. package/vendor/boost/math/include/boost/math/ccmath/fmod.hpp +114 -0
  335. package/vendor/boost/math/include/boost/math/ccmath/fpclassify.hpp +48 -0
  336. package/vendor/boost/math/include/boost/math/ccmath/frexp.hpp +101 -0
  337. package/vendor/boost/math/include/boost/math/ccmath/hypot.hpp +116 -0
  338. package/vendor/boost/math/include/boost/math/ccmath/ilogb.hpp +60 -0
  339. package/vendor/boost/math/include/boost/math/ccmath/isfinite.hpp +53 -0
  340. package/vendor/boost/math/include/boost/math/ccmath/isgreater.hpp +42 -0
  341. package/vendor/boost/math/include/boost/math/ccmath/isgreaterequal.hpp +42 -0
  342. package/vendor/boost/math/include/boost/math/ccmath/isinf.hpp +61 -0
  343. package/vendor/boost/math/include/boost/math/ccmath/isless.hpp +42 -0
  344. package/vendor/boost/math/include/boost/math/ccmath/islessequal.hpp +42 -0
  345. package/vendor/boost/math/include/boost/math/ccmath/isnan.hpp +42 -0
  346. package/vendor/boost/math/include/boost/math/ccmath/isnormal.hpp +47 -0
  347. package/vendor/boost/math/include/boost/math/ccmath/isunordered.hpp +35 -0
  348. package/vendor/boost/math/include/boost/math/ccmath/ldexp.hpp +81 -0
  349. package/vendor/boost/math/include/boost/math/ccmath/logb.hpp +86 -0
  350. package/vendor/boost/math/include/boost/math/ccmath/modf.hpp +79 -0
  351. package/vendor/boost/math/include/boost/math/ccmath/next.hpp +458 -0
  352. package/vendor/boost/math/include/boost/math/ccmath/remainder.hpp +106 -0
  353. package/vendor/boost/math/include/boost/math/ccmath/round.hpp +179 -0
  354. package/vendor/boost/math/include/boost/math/ccmath/scalbln.hpp +60 -0
  355. package/vendor/boost/math/include/boost/math/ccmath/scalbn.hpp +81 -0
  356. package/vendor/boost/math/include/boost/math/ccmath/signbit.hpp +218 -0
  357. package/vendor/boost/math/include/boost/math/ccmath/sqrt.hpp +80 -0
  358. package/vendor/boost/math/include/boost/math/ccmath/trunc.hpp +70 -0
  359. package/vendor/boost/math/include/boost/math/common_factor.hpp +23 -0
  360. package/vendor/boost/math/include/boost/math/common_factor_ct.hpp +34 -0
  361. package/vendor/boost/math/include/boost/math/common_factor_rt.hpp +30 -0
  362. package/vendor/boost/math/include/boost/math/complex/acos.hpp +245 -0
  363. package/vendor/boost/math/include/boost/math/complex/acosh.hpp +34 -0
  364. package/vendor/boost/math/include/boost/math/complex/asin.hpp +252 -0
  365. package/vendor/boost/math/include/boost/math/complex/asinh.hpp +32 -0
  366. package/vendor/boost/math/include/boost/math/complex/atan.hpp +36 -0
  367. package/vendor/boost/math/include/boost/math/complex/atanh.hpp +214 -0
  368. package/vendor/boost/math/include/boost/math/complex/details.hpp +68 -0
  369. package/vendor/boost/math/include/boost/math/complex/fabs.hpp +23 -0
  370. package/vendor/boost/math/include/boost/math/complex.hpp +32 -0
  371. package/vendor/boost/math/include/boost/math/concepts/distributions.hpp +497 -0
  372. package/vendor/boost/math/include/boost/math/concepts/real_concept.hpp +400 -0
  373. package/vendor/boost/math/include/boost/math/concepts/real_type_concept.hpp +119 -0
  374. package/vendor/boost/math/include/boost/math/concepts/std_real_concept.hpp +427 -0
  375. package/vendor/boost/math/include/boost/math/constants/calculate_constants.hpp +1117 -0
  376. package/vendor/boost/math/include/boost/math/constants/constants.hpp +360 -0
  377. package/vendor/boost/math/include/boost/math/constants/info.hpp +169 -0
  378. package/vendor/boost/math/include/boost/math/cstdfloat/cstdfloat_cmath.hpp +1012 -0
  379. package/vendor/boost/math/include/boost/math/cstdfloat/cstdfloat_complex.hpp +38 -0
  380. package/vendor/boost/math/include/boost/math/cstdfloat/cstdfloat_complex_std.hpp +813 -0
  381. package/vendor/boost/math/include/boost/math/cstdfloat/cstdfloat_iostream.hpp +822 -0
  382. package/vendor/boost/math/include/boost/math/cstdfloat/cstdfloat_limits.hpp +87 -0
  383. package/vendor/boost/math/include/boost/math/cstdfloat/cstdfloat_types.hpp +441 -0
  384. package/vendor/boost/math/include/boost/math/differentiation/autodiff.hpp +2061 -0
  385. package/vendor/boost/math/include/boost/math/differentiation/autodiff_cpp11.hpp +387 -0
  386. package/vendor/boost/math/include/boost/math/differentiation/autodiff_reverse.hpp +811 -0
  387. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_basic_operator_expressions.hpp +276 -0
  388. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_basic_ops_et.hpp +160 -0
  389. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_basic_ops_no_et.hpp +154 -0
  390. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_comparison_operator_overloads.hpp +167 -0
  391. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_erf_overloads.hpp +234 -0
  392. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp +258 -0
  393. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_helper_functions.hpp +18 -0
  394. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_memory_management.hpp +462 -0
  395. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_stl_et.hpp +275 -0
  396. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_stl_expressions.hpp +852 -0
  397. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_stl_no_et.hpp +266 -0
  398. package/vendor/boost/math/include/boost/math/differentiation/detail/reverse_mode_autodiff_utilities.hpp +51 -0
  399. package/vendor/boost/math/include/boost/math/differentiation/finite_difference.hpp +266 -0
  400. package/vendor/boost/math/include/boost/math/differentiation/lanczos_smoothing.hpp +591 -0
  401. package/vendor/boost/math/include/boost/math/distributions/arcsine.hpp +593 -0
  402. package/vendor/boost/math/include/boost/math/distributions/bernoulli.hpp +349 -0
  403. package/vendor/boost/math/include/boost/math/distributions/beta.hpp +584 -0
  404. package/vendor/boost/math/include/boost/math/distributions/binomial.hpp +729 -0
  405. package/vendor/boost/math/include/boost/math/distributions/cauchy.hpp +379 -0
  406. package/vendor/boost/math/include/boost/math/distributions/chi_squared.hpp +345 -0
  407. package/vendor/boost/math/include/boost/math/distributions/complement.hpp +198 -0
  408. package/vendor/boost/math/include/boost/math/distributions/detail/common_error_handling.hpp +228 -0
  409. package/vendor/boost/math/include/boost/math/distributions/detail/derived_accessors.hpp +190 -0
  410. package/vendor/boost/math/include/boost/math/distributions/detail/generic_mode.hpp +145 -0
  411. package/vendor/boost/math/include/boost/math/distributions/detail/generic_quantile.hpp +100 -0
  412. package/vendor/boost/math/include/boost/math/distributions/detail/hypergeometric_cdf.hpp +101 -0
  413. package/vendor/boost/math/include/boost/math/distributions/detail/hypergeometric_pdf.hpp +490 -0
  414. package/vendor/boost/math/include/boost/math/distributions/detail/hypergeometric_quantile.hpp +245 -0
  415. package/vendor/boost/math/include/boost/math/distributions/detail/inv_discrete_quantile.hpp +583 -0
  416. package/vendor/boost/math/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp +73 -0
  417. package/vendor/boost/math/include/boost/math/distributions/exponential.hpp +352 -0
  418. package/vendor/boost/math/include/boost/math/distributions/extreme_value.hpp +388 -0
  419. package/vendor/boost/math/include/boost/math/distributions/find_location.hpp +141 -0
  420. package/vendor/boost/math/include/boost/math/distributions/find_scale.hpp +200 -0
  421. package/vendor/boost/math/include/boost/math/distributions/fisher_f.hpp +393 -0
  422. package/vendor/boost/math/include/boost/math/distributions/fwd.hpp +171 -0
  423. package/vendor/boost/math/include/boost/math/distributions/gamma.hpp +396 -0
  424. package/vendor/boost/math/include/boost/math/distributions/geometric.hpp +571 -0
  425. package/vendor/boost/math/include/boost/math/distributions/holtsmark.hpp +2518 -0
  426. package/vendor/boost/math/include/boost/math/distributions/hyperexponential.hpp +641 -0
  427. package/vendor/boost/math/include/boost/math/distributions/hypergeometric.hpp +313 -0
  428. package/vendor/boost/math/include/boost/math/distributions/inverse_chi_squared.hpp +398 -0
  429. package/vendor/boost/math/include/boost/math/distributions/inverse_gamma.hpp +504 -0
  430. package/vendor/boost/math/include/boost/math/distributions/inverse_gaussian.hpp +566 -0
  431. package/vendor/boost/math/include/boost/math/distributions/kolmogorov_smirnov.hpp +511 -0
  432. package/vendor/boost/math/include/boost/math/distributions/landau.hpp +4642 -0
  433. package/vendor/boost/math/include/boost/math/distributions/laplace.hpp +494 -0
  434. package/vendor/boost/math/include/boost/math/distributions/logistic.hpp +377 -0
  435. package/vendor/boost/math/include/boost/math/distributions/lognormal.hpp +361 -0
  436. package/vendor/boost/math/include/boost/math/distributions/mapairy.hpp +4220 -0
  437. package/vendor/boost/math/include/boost/math/distributions/negative_binomial.hpp +609 -0
  438. package/vendor/boost/math/include/boost/math/distributions/non_central_beta.hpp +981 -0
  439. package/vendor/boost/math/include/boost/math/distributions/non_central_chi_squared.hpp +998 -0
  440. package/vendor/boost/math/include/boost/math/distributions/non_central_f.hpp +712 -0
  441. package/vendor/boost/math/include/boost/math/distributions/non_central_t.hpp +1324 -0
  442. package/vendor/boost/math/include/boost/math/distributions/normal.hpp +368 -0
  443. package/vendor/boost/math/include/boost/math/distributions/pareto.hpp +508 -0
  444. package/vendor/boost/math/include/boost/math/distributions/poisson.hpp +563 -0
  445. package/vendor/boost/math/include/boost/math/distributions/rayleigh.hpp +381 -0
  446. package/vendor/boost/math/include/boost/math/distributions/saspoint5.hpp +2796 -0
  447. package/vendor/boost/math/include/boost/math/distributions/skew_normal.hpp +760 -0
  448. package/vendor/boost/math/include/boost/math/distributions/students_t.hpp +721 -0
  449. package/vendor/boost/math/include/boost/math/distributions/triangular.hpp +548 -0
  450. package/vendor/boost/math/include/boost/math/distributions/uniform.hpp +398 -0
  451. package/vendor/boost/math/include/boost/math/distributions/weibull.hpp +487 -0
  452. package/vendor/boost/math/include/boost/math/distributions.hpp +58 -0
  453. package/vendor/boost/math/include/boost/math/filters/daubechies.hpp +99 -0
  454. package/vendor/boost/math/include/boost/math/interpolators/barycentric_rational.hpp +99 -0
  455. package/vendor/boost/math/include/boost/math/interpolators/bezier_polynomial.hpp +60 -0
  456. package/vendor/boost/math/include/boost/math/interpolators/bilinear_uniform.hpp +54 -0
  457. package/vendor/boost/math/include/boost/math/interpolators/cardinal_cubic_b_spline.hpp +87 -0
  458. package/vendor/boost/math/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp +57 -0
  459. package/vendor/boost/math/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp +62 -0
  460. package/vendor/boost/math/include/boost/math/interpolators/cardinal_trigonometric.hpp +58 -0
  461. package/vendor/boost/math/include/boost/math/interpolators/catmull_rom.hpp +310 -0
  462. package/vendor/boost/math/include/boost/math/interpolators/cubic_b_spline.hpp +90 -0
  463. package/vendor/boost/math/include/boost/math/interpolators/cubic_hermite.hpp +142 -0
  464. package/vendor/boost/math/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp +215 -0
  465. package/vendor/boost/math/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp +167 -0
  466. package/vendor/boost/math/include/boost/math/interpolators/detail/bilinear_uniform_detail.hpp +137 -0
  467. package/vendor/boost/math/include/boost/math/interpolators/detail/cardinal_cubic_b_spline_detail.hpp +331 -0
  468. package/vendor/boost/math/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp +208 -0
  469. package/vendor/boost/math/include/boost/math/interpolators/detail/cardinal_quintic_b_spline_detail.hpp +241 -0
  470. package/vendor/boost/math/include/boost/math/interpolators/detail/cardinal_trigonometric_detail.hpp +684 -0
  471. package/vendor/boost/math/include/boost/math/interpolators/detail/cubic_b_spline_detail.hpp +330 -0
  472. package/vendor/boost/math/include/boost/math/interpolators/detail/cubic_hermite_detail.hpp +439 -0
  473. package/vendor/boost/math/include/boost/math/interpolators/detail/quintic_hermite_detail.hpp +586 -0
  474. package/vendor/boost/math/include/boost/math/interpolators/detail/septic_hermite_detail.hpp +653 -0
  475. package/vendor/boost/math/include/boost/math/interpolators/detail/vector_barycentric_rational_detail.hpp +196 -0
  476. package/vendor/boost/math/include/boost/math/interpolators/detail/whittaker_shannon_detail.hpp +128 -0
  477. package/vendor/boost/math/include/boost/math/interpolators/makima.hpp +178 -0
  478. package/vendor/boost/math/include/boost/math/interpolators/pchip.hpp +136 -0
  479. package/vendor/boost/math/include/boost/math/interpolators/quintic_hermite.hpp +143 -0
  480. package/vendor/boost/math/include/boost/math/interpolators/septic_hermite.hpp +147 -0
  481. package/vendor/boost/math/include/boost/math/interpolators/vector_barycentric_rational.hpp +82 -0
  482. package/vendor/boost/math/include/boost/math/interpolators/whittaker_shannon.hpp +47 -0
  483. package/vendor/boost/math/include/boost/math/octonion.hpp +4254 -0
  484. package/vendor/boost/math/include/boost/math/optimization/cma_es.hpp +392 -0
  485. package/vendor/boost/math/include/boost/math/optimization/detail/common.hpp +200 -0
  486. package/vendor/boost/math/include/boost/math/optimization/detail/differentiable_opt_utilties.hpp +157 -0
  487. package/vendor/boost/math/include/boost/math/optimization/detail/gradient_opt_base.hpp +92 -0
  488. package/vendor/boost/math/include/boost/math/optimization/detail/line_search_policies.hpp +206 -0
  489. package/vendor/boost/math/include/boost/math/optimization/detail/rdiff_optimization_policies.hpp +134 -0
  490. package/vendor/boost/math/include/boost/math/optimization/differential_evolution.hpp +236 -0
  491. package/vendor/boost/math/include/boost/math/optimization/gradient_descent.hpp +202 -0
  492. package/vendor/boost/math/include/boost/math/optimization/gradient_optimizers.hpp +18 -0
  493. package/vendor/boost/math/include/boost/math/optimization/jso.hpp +465 -0
  494. package/vendor/boost/math/include/boost/math/optimization/lbfgs.hpp +382 -0
  495. package/vendor/boost/math/include/boost/math/optimization/minimizer.hpp +336 -0
  496. package/vendor/boost/math/include/boost/math/optimization/nesterov.hpp +208 -0
  497. package/vendor/boost/math/include/boost/math/optimization/random_search.hpp +145 -0
  498. package/vendor/boost/math/include/boost/math/policies/error_handling.hpp +1062 -0
  499. package/vendor/boost/math/include/boost/math/policies/policy.hpp +1034 -0
  500. package/vendor/boost/math/include/boost/math/quadrature/detail/exp_sinh_detail.hpp +2002 -0
  501. package/vendor/boost/math/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp +692 -0
  502. package/vendor/boost/math/include/boost/math/quadrature/detail/sinh_sinh_detail.hpp +1353 -0
  503. package/vendor/boost/math/include/boost/math/quadrature/detail/tanh_sinh_detail.hpp +879 -0
  504. package/vendor/boost/math/include/boost/math/quadrature/exp_sinh.hpp +180 -0
  505. package/vendor/boost/math/include/boost/math/quadrature/gauss.hpp +904 -0
  506. package/vendor/boost/math/include/boost/math/quadrature/gauss_kronrod.hpp +1317 -0
  507. package/vendor/boost/math/include/boost/math/quadrature/naive_monte_carlo.hpp +469 -0
  508. package/vendor/boost/math/include/boost/math/quadrature/ooura_fourier_integrals.hpp +68 -0
  509. package/vendor/boost/math/include/boost/math/quadrature/sinh_sinh.hpp +72 -0
  510. package/vendor/boost/math/include/boost/math/quadrature/tanh_sinh.hpp +289 -0
  511. package/vendor/boost/math/include/boost/math/quadrature/trapezoidal.hpp +125 -0
  512. package/vendor/boost/math/include/boost/math/quadrature/wavelet_transforms.hpp +47 -0
  513. package/vendor/boost/math/include/boost/math/quaternion.hpp +1190 -0
  514. package/vendor/boost/math/include/boost/math/special_functions/acosh.hpp +102 -0
  515. package/vendor/boost/math/include/boost/math/special_functions/airy.hpp +475 -0
  516. package/vendor/boost/math/include/boost/math/special_functions/asinh.hpp +110 -0
  517. package/vendor/boost/math/include/boost/math/special_functions/atanh.hpp +116 -0
  518. package/vendor/boost/math/include/boost/math/special_functions/bernoulli.hpp +149 -0
  519. package/vendor/boost/math/include/boost/math/special_functions/bessel.hpp +795 -0
  520. package/vendor/boost/math/include/boost/math/special_functions/bessel_iterators.hpp +187 -0
  521. package/vendor/boost/math/include/boost/math/special_functions/bessel_prime.hpp +343 -0
  522. package/vendor/boost/math/include/boost/math/special_functions/beta.hpp +1870 -0
  523. package/vendor/boost/math/include/boost/math/special_functions/binomial.hpp +87 -0
  524. package/vendor/boost/math/include/boost/math/special_functions/cardinal_b_spline.hpp +218 -0
  525. package/vendor/boost/math/include/boost/math/special_functions/cbrt.hpp +215 -0
  526. package/vendor/boost/math/include/boost/math/special_functions/chebyshev.hpp +314 -0
  527. package/vendor/boost/math/include/boost/math/special_functions/chebyshev_transform.hpp +237 -0
  528. package/vendor/boost/math/include/boost/math/special_functions/cos_pi.hpp +128 -0
  529. package/vendor/boost/math/include/boost/math/special_functions/daubechies_scaling.hpp +491 -0
  530. package/vendor/boost/math/include/boost/math/special_functions/daubechies_wavelet.hpp +266 -0
  531. package/vendor/boost/math/include/boost/math/special_functions/detail/airy_ai_bi_zero.hpp +222 -0
  532. package/vendor/boost/math/include/boost/math/special_functions/detail/bernoulli_details.hpp +629 -0
  533. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp +107 -0
  534. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_i0.hpp +550 -0
  535. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_i1.hpp +556 -0
  536. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_ik.hpp +447 -0
  537. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_j0.hpp +192 -0
  538. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_j1.hpp +179 -0
  539. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_jn.hpp +127 -0
  540. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_jy.hpp +603 -0
  541. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_jy_asym.hpp +230 -0
  542. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_jy_derivatives_asym.hpp +141 -0
  543. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_jy_derivatives_series.hpp +219 -0
  544. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_jy_series.hpp +267 -0
  545. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_jy_zero.hpp +643 -0
  546. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_k0.hpp +485 -0
  547. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_k1.hpp +526 -0
  548. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_kn.hpp +91 -0
  549. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_y0.hpp +205 -0
  550. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_y1.hpp +183 -0
  551. package/vendor/boost/math/include/boost/math/special_functions/detail/bessel_yn.hpp +113 -0
  552. package/vendor/boost/math/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp +244 -0
  553. package/vendor/boost/math/include/boost/math/special_functions/detail/erf_inv.hpp +559 -0
  554. package/vendor/boost/math/include/boost/math/special_functions/detail/fp_traits.hpp +562 -0
  555. package/vendor/boost/math/include/boost/math/special_functions/detail/gamma_inva.hpp +241 -0
  556. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_0F1_bessel.hpp +46 -0
  557. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_addition_theorems_on_z.hpp +293 -0
  558. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_bessel.hpp +768 -0
  559. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_by_ratios.hpp +678 -0
  560. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_cf.hpp +50 -0
  561. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_large_a.hpp +35 -0
  562. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_large_abz.hpp +492 -0
  563. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_negative_b_regions.hpp +521 -0
  564. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_recurrence.hpp +522 -0
  565. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_scaled_series.hpp +60 -0
  566. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_1F1_small_a_negative_b_by_ratio.hpp +70 -0
  567. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_asym.hpp +179 -0
  568. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_cf.hpp +228 -0
  569. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_pFq_checked_series.hpp +687 -0
  570. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_pade.hpp +131 -0
  571. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_rational.hpp +167 -0
  572. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_separated_series.hpp +50 -0
  573. package/vendor/boost/math/include/boost/math/special_functions/detail/hypergeometric_series.hpp +434 -0
  574. package/vendor/boost/math/include/boost/math/special_functions/detail/ibeta_inv_ab.hpp +331 -0
  575. package/vendor/boost/math/include/boost/math/special_functions/detail/ibeta_inverse.hpp +1122 -0
  576. package/vendor/boost/math/include/boost/math/special_functions/detail/iconv.hpp +43 -0
  577. package/vendor/boost/math/include/boost/math/special_functions/detail/igamma_inverse.hpp +587 -0
  578. package/vendor/boost/math/include/boost/math/special_functions/detail/igamma_large.hpp +823 -0
  579. package/vendor/boost/math/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp +162 -0
  580. package/vendor/boost/math/include/boost/math/special_functions/detail/lanczos_sse2.hpp +238 -0
  581. package/vendor/boost/math/include/boost/math/special_functions/detail/lgamma_small.hpp +569 -0
  582. package/vendor/boost/math/include/boost/math/special_functions/detail/polygamma.hpp +538 -0
  583. package/vendor/boost/math/include/boost/math/special_functions/detail/round_fwd.hpp +87 -0
  584. package/vendor/boost/math/include/boost/math/special_functions/detail/t_distribution_inv.hpp +567 -0
  585. package/vendor/boost/math/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp +1305 -0
  586. package/vendor/boost/math/include/boost/math/special_functions/detail/unchecked_factorial.hpp +1727 -0
  587. package/vendor/boost/math/include/boost/math/special_functions/digamma.hpp +631 -0
  588. package/vendor/boost/math/include/boost/math/special_functions/ellint_1.hpp +815 -0
  589. package/vendor/boost/math/include/boost/math/special_functions/ellint_2.hpp +756 -0
  590. package/vendor/boost/math/include/boost/math/special_functions/ellint_3.hpp +374 -0
  591. package/vendor/boost/math/include/boost/math/special_functions/ellint_d.hpp +183 -0
  592. package/vendor/boost/math/include/boost/math/special_functions/ellint_rc.hpp +112 -0
  593. package/vendor/boost/math/include/boost/math/special_functions/ellint_rd.hpp +207 -0
  594. package/vendor/boost/math/include/boost/math/special_functions/ellint_rf.hpp +169 -0
  595. package/vendor/boost/math/include/boost/math/special_functions/ellint_rg.hpp +130 -0
  596. package/vendor/boost/math/include/boost/math/special_functions/ellint_rj.hpp +299 -0
  597. package/vendor/boost/math/include/boost/math/special_functions/erf.hpp +1334 -0
  598. package/vendor/boost/math/include/boost/math/special_functions/expint.hpp +1614 -0
  599. package/vendor/boost/math/include/boost/math/special_functions/expm1.hpp +416 -0
  600. package/vendor/boost/math/include/boost/math/special_functions/factorials.hpp +276 -0
  601. package/vendor/boost/math/include/boost/math/special_functions/fibonacci.hpp +92 -0
  602. package/vendor/boost/math/include/boost/math/special_functions/fourier_transform_daubechies.hpp +248 -0
  603. package/vendor/boost/math/include/boost/math/special_functions/fpclassify.hpp +797 -0
  604. package/vendor/boost/math/include/boost/math/special_functions/gamma.hpp +2628 -0
  605. package/vendor/boost/math/include/boost/math/special_functions/gegenbauer.hpp +84 -0
  606. package/vendor/boost/math/include/boost/math/special_functions/hankel.hpp +186 -0
  607. package/vendor/boost/math/include/boost/math/special_functions/hermite.hpp +79 -0
  608. package/vendor/boost/math/include/boost/math/special_functions/heuman_lambda.hpp +97 -0
  609. package/vendor/boost/math/include/boost/math/special_functions/hypergeometric_0F1.hpp +116 -0
  610. package/vendor/boost/math/include/boost/math/special_functions/hypergeometric_1F0.hpp +69 -0
  611. package/vendor/boost/math/include/boost/math/special_functions/hypergeometric_1F1.hpp +822 -0
  612. package/vendor/boost/math/include/boost/math/special_functions/hypergeometric_2F0.hpp +163 -0
  613. package/vendor/boost/math/include/boost/math/special_functions/hypergeometric_pFq.hpp +205 -0
  614. package/vendor/boost/math/include/boost/math/special_functions/hypot.hpp +148 -0
  615. package/vendor/boost/math/include/boost/math/special_functions/jacobi.hpp +69 -0
  616. package/vendor/boost/math/include/boost/math/special_functions/jacobi_elliptic.hpp +319 -0
  617. package/vendor/boost/math/include/boost/math/special_functions/jacobi_theta.hpp +802 -0
  618. package/vendor/boost/math/include/boost/math/special_functions/jacobi_zeta.hpp +83 -0
  619. package/vendor/boost/math/include/boost/math/special_functions/laguerre.hpp +139 -0
  620. package/vendor/boost/math/include/boost/math/special_functions/lambert_w.hpp +2171 -0
  621. package/vendor/boost/math/include/boost/math/special_functions/lanczos.hpp +2760 -0
  622. package/vendor/boost/math/include/boost/math/special_functions/legendre.hpp +380 -0
  623. package/vendor/boost/math/include/boost/math/special_functions/legendre_stieltjes.hpp +234 -0
  624. package/vendor/boost/math/include/boost/math/special_functions/log1p.hpp +417 -0
  625. package/vendor/boost/math/include/boost/math/special_functions/logaddexp.hpp +41 -0
  626. package/vendor/boost/math/include/boost/math/special_functions/logistic_sigmoid.hpp +46 -0
  627. package/vendor/boost/math/include/boost/math/special_functions/logit.hpp +56 -0
  628. package/vendor/boost/math/include/boost/math/special_functions/logsumexp.hpp +60 -0
  629. package/vendor/boost/math/include/boost/math/special_functions/math_fwd.hpp +1927 -0
  630. package/vendor/boost/math/include/boost/math/special_functions/modf.hpp +74 -0
  631. package/vendor/boost/math/include/boost/math/special_functions/next.hpp +886 -0
  632. package/vendor/boost/math/include/boost/math/special_functions/nonfinite_num_facets.hpp +588 -0
  633. package/vendor/boost/math/include/boost/math/special_functions/owens_t.hpp +1067 -0
  634. package/vendor/boost/math/include/boost/math/special_functions/polygamma.hpp +83 -0
  635. package/vendor/boost/math/include/boost/math/special_functions/pow.hpp +144 -0
  636. package/vendor/boost/math/include/boost/math/special_functions/powm1.hpp +101 -0
  637. package/vendor/boost/math/include/boost/math/special_functions/prime.hpp +2433 -0
  638. package/vendor/boost/math/include/boost/math/special_functions/relative_difference.hpp +134 -0
  639. package/vendor/boost/math/include/boost/math/special_functions/round.hpp +353 -0
  640. package/vendor/boost/math/include/boost/math/special_functions/rsqrt.hpp +52 -0
  641. package/vendor/boost/math/include/boost/math/special_functions/sign.hpp +241 -0
  642. package/vendor/boost/math/include/boost/math/special_functions/sin_pi.hpp +135 -0
  643. package/vendor/boost/math/include/boost/math/special_functions/sinc.hpp +123 -0
  644. package/vendor/boost/math/include/boost/math/special_functions/sinhc.hpp +142 -0
  645. package/vendor/boost/math/include/boost/math/special_functions/spherical_harmonic.hpp +205 -0
  646. package/vendor/boost/math/include/boost/math/special_functions/sqrt1pm1.hpp +49 -0
  647. package/vendor/boost/math/include/boost/math/special_functions/trigamma.hpp +448 -0
  648. package/vendor/boost/math/include/boost/math/special_functions/trunc.hpp +385 -0
  649. package/vendor/boost/math/include/boost/math/special_functions/ulp.hpp +102 -0
  650. package/vendor/boost/math/include/boost/math/special_functions/zeta.hpp +1081 -0
  651. package/vendor/boost/math/include/boost/math/special_functions.hpp +86 -0
  652. package/vendor/boost/math/include/boost/math/statistics/anderson_darling.hpp +112 -0
  653. package/vendor/boost/math/include/boost/math/statistics/bivariate_statistics.hpp +470 -0
  654. package/vendor/boost/math/include/boost/math/statistics/chatterjee_correlation.hpp +159 -0
  655. package/vendor/boost/math/include/boost/math/statistics/detail/rank.hpp +140 -0
  656. package/vendor/boost/math/include/boost/math/statistics/detail/single_pass.hpp +401 -0
  657. package/vendor/boost/math/include/boost/math/statistics/linear_regression.hpp +133 -0
  658. package/vendor/boost/math/include/boost/math/statistics/ljung_box.hpp +70 -0
  659. package/vendor/boost/math/include/boost/math/statistics/runs_test.hpp +121 -0
  660. package/vendor/boost/math/include/boost/math/statistics/signal_statistics.hpp +350 -0
  661. package/vendor/boost/math/include/boost/math/statistics/t_test.hpp +275 -0
  662. package/vendor/boost/math/include/boost/math/statistics/univariate_statistics.hpp +1184 -0
  663. package/vendor/boost/math/include/boost/math/statistics/z_test.hpp +161 -0
  664. package/vendor/boost/math/include/boost/math/tools/agm.hpp +47 -0
  665. package/vendor/boost/math/include/boost/math/tools/array.hpp +41 -0
  666. package/vendor/boost/math/include/boost/math/tools/assert.hpp +49 -0
  667. package/vendor/boost/math/include/boost/math/tools/atomic.hpp +50 -0
  668. package/vendor/boost/math/include/boost/math/tools/big_constant.hpp +110 -0
  669. package/vendor/boost/math/include/boost/math/tools/bivariate_statistics.hpp +96 -0
  670. package/vendor/boost/math/include/boost/math/tools/centered_continued_fraction.hpp +173 -0
  671. package/vendor/boost/math/include/boost/math/tools/cohen_acceleration.hpp +51 -0
  672. package/vendor/boost/math/include/boost/math/tools/color_maps.hpp +1943 -0
  673. package/vendor/boost/math/include/boost/math/tools/complex.hpp +115 -0
  674. package/vendor/boost/math/include/boost/math/tools/concepts.hpp +24 -0
  675. package/vendor/boost/math/include/boost/math/tools/condition_numbers.hpp +144 -0
  676. package/vendor/boost/math/include/boost/math/tools/config.hpp +856 -0
  677. package/vendor/boost/math/include/boost/math/tools/convert_from_string.hpp +85 -0
  678. package/vendor/boost/math/include/boost/math/tools/cstdint.hpp +107 -0
  679. package/vendor/boost/math/include/boost/math/tools/cubic_roots.hpp +198 -0
  680. package/vendor/boost/math/include/boost/math/tools/cxx03_warn.hpp +95 -0
  681. package/vendor/boost/math/include/boost/math/tools/detail/is_const_iterable.hpp +38 -0
  682. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_10.hpp +84 -0
  683. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_11.hpp +90 -0
  684. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_12.hpp +96 -0
  685. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_13.hpp +102 -0
  686. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_14.hpp +108 -0
  687. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_15.hpp +114 -0
  688. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_16.hpp +120 -0
  689. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_17.hpp +126 -0
  690. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_18.hpp +132 -0
  691. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_19.hpp +138 -0
  692. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_2.hpp +36 -0
  693. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_20.hpp +144 -0
  694. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_3.hpp +42 -0
  695. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_4.hpp +48 -0
  696. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_5.hpp +54 -0
  697. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_6.hpp +60 -0
  698. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_7.hpp +66 -0
  699. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_8.hpp +72 -0
  700. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner1_9.hpp +78 -0
  701. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_10.hpp +90 -0
  702. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_11.hpp +97 -0
  703. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_12.hpp +104 -0
  704. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_13.hpp +111 -0
  705. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_14.hpp +118 -0
  706. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_15.hpp +125 -0
  707. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_16.hpp +132 -0
  708. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_17.hpp +139 -0
  709. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_18.hpp +146 -0
  710. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_19.hpp +153 -0
  711. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_2.hpp +48 -0
  712. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_20.hpp +160 -0
  713. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_3.hpp +48 -0
  714. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_4.hpp +48 -0
  715. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_5.hpp +55 -0
  716. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_6.hpp +62 -0
  717. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_7.hpp +69 -0
  718. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_8.hpp +76 -0
  719. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner2_9.hpp +83 -0
  720. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_10.hpp +156 -0
  721. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_11.hpp +181 -0
  722. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_12.hpp +208 -0
  723. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_13.hpp +237 -0
  724. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_14.hpp +268 -0
  725. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_15.hpp +301 -0
  726. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_16.hpp +336 -0
  727. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_17.hpp +373 -0
  728. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_18.hpp +412 -0
  729. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_19.hpp +453 -0
  730. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_2.hpp +48 -0
  731. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_20.hpp +496 -0
  732. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_3.hpp +48 -0
  733. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_4.hpp +48 -0
  734. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_5.hpp +61 -0
  735. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_6.hpp +76 -0
  736. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_7.hpp +93 -0
  737. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_8.hpp +112 -0
  738. package/vendor/boost/math/include/boost/math/tools/detail/polynomial_horner3_9.hpp +133 -0
  739. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_10.hpp +138 -0
  740. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_11.hpp +150 -0
  741. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_12.hpp +162 -0
  742. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_13.hpp +174 -0
  743. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_14.hpp +186 -0
  744. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_15.hpp +198 -0
  745. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_16.hpp +210 -0
  746. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_17.hpp +222 -0
  747. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_18.hpp +234 -0
  748. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_19.hpp +246 -0
  749. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_2.hpp +42 -0
  750. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_20.hpp +258 -0
  751. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_3.hpp +54 -0
  752. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_4.hpp +66 -0
  753. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_5.hpp +78 -0
  754. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_6.hpp +90 -0
  755. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_7.hpp +102 -0
  756. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_8.hpp +114 -0
  757. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner1_9.hpp +126 -0
  758. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_10.hpp +144 -0
  759. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_11.hpp +160 -0
  760. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_12.hpp +176 -0
  761. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_13.hpp +192 -0
  762. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_14.hpp +208 -0
  763. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_15.hpp +224 -0
  764. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_16.hpp +240 -0
  765. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_17.hpp +256 -0
  766. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_18.hpp +272 -0
  767. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_19.hpp +288 -0
  768. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_2.hpp +48 -0
  769. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_20.hpp +304 -0
  770. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_3.hpp +48 -0
  771. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_4.hpp +48 -0
  772. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_5.hpp +64 -0
  773. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_6.hpp +80 -0
  774. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_7.hpp +96 -0
  775. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_8.hpp +112 -0
  776. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner2_9.hpp +128 -0
  777. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_10.hpp +396 -0
  778. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_11.hpp +482 -0
  779. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_12.hpp +576 -0
  780. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_13.hpp +678 -0
  781. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_14.hpp +788 -0
  782. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_15.hpp +906 -0
  783. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_16.hpp +1032 -0
  784. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_17.hpp +1166 -0
  785. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_18.hpp +1308 -0
  786. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_19.hpp +1458 -0
  787. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_2.hpp +48 -0
  788. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_20.hpp +1616 -0
  789. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_3.hpp +48 -0
  790. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_4.hpp +48 -0
  791. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_5.hpp +86 -0
  792. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_6.hpp +132 -0
  793. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_7.hpp +186 -0
  794. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_8.hpp +248 -0
  795. package/vendor/boost/math/include/boost/math/tools/detail/rational_horner3_9.hpp +318 -0
  796. package/vendor/boost/math/include/boost/math/tools/engel_expansion.hpp +124 -0
  797. package/vendor/boost/math/include/boost/math/tools/estrin.hpp +72 -0
  798. package/vendor/boost/math/include/boost/math/tools/fraction.hpp +354 -0
  799. package/vendor/boost/math/include/boost/math/tools/header_deprecated.hpp +27 -0
  800. package/vendor/boost/math/include/boost/math/tools/is_constant_evaluated.hpp +51 -0
  801. package/vendor/boost/math/include/boost/math/tools/is_detected.hpp +56 -0
  802. package/vendor/boost/math/include/boost/math/tools/is_standalone.hpp +18 -0
  803. package/vendor/boost/math/include/boost/math/tools/luroth_expansion.hpp +147 -0
  804. package/vendor/boost/math/include/boost/math/tools/minima.hpp +164 -0
  805. package/vendor/boost/math/include/boost/math/tools/mp.hpp +423 -0
  806. package/vendor/boost/math/include/boost/math/tools/norms.hpp +638 -0
  807. package/vendor/boost/math/include/boost/math/tools/nothrow.hpp +27 -0
  808. package/vendor/boost/math/include/boost/math/tools/numeric_limits.hpp +888 -0
  809. package/vendor/boost/math/include/boost/math/tools/numerical_differentiation.hpp +12 -0
  810. package/vendor/boost/math/include/boost/math/tools/polynomial.hpp +862 -0
  811. package/vendor/boost/math/include/boost/math/tools/polynomial_gcd.hpp +268 -0
  812. package/vendor/boost/math/include/boost/math/tools/precision.hpp +418 -0
  813. package/vendor/boost/math/include/boost/math/tools/promotion.hpp +135 -0
  814. package/vendor/boost/math/include/boost/math/tools/quartic_roots.hpp +157 -0
  815. package/vendor/boost/math/include/boost/math/tools/random_vector.hpp +101 -0
  816. package/vendor/boost/math/include/boost/math/tools/rational.hpp +346 -0
  817. package/vendor/boost/math/include/boost/math/tools/real_cast.hpp +31 -0
  818. package/vendor/boost/math/include/boost/math/tools/recurrence.hpp +330 -0
  819. package/vendor/boost/math/include/boost/math/tools/roots.hpp +1072 -0
  820. package/vendor/boost/math/include/boost/math/tools/series.hpp +221 -0
  821. package/vendor/boost/math/include/boost/math/tools/signal_statistics.hpp +353 -0
  822. package/vendor/boost/math/include/boost/math/tools/simple_continued_fraction.hpp +177 -0
  823. package/vendor/boost/math/include/boost/math/tools/stats.hpp +87 -0
  824. package/vendor/boost/math/include/boost/math/tools/test_value.hpp +143 -0
  825. package/vendor/boost/math/include/boost/math/tools/throw_exception.hpp +43 -0
  826. package/vendor/boost/math/include/boost/math/tools/toms748_solve.hpp +636 -0
  827. package/vendor/boost/math/include/boost/math/tools/traits.hpp +140 -0
  828. package/vendor/boost/math/include/boost/math/tools/tuple.hpp +88 -0
  829. package/vendor/boost/math/include/boost/math/tools/type_traits.hpp +489 -0
  830. package/vendor/boost/math/include/boost/math/tools/ulps_plot.hpp +598 -0
  831. package/vendor/boost/math/include/boost/math/tools/univariate_statistics.hpp +437 -0
  832. package/vendor/boost/math/include/boost/math/tools/user.hpp +105 -0
  833. package/vendor/boost/math/include/boost/math/tools/utility.hpp +69 -0
  834. package/vendor/boost/math/include/boost/math/tools/workaround.hpp +42 -0
  835. package/vendor/boost/math/include/boost/math/tr1.hpp +1121 -0
  836. package/vendor/boost/math/include/boost/math/tr1_c_macros.ipp +810 -0
  837. package/vendor/boost/math/include/boost/math_fwd.hpp +42 -0
  838. package/vendor/boost/multiprecision/LICENSE +23 -0
  839. package/vendor/boost/multiprecision/README.md +168 -0
  840. package/vendor/boost/multiprecision/include/boost/config/abi/borland_prefix.hpp +27 -0
  841. package/vendor/boost/multiprecision/include/boost/config/abi/borland_suffix.hpp +12 -0
  842. package/vendor/boost/multiprecision/include/boost/config/abi/msvc_prefix.hpp +22 -0
  843. package/vendor/boost/multiprecision/include/boost/config/abi/msvc_suffix.hpp +8 -0
  844. package/vendor/boost/multiprecision/include/boost/config/abi_prefix.hpp +25 -0
  845. package/vendor/boost/multiprecision/include/boost/config/abi_suffix.hpp +25 -0
  846. package/vendor/boost/multiprecision/include/boost/config/assert_cxx03.hpp +211 -0
  847. package/vendor/boost/multiprecision/include/boost/config/assert_cxx11.hpp +212 -0
  848. package/vendor/boost/multiprecision/include/boost/config/assert_cxx14.hpp +47 -0
  849. package/vendor/boost/multiprecision/include/boost/config/assert_cxx17.hpp +65 -0
  850. package/vendor/boost/multiprecision/include/boost/config/assert_cxx20.hpp +59 -0
  851. package/vendor/boost/multiprecision/include/boost/config/assert_cxx23.hpp +41 -0
  852. package/vendor/boost/multiprecision/include/boost/config/assert_cxx98.hpp +23 -0
  853. package/vendor/boost/multiprecision/include/boost/config/auto_link.hpp +530 -0
  854. package/vendor/boost/multiprecision/include/boost/config/compiler/borland.hpp +342 -0
  855. package/vendor/boost/multiprecision/include/boost/config/compiler/clang.hpp +370 -0
  856. package/vendor/boost/multiprecision/include/boost/config/compiler/clang_version.hpp +98 -0
  857. package/vendor/boost/multiprecision/include/boost/config/compiler/codegear.hpp +389 -0
  858. package/vendor/boost/multiprecision/include/boost/config/compiler/comeau.hpp +59 -0
  859. package/vendor/boost/multiprecision/include/boost/config/compiler/common_edg.hpp +185 -0
  860. package/vendor/boost/multiprecision/include/boost/config/compiler/compaq_cxx.hpp +19 -0
  861. package/vendor/boost/multiprecision/include/boost/config/compiler/cray.hpp +446 -0
  862. package/vendor/boost/multiprecision/include/boost/config/compiler/diab.hpp +26 -0
  863. package/vendor/boost/multiprecision/include/boost/config/compiler/digitalmars.hpp +146 -0
  864. package/vendor/boost/multiprecision/include/boost/config/compiler/gcc.hpp +386 -0
  865. package/vendor/boost/multiprecision/include/boost/config/compiler/gcc_xml.hpp +115 -0
  866. package/vendor/boost/multiprecision/include/boost/config/compiler/greenhills.hpp +28 -0
  867. package/vendor/boost/multiprecision/include/boost/config/compiler/hp_acc.hpp +153 -0
  868. package/vendor/boost/multiprecision/include/boost/config/compiler/intel.hpp +577 -0
  869. package/vendor/boost/multiprecision/include/boost/config/compiler/kai.hpp +33 -0
  870. package/vendor/boost/multiprecision/include/boost/config/compiler/metrowerks.hpp +201 -0
  871. package/vendor/boost/multiprecision/include/boost/config/compiler/mpw.hpp +143 -0
  872. package/vendor/boost/multiprecision/include/boost/config/compiler/nvcc.hpp +64 -0
  873. package/vendor/boost/multiprecision/include/boost/config/compiler/pathscale.hpp +141 -0
  874. package/vendor/boost/multiprecision/include/boost/config/compiler/pgi.hpp +23 -0
  875. package/vendor/boost/multiprecision/include/boost/config/compiler/sgi_mipspro.hpp +29 -0
  876. package/vendor/boost/multiprecision/include/boost/config/compiler/sunpro_cc.hpp +225 -0
  877. package/vendor/boost/multiprecision/include/boost/config/compiler/vacpp.hpp +189 -0
  878. package/vendor/boost/multiprecision/include/boost/config/compiler/visualc.hpp +400 -0
  879. package/vendor/boost/multiprecision/include/boost/config/compiler/xlcpp.hpp +303 -0
  880. package/vendor/boost/multiprecision/include/boost/config/compiler/xlcpp_zos.hpp +174 -0
  881. package/vendor/boost/multiprecision/include/boost/config/detail/cxx_composite.hpp +218 -0
  882. package/vendor/boost/multiprecision/include/boost/config/detail/posix_features.hpp +95 -0
  883. package/vendor/boost/multiprecision/include/boost/config/detail/select_compiler_config.hpp +157 -0
  884. package/vendor/boost/multiprecision/include/boost/config/detail/select_platform_config.hpp +147 -0
  885. package/vendor/boost/multiprecision/include/boost/config/detail/select_stdlib_config.hpp +121 -0
  886. package/vendor/boost/multiprecision/include/boost/config/detail/suffix.hpp +1334 -0
  887. package/vendor/boost/multiprecision/include/boost/config/header_deprecated.hpp +26 -0
  888. package/vendor/boost/multiprecision/include/boost/config/helper_macros.hpp +37 -0
  889. package/vendor/boost/multiprecision/include/boost/config/no_tr1/cmath.hpp +28 -0
  890. package/vendor/boost/multiprecision/include/boost/config/no_tr1/complex.hpp +28 -0
  891. package/vendor/boost/multiprecision/include/boost/config/no_tr1/functional.hpp +28 -0
  892. package/vendor/boost/multiprecision/include/boost/config/no_tr1/memory.hpp +28 -0
  893. package/vendor/boost/multiprecision/include/boost/config/no_tr1/utility.hpp +28 -0
  894. package/vendor/boost/multiprecision/include/boost/config/platform/aix.hpp +33 -0
  895. package/vendor/boost/multiprecision/include/boost/config/platform/amigaos.hpp +15 -0
  896. package/vendor/boost/multiprecision/include/boost/config/platform/beos.hpp +26 -0
  897. package/vendor/boost/multiprecision/include/boost/config/platform/bsd.hpp +83 -0
  898. package/vendor/boost/multiprecision/include/boost/config/platform/cloudabi.hpp +18 -0
  899. package/vendor/boost/multiprecision/include/boost/config/platform/cray.hpp +18 -0
  900. package/vendor/boost/multiprecision/include/boost/config/platform/cygwin.hpp +71 -0
  901. package/vendor/boost/multiprecision/include/boost/config/platform/haiku.hpp +31 -0
  902. package/vendor/boost/multiprecision/include/boost/config/platform/hpux.hpp +87 -0
  903. package/vendor/boost/multiprecision/include/boost/config/platform/irix.hpp +31 -0
  904. package/vendor/boost/multiprecision/include/boost/config/platform/linux.hpp +106 -0
  905. package/vendor/boost/multiprecision/include/boost/config/platform/macos.hpp +87 -0
  906. package/vendor/boost/multiprecision/include/boost/config/platform/qnxnto.hpp +31 -0
  907. package/vendor/boost/multiprecision/include/boost/config/platform/solaris.hpp +31 -0
  908. package/vendor/boost/multiprecision/include/boost/config/platform/symbian.hpp +97 -0
  909. package/vendor/boost/multiprecision/include/boost/config/platform/vms.hpp +25 -0
  910. package/vendor/boost/multiprecision/include/boost/config/platform/vxworks.hpp +422 -0
  911. package/vendor/boost/multiprecision/include/boost/config/platform/wasm.hpp +23 -0
  912. package/vendor/boost/multiprecision/include/boost/config/platform/win32.hpp +90 -0
  913. package/vendor/boost/multiprecision/include/boost/config/platform/zos.hpp +32 -0
  914. package/vendor/boost/multiprecision/include/boost/config/pragma_message.hpp +31 -0
  915. package/vendor/boost/multiprecision/include/boost/config/requires_threads.hpp +92 -0
  916. package/vendor/boost/multiprecision/include/boost/config/stdlib/dinkumware.hpp +324 -0
  917. package/vendor/boost/multiprecision/include/boost/config/stdlib/libcomo.hpp +93 -0
  918. package/vendor/boost/multiprecision/include/boost/config/stdlib/libcpp.hpp +185 -0
  919. package/vendor/boost/multiprecision/include/boost/config/stdlib/libstdcpp3.hpp +482 -0
  920. package/vendor/boost/multiprecision/include/boost/config/stdlib/modena.hpp +79 -0
  921. package/vendor/boost/multiprecision/include/boost/config/stdlib/msl.hpp +98 -0
  922. package/vendor/boost/multiprecision/include/boost/config/stdlib/roguewave.hpp +208 -0
  923. package/vendor/boost/multiprecision/include/boost/config/stdlib/sgi.hpp +168 -0
  924. package/vendor/boost/multiprecision/include/boost/config/stdlib/stlport.hpp +258 -0
  925. package/vendor/boost/multiprecision/include/boost/config/stdlib/vacpp.hpp +74 -0
  926. package/vendor/boost/multiprecision/include/boost/config/stdlib/xlcpp_zos.hpp +61 -0
  927. package/vendor/boost/multiprecision/include/boost/config/user.hpp +133 -0
  928. package/vendor/boost/multiprecision/include/boost/config/warning_disable.hpp +47 -0
  929. package/vendor/boost/multiprecision/include/boost/config/workaround.hpp +310 -0
  930. package/vendor/boost/multiprecision/include/boost/config.hpp +67 -0
  931. package/vendor/boost/multiprecision/include/boost/cstdint.hpp +556 -0
  932. package/vendor/boost/multiprecision/include/boost/cxx11_char_types.hpp +70 -0
  933. package/vendor/boost/multiprecision/include/boost/detail/workaround.hpp +10 -0
  934. package/vendor/boost/multiprecision/include/boost/limits.hpp +146 -0
  935. package/vendor/boost/multiprecision/include/boost/multiprecision/complex128.hpp +24 -0
  936. package/vendor/boost/multiprecision/include/boost/multiprecision/complex_adaptor.hpp +1049 -0
  937. package/vendor/boost/multiprecision/include/boost/multiprecision/concepts/mp_number_archetypes.hpp +257 -0
  938. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_bin_float/io.hpp +700 -0
  939. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_bin_float/transcendental.hpp +157 -0
  940. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_bin_float.hpp +2374 -0
  941. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_complex.hpp +12 -0
  942. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_dec_float.hpp +3807 -0
  943. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail.hpp +177 -0
  944. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath.hpp +25 -0
  945. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fabs.hpp +27 -0
  946. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_floor.hpp +116 -0
  947. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fma.hpp +65 -0
  948. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fpclassify.hpp +52 -0
  949. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_frexp.hpp +93 -0
  950. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_isinf.hpp +24 -0
  951. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_isnan.hpp +21 -0
  952. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_ldexp.hpp +71 -0
  953. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_limits.hpp +218 -0
  954. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_log.hpp +172 -0
  955. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_sqrt.hpp +57 -0
  956. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_constants.hpp +80 -0
  957. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_double_fp.hpp +2690 -0
  958. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/add.hpp +368 -0
  959. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/add_unsigned.hpp +387 -0
  960. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/bitwise.hpp +896 -0
  961. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/checked.hpp +178 -0
  962. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/comparison.hpp +374 -0
  963. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/cpp_int_config.hpp +161 -0
  964. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/divide.hpp +703 -0
  965. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/import_export.hpp +248 -0
  966. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/intel_intrinsics.hpp +138 -0
  967. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/limits.hpp +292 -0
  968. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/literals.hpp +296 -0
  969. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/misc.hpp +1462 -0
  970. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/multiply.hpp +848 -0
  971. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/serialize.hpp +209 -0
  972. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int/value_pack.hpp +42 -0
  973. package/vendor/boost/multiprecision/include/boost/multiprecision/cpp_int.hpp +2360 -0
  974. package/vendor/boost/multiprecision/include/boost/multiprecision/debug_adaptor.hpp +760 -0
  975. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/assert.hpp +29 -0
  976. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/atomic.hpp +62 -0
  977. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/bitscan.hpp +317 -0
  978. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/check_cpp11_config.hpp +64 -0
  979. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/constexpr.hpp +88 -0
  980. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/default_ops.hpp +4077 -0
  981. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/digits.hpp +49 -0
  982. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/dynamic_array.hpp +44 -0
  983. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/empty_value.hpp +87 -0
  984. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/endian.hpp +35 -0
  985. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/et_ops.hpp +1831 -0
  986. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/float128_functions.hpp +95 -0
  987. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/float_string_cvt.hpp +333 -0
  988. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/fpclassify.hpp +101 -0
  989. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/functions/constants.hpp +289 -0
  990. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/functions/pow.hpp +941 -0
  991. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/functions/trig.hpp +1064 -0
  992. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/functions/trunc.hpp +82 -0
  993. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/generic_interconvert.hpp +687 -0
  994. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/hash.hpp +56 -0
  995. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/integer_ops.hpp +474 -0
  996. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/itos.hpp +39 -0
  997. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/min_max.hpp +106 -0
  998. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/no_et_ops.hpp +661 -0
  999. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/no_exceptions_support.hpp +55 -0
  1000. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/number_base.hpp +1656 -0
  1001. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/number_compare.hpp +848 -0
  1002. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/precision.hpp +313 -0
  1003. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/rebind.hpp +19 -0
  1004. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/standalone_config.hpp +165 -0
  1005. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/static_array.hpp +42 -0
  1006. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/string_helpers.hpp +48 -0
  1007. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/tables.hpp +80 -0
  1008. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/ublas_interop.hpp +75 -0
  1009. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/uniform_int_distribution.hpp +212 -0
  1010. package/vendor/boost/multiprecision/include/boost/multiprecision/detail/utype_helper.hpp +374 -0
  1011. package/vendor/boost/multiprecision/include/boost/multiprecision/eigen.hpp +248 -0
  1012. package/vendor/boost/multiprecision/include/boost/multiprecision/float128.hpp +960 -0
  1013. package/vendor/boost/multiprecision/include/boost/multiprecision/fwd.hpp +268 -0
  1014. package/vendor/boost/multiprecision/include/boost/multiprecision/gmp.hpp +4100 -0
  1015. package/vendor/boost/multiprecision/include/boost/multiprecision/integer.hpp +363 -0
  1016. package/vendor/boost/multiprecision/include/boost/multiprecision/logged_adaptor.hpp +834 -0
  1017. package/vendor/boost/multiprecision/include/boost/multiprecision/miller_rabin.hpp +221 -0
  1018. package/vendor/boost/multiprecision/include/boost/multiprecision/mpc.hpp +1721 -0
  1019. package/vendor/boost/multiprecision/include/boost/multiprecision/mpfi.hpp +2579 -0
  1020. package/vendor/boost/multiprecision/include/boost/multiprecision/mpfr.hpp +3668 -0
  1021. package/vendor/boost/multiprecision/include/boost/multiprecision/number.hpp +2491 -0
  1022. package/vendor/boost/multiprecision/include/boost/multiprecision/random.hpp +23 -0
  1023. package/vendor/boost/multiprecision/include/boost/multiprecision/rational_adaptor.hpp +1289 -0
  1024. package/vendor/boost/multiprecision/include/boost/multiprecision/tommath.hpp +1044 -0
  1025. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/explicit_conversion.hpp +67 -0
  1026. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/extract_exponent_type.hpp +28 -0
  1027. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/is_backend.hpp +91 -0
  1028. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/is_byte_container.hpp +51 -0
  1029. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/is_complex.hpp +22 -0
  1030. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/is_convertible_arithmetic.hpp +51 -0
  1031. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/is_restricted_conversion.hpp +47 -0
  1032. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/is_variable_precision.hpp +25 -0
  1033. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/max_digits10.hpp +79 -0
  1034. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/std_integer_traits.hpp +95 -0
  1035. package/vendor/boost/multiprecision/include/boost/multiprecision/traits/transcendental_reduction_type.hpp +21 -0
  1036. package/vendor/boost/multiprecision/include/boost/static_assert.hpp +179 -0
  1037. package/vendor/boost/multiprecision/include/boost/version.hpp +32 -0
  1038. package/vendor/eigen/COPYING.APACHE +203 -0
  1039. package/vendor/eigen/COPYING.BSD +26 -0
  1040. package/vendor/eigen/COPYING.MPL2 +373 -0
  1041. package/vendor/eigen/COPYING.README +6 -0
  1042. package/vendor/eigen/Eigen/AccelerateSupport +52 -0
  1043. package/vendor/eigen/Eigen/Cholesky +43 -0
  1044. package/vendor/eigen/Eigen/CholmodSupport +48 -0
  1045. package/vendor/eigen/Eigen/Core +451 -0
  1046. package/vendor/eigen/Eigen/Dense +7 -0
  1047. package/vendor/eigen/Eigen/Eigen +2 -0
  1048. package/vendor/eigen/Eigen/Eigenvalues +63 -0
  1049. package/vendor/eigen/Eigen/Geometry +59 -0
  1050. package/vendor/eigen/Eigen/Householder +31 -0
  1051. package/vendor/eigen/Eigen/IterativeLinearSolvers +52 -0
  1052. package/vendor/eigen/Eigen/Jacobi +33 -0
  1053. package/vendor/eigen/Eigen/KLUSupport +43 -0
  1054. package/vendor/eigen/Eigen/LU +46 -0
  1055. package/vendor/eigen/Eigen/MetisSupport +35 -0
  1056. package/vendor/eigen/Eigen/OrderingMethods +73 -0
  1057. package/vendor/eigen/Eigen/PaStiXSupport +51 -0
  1058. package/vendor/eigen/Eigen/PardisoSupport +38 -0
  1059. package/vendor/eigen/Eigen/QR +48 -0
  1060. package/vendor/eigen/Eigen/QtAlignedMalloc +32 -0
  1061. package/vendor/eigen/Eigen/SPQRSupport +41 -0
  1062. package/vendor/eigen/Eigen/SVD +56 -0
  1063. package/vendor/eigen/Eigen/Sparse +33 -0
  1064. package/vendor/eigen/Eigen/SparseCholesky +40 -0
  1065. package/vendor/eigen/Eigen/SparseCore +70 -0
  1066. package/vendor/eigen/Eigen/SparseLU +50 -0
  1067. package/vendor/eigen/Eigen/SparseQR +38 -0
  1068. package/vendor/eigen/Eigen/StdDeque +30 -0
  1069. package/vendor/eigen/Eigen/StdList +29 -0
  1070. package/vendor/eigen/Eigen/StdVector +30 -0
  1071. package/vendor/eigen/Eigen/SuperLUSupport +70 -0
  1072. package/vendor/eigen/Eigen/ThreadPool +80 -0
  1073. package/vendor/eigen/Eigen/UmfPackSupport +42 -0
  1074. package/vendor/eigen/Eigen/Version +14 -0
  1075. package/vendor/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
  1076. package/vendor/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
  1077. package/vendor/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
  1078. package/vendor/eigen/Eigen/src/Cholesky/LDLT.h +649 -0
  1079. package/vendor/eigen/Eigen/src/Cholesky/LLT.h +514 -0
  1080. package/vendor/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +124 -0
  1081. package/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +738 -0
  1082. package/vendor/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
  1083. package/vendor/eigen/Eigen/src/Core/ArithmeticSequence.h +239 -0
  1084. package/vendor/eigen/Eigen/src/Core/Array.h +376 -0
  1085. package/vendor/eigen/Eigen/src/Core/ArrayBase.h +213 -0
  1086. package/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +165 -0
  1087. package/vendor/eigen/Eigen/src/Core/Assign.h +80 -0
  1088. package/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +1057 -0
  1089. package/vendor/eigen/Eigen/src/Core/Assign_MKL.h +183 -0
  1090. package/vendor/eigen/Eigen/src/Core/BandMatrix.h +338 -0
  1091. package/vendor/eigen/Eigen/src/Core/Block.h +429 -0
  1092. package/vendor/eigen/Eigen/src/Core/CommaInitializer.h +149 -0
  1093. package/vendor/eigen/Eigen/src/Core/ConditionEstimator.h +173 -0
  1094. package/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +2018 -0
  1095. package/vendor/eigen/Eigen/src/Core/CoreIterators.h +141 -0
  1096. package/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +166 -0
  1097. package/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +975 -0
  1098. package/vendor/eigen/Eigen/src/Core/CwiseTernaryOp.h +171 -0
  1099. package/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +91 -0
  1100. package/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +167 -0
  1101. package/vendor/eigen/Eigen/src/Core/DenseBase.h +673 -0
  1102. package/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +568 -0
  1103. package/vendor/eigen/Eigen/src/Core/DenseStorage.h +573 -0
  1104. package/vendor/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
  1105. package/vendor/eigen/Eigen/src/Core/Diagonal.h +219 -0
  1106. package/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +420 -0
  1107. package/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +30 -0
  1108. package/vendor/eigen/Eigen/src/Core/Dot.h +268 -0
  1109. package/vendor/eigen/Eigen/src/Core/EigenBase.h +149 -0
  1110. package/vendor/eigen/Eigen/src/Core/Fill.h +138 -0
  1111. package/vendor/eigen/Eigen/src/Core/FindCoeff.h +464 -0
  1112. package/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +127 -0
  1113. package/vendor/eigen/Eigen/src/Core/Fuzzy.h +132 -0
  1114. package/vendor/eigen/Eigen/src/Core/GeneralProduct.h +519 -0
  1115. package/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +1702 -0
  1116. package/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +230 -0
  1117. package/vendor/eigen/Eigen/src/Core/IO.h +233 -0
  1118. package/vendor/eigen/Eigen/src/Core/IndexedView.h +321 -0
  1119. package/vendor/eigen/Eigen/src/Core/InnerProduct.h +260 -0
  1120. package/vendor/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
  1121. package/vendor/eigen/Eigen/src/Core/Inverse.h +108 -0
  1122. package/vendor/eigen/Eigen/src/Core/Map.h +153 -0
  1123. package/vendor/eigen/Eigen/src/Core/MapBase.h +283 -0
  1124. package/vendor/eigen/Eigen/src/Core/MathFunctions.h +2103 -0
  1125. package/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +263 -0
  1126. package/vendor/eigen/Eigen/src/Core/Matrix.h +534 -0
  1127. package/vendor/eigen/Eigen/src/Core/MatrixBase.h +545 -0
  1128. package/vendor/eigen/Eigen/src/Core/NestByValue.h +91 -0
  1129. package/vendor/eigen/Eigen/src/Core/NoAlias.h +102 -0
  1130. package/vendor/eigen/Eigen/src/Core/NumTraits.h +335 -0
  1131. package/vendor/eigen/Eigen/src/Core/PartialReduxEvaluator.h +253 -0
  1132. package/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +555 -0
  1133. package/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +1014 -0
  1134. package/vendor/eigen/Eigen/src/Core/Product.h +307 -0
  1135. package/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +1287 -0
  1136. package/vendor/eigen/Eigen/src/Core/Random.h +207 -0
  1137. package/vendor/eigen/Eigen/src/Core/RandomImpl.h +262 -0
  1138. package/vendor/eigen/Eigen/src/Core/RealView.h +250 -0
  1139. package/vendor/eigen/Eigen/src/Core/Redux.h +535 -0
  1140. package/vendor/eigen/Eigen/src/Core/Ref.h +383 -0
  1141. package/vendor/eigen/Eigen/src/Core/Replicate.h +130 -0
  1142. package/vendor/eigen/Eigen/src/Core/Reshaped.h +398 -0
  1143. package/vendor/eigen/Eigen/src/Core/ReturnByValue.h +111 -0
  1144. package/vendor/eigen/Eigen/src/Core/Reverse.h +202 -0
  1145. package/vendor/eigen/Eigen/src/Core/Select.h +92 -0
  1146. package/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +329 -0
  1147. package/vendor/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +50 -0
  1148. package/vendor/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
  1149. package/vendor/eigen/Eigen/src/Core/Solve.h +174 -0
  1150. package/vendor/eigen/Eigen/src/Core/SolveTriangular.h +237 -0
  1151. package/vendor/eigen/Eigen/src/Core/SolverBase.h +167 -0
  1152. package/vendor/eigen/Eigen/src/Core/StableNorm.h +217 -0
  1153. package/vendor/eigen/Eigen/src/Core/StlIterators.h +619 -0
  1154. package/vendor/eigen/Eigen/src/Core/Stride.h +114 -0
  1155. package/vendor/eigen/Eigen/src/Core/Swap.h +99 -0
  1156. package/vendor/eigen/Eigen/src/Core/Transpose.h +427 -0
  1157. package/vendor/eigen/Eigen/src/Core/Transpositions.h +323 -0
  1158. package/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +900 -0
  1159. package/vendor/eigen/Eigen/src/Core/VectorBlock.h +83 -0
  1160. package/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +733 -0
  1161. package/vendor/eigen/Eigen/src/Core/Visitor.h +537 -0
  1162. package/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +565 -0
  1163. package/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +130 -0
  1164. package/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +3081 -0
  1165. package/vendor/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
  1166. package/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +308 -0
  1167. package/vendor/eigen/Eigen/src/Core/arch/AVX512/Complex.h +472 -0
  1168. package/vendor/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
  1169. package/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +141 -0
  1170. package/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
  1171. package/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +3146 -0
  1172. package/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
  1173. package/vendor/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
  1174. package/vendor/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
  1175. package/vendor/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
  1176. package/vendor/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +277 -0
  1177. package/vendor/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
  1178. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +653 -0
  1179. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +81 -0
  1180. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +3686 -0
  1181. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +205 -0
  1182. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +901 -0
  1183. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
  1184. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
  1185. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +3729 -0
  1186. package/vendor/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
  1187. package/vendor/eigen/Eigen/src/Core/arch/Default/BFloat16.h +866 -0
  1188. package/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +128 -0
  1189. package/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +2634 -0
  1190. package/vendor/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +227 -0
  1191. package/vendor/eigen/Eigen/src/Core/arch/Default/Half.h +1091 -0
  1192. package/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +47 -0
  1193. package/vendor/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
  1194. package/vendor/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +104 -0
  1195. package/vendor/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1712 -0
  1196. package/vendor/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
  1197. package/vendor/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +77 -0
  1198. package/vendor/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  1199. package/vendor/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
  1200. package/vendor/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
  1201. package/vendor/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
  1202. package/vendor/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
  1203. package/vendor/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
  1204. package/vendor/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
  1205. package/vendor/eigen/Eigen/src/Core/arch/MSA/Complex.h +620 -0
  1206. package/vendor/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +379 -0
  1207. package/vendor/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1237 -0
  1208. package/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +732 -0
  1209. package/vendor/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +243 -0
  1210. package/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +68 -0
  1211. package/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +6096 -0
  1212. package/vendor/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1642 -0
  1213. package/vendor/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
  1214. package/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +503 -0
  1215. package/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +88 -0
  1216. package/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +2384 -0
  1217. package/vendor/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
  1218. package/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +230 -0
  1219. package/vendor/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +48 -0
  1220. package/vendor/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +674 -0
  1221. package/vendor/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +52 -0
  1222. package/vendor/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +227 -0
  1223. package/vendor/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +303 -0
  1224. package/vendor/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +576 -0
  1225. package/vendor/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +83 -0
  1226. package/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +570 -0
  1227. package/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +244 -0
  1228. package/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +1413 -0
  1229. package/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +174 -0
  1230. package/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +747 -0
  1231. package/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +274 -0
  1232. package/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +149 -0
  1233. package/vendor/eigen/Eigen/src/Core/functors/TernaryFunctors.h +52 -0
  1234. package/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1420 -0
  1235. package/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +3153 -0
  1236. package/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +459 -0
  1237. package/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +330 -0
  1238. package/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +148 -0
  1239. package/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +205 -0
  1240. package/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +473 -0
  1241. package/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +139 -0
  1242. package/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +282 -0
  1243. package/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +483 -0
  1244. package/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +277 -0
  1245. package/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +253 -0
  1246. package/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +115 -0
  1247. package/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  1248. package/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +95 -0
  1249. package/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +397 -0
  1250. package/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +325 -0
  1251. package/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +347 -0
  1252. package/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +275 -0
  1253. package/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +388 -0
  1254. package/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +166 -0
  1255. package/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +122 -0
  1256. package/vendor/eigen/Eigen/src/Core/util/Assert.h +158 -0
  1257. package/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +622 -0
  1258. package/vendor/eigen/Eigen/src/Core/util/ConfigureVectorization.h +543 -0
  1259. package/vendor/eigen/Eigen/src/Core/util/Constants.h +598 -0
  1260. package/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +146 -0
  1261. package/vendor/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
  1262. package/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +524 -0
  1263. package/vendor/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
  1264. package/vendor/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
  1265. package/vendor/eigen/Eigen/src/Core/util/IndexedViewHelper.h +487 -0
  1266. package/vendor/eigen/Eigen/src/Core/util/IntegralConstant.h +279 -0
  1267. package/vendor/eigen/Eigen/src/Core/util/MKL_support.h +139 -0
  1268. package/vendor/eigen/Eigen/src/Core/util/Macros.h +1346 -0
  1269. package/vendor/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
  1270. package/vendor/eigen/Eigen/src/Core/util/Memory.h +1385 -0
  1271. package/vendor/eigen/Eigen/src/Core/util/Meta.h +760 -0
  1272. package/vendor/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
  1273. package/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +44 -0
  1274. package/vendor/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  1275. package/vendor/eigen/Eigen/src/Core/util/Serializer.h +209 -0
  1276. package/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +105 -0
  1277. package/vendor/eigen/Eigen/src/Core/util/SymbolicIndex.h +445 -0
  1278. package/vendor/eigen/Eigen/src/Core/util/XprHelper.h +1093 -0
  1279. package/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +315 -0
  1280. package/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +442 -0
  1281. package/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +95 -0
  1282. package/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +579 -0
  1283. package/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +402 -0
  1284. package/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +212 -0
  1285. package/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +356 -0
  1286. package/vendor/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
  1287. package/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +142 -0
  1288. package/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +587 -0
  1289. package/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +519 -0
  1290. package/vendor/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +83 -0
  1291. package/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +850 -0
  1292. package/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +90 -0
  1293. package/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +529 -0
  1294. package/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +485 -0
  1295. package/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +245 -0
  1296. package/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +203 -0
  1297. package/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +453 -0
  1298. package/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +273 -0
  1299. package/vendor/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
  1300. package/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +257 -0
  1301. package/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +232 -0
  1302. package/vendor/eigen/Eigen/src/Geometry/Quaternion.h +930 -0
  1303. package/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +201 -0
  1304. package/vendor/eigen/Eigen/src/Geometry/RotationBase.h +209 -0
  1305. package/vendor/eigen/Eigen/src/Geometry/Scaling.h +195 -0
  1306. package/vendor/eigen/Eigen/src/Geometry/Transform.h +1485 -0
  1307. package/vendor/eigen/Eigen/src/Geometry/Translation.h +204 -0
  1308. package/vendor/eigen/Eigen/src/Geometry/Umeyama.h +161 -0
  1309. package/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +154 -0
  1310. package/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +115 -0
  1311. package/vendor/eigen/Eigen/src/Householder/Householder.h +154 -0
  1312. package/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +504 -0
  1313. package/vendor/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
  1314. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +213 -0
  1315. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +220 -0
  1316. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +217 -0
  1317. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +402 -0
  1318. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +449 -0
  1319. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
  1320. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +395 -0
  1321. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +193 -0
  1322. package/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +111 -0
  1323. package/vendor/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
  1324. package/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +427 -0
  1325. package/vendor/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
  1326. package/vendor/eigen/Eigen/src/KLUSupport/KLUSupport.h +339 -0
  1327. package/vendor/eigen/Eigen/src/LU/Determinant.h +98 -0
  1328. package/vendor/eigen/Eigen/src/LU/FullPivLU.h +826 -0
  1329. package/vendor/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
  1330. package/vendor/eigen/Eigen/src/LU/InverseImpl.h +353 -0
  1331. package/vendor/eigen/Eigen/src/LU/PartialPivLU.h +586 -0
  1332. package/vendor/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +97 -0
  1333. package/vendor/eigen/Eigen/src/LU/arch/InverseSize4.h +353 -0
  1334. package/vendor/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
  1335. package/vendor/eigen/Eigen/src/MetisSupport/MetisSupport.h +125 -0
  1336. package/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +413 -0
  1337. package/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +1690 -0
  1338. package/vendor/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
  1339. package/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +146 -0
  1340. package/vendor/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
  1341. package/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +632 -0
  1342. package/vendor/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
  1343. package/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +500 -0
  1344. package/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
  1345. package/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +161 -0
  1346. package/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +648 -0
  1347. package/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +733 -0
  1348. package/vendor/eigen/Eigen/src/QR/HouseholderQR.h +543 -0
  1349. package/vendor/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +77 -0
  1350. package/vendor/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
  1351. package/vendor/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
  1352. package/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +315 -0
  1353. package/vendor/eigen/Eigen/src/SVD/BDCSVD.h +1470 -0
  1354. package/vendor/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
  1355. package/vendor/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
  1356. package/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +846 -0
  1357. package/vendor/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +127 -0
  1358. package/vendor/eigen/Eigen/src/SVD/SVDBase.h +436 -0
  1359. package/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +379 -0
  1360. package/vendor/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
  1361. package/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +868 -0
  1362. package/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +388 -0
  1363. package/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +329 -0
  1364. package/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +206 -0
  1365. package/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +308 -0
  1366. package/vendor/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
  1367. package/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +279 -0
  1368. package/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +534 -0
  1369. package/vendor/eigen/Eigen/src/SparseCore/SparseColEtree.h +194 -0
  1370. package/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +592 -0
  1371. package/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +938 -0
  1372. package/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +142 -0
  1373. package/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +314 -0
  1374. package/vendor/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  1375. package/vendor/eigen/Eigen/src/SparseCore/SparseDot.h +100 -0
  1376. package/vendor/eigen/Eigen/src/SparseCore/SparseFuzzy.h +31 -0
  1377. package/vendor/eigen/Eigen/src/SparseCore/SparseMap.h +295 -0
  1378. package/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +1876 -0
  1379. package/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +451 -0
  1380. package/vendor/eigen/Eigen/src/SparseCore/SparsePermutation.h +249 -0
  1381. package/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +178 -0
  1382. package/vendor/eigen/Eigen/src/SparseCore/SparseRedux.h +47 -0
  1383. package/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +370 -0
  1384. package/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +613 -0
  1385. package/vendor/eigen/Eigen/src/SparseCore/SparseSolverBase.h +115 -0
  1386. package/vendor/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +184 -0
  1387. package/vendor/eigen/Eigen/src/SparseCore/SparseTranspose.h +83 -0
  1388. package/vendor/eigen/Eigen/src/SparseCore/SparseTriangularView.h +177 -0
  1389. package/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +209 -0
  1390. package/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +532 -0
  1391. package/vendor/eigen/Eigen/src/SparseCore/SparseView.h +225 -0
  1392. package/vendor/eigen/Eigen/src/SparseCore/TriangularSolver.h +274 -0
  1393. package/vendor/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
  1394. package/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +969 -0
  1395. package/vendor/eigen/Eigen/src/SparseLU/SparseLUImpl.h +79 -0
  1396. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +210 -0
  1397. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +113 -0
  1398. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +319 -0
  1399. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +75 -0
  1400. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +177 -0
  1401. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +168 -0
  1402. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +106 -0
  1403. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +114 -0
  1404. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +133 -0
  1405. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +215 -0
  1406. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +235 -0
  1407. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +136 -0
  1408. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +130 -0
  1409. package/vendor/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +81 -0
  1410. package/vendor/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
  1411. package/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +706 -0
  1412. package/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +51 -0
  1413. package/vendor/eigen/Eigen/src/StlSupport/StdList.h +50 -0
  1414. package/vendor/eigen/Eigen/src/StlSupport/StdVector.h +51 -0
  1415. package/vendor/eigen/Eigen/src/StlSupport/details.h +82 -0
  1416. package/vendor/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
  1417. package/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +929 -0
  1418. package/vendor/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
  1419. package/vendor/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
  1420. package/vendor/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
  1421. package/vendor/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
  1422. package/vendor/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
  1423. package/vendor/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
  1424. package/vendor/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
  1425. package/vendor/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
  1426. package/vendor/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
  1427. package/vendor/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
  1428. package/vendor/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
  1429. package/vendor/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
  1430. package/vendor/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
  1431. package/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +606 -0
  1432. package/vendor/eigen/Eigen/src/misc/Image.h +80 -0
  1433. package/vendor/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
  1434. package/vendor/eigen/Eigen/src/misc/Kernel.h +77 -0
  1435. package/vendor/eigen/Eigen/src/misc/RealSvd2x2.h +53 -0
  1436. package/vendor/eigen/Eigen/src/misc/blas.h +97 -0
  1437. package/vendor/eigen/Eigen/src/misc/lapacke.h +10085 -0
  1438. package/vendor/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
  1439. package/vendor/eigen/Eigen/src/misc/lapacke_mangling.h +16 -0
  1440. package/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
  1441. package/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
  1442. package/vendor/eigen/Eigen/src/plugins/BlockMethods.inc +1370 -0
  1443. package/vendor/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
  1444. package/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.inc +167 -0
  1445. package/vendor/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
  1446. package/vendor/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
  1447. package/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
  1448. package/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
  1449. package/vendor/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
  1450. package/vendor/eigen/README.md +5 -0
  1451. package/vendor/mpdecimal/COPYRIGHT.txt +23 -0
  1452. package/vendor/mpdecimal/README.txt +53 -0
  1453. package/vendor/mpdecimal/libmpdec/.objs/README.txt +8 -0
  1454. package/vendor/mpdecimal/libmpdec/.objs/symbols32.exp +343 -0
  1455. package/vendor/mpdecimal/libmpdec/.objs/symbols64.exp +347 -0
  1456. package/vendor/mpdecimal/libmpdec/.pc/libmpdec.pc.in +11 -0
  1457. package/vendor/mpdecimal/libmpdec/.profile/train.sh +35 -0
  1458. package/vendor/mpdecimal/libmpdec/README.txt +84 -0
  1459. package/vendor/mpdecimal/libmpdec/basearith.c +649 -0
  1460. package/vendor/mpdecimal/libmpdec/basearith.h +217 -0
  1461. package/vendor/mpdecimal/libmpdec/bits.h +188 -0
  1462. package/vendor/mpdecimal/libmpdec/constants.c +129 -0
  1463. package/vendor/mpdecimal/libmpdec/constants.h +88 -0
  1464. package/vendor/mpdecimal/libmpdec/context.c +285 -0
  1465. package/vendor/mpdecimal/libmpdec/convolute.c +172 -0
  1466. package/vendor/mpdecimal/libmpdec/convolute.h +48 -0
  1467. package/vendor/mpdecimal/libmpdec/crt.c +178 -0
  1468. package/vendor/mpdecimal/libmpdec/crt.h +45 -0
  1469. package/vendor/mpdecimal/libmpdec/difradix2.c +171 -0
  1470. package/vendor/mpdecimal/libmpdec/difradix2.h +46 -0
  1471. package/vendor/mpdecimal/libmpdec/fnt.c +77 -0
  1472. package/vendor/mpdecimal/libmpdec/fnt.h +46 -0
  1473. package/vendor/mpdecimal/libmpdec/fourstep.c +242 -0
  1474. package/vendor/mpdecimal/libmpdec/fourstep.h +46 -0
  1475. package/vendor/mpdecimal/libmpdec/io.c +1610 -0
  1476. package/vendor/mpdecimal/libmpdec/io.h +61 -0
  1477. package/vendor/mpdecimal/libmpdec/mpalloc.c +347 -0
  1478. package/vendor/mpdecimal/libmpdec/mpalloc.h +53 -0
  1479. package/vendor/mpdecimal/libmpdec/mpdecimal.c +9155 -0
  1480. package/vendor/mpdecimal/libmpdec/mpdecimal.h.in +804 -0
  1481. package/vendor/mpdecimal/libmpdec/mpsignal.c +966 -0
  1482. package/vendor/mpdecimal/libmpdec/numbertheory.c +129 -0
  1483. package/vendor/mpdecimal/libmpdec/numbertheory.h +75 -0
  1484. package/vendor/mpdecimal/libmpdec/sixstep.c +212 -0
  1485. package/vendor/mpdecimal/libmpdec/sixstep.h +46 -0
  1486. package/vendor/mpdecimal/libmpdec/transpose.c +275 -0
  1487. package/vendor/mpdecimal/libmpdec/transpose.h +60 -0
  1488. package/vendor/mpdecimal/libmpdec/typearith.h +661 -0
  1489. package/vendor/mpdecimal/libmpdec/umodarith.h +645 -0
  1490. package/vendor/symengine/AUTHORS +101 -0
  1491. package/vendor/symengine/LICENSE +254 -0
  1492. package/vendor/symengine/README.md +199 -0
  1493. package/vendor/symengine/symengine/add.cpp +508 -0
  1494. package/vendor/symengine/symengine/add.h +187 -0
  1495. package/vendor/symengine/symengine/as_real_imag.cpp +289 -0
  1496. package/vendor/symengine/symengine/assumptions.cpp +202 -0
  1497. package/vendor/symengine/symengine/assumptions.h +47 -0
  1498. package/vendor/symengine/symengine/basic-inl.h +152 -0
  1499. package/vendor/symengine/symengine/basic-methods.inc +9 -0
  1500. package/vendor/symengine/symengine/basic.cpp +110 -0
  1501. package/vendor/symengine/symengine/basic.h +356 -0
  1502. package/vendor/symengine/symengine/complex.cpp +198 -0
  1503. package/vendor/symengine/symengine/complex.h +396 -0
  1504. package/vendor/symengine/symengine/complex_double.cpp +72 -0
  1505. package/vendor/symengine/symengine/complex_double.h +570 -0
  1506. package/vendor/symengine/symengine/complex_mpc.h +406 -0
  1507. package/vendor/symengine/symengine/constants.cpp +130 -0
  1508. package/vendor/symengine/symengine/constants.h +81 -0
  1509. package/vendor/symengine/symengine/cse.cpp +556 -0
  1510. package/vendor/symengine/symengine/cwrapper.h +949 -0
  1511. package/vendor/symengine/symengine/dense_matrix.cpp +2100 -0
  1512. package/vendor/symengine/symengine/derivative.cpp +841 -0
  1513. package/vendor/symengine/symengine/derivative.h +137 -0
  1514. package/vendor/symengine/symengine/dict.cpp +125 -0
  1515. package/vendor/symengine/symengine/dict.h +333 -0
  1516. package/vendor/symengine/symengine/diophantine.cpp +139 -0
  1517. package/vendor/symengine/symengine/diophantine.h +20 -0
  1518. package/vendor/symengine/symengine/eval.cpp +109 -0
  1519. package/vendor/symengine/symengine/eval.h +40 -0
  1520. package/vendor/symengine/symengine/eval_arb.h +31 -0
  1521. package/vendor/symengine/symengine/eval_double.cpp +959 -0
  1522. package/vendor/symengine/symengine/eval_double.h +28 -0
  1523. package/vendor/symengine/symengine/eval_mpc.h +29 -0
  1524. package/vendor/symengine/symengine/eval_mpfr.h +26 -0
  1525. package/vendor/symengine/symengine/expand.cpp +379 -0
  1526. package/vendor/symengine/symengine/expression.cpp +24 -0
  1527. package/vendor/symengine/symengine/expression.h +375 -0
  1528. package/vendor/symengine/symengine/fields.cpp +861 -0
  1529. package/vendor/symengine/symengine/fields.h +647 -0
  1530. package/vendor/symengine/symengine/finitediff.cpp +70 -0
  1531. package/vendor/symengine/symengine/finitediff.h +21 -0
  1532. package/vendor/symengine/symengine/flint_wrapper.h +1010 -0
  1533. package/vendor/symengine/symengine/functions.cpp +3913 -0
  1534. package/vendor/symengine/symengine/functions.h +1321 -0
  1535. package/vendor/symengine/symengine/infinity.cpp +537 -0
  1536. package/vendor/symengine/symengine/infinity.h +118 -0
  1537. package/vendor/symengine/symengine/integer.cpp +153 -0
  1538. package/vendor/symengine/symengine/integer.h +227 -0
  1539. package/vendor/symengine/symengine/interruption.cpp +9 -0
  1540. package/vendor/symengine/symengine/interruption.h +19 -0
  1541. package/vendor/symengine/symengine/lambda_double.h +918 -0
  1542. package/vendor/symengine/symengine/limits.h +35 -0
  1543. package/vendor/symengine/symengine/llvm_double.h +201 -0
  1544. package/vendor/symengine/symengine/logic.cpp +812 -0
  1545. package/vendor/symengine/symengine/logic.h +281 -0
  1546. package/vendor/symengine/symengine/matrices/conjugate_matrix.cpp +139 -0
  1547. package/vendor/symengine/symengine/matrices/conjugate_matrix.h +39 -0
  1548. package/vendor/symengine/symengine/matrices/diagonal_matrix.cpp +79 -0
  1549. package/vendor/symengine/symengine/matrices/diagonal_matrix.h +52 -0
  1550. package/vendor/symengine/symengine/matrices/hadamard_product.cpp +151 -0
  1551. package/vendor/symengine/symengine/matrices/hadamard_product.h +42 -0
  1552. package/vendor/symengine/symengine/matrices/identity_matrix.cpp +63 -0
  1553. package/vendor/symengine/symengine/matrices/identity_matrix.h +40 -0
  1554. package/vendor/symengine/symengine/matrices/immutable_dense_matrix.cpp +143 -0
  1555. package/vendor/symengine/symengine/matrices/immutable_dense_matrix.h +65 -0
  1556. package/vendor/symengine/symengine/matrices/is_diagonal.cpp +115 -0
  1557. package/vendor/symengine/symengine/matrices/is_lower.cpp +110 -0
  1558. package/vendor/symengine/symengine/matrices/is_real.cpp +78 -0
  1559. package/vendor/symengine/symengine/matrices/is_square.cpp +85 -0
  1560. package/vendor/symengine/symengine/matrices/is_symmetric.cpp +112 -0
  1561. package/vendor/symengine/symengine/matrices/is_toeplitz.cpp +104 -0
  1562. package/vendor/symengine/symengine/matrices/is_upper.cpp +108 -0
  1563. package/vendor/symengine/symengine/matrices/is_zero.cpp +81 -0
  1564. package/vendor/symengine/symengine/matrices/matrix_add.cpp +176 -0
  1565. package/vendor/symengine/symengine/matrices/matrix_add.h +42 -0
  1566. package/vendor/symengine/symengine/matrices/matrix_expr.h +19 -0
  1567. package/vendor/symengine/symengine/matrices/matrix_mul.cpp +258 -0
  1568. package/vendor/symengine/symengine/matrices/matrix_mul.h +55 -0
  1569. package/vendor/symengine/symengine/matrices/matrix_symbol.cpp +34 -0
  1570. package/vendor/symengine/symengine/matrices/matrix_symbol.h +41 -0
  1571. package/vendor/symengine/symengine/matrices/size.cpp +121 -0
  1572. package/vendor/symengine/symengine/matrices/size.h +15 -0
  1573. package/vendor/symengine/symengine/matrices/trace.cpp +112 -0
  1574. package/vendor/symengine/symengine/matrices/trace.h +31 -0
  1575. package/vendor/symengine/symengine/matrices/transpose.cpp +126 -0
  1576. package/vendor/symengine/symengine/matrices/transpose.h +39 -0
  1577. package/vendor/symengine/symengine/matrices/zero_matrix.cpp +94 -0
  1578. package/vendor/symengine/symengine/matrices/zero_matrix.h +47 -0
  1579. package/vendor/symengine/symengine/matrix.cpp +33 -0
  1580. package/vendor/symengine/symengine/matrix.h +675 -0
  1581. package/vendor/symengine/symengine/matrix_expressions.h +51 -0
  1582. package/vendor/symengine/symengine/monomials.cpp +33 -0
  1583. package/vendor/symengine/symengine/monomials.h +20 -0
  1584. package/vendor/symengine/symengine/mp_boost.cpp +635 -0
  1585. package/vendor/symengine/symengine/mp_class.h +1286 -0
  1586. package/vendor/symengine/symengine/mp_wrapper.h +510 -0
  1587. package/vendor/symengine/symengine/mul.cpp +629 -0
  1588. package/vendor/symengine/symengine/mul.h +146 -0
  1589. package/vendor/symengine/symengine/nan.cpp +234 -0
  1590. package/vendor/symengine/symengine/nan.h +82 -0
  1591. package/vendor/symengine/symengine/ntheory.cpp +1700 -0
  1592. package/vendor/symengine/symengine/ntheory.h +213 -0
  1593. package/vendor/symengine/symengine/ntheory_funcs.cpp +189 -0
  1594. package/vendor/symengine/symengine/ntheory_funcs.h +78 -0
  1595. package/vendor/symengine/symengine/number.cpp +36 -0
  1596. package/vendor/symengine/symengine/number.h +256 -0
  1597. package/vendor/symengine/symengine/numer_denom.cpp +149 -0
  1598. package/vendor/symengine/symengine/parser/parser.cpp +367 -0
  1599. package/vendor/symengine/symengine/parser/parser.h +56 -0
  1600. package/vendor/symengine/symengine/parser/parser.tab.cc +1495 -0
  1601. package/vendor/symengine/symengine/parser/parser.tab.hh +1410 -0
  1602. package/vendor/symengine/symengine/parser/parser_old.cpp +688 -0
  1603. package/vendor/symengine/symengine/parser/tokenizer.cpp +435 -0
  1604. package/vendor/symengine/symengine/parser/tokenizer.h +35 -0
  1605. package/vendor/symengine/symengine/parser.h +25 -0
  1606. package/vendor/symengine/symengine/polys/basic_conversions.cpp +178 -0
  1607. package/vendor/symengine/symengine/polys/basic_conversions.h +575 -0
  1608. package/vendor/symengine/symengine/polys/cancel.h +39 -0
  1609. package/vendor/symengine/symengine/polys/msymenginepoly.cpp +130 -0
  1610. package/vendor/symengine/symengine/polys/msymenginepoly.h +536 -0
  1611. package/vendor/symengine/symengine/polys/uexprpoly.cpp +90 -0
  1612. package/vendor/symengine/symengine/polys/uexprpoly.h +205 -0
  1613. package/vendor/symengine/symengine/polys/uintpoly.cpp +62 -0
  1614. package/vendor/symengine/symengine/polys/uintpoly.h +134 -0
  1615. package/vendor/symengine/symengine/polys/uintpoly_flint.h +228 -0
  1616. package/vendor/symengine/symengine/polys/uintpoly_piranha.h +373 -0
  1617. package/vendor/symengine/symengine/polys/upolybase.h +769 -0
  1618. package/vendor/symengine/symengine/polys/uratpoly.cpp +59 -0
  1619. package/vendor/symengine/symengine/polys/uratpoly.h +58 -0
  1620. package/vendor/symengine/symengine/polys/usymenginepoly.h +139 -0
  1621. package/vendor/symengine/symengine/pow.cpp +303 -0
  1622. package/vendor/symengine/symengine/pow.h +76 -0
  1623. package/vendor/symengine/symengine/prime_sieve.cpp +143 -0
  1624. package/vendor/symengine/symengine/prime_sieve.h +64 -0
  1625. package/vendor/symengine/symengine/printers/codegen.cpp +716 -0
  1626. package/vendor/symengine/symengine/printers/codegen.h +168 -0
  1627. package/vendor/symengine/symengine/printers/latex.cpp +630 -0
  1628. package/vendor/symengine/symengine/printers/latex.h +76 -0
  1629. package/vendor/symengine/symengine/printers/mathml.cpp +358 -0
  1630. package/vendor/symengine/symengine/printers/mathml.h +62 -0
  1631. package/vendor/symengine/symengine/printers/stringbox.cpp +276 -0
  1632. package/vendor/symengine/symengine/printers/stringbox.h +60 -0
  1633. package/vendor/symengine/symengine/printers/strprinter.cpp +1212 -0
  1634. package/vendor/symengine/symengine/printers/strprinter.h +217 -0
  1635. package/vendor/symengine/symengine/printers/unicode.cpp +730 -0
  1636. package/vendor/symengine/symengine/printers/unicode.h +84 -0
  1637. package/vendor/symengine/symengine/printers.h +46 -0
  1638. package/vendor/symengine/symengine/rational.cpp +365 -0
  1639. package/vendor/symengine/symengine/rational.h +341 -0
  1640. package/vendor/symengine/symengine/real_double.cpp +388 -0
  1641. package/vendor/symengine/symengine/real_double.h +492 -0
  1642. package/vendor/symengine/symengine/real_mpfr.h +379 -0
  1643. package/vendor/symengine/symengine/refine.cpp +213 -0
  1644. package/vendor/symengine/symengine/refine.h +43 -0
  1645. package/vendor/symengine/symengine/rewrite.cpp +235 -0
  1646. package/vendor/symengine/symengine/rings.cpp +107 -0
  1647. package/vendor/symengine/symengine/rings.h +24 -0
  1648. package/vendor/symengine/symengine/serialize-cereal.h +964 -0
  1649. package/vendor/symengine/symengine/series.cpp +85 -0
  1650. package/vendor/symengine/symengine/series.h +727 -0
  1651. package/vendor/symengine/symengine/series_flint.h +214 -0
  1652. package/vendor/symengine/symengine/series_generic.cpp +247 -0
  1653. package/vendor/symengine/symengine/series_generic.h +86 -0
  1654. package/vendor/symengine/symengine/series_piranha.h +95 -0
  1655. package/vendor/symengine/symengine/series_visitor.h +357 -0
  1656. package/vendor/symengine/symengine/set_funcs.cpp +296 -0
  1657. package/vendor/symengine/symengine/sets.cpp +1854 -0
  1658. package/vendor/symengine/symengine/sets.h +696 -0
  1659. package/vendor/symengine/symengine/simplify.cpp +62 -0
  1660. package/vendor/symengine/symengine/simplify.h +34 -0
  1661. package/vendor/symengine/symengine/solve.cpp +665 -0
  1662. package/vendor/symengine/symengine/solve.h +117 -0
  1663. package/vendor/symengine/symengine/sparse_matrix.cpp +776 -0
  1664. package/vendor/symengine/symengine/special_boost.cpp +85 -0
  1665. package/vendor/symengine/symengine/special_double.h +570 -0
  1666. package/vendor/symengine/symengine/subs.h +579 -0
  1667. package/vendor/symengine/symengine/symbol.cpp +88 -0
  1668. package/vendor/symengine/symengine/symbol.h +116 -0
  1669. package/vendor/symengine/symengine/symengine_assert.h +50 -0
  1670. package/vendor/symengine/symengine/symengine_casts.h +139 -0
  1671. package/vendor/symengine/symengine/symengine_exception.h +101 -0
  1672. package/vendor/symengine/symengine/symengine_rcp.cpp +21 -0
  1673. package/vendor/symengine/symengine/symengine_rcp.h +384 -0
  1674. package/vendor/symengine/symengine/test_visitors.cpp +1083 -0
  1675. package/vendor/symengine/symengine/test_visitors.h +466 -0
  1676. package/vendor/symengine/symengine/tribool.h +85 -0
  1677. package/vendor/symengine/symengine/tuple.cpp +47 -0
  1678. package/vendor/symengine/symengine/tuple.h +32 -0
  1679. package/vendor/symengine/symengine/type_codes.inc +139 -0
  1680. package/vendor/symengine/symengine/utilities/cereal/LICENSE +24 -0
  1681. package/vendor/symengine/symengine/utilities/cereal/include/cereal/access.hpp +351 -0
  1682. package/vendor/symengine/symengine/utilities/cereal/include/cereal/archives/adapters.hpp +163 -0
  1683. package/vendor/symengine/symengine/utilities/cereal/include/cereal/archives/binary.hpp +169 -0
  1684. package/vendor/symengine/symengine/utilities/cereal/include/cereal/archives/json.hpp +1024 -0
  1685. package/vendor/symengine/symengine/utilities/cereal/include/cereal/archives/portable_binary.hpp +334 -0
  1686. package/vendor/symengine/symengine/utilities/cereal/include/cereal/archives/xml.hpp +956 -0
  1687. package/vendor/symengine/symengine/utilities/cereal/include/cereal/cereal.hpp +1120 -0
  1688. package/vendor/symengine/symengine/utilities/cereal/include/cereal/details/helpers.hpp +422 -0
  1689. package/vendor/symengine/symengine/utilities/cereal/include/cereal/details/polymorphic_impl.hpp +825 -0
  1690. package/vendor/symengine/symengine/utilities/cereal/include/cereal/details/polymorphic_impl_fwd.hpp +65 -0
  1691. package/vendor/symengine/symengine/utilities/cereal/include/cereal/details/static_object.hpp +128 -0
  1692. package/vendor/symengine/symengine/utilities/cereal/include/cereal/details/traits.hpp +1411 -0
  1693. package/vendor/symengine/symengine/utilities/cereal/include/cereal/details/util.hpp +84 -0
  1694. package/vendor/symengine/symengine/utilities/cereal/include/cereal/macros.hpp +156 -0
  1695. package/vendor/symengine/symengine/utilities/cereal/include/cereal/specialize.hpp +139 -0
  1696. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/array.hpp +79 -0
  1697. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/atomic.hpp +55 -0
  1698. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/base_class.hpp +203 -0
  1699. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/bitset.hpp +176 -0
  1700. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/boost_variant.hpp +164 -0
  1701. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/chrono.hpp +72 -0
  1702. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/common.hpp +129 -0
  1703. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/complex.hpp +56 -0
  1704. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/concepts/pair_associative_container.hpp +73 -0
  1705. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/deque.hpp +62 -0
  1706. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/forward_list.hpp +68 -0
  1707. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/functional.hpp +43 -0
  1708. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/list.hpp +62 -0
  1709. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/map.hpp +36 -0
  1710. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/memory.hpp +425 -0
  1711. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/optional.hpp +65 -0
  1712. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/polymorphic.hpp +483 -0
  1713. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/queue.hpp +132 -0
  1714. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/set.hpp +103 -0
  1715. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/stack.hpp +76 -0
  1716. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/string.hpp +61 -0
  1717. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/tuple.hpp +123 -0
  1718. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/unordered_map.hpp +36 -0
  1719. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/unordered_set.hpp +99 -0
  1720. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/utility.hpp +47 -0
  1721. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/valarray.hpp +89 -0
  1722. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/variant.hpp +108 -0
  1723. package/vendor/symengine/symengine/utilities/cereal/include/cereal/types/vector.hpp +112 -0
  1724. package/vendor/symengine/symengine/utilities/cereal/include/cereal/version.hpp +52 -0
  1725. package/vendor/symengine/symengine/utilities/fast_float/include/fast_float/fast_float.h +3720 -0
  1726. package/vendor/symengine/symengine/utilities/stream_fmt.h +25 -0
  1727. package/vendor/symengine/symengine/visitor.cpp +348 -0
  1728. package/vendor/symengine/symengine/visitor.h +425 -0
@@ -0,0 +1,3913 @@
1
+ #include <symengine/visitor.h>
2
+ #include <symengine/symengine_exception.h>
3
+ #include <symengine/eval_double.h>
4
+ #include <symengine/limits.h>
5
+ #include <symengine/real_double.h>
6
+ #include <symengine/complex_double.h>
7
+
8
+ namespace SymEngine
9
+ {
10
+
11
+ extern RCP<const Basic> &i2;
12
+ extern RCP<const Basic> &i3;
13
+ extern RCP<const Basic> &i5;
14
+ extern RCP<const Basic> &im2;
15
+ extern RCP<const Basic> &im3;
16
+ extern RCP<const Basic> &im5;
17
+
18
+ RCP<const Basic> sqrt(RCP<const Basic> &arg)
19
+ {
20
+ return pow(arg, div(one, i2));
21
+ }
22
+ RCP<const Basic> cbrt(RCP<const Basic> &arg)
23
+ {
24
+ return pow(arg, div(one, i3));
25
+ }
26
+
27
+ extern RCP<const Basic> &sq3;
28
+ extern RCP<const Basic> &sq2;
29
+ extern RCP<const Basic> &sq5;
30
+
31
+ extern RCP<const Basic> &C0;
32
+ extern RCP<const Basic> &C1;
33
+ extern RCP<const Basic> &C2;
34
+ extern RCP<const Basic> &C3;
35
+ extern RCP<const Basic> &C4;
36
+ extern RCP<const Basic> &C5;
37
+ extern RCP<const Basic> &C6;
38
+
39
+ extern RCP<const Basic> &mC0;
40
+ extern RCP<const Basic> &mC1;
41
+ extern RCP<const Basic> &mC2;
42
+ extern RCP<const Basic> &mC3;
43
+ extern RCP<const Basic> &mC4;
44
+ extern RCP<const Basic> &mC5;
45
+ extern RCP<const Basic> &mC6;
46
+
47
+ // sin_table()[n] represents the value of sin(pi*n/12) for n = 0..23
48
+ static const RCP<const Basic> *sin_table()
49
+ {
50
+ // lakutata: the tables are never destroyed, the threads of the addon may use them when the process exits
51
+ static const RCP<const Basic> *table = new RCP<const Basic>[24]{
52
+ zero, C0, C1, C2, C3, C4, one, C4, C3, C2, C1, C0,
53
+ zero, mC0, mC1, mC2, mC3, mC4, minus_one, mC4, mC3, mC2, mC1, mC0};
54
+ return table;
55
+ }
56
+
57
+ static const umap_basic_basic &inverse_cst()
58
+ {
59
+ static const umap_basic_basic &inverse_cst_ = *new umap_basic_basic{
60
+ {C3, i3},
61
+ {mC3, im3},
62
+ {C2, mul(i2, i2)},
63
+ {mC2, mul(im2, i2)},
64
+ {C4, integer(12)},
65
+ {mC4, integer(-12)},
66
+ {C5, i5},
67
+ {mC5, im5},
68
+ {C6, integer(10)},
69
+ {mC6, integer(-10)},
70
+ {div(one, i2), integer(6)},
71
+ {div(minus_one, i2), integer(-6)},
72
+ };
73
+ return inverse_cst_;
74
+ }
75
+
76
+ static const umap_basic_basic &inverse_tct()
77
+ {
78
+ static const umap_basic_basic &inverse_tct_ = *new umap_basic_basic{
79
+ {div(one, sq3), mul(i2, i3)},
80
+ {div(minus_one, sq3), mul(im2, i3)},
81
+ {sq3, i3},
82
+ {mul(minus_one, sq3), im3},
83
+ {add(one, sq2), div(pow(i2, i3), i3)},
84
+ {mul(minus_one, add(one, sq2)), div(pow(i2, i3), im3)},
85
+ {sub(sq2, one), pow(i2, i3)},
86
+ {sub(one, sq2), pow(im2, i3)},
87
+ {sub(i2, sq3), mul(mul(i2, i2), i3)},
88
+ {sub(sq3, i2), mul(mul(im2, i2), i3)},
89
+ {sqrt(add(i5, mul(i2, sqrt(i5)))), div(i5, i2)},
90
+ {mul(minus_one, sqrt(add(i5, mul(i2, sqrt(i5))))), div(im5, i2)},
91
+ {one, pow(i2, i2)},
92
+ {minus_one, mul(minus_one, pow(i2, i2))},
93
+ };
94
+ return inverse_tct_;
95
+ }
96
+
97
+ Conjugate::Conjugate(const RCP<const Basic> &arg) : OneArgFunction(arg)
98
+ {
99
+ SYMENGINE_ASSIGN_TYPEID()
100
+ SYMENGINE_ASSERT(is_canonical(arg))
101
+ }
102
+
103
+ bool Conjugate::is_canonical(const RCP<const Basic> &arg) const
104
+ {
105
+ if (is_a_Number(*arg)) {
106
+ if (eq(*arg, *ComplexInf)) {
107
+ return true;
108
+ }
109
+ return false;
110
+ }
111
+ if (is_a<Constant>(*arg)) {
112
+ return false;
113
+ }
114
+ if (is_a<Mul>(*arg)) {
115
+ return false;
116
+ }
117
+ if (is_a<Pow>(*arg)) {
118
+ if (is_a<Integer>(*down_cast<const Pow &>(*arg).get_exp())) {
119
+ return false;
120
+ }
121
+ }
122
+ // OneArgFunction classes
123
+ if (is_a<Sign>(*arg) or is_a<Conjugate>(*arg) or is_a<Erf>(*arg)
124
+ or is_a<Erfc>(*arg) or is_a<Gamma>(*arg) or is_a<LogGamma>(*arg)
125
+ or is_a<Abs>(*arg)) {
126
+ return false;
127
+ }
128
+ if (is_a<Sin>(*arg) or is_a<Cos>(*arg) or is_a<Tan>(*arg) or is_a<Cot>(*arg)
129
+ or is_a<Sec>(*arg) or is_a<Csc>(*arg)) {
130
+ return false;
131
+ }
132
+ if (is_a<Sinh>(*arg) or is_a<Cosh>(*arg) or is_a<Tanh>(*arg)
133
+ or is_a<Coth>(*arg) or is_a<Sech>(*arg) or is_a<Csch>(*arg)) {
134
+ return false;
135
+ }
136
+ // TwoArgFunction classes
137
+ if (is_a<KroneckerDelta>(*arg) or is_a<ATan2>(*arg)
138
+ or is_a<LowerGamma>(*arg) or is_a<UpperGamma>(*arg)
139
+ or is_a<Beta>(*arg)) {
140
+ return false;
141
+ }
142
+ // MultiArgFunction class
143
+ if (is_a<LeviCivita>(*arg)) {
144
+ return false;
145
+ }
146
+ return true;
147
+ }
148
+
149
+ RCP<const Basic> Conjugate::create(const RCP<const Basic> &arg) const
150
+ {
151
+ return conjugate(arg);
152
+ }
153
+
154
+ RCP<const Basic> conjugate(const RCP<const Basic> &arg)
155
+ {
156
+ if (is_a_Number(*arg)) {
157
+ return down_cast<const Number &>(*arg).conjugate();
158
+ }
159
+ if (is_a<Constant>(*arg) or is_a<Abs>(*arg) or is_a<KroneckerDelta>(*arg)
160
+ or is_a<LeviCivita>(*arg)) {
161
+ return arg;
162
+ }
163
+ if (is_a<Mul>(*arg)) {
164
+ const map_basic_basic &dict = down_cast<const Mul &>(*arg).get_dict();
165
+ map_basic_basic new_dict;
166
+ RCP<const Number> coef = rcp_static_cast<const Number>(
167
+ conjugate(down_cast<const Mul &>(*arg).get_coef()));
168
+ for (const auto &p : dict) {
169
+ if (is_a<Integer>(*p.second)) {
170
+ Mul::dict_add_term_new(outArg(coef), new_dict, p.second,
171
+ conjugate(p.first));
172
+ } else {
173
+ Mul::dict_add_term_new(
174
+ outArg(coef), new_dict, one,
175
+ conjugate(Mul::from_dict(one, {{p.first, p.second}})));
176
+ }
177
+ }
178
+ return Mul::from_dict(coef, std::move(new_dict));
179
+ }
180
+ if (is_a<Pow>(*arg)) {
181
+ RCP<const Basic> base = down_cast<const Pow &>(*arg).get_base();
182
+ RCP<const Basic> exp = down_cast<const Pow &>(*arg).get_exp();
183
+ if (is_a<Integer>(*exp)) {
184
+ return pow(conjugate(base), exp);
185
+ }
186
+ }
187
+ if (is_a<Conjugate>(*arg)) {
188
+ return down_cast<const Conjugate &>(*arg).get_arg();
189
+ }
190
+ if (is_a<Sign>(*arg) or is_a<Erf>(*arg) or is_a<Erfc>(*arg)
191
+ or is_a<Gamma>(*arg) or is_a<LogGamma>(*arg) or is_a<Sin>(*arg)
192
+ or is_a<Cos>(*arg) or is_a<Tan>(*arg) or is_a<Cot>(*arg)
193
+ or is_a<Sec>(*arg) or is_a<Csc>(*arg) or is_a<Sinh>(*arg)
194
+ or is_a<Cosh>(*arg) or is_a<Tanh>(*arg) or is_a<Coth>(*arg)
195
+ or is_a<Sech>(*arg) or is_a<Csch>(*arg)) {
196
+ const OneArgFunction &func = down_cast<const OneArgFunction &>(*arg);
197
+ return func.create(conjugate(func.get_arg()));
198
+ }
199
+ if (is_a<ATan2>(*arg) or is_a<LowerGamma>(*arg) or is_a<UpperGamma>(*arg)
200
+ or is_a<Beta>(*arg)) {
201
+ const TwoArgFunction &func = down_cast<const TwoArgFunction &>(*arg);
202
+ return func.create(conjugate(func.get_arg1()),
203
+ conjugate(func.get_arg2()));
204
+ }
205
+ return make_rcp<const Conjugate>(arg);
206
+ }
207
+
208
+ bool get_pi_shift(const RCP<const Basic> &arg, const Ptr<RCP<const Number>> &n,
209
+ const Ptr<RCP<const Basic>> &x)
210
+ {
211
+ if (is_a<Add>(*arg)) {
212
+ const Add &s = down_cast<const Add &>(*arg);
213
+ RCP<const Basic> coef = s.get_coef();
214
+ auto size = s.get_dict().size();
215
+ if (size > 1) {
216
+ // arg should be of form `x + n*pi`
217
+ // `n` is an integer
218
+ // `x` is an `Expression`
219
+ bool check_pi = false;
220
+ RCP<const Basic> temp;
221
+ *x = coef;
222
+ for (const auto &p : s.get_dict()) {
223
+ if (eq(*p.first, *pi)
224
+ and (is_a<Integer>(*p.second)
225
+ or is_a<Rational>(*p.second))) {
226
+ check_pi = true;
227
+ *n = p.second;
228
+ } else {
229
+ *x = add(mul(p.first, p.second), *x);
230
+ }
231
+ }
232
+ if (check_pi)
233
+ return true;
234
+ else // No term with `pi` found
235
+ return false;
236
+ } else if (size == 1) {
237
+ // arg should be of form `a + n*pi`
238
+ // where `a` is a `Number`.
239
+ auto p = s.get_dict().begin();
240
+ if (eq(*p->first, *pi)
241
+ and (is_a<Integer>(*p->second) or is_a<Rational>(*p->second))) {
242
+ *n = p->second;
243
+ *x = coef;
244
+ return true;
245
+ } else {
246
+ return false;
247
+ }
248
+ } else { // Should never reach here though!
249
+ // Dict of size < 1
250
+ return false;
251
+ }
252
+ } else if (is_a<Mul>(*arg)) {
253
+ // `arg` is of the form `k*pi/12`
254
+ const Mul &s = down_cast<const Mul &>(*arg);
255
+ auto p = s.get_dict().begin();
256
+ // dict should contain symbol `pi` only
257
+ if (s.get_dict().size() == 1 and eq(*p->first, *pi)
258
+ and eq(*p->second, *one)
259
+ and (is_a<Integer>(*s.get_coef())
260
+ or is_a<Rational>(*s.get_coef()))) {
261
+ *n = s.get_coef();
262
+ *x = zero;
263
+ return true;
264
+ } else {
265
+ return false;
266
+ }
267
+ } else if (eq(*arg, *pi)) {
268
+ *n = one;
269
+ *x = zero;
270
+ return true;
271
+ } else if (eq(*arg, *zero)) {
272
+ *n = zero;
273
+ *x = zero;
274
+ return true;
275
+ } else {
276
+ return false;
277
+ }
278
+ }
279
+
280
+ // Return true if arg is of form a+b*pi, with b integer or rational
281
+ // with denominator 2. The a may be zero or any expression.
282
+ bool trig_has_basic_shift(const RCP<const Basic> &arg)
283
+ {
284
+ if (is_a<Add>(*arg)) {
285
+ const Add &s = down_cast<const Add &>(*arg);
286
+ for (const auto &p : s.get_dict()) {
287
+ const auto &temp = mul(p.second, integer(2));
288
+ if (eq(*p.first, *pi)) {
289
+ if (is_a<Integer>(*temp)) {
290
+ return true;
291
+ }
292
+ if (is_a<Rational>(*temp)) {
293
+ auto m = down_cast<const Rational &>(*temp)
294
+ .as_rational_class();
295
+ return (m < 0) or (m > 1);
296
+ }
297
+ return false;
298
+ }
299
+ }
300
+ return false;
301
+ } else if (is_a<Mul>(*arg)) {
302
+ // is `arg` of the form `k*pi/2`?
303
+ // dict should contain symbol `pi` only
304
+ // and `k` should be a rational s.t. 0 < k < 1
305
+ const Mul &s = down_cast<const Mul &>(*arg);
306
+ RCP<const Basic> coef = mul(s.get_coef(), integer(2));
307
+ auto p = s.get_dict().begin();
308
+ if (s.get_dict().size() == 1 and eq(*p->first, *pi)
309
+ and eq(*p->second, *one)) {
310
+ if (is_a<Integer>(*coef)) {
311
+ return true;
312
+ }
313
+ if (is_a<Rational>(*coef)) {
314
+ auto m = down_cast<const Rational &>(*coef).as_rational_class();
315
+ return (m < 0) or (m > 1);
316
+ }
317
+ return false;
318
+ } else {
319
+ return false;
320
+ }
321
+ } else if (eq(*arg, *pi)) {
322
+ return true;
323
+ } else if (eq(*arg, *zero)) {
324
+ return true;
325
+ } else {
326
+ return false;
327
+ }
328
+ }
329
+
330
+ bool could_extract_minus(const Basic &arg)
331
+ {
332
+ if (is_a_Number(arg)) {
333
+ if (down_cast<const Number &>(arg).is_negative()) {
334
+ return true;
335
+ } else if (is_a_Complex(arg)) {
336
+ const ComplexBase &c = down_cast<const ComplexBase &>(arg);
337
+ RCP<const Number> real_part = c.real_part();
338
+ return (real_part->is_negative())
339
+ or (eq(*real_part, *zero)
340
+ and c.imaginary_part()->is_negative());
341
+ } else {
342
+ return false;
343
+ }
344
+ } else if (is_a<Mul>(arg)) {
345
+ const Mul &s = down_cast<const Mul &>(arg);
346
+ return could_extract_minus(*s.get_coef());
347
+ } else if (is_a<Add>(arg)) {
348
+ const Add &s = down_cast<const Add &>(arg);
349
+ if (s.get_coef()->is_zero()) {
350
+ map_basic_num d(s.get_dict().begin(), s.get_dict().end());
351
+ return could_extract_minus(*d.begin()->second);
352
+ } else {
353
+ return could_extract_minus(*s.get_coef());
354
+ }
355
+ } else {
356
+ return false;
357
+ }
358
+ }
359
+
360
+ bool handle_minus(const RCP<const Basic> &arg,
361
+ const Ptr<RCP<const Basic>> &rarg)
362
+ {
363
+ if (is_a<Mul>(*arg)) {
364
+ const Mul &s = down_cast<const Mul &>(*arg);
365
+ // Check for -Add instances to transform -(-x + 2*y) to (x - 2*y)
366
+ if (s.get_coef()->is_minus_one() && s.get_dict().size() == 1
367
+ && eq(*s.get_dict().begin()->second, *one)) {
368
+ return not handle_minus(mul(minus_one, arg), rarg);
369
+ } else if (could_extract_minus(*s.get_coef())) {
370
+ *rarg = mul(minus_one, arg);
371
+ return true;
372
+ }
373
+ } else if (is_a<Add>(*arg)) {
374
+ if (could_extract_minus(*arg)) {
375
+ const Add &s = down_cast<const Add &>(*arg);
376
+ // lakutata: added term by term, so that a sum among the terms is
377
+ // flattened (its coefficient -1 would become 1 in the dictionary)
378
+ RCP<const Basic> negated = s.get_coef()->mul(*minus_one);
379
+ for (const auto &p : s.get_dict()) {
380
+ negated = add(negated, mul(p.second->mul(*minus_one), p.first));
381
+ }
382
+ *rarg = negated;
383
+ return true;
384
+ }
385
+ } else if (could_extract_minus(*arg)) {
386
+ *rarg = mul(minus_one, arg);
387
+ return true;
388
+ }
389
+ *rarg = arg;
390
+ return false;
391
+ }
392
+
393
+ // \return true if conjugate has to be returned finally else false
394
+ bool trig_simplify(const RCP<const Basic> &arg, unsigned period, bool odd,
395
+ bool conj_odd, // input
396
+ const Ptr<RCP<const Basic>> &rarg, int &index,
397
+ int &sign) // output
398
+ {
399
+ bool check;
400
+ RCP<const Number> n;
401
+ RCP<const Basic> r;
402
+ RCP<const Basic> ret_arg;
403
+ check = get_pi_shift(arg, outArg(n), outArg(r));
404
+ if (check) {
405
+ RCP<const Number> t = mulnum(n, integer(12));
406
+ sign = 1;
407
+ if (is_a<Integer>(*t)) {
408
+ int m = numeric_cast<int>(
409
+ mod_f(down_cast<const Integer &>(*t), *integer(12 * period))
410
+ ->as_int());
411
+ if (eq(*r, *zero)) {
412
+ index = m;
413
+ *rarg = zero;
414
+ return false;
415
+ } else if (m == 0) {
416
+ index = 0;
417
+ bool b = handle_minus(r, outArg(ret_arg));
418
+ *rarg = ret_arg;
419
+ if (odd and b)
420
+ sign = -1;
421
+ return false;
422
+ }
423
+ }
424
+
425
+ rational_class m;
426
+ if (is_a<Integer>(*n)) {
427
+ // 2*pi periodic => f(r + pi * n) = f(r - pi * n)
428
+ m = mp_abs(down_cast<const Integer &>(*n).as_integer_class());
429
+ m /= period;
430
+ } else {
431
+ SYMENGINE_ASSERT(is_a<Rational>(*n));
432
+ m = down_cast<const Rational &>(*n).as_rational_class() / period;
433
+ integer_class t;
434
+ #if SYMENGINE_INTEGER_CLASS != SYMENGINE_BOOSTMP
435
+ mp_fdiv_r(t, get_num(m), get_den(m));
436
+ get_num(m) = t;
437
+ #else
438
+ integer_class quo;
439
+ mp_fdiv_qr(quo, t, get_num(m), get_den(m));
440
+ m -= rational_class(quo);
441
+ #endif
442
+ // m = a / b => m = (a % b / b)
443
+ }
444
+ // Now, arg = r + 2 * pi * m where 0 <= m < 1
445
+ m *= 2 * period;
446
+ // Now, arg = r + pi * m / 2 where 0 <= m < 4
447
+ if (m >= 2 and m < 3) {
448
+ sign = -1;
449
+ r = add(r, mul(pi, Rational::from_mpq((m - 2) / 2)));
450
+ bool b = handle_minus(r, outArg(ret_arg));
451
+ *rarg = ret_arg;
452
+ if (odd and b)
453
+ sign = -1 * sign;
454
+ return false;
455
+ } else if (m >= 1) {
456
+ if (m < 2) {
457
+ // 1 <= m < 2
458
+ sign = 1;
459
+ r = add(r, mul(pi, Rational::from_mpq((m - 1) / 2)));
460
+ } else {
461
+ // 3 <= m < 4
462
+ sign = -1;
463
+ r = add(r, mul(pi, Rational::from_mpq((m - 3) / 2)));
464
+ }
465
+ bool b = handle_minus(r, outArg(ret_arg));
466
+ *rarg = ret_arg;
467
+ if (not b and conj_odd)
468
+ sign = -sign;
469
+ return true;
470
+ } else {
471
+ *rarg = add(r, mul(pi, Rational::from_mpq(m / 2)));
472
+ index = -1;
473
+ return false;
474
+ }
475
+ } else {
476
+ bool b = handle_minus(arg, outArg(ret_arg));
477
+ *rarg = ret_arg;
478
+ index = -1;
479
+ if (odd and b)
480
+ sign = -1;
481
+ else
482
+ sign = 1;
483
+ return false;
484
+ }
485
+ }
486
+
487
+ bool inverse_lookup(const umap_basic_basic &d, const RCP<const Basic> &t,
488
+ const Ptr<RCP<const Basic>> &index)
489
+ {
490
+ auto it = d.find(t);
491
+ if (it == d.end()) {
492
+ // Not found in lookup
493
+ return false;
494
+ } else {
495
+ *index = (it->second);
496
+ return true;
497
+ }
498
+ }
499
+
500
+ Sign::Sign(const RCP<const Basic> &arg) : OneArgFunction(arg)
501
+ {
502
+ SYMENGINE_ASSIGN_TYPEID()
503
+ SYMENGINE_ASSERT(is_canonical(arg))
504
+ }
505
+
506
+ bool Sign::is_canonical(const RCP<const Basic> &arg) const
507
+ {
508
+ if (is_a_Number(*arg)) {
509
+ if (eq(*arg, *ComplexInf)) {
510
+ return true;
511
+ }
512
+ return false;
513
+ }
514
+ if (is_a<Constant>(*arg)) {
515
+ return false;
516
+ }
517
+ if (is_a<Sign>(*arg)) {
518
+ return false;
519
+ }
520
+ if (is_a<Mul>(*arg)) {
521
+ if (neq(*down_cast<const Mul &>(*arg).get_coef(), *one)
522
+ and neq(*down_cast<const Mul &>(*arg).get_coef(), *minus_one)) {
523
+ return false;
524
+ }
525
+ }
526
+ return true;
527
+ }
528
+
529
+ RCP<const Basic> Sign::create(const RCP<const Basic> &arg) const
530
+ {
531
+ return sign(arg);
532
+ }
533
+
534
+ RCP<const Basic> sign(const RCP<const Basic> &arg)
535
+ {
536
+ if (is_a_Number(*arg)) {
537
+ if (is_a<NaN>(*arg)) {
538
+ return Nan;
539
+ }
540
+ if (down_cast<const Number &>(*arg).is_zero()) {
541
+ return zero;
542
+ }
543
+ if (down_cast<const Number &>(*arg).is_positive()) {
544
+ return one;
545
+ }
546
+ if (down_cast<const Number &>(*arg).is_negative()) {
547
+ return minus_one;
548
+ }
549
+ if (is_a_Complex(*arg)
550
+ and down_cast<const ComplexBase &>(*arg).is_re_zero()) {
551
+ RCP<const Number> r
552
+ = down_cast<const ComplexBase &>(*arg).imaginary_part();
553
+ if (down_cast<const Number &>(*r).is_positive()) {
554
+ return I;
555
+ }
556
+ if (down_cast<const Number &>(*r).is_negative()) {
557
+ return mul(minus_one, I);
558
+ }
559
+ }
560
+ }
561
+ if (is_a<Constant>(*arg)) {
562
+ if (eq(*arg, *pi) or eq(*arg, *E) or eq(*arg, *EulerGamma)
563
+ or eq(*arg, *Catalan) or eq(*arg, *GoldenRatio))
564
+ return one;
565
+ }
566
+ if (is_a<Sign>(*arg)) {
567
+ return arg;
568
+ }
569
+ if (is_a<Mul>(*arg)) {
570
+ // lakutata: the sign of each factor, where it is known (sign(2*sqrt(3))
571
+ // is 1, sign(-e) is -1); SymEngine kept the factors after the coefficient
572
+ RCP<const Basic> s = sign(down_cast<const Mul &>(*arg).get_coef());
573
+ map_basic_basic rest;
574
+ for (const auto &p : down_cast<const Mul &>(*arg).get_dict()) {
575
+ map_basic_basic single;
576
+ insert(single, p.first, p.second);
577
+ const RCP<const Basic> power = Mul::from_dict(one, std::move(single));
578
+ const RCP<const Basic> factor = sign(power);
579
+ // Unknown: sign(factor) itself; a factor that is a sign is its own
580
+ if (is_a<Sign>(*factor)
581
+ and eq(*down_cast<const Sign &>(*factor).get_arg(), *power)) {
582
+ insert(rest, p.first, p.second);
583
+ } else {
584
+ s = mul(s, factor);
585
+ }
586
+ }
587
+ if (rest.empty())
588
+ return s;
589
+ return mul(s,
590
+ make_rcp<const Sign>(Mul::from_dict(one, std::move(rest))));
591
+ }
592
+ if (is_a<Pow>(*arg)) {
593
+ RCP<const Pow> pow_arg = rcp_static_cast<const Pow>(arg);
594
+ RCP<const Basic> s = sign(pow_arg->get_base());
595
+ // lakutata: a number only (the sign of a base -x is -sign(x), whose
596
+ // power came back here without end)
597
+ if (is_a_Number(*s) and not eq(*s, *pow_arg->get_base())) {
598
+ return sign(pow(s, pow_arg->get_exp()));
599
+ }
600
+ }
601
+ // lakutata: a number written as an expression (pi - 3), its sign from its
602
+ // value when it is clearly away from zero
603
+ if (free_symbols(*arg).empty()) {
604
+ try {
605
+ const std::complex<double> value = eval_complex_double(*arg);
606
+ if (value.imag() == 0 and std::abs(value.real()) > 1e-10)
607
+ return value.real() > 0 ? one : minus_one;
608
+ } catch (SymEngineException &) {
609
+ }
610
+ }
611
+ return make_rcp<const Sign>(arg);
612
+ }
613
+
614
+ Floor::Floor(const RCP<const Basic> &arg) : OneArgFunction(arg)
615
+ {
616
+ SYMENGINE_ASSIGN_TYPEID()
617
+ SYMENGINE_ASSERT(is_canonical(arg))
618
+ }
619
+
620
+ bool Floor::is_canonical(const RCP<const Basic> &arg) const
621
+ {
622
+ if (is_a_Number(*arg)) {
623
+ return false;
624
+ }
625
+ if (is_a<Constant>(*arg)) {
626
+ return false;
627
+ }
628
+ if (is_a<Floor>(*arg)) {
629
+ return false;
630
+ }
631
+ if (is_a<Ceiling>(*arg)) {
632
+ return false;
633
+ }
634
+ if (is_a<Truncate>(*arg)) {
635
+ return false;
636
+ }
637
+ if (is_a<BooleanAtom>(*arg) or is_a_Relational(*arg)) {
638
+ return false;
639
+ }
640
+ if (is_a<Add>(*arg)) {
641
+ RCP<const Number> s = down_cast<const Add &>(*arg).get_coef();
642
+ if (neq(*zero, *s) and is_a<Integer>(*s)) {
643
+ return false;
644
+ }
645
+ }
646
+ return true;
647
+ }
648
+
649
+ RCP<const Basic> Floor::create(const RCP<const Basic> &arg) const
650
+ {
651
+ return floor(arg);
652
+ }
653
+
654
+ // lakutata: the integer part of a real number written as an expression
655
+ // (floor(sqrt(2)) is 1), from its value when it is clearly away from an
656
+ // integer and small enough for a double to tell
657
+ static bool integer_part_of(const RCP<const Basic> &arg, double (*part)(double),
658
+ const Ptr<RCP<const Basic>> &value)
659
+ {
660
+ if (is_a_Number(*arg) or not free_symbols(*arg).empty())
661
+ return false;
662
+ try {
663
+ const double x = eval_double(*arg);
664
+ if (not std::isfinite(x) or std::abs(x) > 1e15
665
+ or std::abs(x - std::round(x)) <= 1e-10 * std::max(1.0, std::abs(x)))
666
+ return false;
667
+ *value = integer(integer_class(static_cast<long long>(part(x))));
668
+ return true;
669
+ } catch (SymEngineException &) {
670
+ return false;
671
+ }
672
+ }
673
+
674
+ RCP<const Basic> floor(const RCP<const Basic> &arg)
675
+ {
676
+ if (is_a_Number(*arg)) {
677
+ if (down_cast<const Number &>(*arg).is_exact()) {
678
+ if (is_a<Rational>(*arg)) {
679
+ const Rational &s = down_cast<const Rational &>(*arg);
680
+ integer_class quotient;
681
+ mp_fdiv_q(quotient, SymEngine::get_num(s.as_rational_class()),
682
+ SymEngine::get_den(s.as_rational_class()));
683
+ return integer(std::move(quotient));
684
+ }
685
+ return arg;
686
+ }
687
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
688
+ return _arg->get_eval().floor(*_arg);
689
+ }
690
+ if (is_a<Constant>(*arg)) {
691
+ if (eq(*arg, *pi)) {
692
+ return integer(3);
693
+ }
694
+ if (eq(*arg, *E)) {
695
+ return integer(2);
696
+ }
697
+ if (eq(*arg, *GoldenRatio)) {
698
+ return integer(1);
699
+ }
700
+ if (eq(*arg, *Catalan) or eq(*arg, *EulerGamma)) {
701
+ return integer(0);
702
+ }
703
+ }
704
+ if (is_a<Floor>(*arg)) {
705
+ return arg;
706
+ }
707
+ if (is_a<Ceiling>(*arg)) {
708
+ return arg;
709
+ }
710
+ if (is_a<Truncate>(*arg)) {
711
+ return arg;
712
+ }
713
+ if (is_a<BooleanAtom>(*arg) or is_a_Relational(*arg)) {
714
+ throw SymEngineException(
715
+ "Boolean objects not allowed in this context.");
716
+ }
717
+ if (is_a<Add>(*arg)) {
718
+ RCP<const Number> s = down_cast<const Add &>(*arg).get_coef();
719
+ umap_basic_num d = down_cast<const Add &>(*arg).get_dict();
720
+ if (is_a<Integer>(*s)
721
+ and not down_cast<const Integer &>(*s).is_zero()) {
722
+ return add(s, floor(Add::from_dict(zero, std::move(d))));
723
+ }
724
+ }
725
+ RCP<const Basic> value;
726
+ if (integer_part_of(arg, std::floor, outArg(value)))
727
+ return value;
728
+ return make_rcp<const Floor>(arg);
729
+ }
730
+
731
+ Ceiling::Ceiling(const RCP<const Basic> &arg) : OneArgFunction(arg)
732
+ {
733
+ SYMENGINE_ASSIGN_TYPEID()
734
+ SYMENGINE_ASSERT(is_canonical(arg))
735
+ }
736
+
737
+ bool Ceiling::is_canonical(const RCP<const Basic> &arg) const
738
+ {
739
+ if (is_a_Number(*arg)) {
740
+ return false;
741
+ }
742
+ if (is_a<Constant>(*arg)) {
743
+ return false;
744
+ }
745
+ if (is_a<Floor>(*arg)) {
746
+ return false;
747
+ }
748
+ if (is_a<Ceiling>(*arg)) {
749
+ return false;
750
+ }
751
+ if (is_a<Truncate>(*arg)) {
752
+ return false;
753
+ }
754
+ if (is_a<BooleanAtom>(*arg) or is_a_Relational(*arg)) {
755
+ return false;
756
+ }
757
+ if (is_a<Add>(*arg)) {
758
+ RCP<const Number> s = down_cast<const Add &>(*arg).get_coef();
759
+ if (neq(*zero, *s) and is_a<Integer>(*s)) {
760
+ return false;
761
+ }
762
+ }
763
+ return true;
764
+ }
765
+
766
+ RCP<const Basic> Ceiling::create(const RCP<const Basic> &arg) const
767
+ {
768
+ return ceiling(arg);
769
+ }
770
+
771
+ RCP<const Basic> ceiling(const RCP<const Basic> &arg)
772
+ {
773
+ if (is_a_Number(*arg)) {
774
+ if (down_cast<const Number &>(*arg).is_exact()) {
775
+ if (is_a<Rational>(*arg)) {
776
+ const Rational &s = down_cast<const Rational &>(*arg);
777
+ integer_class quotient;
778
+ mp_cdiv_q(quotient, SymEngine::get_num(s.as_rational_class()),
779
+ SymEngine::get_den(s.as_rational_class()));
780
+ return integer(std::move(quotient));
781
+ }
782
+ return arg;
783
+ }
784
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
785
+ return _arg->get_eval().ceiling(*_arg);
786
+ }
787
+ if (is_a<Constant>(*arg)) {
788
+ if (eq(*arg, *pi)) {
789
+ return integer(4);
790
+ }
791
+ if (eq(*arg, *E)) {
792
+ return integer(3);
793
+ }
794
+ if (eq(*arg, *GoldenRatio)) {
795
+ return integer(2);
796
+ }
797
+ if (eq(*arg, *Catalan) or eq(*arg, *EulerGamma)) {
798
+ return integer(1);
799
+ }
800
+ }
801
+ if (is_a<Floor>(*arg)) {
802
+ return arg;
803
+ }
804
+ if (is_a<Ceiling>(*arg)) {
805
+ return arg;
806
+ }
807
+ if (is_a<Truncate>(*arg)) {
808
+ return arg;
809
+ }
810
+ if (is_a<BooleanAtom>(*arg) or is_a_Relational(*arg)) {
811
+ throw SymEngineException(
812
+ "Boolean objects not allowed in this context.");
813
+ }
814
+ if (is_a<Add>(*arg)) {
815
+ RCP<const Number> s = down_cast<const Add &>(*arg).get_coef();
816
+ umap_basic_num d = down_cast<const Add &>(*arg).get_dict();
817
+ // lakutata: the rest evaluated too (ceiling(5 + pi) is 5 + ceiling(pi), a number)
818
+ if (is_a<Integer>(*s) and not s->is_zero()) {
819
+ return add(s, ceiling(Add::from_dict(zero, std::move(d))));
820
+ }
821
+ }
822
+ RCP<const Basic> value;
823
+ if (integer_part_of(arg, std::ceil, outArg(value)))
824
+ return value;
825
+ return make_rcp<const Ceiling>(arg);
826
+ }
827
+
828
+ Truncate::Truncate(const RCP<const Basic> &arg) : OneArgFunction(arg)
829
+ {
830
+ SYMENGINE_ASSIGN_TYPEID()
831
+ SYMENGINE_ASSERT(is_canonical(arg))
832
+ }
833
+
834
+ bool Truncate::is_canonical(const RCP<const Basic> &arg) const
835
+ {
836
+ if (is_a_Number(*arg)) {
837
+ return false;
838
+ }
839
+ if (is_a<Constant>(*arg)) {
840
+ return false;
841
+ }
842
+ if (is_a<Floor>(*arg)) {
843
+ return false;
844
+ }
845
+ if (is_a<Ceiling>(*arg)) {
846
+ return false;
847
+ }
848
+ if (is_a<Truncate>(*arg)) {
849
+ return false;
850
+ }
851
+ if (is_a<BooleanAtom>(*arg) or is_a_Relational(*arg)) {
852
+ return false;
853
+ }
854
+ if (is_a<Add>(*arg)) {
855
+ RCP<const Number> s = down_cast<const Add &>(*arg).get_coef();
856
+ if (neq(*zero, *s) and is_a<Integer>(*s)) {
857
+ return false;
858
+ }
859
+ }
860
+ return true;
861
+ }
862
+
863
+ RCP<const Basic> Truncate::create(const RCP<const Basic> &arg) const
864
+ {
865
+ return truncate(arg);
866
+ }
867
+
868
+ RCP<const Basic> truncate(const RCP<const Basic> &arg)
869
+ {
870
+ if (is_a_Number(*arg)) {
871
+ if (down_cast<const Number &>(*arg).is_exact()) {
872
+ if (is_a<Rational>(*arg)) {
873
+ const Rational &s = down_cast<const Rational &>(*arg);
874
+ integer_class quotient;
875
+ mp_tdiv_q(quotient, SymEngine::get_num(s.as_rational_class()),
876
+ SymEngine::get_den(s.as_rational_class()));
877
+ return integer(std::move(quotient));
878
+ }
879
+ return arg;
880
+ }
881
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
882
+ return _arg->get_eval().truncate(*_arg);
883
+ }
884
+ if (is_a<Constant>(*arg)) {
885
+ if (eq(*arg, *pi)) {
886
+ return integer(3);
887
+ }
888
+ if (eq(*arg, *E)) {
889
+ return integer(2);
890
+ }
891
+ if (eq(*arg, *GoldenRatio)) {
892
+ return integer(1);
893
+ }
894
+ if (eq(*arg, *Catalan) or eq(*arg, *EulerGamma)) {
895
+ return integer(0);
896
+ }
897
+ }
898
+ if (is_a<Floor>(*arg)) {
899
+ return arg;
900
+ }
901
+ if (is_a<Ceiling>(*arg)) {
902
+ return arg;
903
+ }
904
+ if (is_a<Truncate>(*arg)) {
905
+ return arg;
906
+ }
907
+ if (is_a<BooleanAtom>(*arg) or is_a_Relational(*arg)) {
908
+ throw SymEngineException(
909
+ "Boolean objects not allowed in this context.");
910
+ }
911
+ if (is_a<Add>(*arg)) {
912
+ RCP<const Number> s = down_cast<const Add &>(*arg).get_coef();
913
+ umap_basic_num d = down_cast<const Add &>(*arg).get_dict();
914
+ // lakutata: no integer taken out, trunc(5 - 1/2) is 4, not
915
+ // 5 + trunc(-1/2); SymEngine took it out
916
+ (void)s;
917
+ (void)d;
918
+ }
919
+ RCP<const Basic> value;
920
+ if (integer_part_of(arg, std::trunc, outArg(value)))
921
+ return value;
922
+ return make_rcp<const Truncate>(arg);
923
+ }
924
+
925
+ Sin::Sin(const RCP<const Basic> &arg) : TrigFunction(arg)
926
+ {
927
+ SYMENGINE_ASSIGN_TYPEID()
928
+ SYMENGINE_ASSERT(is_canonical(arg))
929
+ }
930
+
931
+ bool Sin::is_canonical(const RCP<const Basic> &arg) const
932
+ {
933
+ // e.g. sin(0)
934
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
935
+ return false;
936
+ // e.g sin(7*pi/2+y)
937
+ if (trig_has_basic_shift(arg)) {
938
+ return false;
939
+ }
940
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
941
+ return false;
942
+ }
943
+ return true;
944
+ }
945
+
946
+ RCP<const Basic> sin(const RCP<const Basic> &arg)
947
+ {
948
+ if (eq(*arg, *zero))
949
+ return zero;
950
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
951
+ return down_cast<const Number &>(*arg).get_eval().sin(*arg);
952
+ }
953
+
954
+ if (is_a<ASin>(*arg)) {
955
+ return down_cast<const ASin &>(*arg).get_arg();
956
+ } else if (is_a<ACsc>(*arg)) {
957
+ return div(one, down_cast<const ACsc &>(*arg).get_arg());
958
+ }
959
+
960
+ RCP<const Basic> ret_arg;
961
+ int index, sign;
962
+ bool conjugate = trig_simplify(arg, 2, true, false, // input
963
+ outArg(ret_arg), index, sign); // output
964
+
965
+ if (conjugate) {
966
+ // cos has to be returned
967
+ if (sign == 1) {
968
+ return cos(ret_arg);
969
+ } else {
970
+ return mul(minus_one, cos(ret_arg));
971
+ }
972
+ } else {
973
+ if (eq(*ret_arg, *zero)) {
974
+ return mul(integer(sign), sin_table()[index]);
975
+ } else {
976
+ // If ret_arg is the same as arg, a `Sin` instance is returned
977
+ // Or else `sin` is called again.
978
+ if (sign == 1) {
979
+ if (neq(*ret_arg, *arg)) {
980
+ return sin(ret_arg);
981
+ } else {
982
+ return make_rcp<const Sin>(arg);
983
+ }
984
+ } else {
985
+ return mul(minus_one, sin(ret_arg));
986
+ }
987
+ }
988
+ }
989
+ }
990
+
991
+ /* ---------------------------- */
992
+
993
+ Cos::Cos(const RCP<const Basic> &arg) : TrigFunction(arg)
994
+ {
995
+ SYMENGINE_ASSIGN_TYPEID()
996
+ SYMENGINE_ASSERT(is_canonical(arg))
997
+ }
998
+
999
+ bool Cos::is_canonical(const RCP<const Basic> &arg) const
1000
+ {
1001
+ // e.g. cos(0)
1002
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
1003
+ return false;
1004
+ // e.g cos(k*pi/2)
1005
+ if (trig_has_basic_shift(arg)) {
1006
+ return false;
1007
+ }
1008
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1009
+ return false;
1010
+ }
1011
+ return true;
1012
+ }
1013
+
1014
+ RCP<const Basic> cos(const RCP<const Basic> &arg)
1015
+ {
1016
+ if (eq(*arg, *zero))
1017
+ return one;
1018
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1019
+ return down_cast<const Number &>(*arg).get_eval().cos(*arg);
1020
+ }
1021
+
1022
+ if (is_a<ACos>(*arg)) {
1023
+ return down_cast<const ACos &>(*arg).get_arg();
1024
+ } else if (is_a<ASec>(*arg)) {
1025
+ return div(one, down_cast<const ASec &>(*arg).get_arg());
1026
+ }
1027
+
1028
+ RCP<const Basic> ret_arg;
1029
+ int index, sign;
1030
+ bool conjugate = trig_simplify(arg, 2, false, true, // input
1031
+ outArg(ret_arg), index, sign); // output
1032
+
1033
+ if (conjugate) {
1034
+ // sin has to be returned
1035
+ if (sign == 1) {
1036
+ return sin(ret_arg);
1037
+ } else {
1038
+ return mul(minus_one, sin(ret_arg));
1039
+ }
1040
+ } else {
1041
+ if (eq(*ret_arg, *zero)) {
1042
+ return mul(integer(sign), sin_table()[(index + 6) % 24]);
1043
+ } else {
1044
+ if (sign == 1) {
1045
+ if (neq(*ret_arg, *arg)) {
1046
+ return cos(ret_arg);
1047
+ } else {
1048
+ return make_rcp<const Cos>(ret_arg);
1049
+ }
1050
+ } else {
1051
+ return mul(minus_one, cos(ret_arg));
1052
+ }
1053
+ }
1054
+ }
1055
+ }
1056
+
1057
+ /* ---------------------------- */
1058
+
1059
+ Tan::Tan(const RCP<const Basic> &arg) : TrigFunction(arg)
1060
+ {
1061
+ SYMENGINE_ASSIGN_TYPEID()
1062
+ SYMENGINE_ASSERT(is_canonical(arg))
1063
+ }
1064
+
1065
+ bool Tan::is_canonical(const RCP<const Basic> &arg) const
1066
+ {
1067
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
1068
+ return false;
1069
+ // e.g tan(k*pi/2)
1070
+ if (trig_has_basic_shift(arg)) {
1071
+ return false;
1072
+ }
1073
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1074
+ return false;
1075
+ }
1076
+ return true;
1077
+ }
1078
+
1079
+ RCP<const Basic> tan(const RCP<const Basic> &arg)
1080
+ {
1081
+ if (eq(*arg, *zero))
1082
+ return zero;
1083
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1084
+ return down_cast<const Number &>(*arg).get_eval().tan(*arg);
1085
+ }
1086
+
1087
+ if (is_a<ATan>(*arg)) {
1088
+ return down_cast<const ATan &>(*arg).get_arg();
1089
+ } else if (is_a<ACot>(*arg)) {
1090
+ return div(one, down_cast<const ACot &>(*arg).get_arg());
1091
+ }
1092
+
1093
+ RCP<const Basic> ret_arg;
1094
+ int index, sign;
1095
+ bool conjugate = trig_simplify(arg, 1, true, true, // input
1096
+ outArg(ret_arg), index, sign); // output
1097
+
1098
+ if (conjugate) {
1099
+ // cot has to be returned
1100
+ if (sign == 1) {
1101
+ return cot(ret_arg);
1102
+ } else {
1103
+ return mul(minus_one, cot(ret_arg));
1104
+ }
1105
+ } else {
1106
+ if (eq(*ret_arg, *zero)) {
1107
+ return mul(integer(sign),
1108
+ div(sin_table()[index], sin_table()[(index + 6) % 24]));
1109
+ } else {
1110
+ if (sign == 1) {
1111
+ if (neq(*ret_arg, *arg)) {
1112
+ return tan(ret_arg);
1113
+ } else {
1114
+ return make_rcp<const Tan>(ret_arg);
1115
+ }
1116
+ } else {
1117
+ return mul(minus_one, tan(ret_arg));
1118
+ }
1119
+ }
1120
+ }
1121
+ }
1122
+
1123
+ /* ---------------------------- */
1124
+
1125
+ Cot::Cot(const RCP<const Basic> &arg) : TrigFunction(arg)
1126
+ {
1127
+ SYMENGINE_ASSIGN_TYPEID()
1128
+ SYMENGINE_ASSERT(is_canonical(arg))
1129
+ }
1130
+
1131
+ bool Cot::is_canonical(const RCP<const Basic> &arg) const
1132
+ {
1133
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
1134
+ return false;
1135
+ // e.g cot(k*pi/2)
1136
+ if (trig_has_basic_shift(arg)) {
1137
+ return false;
1138
+ }
1139
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1140
+ return false;
1141
+ }
1142
+ return true;
1143
+ }
1144
+
1145
+ RCP<const Basic> cot(const RCP<const Basic> &arg)
1146
+ {
1147
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1148
+ return down_cast<const Number &>(*arg).get_eval().cot(*arg);
1149
+ }
1150
+
1151
+ if (is_a<ACot>(*arg)) {
1152
+ return down_cast<const ACot &>(*arg).get_arg();
1153
+ } else if (is_a<ATan>(*arg)) {
1154
+ return div(one, down_cast<const ATan &>(*arg).get_arg());
1155
+ }
1156
+
1157
+ RCP<const Basic> ret_arg;
1158
+ int index, sign;
1159
+ bool conjugate = trig_simplify(arg, 1, true, true, // input
1160
+ outArg(ret_arg), index, sign); // output
1161
+
1162
+ if (conjugate) {
1163
+ // tan has to be returned
1164
+ if (sign == 1) {
1165
+ return tan(ret_arg);
1166
+ } else {
1167
+ return mul(minus_one, tan(ret_arg));
1168
+ }
1169
+ } else {
1170
+ if (eq(*ret_arg, *zero)) {
1171
+ return mul(integer(sign),
1172
+ div(sin_table()[(index + 6) % 24], sin_table()[index]));
1173
+ } else {
1174
+ if (sign == 1) {
1175
+ if (neq(*ret_arg, *arg)) {
1176
+ return cot(ret_arg);
1177
+ } else {
1178
+ return make_rcp<const Cot>(ret_arg);
1179
+ }
1180
+ } else {
1181
+ return mul(minus_one, cot(ret_arg));
1182
+ }
1183
+ }
1184
+ }
1185
+ }
1186
+
1187
+ /* ---------------------------- */
1188
+
1189
+ Csc::Csc(const RCP<const Basic> &arg) : TrigFunction(arg)
1190
+ {
1191
+ SYMENGINE_ASSIGN_TYPEID()
1192
+ SYMENGINE_ASSERT(is_canonical(arg))
1193
+ }
1194
+
1195
+ bool Csc::is_canonical(const RCP<const Basic> &arg) const
1196
+ {
1197
+ // e.g. Csc(0)
1198
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
1199
+ return false;
1200
+ // e.g csc(k*pi/2)
1201
+ if (trig_has_basic_shift(arg)) {
1202
+ return false;
1203
+ }
1204
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1205
+ return false;
1206
+ }
1207
+ return true;
1208
+ }
1209
+
1210
+ RCP<const Basic> csc(const RCP<const Basic> &arg)
1211
+ {
1212
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1213
+ return down_cast<const Number &>(*arg).get_eval().csc(*arg);
1214
+ }
1215
+
1216
+ if (is_a<ACsc>(*arg)) {
1217
+ return down_cast<const ACsc &>(*arg).get_arg();
1218
+ } else if (is_a<ASin>(*arg)) {
1219
+ return div(one, down_cast<const ASin &>(*arg).get_arg());
1220
+ }
1221
+
1222
+ RCP<const Basic> ret_arg;
1223
+ int index, sign;
1224
+ bool conjugate = trig_simplify(arg, 2, true, false, // input
1225
+ outArg(ret_arg), index, sign); // output
1226
+
1227
+ if (conjugate) {
1228
+ // cos has to be returned
1229
+ if (sign == 1) {
1230
+ return sec(ret_arg);
1231
+ } else {
1232
+ return mul(minus_one, sec(ret_arg));
1233
+ }
1234
+ } else {
1235
+ if (eq(*ret_arg, *zero)) {
1236
+ return mul(integer(sign), div(one, sin_table()[index]));
1237
+ } else {
1238
+ if (sign == 1) {
1239
+ if (neq(*ret_arg, *arg)) {
1240
+ return csc(ret_arg);
1241
+ } else {
1242
+ return make_rcp<const Csc>(ret_arg);
1243
+ }
1244
+ } else {
1245
+ return mul(minus_one, csc(ret_arg));
1246
+ }
1247
+ }
1248
+ }
1249
+ }
1250
+
1251
+ /* ---------------------------- */
1252
+
1253
+ Sec::Sec(const RCP<const Basic> &arg) : TrigFunction(arg)
1254
+ {
1255
+ SYMENGINE_ASSIGN_TYPEID()
1256
+ SYMENGINE_ASSERT(is_canonical(arg))
1257
+ }
1258
+
1259
+ bool Sec::is_canonical(const RCP<const Basic> &arg) const
1260
+ {
1261
+ // e.g. Sec(0)
1262
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
1263
+ return false;
1264
+ // e.g sec(k*pi/2)
1265
+ if (trig_has_basic_shift(arg)) {
1266
+ return false;
1267
+ }
1268
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1269
+ return false;
1270
+ }
1271
+ return true;
1272
+ }
1273
+
1274
+ RCP<const Basic> sec(const RCP<const Basic> &arg)
1275
+ {
1276
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1277
+ return down_cast<const Number &>(*arg).get_eval().sec(*arg);
1278
+ }
1279
+
1280
+ if (is_a<ASec>(*arg)) {
1281
+ return down_cast<const ASec &>(*arg).get_arg();
1282
+ } else if (is_a<ACos>(*arg)) {
1283
+ return div(one, down_cast<const ACos &>(*arg).get_arg());
1284
+ }
1285
+
1286
+ RCP<const Basic> ret_arg;
1287
+ int index, sign;
1288
+ bool conjugate = trig_simplify(arg, 2, false, true, // input
1289
+ outArg(ret_arg), index, sign); // output
1290
+
1291
+ if (conjugate) {
1292
+ // csc has to be returned
1293
+ if (sign == 1) {
1294
+ return csc(ret_arg);
1295
+ } else {
1296
+ return mul(minus_one, csc(ret_arg));
1297
+ }
1298
+ } else {
1299
+ if (eq(*ret_arg, *zero)) {
1300
+ return mul(integer(sign), div(one, sin_table()[(index + 6) % 24]));
1301
+ } else {
1302
+ if (sign == 1) {
1303
+ if (neq(*ret_arg, *arg)) {
1304
+ return sec(ret_arg);
1305
+ } else {
1306
+ return make_rcp<const Sec>(ret_arg);
1307
+ }
1308
+ } else {
1309
+ return mul(minus_one, sec(ret_arg));
1310
+ }
1311
+ }
1312
+ }
1313
+ }
1314
+ /* ---------------------------- */
1315
+
1316
+ // simplifies trigonometric functions wherever possible
1317
+ // currently deals with simplifications of type sin(acos())
1318
+ RCP<const Basic> trig_to_sqrt(const RCP<const Basic> &arg)
1319
+ {
1320
+ RCP<const Basic> i_arg;
1321
+
1322
+ if (is_a<Sin>(*arg)) {
1323
+ if (is_a<ACos>(*arg->get_args()[0])) {
1324
+ i_arg = down_cast<const ACos &>(*(arg->get_args()[0])).get_arg();
1325
+ return sqrt(sub(one, pow(i_arg, i2)));
1326
+ } else if (is_a<ATan>(*arg->get_args()[0])) {
1327
+ i_arg = down_cast<const ATan &>(*(arg->get_args()[0])).get_arg();
1328
+ return div(i_arg, sqrt(add(one, pow(i_arg, i2))));
1329
+ } else if (is_a<ASec>(*arg->get_args()[0])) {
1330
+ i_arg = down_cast<const ASec &>(*(arg->get_args()[0])).get_arg();
1331
+ return sqrt(sub(one, pow(i_arg, im2)));
1332
+ } else if (is_a<ACot>(*arg->get_args()[0])) {
1333
+ i_arg = down_cast<const ACot &>(*(arg->get_args()[0])).get_arg();
1334
+ return div(one, mul(i_arg, sqrt(add(one, pow(i_arg, im2)))));
1335
+ }
1336
+ } else if (is_a<Cos>(*arg)) {
1337
+ if (is_a<ASin>(*arg->get_args()[0])) {
1338
+ i_arg = down_cast<const ASin &>(*(arg->get_args()[0])).get_arg();
1339
+ return sqrt(sub(one, pow(i_arg, i2)));
1340
+ } else if (is_a<ATan>(*arg->get_args()[0])) {
1341
+ i_arg = down_cast<const ATan &>(*(arg->get_args()[0])).get_arg();
1342
+ return div(one, sqrt(add(one, pow(i_arg, i2))));
1343
+ } else if (is_a<ACsc>(*arg->get_args()[0])) {
1344
+ i_arg = down_cast<const ACsc &>(*(arg->get_args()[0])).get_arg();
1345
+ return sqrt(sub(one, pow(i_arg, im2)));
1346
+ } else if (is_a<ACot>(*arg->get_args()[0])) {
1347
+ i_arg = down_cast<const ACot &>(*(arg->get_args()[0])).get_arg();
1348
+ return div(one, sqrt(add(one, pow(i_arg, im2))));
1349
+ }
1350
+ } else if (is_a<Tan>(*arg)) {
1351
+ if (is_a<ASin>(*arg->get_args()[0])) {
1352
+ i_arg = down_cast<const ASin &>(*(arg->get_args()[0])).get_arg();
1353
+ return div(i_arg, sqrt(sub(one, pow(i_arg, i2))));
1354
+ } else if (is_a<ACos>(*arg->get_args()[0])) {
1355
+ i_arg = down_cast<const ACos &>(*(arg->get_args()[0])).get_arg();
1356
+ return div(sqrt(sub(one, pow(i_arg, i2))), i_arg);
1357
+ } else if (is_a<ACsc>(*arg->get_args()[0])) {
1358
+ i_arg = down_cast<const ACsc &>(*(arg->get_args()[0])).get_arg();
1359
+ return div(one, mul(i_arg, sqrt(sub(one, pow(i_arg, im2)))));
1360
+ } else if (is_a<ASec>(*arg->get_args()[0])) {
1361
+ i_arg = down_cast<const ASec &>(*(arg->get_args()[0])).get_arg();
1362
+ return mul(i_arg, sqrt(sub(one, pow(i_arg, im2))));
1363
+ }
1364
+ } else if (is_a<Csc>(*arg)) {
1365
+ if (is_a<ACos>(*arg->get_args()[0])) {
1366
+ i_arg = down_cast<const ACos &>(*(arg->get_args()[0])).get_arg();
1367
+ return div(one, sqrt(sub(one, pow(i_arg, i2))));
1368
+ } else if (is_a<ATan>(*arg->get_args()[0])) {
1369
+ i_arg = down_cast<const ATan &>(*(arg->get_args()[0])).get_arg();
1370
+ return div(sqrt(add(one, pow(i_arg, i2))), i_arg);
1371
+ } else if (is_a<ASec>(*arg->get_args()[0])) {
1372
+ i_arg = down_cast<const ASec &>(*(arg->get_args()[0])).get_arg();
1373
+ return div(one, sqrt(sub(one, pow(i_arg, im2))));
1374
+ } else if (is_a<ACot>(*arg->get_args()[0])) {
1375
+ i_arg = down_cast<const ACot &>(*(arg->get_args()[0])).get_arg();
1376
+ return mul(i_arg, sqrt(add(one, pow(i_arg, im2))));
1377
+ }
1378
+ } else if (is_a<Sec>(*arg)) {
1379
+ if (is_a<ASin>(*arg->get_args()[0])) {
1380
+ i_arg = down_cast<const ASin &>(*(arg->get_args()[0])).get_arg();
1381
+ return div(one, sqrt(sub(one, pow(i_arg, i2))));
1382
+ } else if (is_a<ATan>(*arg->get_args()[0])) {
1383
+ i_arg = down_cast<const ATan &>(*(arg->get_args()[0])).get_arg();
1384
+ return sqrt(add(one, pow(i_arg, i2)));
1385
+ } else if (is_a<ACsc>(*arg->get_args()[0])) {
1386
+ i_arg = down_cast<const ACsc &>(*(arg->get_args()[0])).get_arg();
1387
+ return div(one, sqrt(sub(one, pow(i_arg, im2))));
1388
+ } else if (is_a<ACot>(*arg->get_args()[0])) {
1389
+ i_arg = down_cast<const ACot &>(*(arg->get_args()[0])).get_arg();
1390
+ return sqrt(add(one, pow(i_arg, im2)));
1391
+ }
1392
+ } else if (is_a<Cot>(*arg)) {
1393
+ if (is_a<ASin>(*arg->get_args()[0])) {
1394
+ i_arg = down_cast<const ASin &>(*(arg->get_args()[0])).get_arg();
1395
+ return div(sqrt(sub(one, pow(i_arg, i2))), i_arg);
1396
+ } else if (is_a<ACos>(*arg->get_args()[0])) {
1397
+ i_arg = down_cast<const ACos &>(*(arg->get_args()[0])).get_arg();
1398
+ return div(i_arg, sqrt(sub(one, pow(i_arg, i2))));
1399
+ } else if (is_a<ACsc>(*arg->get_args()[0])) {
1400
+ i_arg = down_cast<const ACsc &>(*(arg->get_args()[0])).get_arg();
1401
+ return mul(i_arg, sqrt(sub(one, pow(i_arg, im2))));
1402
+ } else if (is_a<ASec>(*arg->get_args()[0])) {
1403
+ i_arg = down_cast<const ASec &>(*(arg->get_args()[0])).get_arg();
1404
+ return div(one, mul(i_arg, sqrt(sub(one, pow(i_arg, im2)))));
1405
+ }
1406
+ }
1407
+
1408
+ return arg;
1409
+ }
1410
+
1411
+ /* ---------------------------- */
1412
+ ASin::ASin(const RCP<const Basic> &arg) : InverseTrigFunction(arg)
1413
+ {
1414
+ SYMENGINE_ASSIGN_TYPEID()
1415
+ SYMENGINE_ASSERT(is_canonical(arg))
1416
+ }
1417
+
1418
+ bool ASin::is_canonical(const RCP<const Basic> &arg) const
1419
+ {
1420
+ if (eq(*arg, *zero) or eq(*arg, *one) or eq(*arg, *minus_one))
1421
+ return false;
1422
+ RCP<const Basic> index;
1423
+ if (inverse_lookup(inverse_cst(), get_arg(), outArg(index))) {
1424
+ return false;
1425
+ }
1426
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1427
+ return false;
1428
+ }
1429
+ return true;
1430
+ }
1431
+
1432
+ RCP<const Basic> asin(const RCP<const Basic> &arg)
1433
+ {
1434
+ if (eq(*arg, *zero))
1435
+ return zero;
1436
+ else if (eq(*arg, *one))
1437
+ return div(pi, i2);
1438
+ else if (eq(*arg, *minus_one))
1439
+ return mul(minus_one, div(pi, i2));
1440
+ else if (is_a_Number(*arg)
1441
+ and not down_cast<const Number &>(*arg).is_exact()) {
1442
+ return down_cast<const Number &>(*arg).get_eval().asin(*arg);
1443
+ }
1444
+
1445
+ RCP<const Basic> index;
1446
+ bool b = inverse_lookup(inverse_cst(), arg, outArg(index));
1447
+ if (b) {
1448
+ return div(pi, index);
1449
+ } else {
1450
+ return make_rcp<const ASin>(arg);
1451
+ }
1452
+ }
1453
+
1454
+ ACos::ACos(const RCP<const Basic> &arg) : InverseTrigFunction(arg)
1455
+ {
1456
+ SYMENGINE_ASSIGN_TYPEID()
1457
+ SYMENGINE_ASSERT(is_canonical(arg))
1458
+ }
1459
+
1460
+ bool ACos::is_canonical(const RCP<const Basic> &arg) const
1461
+ {
1462
+ if (eq(*arg, *zero) or eq(*arg, *one) or eq(*arg, *minus_one))
1463
+ return false;
1464
+ RCP<const Basic> index;
1465
+ if (inverse_lookup(inverse_cst(), get_arg(), outArg(index))) {
1466
+ return false;
1467
+ }
1468
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1469
+ return false;
1470
+ }
1471
+ return true;
1472
+ }
1473
+
1474
+ RCP<const Basic> acos(const RCP<const Basic> &arg)
1475
+ {
1476
+ if (eq(*arg, *zero))
1477
+ return div(pi, i2);
1478
+ else if (eq(*arg, *one))
1479
+ return zero;
1480
+ else if (eq(*arg, *minus_one))
1481
+ return pi;
1482
+ else if (is_a_Number(*arg)
1483
+ and not down_cast<const Number &>(*arg).is_exact()) {
1484
+ return down_cast<const Number &>(*arg).get_eval().acos(*arg);
1485
+ }
1486
+
1487
+ RCP<const Basic> index;
1488
+ bool b = inverse_lookup(inverse_cst(), arg, outArg(index));
1489
+ if (b) {
1490
+ return sub(div(pi, i2), div(pi, index));
1491
+ } else {
1492
+ return make_rcp<const ACos>(arg);
1493
+ }
1494
+ }
1495
+
1496
+ ASec::ASec(const RCP<const Basic> &arg) : InverseTrigFunction(arg)
1497
+ {
1498
+ SYMENGINE_ASSIGN_TYPEID()
1499
+ SYMENGINE_ASSERT(is_canonical(arg))
1500
+ }
1501
+
1502
+ bool ASec::is_canonical(const RCP<const Basic> &arg) const
1503
+ {
1504
+ if (eq(*arg, *one) or eq(*arg, *minus_one))
1505
+ return false;
1506
+ RCP<const Basic> index;
1507
+ if (inverse_lookup(inverse_cst(), div(one, get_arg()), outArg(index))) {
1508
+ return false;
1509
+ } else if (is_a_Number(*arg)
1510
+ and not down_cast<const Number &>(*arg).is_exact()) {
1511
+ return false;
1512
+ }
1513
+ return true;
1514
+ }
1515
+
1516
+ RCP<const Basic> asec(const RCP<const Basic> &arg)
1517
+ {
1518
+ if (eq(*arg, *one))
1519
+ return zero;
1520
+ else if (eq(*arg, *minus_one))
1521
+ return pi;
1522
+ else if (is_a_Number(*arg)
1523
+ and not down_cast<const Number &>(*arg).is_exact()) {
1524
+ return down_cast<const Number &>(*arg).get_eval().asec(*arg);
1525
+ }
1526
+
1527
+ RCP<const Basic> index;
1528
+ bool b = inverse_lookup(inverse_cst(), div(one, arg), outArg(index));
1529
+ if (b) {
1530
+ return sub(div(pi, i2), div(pi, index));
1531
+ } else {
1532
+ return make_rcp<const ASec>(arg);
1533
+ }
1534
+ }
1535
+
1536
+ ACsc::ACsc(const RCP<const Basic> &arg) : InverseTrigFunction(arg)
1537
+ {
1538
+ SYMENGINE_ASSIGN_TYPEID()
1539
+ SYMENGINE_ASSERT(is_canonical(arg))
1540
+ }
1541
+
1542
+ bool ACsc::is_canonical(const RCP<const Basic> &arg) const
1543
+ {
1544
+ if (eq(*arg, *one) or eq(*arg, *minus_one))
1545
+ return false;
1546
+ RCP<const Basic> index;
1547
+ if (inverse_lookup(inverse_cst(), div(one, arg), outArg(index))) {
1548
+ return false;
1549
+ }
1550
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1551
+ return false;
1552
+ }
1553
+ return true;
1554
+ }
1555
+
1556
+ RCP<const Basic> acsc(const RCP<const Basic> &arg)
1557
+ {
1558
+ if (eq(*arg, *one))
1559
+ return div(pi, i2);
1560
+ else if (eq(*arg, *minus_one))
1561
+ return div(pi, im2);
1562
+ else if (is_a_Number(*arg)
1563
+ and not down_cast<const Number &>(*arg).is_exact()) {
1564
+ return down_cast<const Number &>(*arg).get_eval().acsc(*arg);
1565
+ }
1566
+
1567
+ RCP<const Basic> index;
1568
+ bool b = inverse_lookup(inverse_cst(), div(one, arg), outArg(index));
1569
+ if (b) {
1570
+ return div(pi, index);
1571
+ } else {
1572
+ return make_rcp<const ACsc>(arg);
1573
+ }
1574
+ }
1575
+
1576
+ ATan::ATan(const RCP<const Basic> &arg) : InverseTrigFunction(arg)
1577
+ {
1578
+ SYMENGINE_ASSIGN_TYPEID()
1579
+ SYMENGINE_ASSERT(is_canonical(arg))
1580
+ }
1581
+
1582
+ bool ATan::is_canonical(const RCP<const Basic> &arg) const
1583
+ {
1584
+ if (eq(*arg, *zero) or eq(*arg, *one) or eq(*arg, *minus_one))
1585
+ return false;
1586
+ RCP<const Basic> index;
1587
+ if (inverse_lookup(inverse_tct(), get_arg(), outArg(index))) {
1588
+ return false;
1589
+ }
1590
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1591
+ return false;
1592
+ }
1593
+ return true;
1594
+ }
1595
+
1596
+ RCP<const Basic> atan(const RCP<const Basic> &arg)
1597
+ {
1598
+ if (eq(*arg, *zero))
1599
+ return zero;
1600
+ else if (eq(*arg, *one))
1601
+ return div(pi, mul(i2, i2));
1602
+ else if (eq(*arg, *minus_one))
1603
+ return mul(minus_one, div(pi, mul(i2, i2)));
1604
+ else if (is_a_Number(*arg)
1605
+ and not down_cast<const Number &>(*arg).is_exact()) {
1606
+ return down_cast<const Number &>(*arg).get_eval().atan(*arg);
1607
+ }
1608
+
1609
+ RCP<const Basic> index;
1610
+ bool b = inverse_lookup(inverse_tct(), arg, outArg(index));
1611
+ if (b) {
1612
+ return div(pi, index);
1613
+ } else {
1614
+ return make_rcp<const ATan>(arg);
1615
+ }
1616
+ }
1617
+
1618
+ ACot::ACot(const RCP<const Basic> &arg) : InverseTrigFunction(arg)
1619
+ {
1620
+ SYMENGINE_ASSIGN_TYPEID()
1621
+ SYMENGINE_ASSERT(is_canonical(arg))
1622
+ }
1623
+
1624
+ bool ACot::is_canonical(const RCP<const Basic> &arg) const
1625
+ {
1626
+ if (eq(*arg, *zero) or eq(*arg, *one) or eq(*arg, *minus_one))
1627
+ return false;
1628
+ RCP<const Basic> index;
1629
+ if (inverse_lookup(inverse_tct(), arg, outArg(index))) {
1630
+ return false;
1631
+ }
1632
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
1633
+ return false;
1634
+ }
1635
+ return true;
1636
+ }
1637
+
1638
+ RCP<const Basic> acot(const RCP<const Basic> &arg)
1639
+ {
1640
+ if (eq(*arg, *zero))
1641
+ return div(pi, i2);
1642
+ else if (eq(*arg, *one))
1643
+ return div(pi, mul(i2, i2));
1644
+ else if (eq(*arg, *minus_one))
1645
+ return mul(i3, div(pi, mul(i2, i2)));
1646
+ else if (is_a_Number(*arg)
1647
+ and not down_cast<const Number &>(*arg).is_exact()) {
1648
+ return down_cast<const Number &>(*arg).get_eval().acot(*arg);
1649
+ }
1650
+
1651
+ RCP<const Basic> index;
1652
+ bool b = inverse_lookup(inverse_tct(), arg, outArg(index));
1653
+ if (b) {
1654
+ return sub(div(pi, i2), div(pi, index));
1655
+ } else {
1656
+ return make_rcp<const ACot>(arg);
1657
+ }
1658
+ }
1659
+
1660
+ ATan2::ATan2(const RCP<const Basic> &num, const RCP<const Basic> &den)
1661
+ : TwoArgFunction(num, den)
1662
+ {
1663
+ SYMENGINE_ASSIGN_TYPEID()
1664
+ SYMENGINE_ASSERT(is_canonical(num, den))
1665
+ }
1666
+
1667
+ bool ATan2::is_canonical(const RCP<const Basic> &num,
1668
+ const RCP<const Basic> &den) const
1669
+ {
1670
+ if (eq(*num, *den) or eq(*num, *mul(minus_one, den)))
1671
+ return false;
1672
+ if (eq(*num, *zero)) {
1673
+ return not(is_a_Number(*den) or eq(*den, *zero));
1674
+ }
1675
+ if (eq(*den, *zero)) {
1676
+ return not is_a_Number(*num);
1677
+ }
1678
+ RCP<const Basic> index;
1679
+ bool b = inverse_lookup(inverse_tct(), div(num, den), outArg(index));
1680
+ if (b)
1681
+ return false;
1682
+ else
1683
+ return true;
1684
+ }
1685
+
1686
+ RCP<const Basic> ATan2::create(const RCP<const Basic> &a,
1687
+ const RCP<const Basic> &b) const
1688
+ {
1689
+ return atan2(a, b);
1690
+ }
1691
+
1692
+ RCP<const Basic> atan2(const RCP<const Basic> &num, const RCP<const Basic> &den)
1693
+ {
1694
+ if (eq(*num, *zero)) {
1695
+ if (eq(*den, *zero)) {
1696
+ return Nan;
1697
+ }
1698
+ if (is_a_Number(*den)) {
1699
+ RCP<const Number> den_new = rcp_static_cast<const Number>(den);
1700
+ if (den_new->is_negative())
1701
+ return pi;
1702
+ else if (den_new->is_positive())
1703
+ return zero;
1704
+ else {
1705
+ return Nan;
1706
+ }
1707
+ }
1708
+ return make_rcp<const ATan2>(num, den);
1709
+ } else if (eq(*den, *zero)) {
1710
+ if (is_a_Number(*num)) {
1711
+ RCP<const Number> num_new = rcp_static_cast<const Number>(num);
1712
+ if (num_new->is_negative())
1713
+ return div(pi, im2);
1714
+ else
1715
+ return div(pi, i2);
1716
+ }
1717
+ return make_rcp<const ATan2>(num, den);
1718
+ }
1719
+ RCP<const Basic> index;
1720
+ bool b = inverse_lookup(inverse_tct(), div(num, den), outArg(index));
1721
+ if (b) {
1722
+ SYMENGINE_ASSERT(is_a_Number(*index));
1723
+ RCP<const Number> index_num = rcp_static_cast<const Number>(index);
1724
+ if (index_num->is_positive()) {
1725
+ return add(div(pi, index), mul(div(pi, i2), sub(sign(den), one)));
1726
+ } else {
1727
+ return sub(div(pi, index), mul(div(pi, i2), sub(sign(den), one)));
1728
+ }
1729
+ } else {
1730
+ return make_rcp<const ATan2>(num, den);
1731
+ }
1732
+ }
1733
+
1734
+ /* ---------------------------- */
1735
+
1736
+ RCP<const Basic> Sin::create(const RCP<const Basic> &arg) const
1737
+ {
1738
+ return sin(arg);
1739
+ }
1740
+
1741
+ RCP<const Basic> Cos::create(const RCP<const Basic> &arg) const
1742
+ {
1743
+ return cos(arg);
1744
+ }
1745
+
1746
+ RCP<const Basic> Tan::create(const RCP<const Basic> &arg) const
1747
+ {
1748
+ return tan(arg);
1749
+ }
1750
+
1751
+ RCP<const Basic> Cot::create(const RCP<const Basic> &arg) const
1752
+ {
1753
+ return cot(arg);
1754
+ }
1755
+
1756
+ RCP<const Basic> Sec::create(const RCP<const Basic> &arg) const
1757
+ {
1758
+ return sec(arg);
1759
+ }
1760
+
1761
+ RCP<const Basic> Csc::create(const RCP<const Basic> &arg) const
1762
+ {
1763
+ return csc(arg);
1764
+ }
1765
+
1766
+ RCP<const Basic> ASin::create(const RCP<const Basic> &arg) const
1767
+ {
1768
+ return asin(arg);
1769
+ }
1770
+
1771
+ RCP<const Basic> ACos::create(const RCP<const Basic> &arg) const
1772
+ {
1773
+ return acos(arg);
1774
+ }
1775
+
1776
+ RCP<const Basic> ATan::create(const RCP<const Basic> &arg) const
1777
+ {
1778
+ return atan(arg);
1779
+ }
1780
+
1781
+ RCP<const Basic> ACot::create(const RCP<const Basic> &arg) const
1782
+ {
1783
+ return acot(arg);
1784
+ }
1785
+
1786
+ RCP<const Basic> ASec::create(const RCP<const Basic> &arg) const
1787
+ {
1788
+ return asec(arg);
1789
+ }
1790
+
1791
+ RCP<const Basic> ACsc::create(const RCP<const Basic> &arg) const
1792
+ {
1793
+ return acsc(arg);
1794
+ }
1795
+
1796
+ /* ---------------------------- */
1797
+
1798
+ Log::Log(const RCP<const Basic> &arg) : OneArgFunction(arg)
1799
+ {
1800
+ SYMENGINE_ASSIGN_TYPEID()
1801
+ SYMENGINE_ASSERT(is_canonical(arg))
1802
+ }
1803
+
1804
+ bool Log::is_canonical(const RCP<const Basic> &arg) const
1805
+ {
1806
+ // log(0)
1807
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
1808
+ return false;
1809
+ // log(1)
1810
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_one())
1811
+ return false;
1812
+ // log(E)
1813
+ if (eq(*arg, *E))
1814
+ return false;
1815
+
1816
+ if (is_a_Number(*arg) and down_cast<const Number &>(*arg).is_negative())
1817
+ return false;
1818
+
1819
+ // log(Inf) is also handled here.
1820
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact())
1821
+ return false;
1822
+
1823
+ // log(3I) should be expanded to log(3) + I*pi/2
1824
+ if (is_a<Complex>(*arg) and down_cast<const Complex &>(*arg).is_re_zero())
1825
+ return false;
1826
+ // log(num/den) = log(num) - log(den)
1827
+ if (is_a<Rational>(*arg))
1828
+ return false;
1829
+ return true;
1830
+ }
1831
+
1832
+ RCP<const Basic> Log::create(const RCP<const Basic> &a) const
1833
+ {
1834
+ return log(a);
1835
+ }
1836
+
1837
+ RCP<const Basic> log(const RCP<const Basic> &arg)
1838
+ {
1839
+ if (eq(*arg, *zero))
1840
+ return ComplexInf;
1841
+ if (eq(*arg, *one))
1842
+ return zero;
1843
+ if (eq(*arg, *E))
1844
+ return one;
1845
+
1846
+ if (is_a_Number(*arg)) {
1847
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
1848
+ if (not _arg->is_exact()) {
1849
+ return _arg->get_eval().log(*_arg);
1850
+ } else if (_arg->is_negative()) {
1851
+ return add(log(mul(minus_one, _arg)), mul(pi, I));
1852
+ }
1853
+ }
1854
+
1855
+ if (is_a<Rational>(*arg)) {
1856
+ RCP<const Integer> num, den;
1857
+ get_num_den(down_cast<const Rational &>(*arg), outArg(num),
1858
+ outArg(den));
1859
+ return sub(log(num), log(den));
1860
+ }
1861
+
1862
+ if (is_a<Complex>(*arg)) {
1863
+ RCP<const Complex> _arg = rcp_static_cast<const Complex>(arg);
1864
+ if (_arg->is_re_zero()) {
1865
+ RCP<const Number> arg_img = _arg->imaginary_part();
1866
+ if (arg_img->is_negative()) {
1867
+ return sub(log(mul(minus_one, arg_img)),
1868
+ mul(I, div(pi, integer(2))));
1869
+ } else if (arg_img->is_zero()) {
1870
+ return ComplexInf;
1871
+ } else if (arg_img->is_positive()) {
1872
+ return add(log(arg_img), mul(I, div(pi, integer(2))));
1873
+ }
1874
+ }
1875
+ }
1876
+
1877
+ // lakutata: log(e**r) is r for an exact real number r, as SymPy
1878
+ if (is_a<Pow>(*arg) and eq(*down_cast<const Pow &>(*arg).get_base(), *E)) {
1879
+ const RCP<const Basic> &exponent = down_cast<const Pow &>(*arg).get_exp();
1880
+ if (is_a<Integer>(*exponent) or is_a<Rational>(*exponent))
1881
+ return exponent;
1882
+ }
1883
+
1884
+ return make_rcp<const Log>(arg);
1885
+ }
1886
+
1887
+ RCP<const Basic> log(const RCP<const Basic> &arg, const RCP<const Basic> &base)
1888
+ {
1889
+ return div(log(arg), log(base));
1890
+ }
1891
+
1892
+ LambertW::LambertW(const RCP<const Basic> &arg) : OneArgFunction{arg}
1893
+ {
1894
+ SYMENGINE_ASSIGN_TYPEID()
1895
+ SYMENGINE_ASSERT(is_canonical(arg))
1896
+ }
1897
+
1898
+ bool LambertW::is_canonical(const RCP<const Basic> &arg) const
1899
+ {
1900
+ if (eq(*arg, *zero))
1901
+ return false;
1902
+ if (eq(*arg, *E))
1903
+ return false;
1904
+ if (eq(*arg, *div(neg(one), E)))
1905
+ return false;
1906
+ if (eq(*arg, *div(log(i2), im2)))
1907
+ return false;
1908
+ return true;
1909
+ }
1910
+
1911
+ RCP<const Basic> LambertW::create(const RCP<const Basic> &arg) const
1912
+ {
1913
+ return lambertw(arg);
1914
+ }
1915
+
1916
+ RCP<const Basic> lambertw(const RCP<const Basic> &arg)
1917
+ {
1918
+ if (eq(*arg, *zero))
1919
+ return zero;
1920
+ if (eq(*arg, *E))
1921
+ return one;
1922
+ if (eq(*arg, *div(neg(one), E)))
1923
+ return minus_one;
1924
+ if (eq(*arg, *div(log(i2), im2)))
1925
+ return mul(minus_one, log(i2));
1926
+ return make_rcp<const LambertW>(arg);
1927
+ }
1928
+
1929
+ FunctionSymbol::FunctionSymbol(std::string name, const RCP<const Basic> &arg)
1930
+ : MultiArgFunction({arg}), name_{name} {SYMENGINE_ASSIGN_TYPEID()
1931
+ SYMENGINE_ASSERT(
1932
+ is_canonical(get_vec()))}
1933
+
1934
+ FunctionSymbol::FunctionSymbol(std::string name, const vec_basic &arg)
1935
+ : MultiArgFunction(arg), name_{name}
1936
+ {
1937
+ SYMENGINE_ASSIGN_TYPEID()
1938
+ SYMENGINE_ASSERT(is_canonical(get_vec()))
1939
+ }
1940
+
1941
+ bool FunctionSymbol::is_canonical(const vec_basic &arg) const
1942
+ {
1943
+ return true;
1944
+ }
1945
+
1946
+ hash_t FunctionSymbol::__hash__() const
1947
+ {
1948
+ hash_t seed = SYMENGINE_FUNCTIONSYMBOL;
1949
+ for (const auto &a : get_vec())
1950
+ hash_combine<Basic>(seed, *a);
1951
+ hash_combine<std::string>(seed, name_);
1952
+ return seed;
1953
+ }
1954
+
1955
+ bool FunctionSymbol::__eq__(const Basic &o) const
1956
+ {
1957
+ // lakutata: the same type code, so that the function wrappers compare too
1958
+ // (is_a<FunctionSymbol> is false for them: a wrapper was not equal to
1959
+ // itself, and cos(wrapper) recursed without end)
1960
+ if (o.get_type_code() == get_type_code()
1961
+ and name_ == down_cast<const FunctionSymbol &>(o).name_
1962
+ and unified_eq(get_vec(),
1963
+ down_cast<const FunctionSymbol &>(o).get_vec()))
1964
+ return true;
1965
+ return false;
1966
+ }
1967
+
1968
+ int FunctionSymbol::compare(const Basic &o) const
1969
+ {
1970
+ SYMENGINE_ASSERT(is_a<FunctionSymbol>(o))
1971
+ const FunctionSymbol &s = down_cast<const FunctionSymbol &>(o);
1972
+ if (name_ == s.name_)
1973
+ return unified_compare(get_vec(), s.get_vec());
1974
+ else
1975
+ return name_ < s.name_ ? -1 : 1;
1976
+ }
1977
+
1978
+ RCP<const Basic> FunctionSymbol::create(const vec_basic &x) const
1979
+ {
1980
+ return make_rcp<const FunctionSymbol>(name_, x);
1981
+ }
1982
+
1983
+ RCP<const Basic> function_symbol(std::string name, const vec_basic &arg)
1984
+ {
1985
+ return make_rcp<const FunctionSymbol>(name, arg);
1986
+ }
1987
+
1988
+ RCP<const Basic> function_symbol(std::string name, const RCP<const Basic> &arg)
1989
+ {
1990
+ return make_rcp<const FunctionSymbol>(name, arg);
1991
+ }
1992
+
1993
+ // lakutata: the values of a wrapper for numbers, through create() and eval()
1994
+ double FunctionWrapper::evaluate_real(const double *arguments) const
1995
+ {
1996
+ vec_basic values;
1997
+ for (size_t i = 0; i < get_args().size(); i++)
1998
+ values.push_back(real_double(arguments[i]));
1999
+ return eval_double(*create(values));
2000
+ }
2001
+
2002
+ std::complex<double>
2003
+ FunctionWrapper::evaluate_complex(const std::complex<double> *arguments) const
2004
+ {
2005
+ vec_basic values;
2006
+ for (size_t i = 0; i < get_args().size(); i++)
2007
+ values.push_back(complex_double(arguments[i]));
2008
+ return eval_complex_double(*create(values));
2009
+ }
2010
+
2011
+ FunctionWrapper::FunctionWrapper(std::string name, const RCP<const Basic> &arg)
2012
+ : FunctionSymbol(name, arg){SYMENGINE_ASSIGN_TYPEID()}
2013
+
2014
+ FunctionWrapper::FunctionWrapper(std::string name, const vec_basic &vec)
2015
+ : FunctionSymbol(name, vec){SYMENGINE_ASSIGN_TYPEID()}
2016
+
2017
+ /* ---------------------------- */
2018
+
2019
+ Derivative::Derivative(const RCP<const Basic> &arg,
2020
+ const multiset_basic &x)
2021
+ : arg_{arg}, x_{x}
2022
+ {
2023
+ SYMENGINE_ASSIGN_TYPEID()
2024
+ SYMENGINE_ASSERT(is_canonical(arg, x))
2025
+ }
2026
+
2027
+ bool Derivative::is_canonical(const RCP<const Basic> &arg,
2028
+ const multiset_basic &x) const
2029
+ {
2030
+ // Check that 'x' are Symbols:
2031
+ for (const auto &a : x)
2032
+ if (not is_a<Symbol>(*a))
2033
+ return false;
2034
+ if (is_a<FunctionSymbol>(*arg) or is_a<LeviCivita>(*arg)) {
2035
+ for (auto &p : x) {
2036
+ RCP<const Symbol> s = rcp_static_cast<const Symbol>(p);
2037
+ RCP<const MultiArgFunction> f
2038
+ = rcp_static_cast<const MultiArgFunction>(arg);
2039
+ bool found_s = false;
2040
+ // 's' should be one of the args of the function
2041
+ // and should not appear anywhere else.
2042
+ for (const auto &a : f->get_args()) {
2043
+ if (eq(*a, *s)) {
2044
+ if (found_s) {
2045
+ return false;
2046
+ } else {
2047
+ found_s = true;
2048
+ }
2049
+ } else if (neq(*a->diff(s), *zero)) {
2050
+ return false;
2051
+ }
2052
+ }
2053
+ if (!found_s) {
2054
+ return false;
2055
+ }
2056
+ }
2057
+ return true;
2058
+ } else if (is_a<Abs>(*arg)) {
2059
+ return true;
2060
+ } else if (is_a<FunctionWrapper>(*arg)) {
2061
+ return true;
2062
+ } else if (is_a<PolyGamma>(*arg) or is_a<Zeta>(*arg)
2063
+ or is_a<UpperGamma>(*arg) or is_a<LowerGamma>(*arg)
2064
+ or is_a<Dirichlet_eta>(*arg)) {
2065
+ bool found = false;
2066
+ auto v = arg->get_args();
2067
+ for (auto &p : x) {
2068
+ if (has_symbol(*v[0], *rcp_static_cast<const Symbol>(p))) {
2069
+ found = true;
2070
+ break;
2071
+ }
2072
+ }
2073
+ return found;
2074
+ } else if (is_a<KroneckerDelta>(*arg)) {
2075
+ bool found = false;
2076
+ auto v = arg->get_args();
2077
+ for (auto &p : x) {
2078
+ if (has_symbol(*v[0], *rcp_static_cast<const Symbol>(p))
2079
+ or has_symbol(*v[1], *rcp_static_cast<const Symbol>(p))) {
2080
+ found = true;
2081
+ break;
2082
+ }
2083
+ }
2084
+ return found;
2085
+ }
2086
+ return false;
2087
+ }
2088
+
2089
+ hash_t Derivative::__hash__() const
2090
+ {
2091
+ hash_t seed = SYMENGINE_DERIVATIVE;
2092
+ hash_combine<Basic>(seed, *arg_);
2093
+ for (auto &p : x_) {
2094
+ hash_combine<Basic>(seed, *p);
2095
+ }
2096
+ return seed;
2097
+ }
2098
+
2099
+ bool Derivative::__eq__(const Basic &o) const
2100
+ {
2101
+ if (is_a<Derivative>(o)
2102
+ and eq(*arg_, *(down_cast<const Derivative &>(o).arg_))
2103
+ and unified_eq(x_, down_cast<const Derivative &>(o).x_))
2104
+ return true;
2105
+ return false;
2106
+ }
2107
+
2108
+ int Derivative::compare(const Basic &o) const
2109
+ {
2110
+ SYMENGINE_ASSERT(is_a<Derivative>(o))
2111
+ const Derivative &s = down_cast<const Derivative &>(o);
2112
+ int cmp = arg_->__cmp__(*(s.arg_));
2113
+ if (cmp != 0)
2114
+ return cmp;
2115
+ cmp = unified_compare(x_, s.x_);
2116
+ return cmp;
2117
+ }
2118
+
2119
+ // Subs class
2120
+ Subs::Subs(const RCP<const Basic> &arg, const map_basic_basic &dict)
2121
+ : arg_{arg}, dict_{dict}
2122
+ {
2123
+ SYMENGINE_ASSIGN_TYPEID()
2124
+ SYMENGINE_ASSERT(is_canonical(arg, dict))
2125
+ }
2126
+
2127
+ bool Subs::is_canonical(const RCP<const Basic> &arg,
2128
+ const map_basic_basic &dict) const
2129
+ {
2130
+ if (is_a<Derivative>(*arg)) {
2131
+ return true;
2132
+ }
2133
+ return false;
2134
+ }
2135
+
2136
+ hash_t Subs::__hash__() const
2137
+ {
2138
+ hash_t seed = SYMENGINE_SUBS;
2139
+ hash_combine<Basic>(seed, *arg_);
2140
+ for (const auto &p : dict_) {
2141
+ hash_combine<Basic>(seed, *p.first);
2142
+ hash_combine<Basic>(seed, *p.second);
2143
+ }
2144
+ return seed;
2145
+ }
2146
+
2147
+ bool Subs::__eq__(const Basic &o) const
2148
+ {
2149
+ if (is_a<Subs>(o) and eq(*arg_, *(down_cast<const Subs &>(o).arg_))
2150
+ and unified_eq(dict_, down_cast<const Subs &>(o).dict_))
2151
+ return true;
2152
+ return false;
2153
+ }
2154
+
2155
+ int Subs::compare(const Basic &o) const
2156
+ {
2157
+ SYMENGINE_ASSERT(is_a<Subs>(o))
2158
+ const Subs &s = down_cast<const Subs &>(o);
2159
+ int cmp = arg_->__cmp__(*(s.arg_));
2160
+ if (cmp != 0)
2161
+ return cmp;
2162
+ cmp = unified_compare(dict_, s.dict_);
2163
+ return cmp;
2164
+ }
2165
+
2166
+ vec_basic Subs::get_variables() const
2167
+ {
2168
+ vec_basic v;
2169
+ for (const auto &p : dict_) {
2170
+ v.push_back(p.first);
2171
+ }
2172
+ return v;
2173
+ }
2174
+
2175
+ vec_basic Subs::get_point() const
2176
+ {
2177
+ vec_basic v;
2178
+ for (const auto &p : dict_) {
2179
+ v.push_back(p.second);
2180
+ }
2181
+ return v;
2182
+ }
2183
+
2184
+ vec_basic Subs::get_args() const
2185
+ {
2186
+ vec_basic v = {arg_};
2187
+ for (const auto &p : dict_) {
2188
+ v.push_back(p.first);
2189
+ }
2190
+ for (const auto &p : dict_) {
2191
+ v.push_back(p.second);
2192
+ }
2193
+ return v;
2194
+ }
2195
+
2196
+ Sinh::Sinh(const RCP<const Basic> &arg) : HyperbolicFunction(arg)
2197
+ {
2198
+ SYMENGINE_ASSIGN_TYPEID()
2199
+ SYMENGINE_ASSERT(is_canonical(arg))
2200
+ }
2201
+
2202
+ bool Sinh::is_canonical(const RCP<const Basic> &arg) const
2203
+ {
2204
+ if (eq(*arg, *zero))
2205
+ return false;
2206
+ if (is_a_Number(*arg)) {
2207
+ if (down_cast<const Number &>(*arg).is_negative()) {
2208
+ return false;
2209
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2210
+ return false;
2211
+ }
2212
+ }
2213
+ if (could_extract_minus(*arg))
2214
+ return false;
2215
+ return true;
2216
+ }
2217
+
2218
+ RCP<const Basic> sinh(const RCP<const Basic> &arg)
2219
+ {
2220
+ if (eq(*arg, *zero))
2221
+ return zero;
2222
+ if (is_a_Number(*arg)) {
2223
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2224
+ if (not _arg->is_exact()) {
2225
+ return _arg->get_eval().sinh(*_arg);
2226
+ } else if (_arg->is_negative()) {
2227
+ return neg(sinh(zero->sub(*_arg)));
2228
+ }
2229
+ }
2230
+ RCP<const Basic> d;
2231
+ bool b = handle_minus(arg, outArg(d));
2232
+ if (b) {
2233
+ return neg(sinh(d));
2234
+ }
2235
+ return make_rcp<const Sinh>(d);
2236
+ }
2237
+
2238
+ Csch::Csch(const RCP<const Basic> &arg) : HyperbolicFunction(arg)
2239
+ {
2240
+ SYMENGINE_ASSIGN_TYPEID()
2241
+ SYMENGINE_ASSERT(is_canonical(arg))
2242
+ }
2243
+
2244
+ bool Csch::is_canonical(const RCP<const Basic> &arg) const
2245
+ {
2246
+ if (eq(*arg, *zero))
2247
+ return false;
2248
+ if (is_a_Number(*arg)) {
2249
+ if (down_cast<const Number &>(*arg).is_negative()) {
2250
+ return false;
2251
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2252
+ return false;
2253
+ }
2254
+ }
2255
+ if (could_extract_minus(*arg))
2256
+ return false;
2257
+ return true;
2258
+ }
2259
+
2260
+ RCP<const Basic> csch(const RCP<const Basic> &arg)
2261
+ {
2262
+ if (eq(*arg, *zero)) {
2263
+ return ComplexInf;
2264
+ }
2265
+ if (is_a_Number(*arg)) {
2266
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2267
+ if (not _arg->is_exact()) {
2268
+ return _arg->get_eval().csch(*_arg);
2269
+ } else if (_arg->is_negative()) {
2270
+ return neg(csch(zero->sub(*_arg)));
2271
+ }
2272
+ }
2273
+ RCP<const Basic> d;
2274
+ bool b = handle_minus(arg, outArg(d));
2275
+ if (b) {
2276
+ return neg(csch(d));
2277
+ }
2278
+ return make_rcp<const Csch>(d);
2279
+ }
2280
+
2281
+ Cosh::Cosh(const RCP<const Basic> &arg) : HyperbolicFunction(arg)
2282
+ {
2283
+ SYMENGINE_ASSIGN_TYPEID()
2284
+ SYMENGINE_ASSERT(is_canonical(arg))
2285
+ }
2286
+
2287
+ bool Cosh::is_canonical(const RCP<const Basic> &arg) const
2288
+ {
2289
+ if (eq(*arg, *zero))
2290
+ return false;
2291
+ if (is_a_Number(*arg)) {
2292
+ if (down_cast<const Number &>(*arg).is_negative()) {
2293
+ return false;
2294
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2295
+ return false;
2296
+ }
2297
+ }
2298
+ if (could_extract_minus(*arg))
2299
+ return false;
2300
+ return true;
2301
+ }
2302
+
2303
+ RCP<const Basic> cosh(const RCP<const Basic> &arg)
2304
+ {
2305
+ if (eq(*arg, *zero))
2306
+ return one;
2307
+ if (is_a_Number(*arg)) {
2308
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2309
+ if (not _arg->is_exact()) {
2310
+ return _arg->get_eval().cosh(*_arg);
2311
+ } else if (_arg->is_negative()) {
2312
+ return cosh(zero->sub(*_arg));
2313
+ }
2314
+ }
2315
+ RCP<const Basic> d;
2316
+ handle_minus(arg, outArg(d));
2317
+ return make_rcp<const Cosh>(d);
2318
+ }
2319
+
2320
+ Sech::Sech(const RCP<const Basic> &arg) : HyperbolicFunction(arg)
2321
+ {
2322
+ SYMENGINE_ASSIGN_TYPEID()
2323
+ SYMENGINE_ASSERT(is_canonical(arg))
2324
+ }
2325
+
2326
+ bool Sech::is_canonical(const RCP<const Basic> &arg) const
2327
+ {
2328
+ if (eq(*arg, *zero))
2329
+ return false;
2330
+ if (is_a_Number(*arg)) {
2331
+ if (down_cast<const Number &>(*arg).is_negative()) {
2332
+ return false;
2333
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2334
+ return false;
2335
+ }
2336
+ }
2337
+ if (could_extract_minus(*arg))
2338
+ return false;
2339
+ return true;
2340
+ }
2341
+
2342
+ RCP<const Basic> sech(const RCP<const Basic> &arg)
2343
+ {
2344
+ if (eq(*arg, *zero))
2345
+ return one;
2346
+ if (is_a_Number(*arg)) {
2347
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2348
+ if (not _arg->is_exact()) {
2349
+ return _arg->get_eval().sech(*_arg);
2350
+ } else if (_arg->is_negative()) {
2351
+ return sech(zero->sub(*_arg));
2352
+ }
2353
+ }
2354
+ RCP<const Basic> d;
2355
+ handle_minus(arg, outArg(d));
2356
+ return make_rcp<const Sech>(d);
2357
+ }
2358
+
2359
+ Tanh::Tanh(const RCP<const Basic> &arg) : HyperbolicFunction(arg)
2360
+ {
2361
+ SYMENGINE_ASSIGN_TYPEID()
2362
+ SYMENGINE_ASSERT(is_canonical(arg))
2363
+ }
2364
+
2365
+ bool Tanh::is_canonical(const RCP<const Basic> &arg) const
2366
+ {
2367
+ if (eq(*arg, *zero))
2368
+ return false;
2369
+ if (is_a_Number(*arg)) {
2370
+ if (down_cast<const Number &>(*arg).is_negative()) {
2371
+ return false;
2372
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2373
+ return false;
2374
+ }
2375
+ }
2376
+ if (could_extract_minus(*arg))
2377
+ return false;
2378
+ return true;
2379
+ }
2380
+
2381
+ RCP<const Basic> tanh(const RCP<const Basic> &arg)
2382
+ {
2383
+ if (eq(*arg, *zero))
2384
+ return zero;
2385
+ if (is_a_Number(*arg)) {
2386
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2387
+ if (not _arg->is_exact()) {
2388
+ return _arg->get_eval().tanh(*_arg);
2389
+ } else if (_arg->is_negative()) {
2390
+ return neg(tanh(zero->sub(*_arg)));
2391
+ }
2392
+ }
2393
+
2394
+ RCP<const Basic> d;
2395
+ bool b = handle_minus(arg, outArg(d));
2396
+ if (b) {
2397
+ return neg(tanh(d));
2398
+ }
2399
+ return make_rcp<const Tanh>(d);
2400
+ }
2401
+
2402
+ Coth::Coth(const RCP<const Basic> &arg) : HyperbolicFunction(arg)
2403
+ {
2404
+ SYMENGINE_ASSIGN_TYPEID()
2405
+ SYMENGINE_ASSERT(is_canonical(arg))
2406
+ }
2407
+
2408
+ bool Coth::is_canonical(const RCP<const Basic> &arg) const
2409
+ {
2410
+ if (eq(*arg, *zero))
2411
+ return false;
2412
+ if (is_a_Number(*arg)) {
2413
+ if (down_cast<const Number &>(*arg).is_negative()) {
2414
+ return false;
2415
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2416
+ return false;
2417
+ }
2418
+ }
2419
+ if (could_extract_minus(*arg))
2420
+ return false;
2421
+ return true;
2422
+ }
2423
+
2424
+ RCP<const Basic> coth(const RCP<const Basic> &arg)
2425
+ {
2426
+ if (eq(*arg, *zero)) {
2427
+ return ComplexInf;
2428
+ }
2429
+ if (is_a_Number(*arg)) {
2430
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2431
+ if (not _arg->is_exact()) {
2432
+ return _arg->get_eval().coth(*_arg);
2433
+ } else if (_arg->is_negative()) {
2434
+ return neg(coth(zero->sub(*_arg)));
2435
+ }
2436
+ }
2437
+ RCP<const Basic> d;
2438
+ bool b = handle_minus(arg, outArg(d));
2439
+ if (b) {
2440
+ return neg(coth(d));
2441
+ }
2442
+ return make_rcp<const Coth>(d);
2443
+ }
2444
+
2445
+ ASinh::ASinh(const RCP<const Basic> &arg) : InverseHyperbolicFunction(arg)
2446
+ {
2447
+ SYMENGINE_ASSIGN_TYPEID()
2448
+ SYMENGINE_ASSERT(is_canonical(arg))
2449
+ }
2450
+
2451
+ bool ASinh::is_canonical(const RCP<const Basic> &arg) const
2452
+ {
2453
+ if (eq(*arg, *zero) or eq(*arg, *one) or eq(*arg, *minus_one))
2454
+ return false;
2455
+ if (is_a_Number(*arg)) {
2456
+ if (down_cast<const Number &>(*arg).is_negative()) {
2457
+ return false;
2458
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2459
+ return false;
2460
+ }
2461
+ }
2462
+ if (could_extract_minus(*arg))
2463
+ return false;
2464
+ return true;
2465
+ }
2466
+
2467
+ RCP<const Basic> asinh(const RCP<const Basic> &arg)
2468
+ {
2469
+ if (eq(*arg, *zero))
2470
+ return zero;
2471
+ if (eq(*arg, *one))
2472
+ return log(add(one, sq2));
2473
+ if (eq(*arg, *minus_one))
2474
+ return log(sub(sq2, one));
2475
+ if (is_a_Number(*arg)) {
2476
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2477
+ if (not _arg->is_exact()) {
2478
+ return _arg->get_eval().asinh(*_arg);
2479
+ } else if (_arg->is_negative()) {
2480
+ return neg(asinh(zero->sub(*_arg)));
2481
+ }
2482
+ }
2483
+ RCP<const Basic> d;
2484
+ bool b = handle_minus(arg, outArg(d));
2485
+ if (b) {
2486
+ return neg(asinh(d));
2487
+ }
2488
+ return make_rcp<const ASinh>(d);
2489
+ }
2490
+
2491
+ ACsch::ACsch(const RCP<const Basic> &arg) : InverseHyperbolicFunction(arg)
2492
+ {
2493
+ SYMENGINE_ASSIGN_TYPEID()
2494
+ SYMENGINE_ASSERT(is_canonical(arg))
2495
+ }
2496
+
2497
+ bool ACsch::is_canonical(const RCP<const Basic> &arg) const
2498
+ {
2499
+ if (eq(*arg, *one) or eq(*arg, *minus_one))
2500
+ return false;
2501
+ if (is_a_Number(*arg)) {
2502
+ if (down_cast<const Number &>(*arg).is_negative()) {
2503
+ return false;
2504
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2505
+ return false;
2506
+ }
2507
+ }
2508
+ if (could_extract_minus(*arg))
2509
+ return false;
2510
+ return true;
2511
+ }
2512
+
2513
+ RCP<const Basic> acsch(const RCP<const Basic> &arg)
2514
+ {
2515
+ if (eq(*arg, *one))
2516
+ return log(add(one, sq2));
2517
+ if (eq(*arg, *minus_one))
2518
+ return log(sub(sq2, one));
2519
+
2520
+ if (is_a_Number(*arg)) {
2521
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2522
+ if (not _arg->is_exact()) {
2523
+ return _arg->get_eval().acsch(*_arg);
2524
+ }
2525
+ }
2526
+
2527
+ RCP<const Basic> d;
2528
+ bool b = handle_minus(arg, outArg(d));
2529
+ if (b) {
2530
+ return neg(acsch(d));
2531
+ }
2532
+ return make_rcp<const ACsch>(d);
2533
+ }
2534
+
2535
+ ACosh::ACosh(const RCP<const Basic> &arg) : InverseHyperbolicFunction(arg)
2536
+ {
2537
+ SYMENGINE_ASSIGN_TYPEID()
2538
+ SYMENGINE_ASSERT(is_canonical(arg))
2539
+ }
2540
+
2541
+ bool ACosh::is_canonical(const RCP<const Basic> &arg) const
2542
+ {
2543
+ // TODO: Lookup into a cst table once complex is implemented
2544
+ if (eq(*arg, *one))
2545
+ return false;
2546
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
2547
+ return false;
2548
+ }
2549
+ return true;
2550
+ }
2551
+
2552
+ RCP<const Basic> acosh(const RCP<const Basic> &arg)
2553
+ {
2554
+ // TODO: Lookup into a cst table once complex is implemented
2555
+ if (eq(*arg, *one))
2556
+ return zero;
2557
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
2558
+ return down_cast<const Number &>(*arg).get_eval().acosh(*arg);
2559
+ }
2560
+ return make_rcp<const ACosh>(arg);
2561
+ }
2562
+
2563
+ ATanh::ATanh(const RCP<const Basic> &arg) : InverseHyperbolicFunction(arg)
2564
+ {
2565
+ SYMENGINE_ASSIGN_TYPEID()
2566
+ SYMENGINE_ASSERT(is_canonical(arg))
2567
+ }
2568
+
2569
+ bool ATanh::is_canonical(const RCP<const Basic> &arg) const
2570
+ {
2571
+ if (eq(*arg, *zero))
2572
+ return false;
2573
+ if (is_a_Number(*arg)) {
2574
+ if (down_cast<const Number &>(*arg).is_negative()) {
2575
+ return false;
2576
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2577
+ return false;
2578
+ }
2579
+ }
2580
+ if (could_extract_minus(*arg))
2581
+ return false;
2582
+ return true;
2583
+ }
2584
+
2585
+ RCP<const Basic> atanh(const RCP<const Basic> &arg)
2586
+ {
2587
+ if (eq(*arg, *zero))
2588
+ return zero;
2589
+ if (is_a_Number(*arg)) {
2590
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2591
+ if (not _arg->is_exact()) {
2592
+ return _arg->get_eval().atanh(*_arg);
2593
+ } else if (_arg->is_negative()) {
2594
+ return neg(atanh(zero->sub(*_arg)));
2595
+ }
2596
+ }
2597
+ RCP<const Basic> d;
2598
+ bool b = handle_minus(arg, outArg(d));
2599
+ if (b) {
2600
+ return neg(atanh(d));
2601
+ }
2602
+ return make_rcp<const ATanh>(d);
2603
+ }
2604
+
2605
+ ACoth::ACoth(const RCP<const Basic> &arg) : InverseHyperbolicFunction(arg)
2606
+ {
2607
+ SYMENGINE_ASSIGN_TYPEID()
2608
+ SYMENGINE_ASSERT(is_canonical(arg))
2609
+ }
2610
+
2611
+ bool ACoth::is_canonical(const RCP<const Basic> &arg) const
2612
+ {
2613
+ if (is_a_Number(*arg)) {
2614
+ if (down_cast<const Number &>(*arg).is_negative()) {
2615
+ return false;
2616
+ } else if (not down_cast<const Number &>(*arg).is_exact()) {
2617
+ return false;
2618
+ }
2619
+ }
2620
+ if (could_extract_minus(*arg))
2621
+ return false;
2622
+ return true;
2623
+ }
2624
+
2625
+ RCP<const Basic> acoth(const RCP<const Basic> &arg)
2626
+ {
2627
+ if (is_a_Number(*arg)) {
2628
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2629
+ if (not _arg->is_exact()) {
2630
+ return _arg->get_eval().acoth(*_arg);
2631
+ } else if (_arg->is_negative()) {
2632
+ return neg(acoth(zero->sub(*_arg)));
2633
+ }
2634
+ }
2635
+ RCP<const Basic> d;
2636
+ bool b = handle_minus(arg, outArg(d));
2637
+ if (b) {
2638
+ return neg(acoth(d));
2639
+ }
2640
+ return make_rcp<const ACoth>(d);
2641
+ }
2642
+
2643
+ ASech::ASech(const RCP<const Basic> &arg) : InverseHyperbolicFunction(arg)
2644
+ {
2645
+ SYMENGINE_ASSIGN_TYPEID()
2646
+ SYMENGINE_ASSERT(is_canonical(arg))
2647
+ }
2648
+
2649
+ bool ASech::is_canonical(const RCP<const Basic> &arg) const
2650
+ {
2651
+ // TODO: Lookup into a cst table once complex is implemented
2652
+ if (eq(*arg, *one))
2653
+ return false;
2654
+ if (eq(*arg, *zero))
2655
+ return false;
2656
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
2657
+ return false;
2658
+ }
2659
+ return true;
2660
+ }
2661
+
2662
+ RCP<const Basic> asech(const RCP<const Basic> &arg)
2663
+ {
2664
+ // TODO: Lookup into a cst table once complex is implemented
2665
+ if (eq(*arg, *one))
2666
+ return zero;
2667
+ if (eq(*arg, *zero))
2668
+ return Inf;
2669
+ if (is_a_Number(*arg)) {
2670
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2671
+ if (not _arg->is_exact()) {
2672
+ return _arg->get_eval().asech(*_arg);
2673
+ }
2674
+ }
2675
+ return make_rcp<const ASech>(arg);
2676
+ }
2677
+
2678
+ RCP<const Basic> Sinh::create(const RCP<const Basic> &arg) const
2679
+ {
2680
+ return sinh(arg);
2681
+ }
2682
+
2683
+ RCP<const Basic> Csch::create(const RCP<const Basic> &arg) const
2684
+ {
2685
+ return csch(arg);
2686
+ }
2687
+
2688
+ RCP<const Basic> Cosh::create(const RCP<const Basic> &arg) const
2689
+ {
2690
+ return cosh(arg);
2691
+ }
2692
+
2693
+ RCP<const Basic> Sech::create(const RCP<const Basic> &arg) const
2694
+ {
2695
+ return sech(arg);
2696
+ }
2697
+
2698
+ RCP<const Basic> Tanh::create(const RCP<const Basic> &arg) const
2699
+ {
2700
+ return tanh(arg);
2701
+ }
2702
+
2703
+ RCP<const Basic> Coth::create(const RCP<const Basic> &arg) const
2704
+ {
2705
+ return coth(arg);
2706
+ }
2707
+
2708
+ RCP<const Basic> ASinh::create(const RCP<const Basic> &arg) const
2709
+ {
2710
+ return asinh(arg);
2711
+ }
2712
+
2713
+ RCP<const Basic> ACsch::create(const RCP<const Basic> &arg) const
2714
+ {
2715
+ return acsch(arg);
2716
+ }
2717
+
2718
+ RCP<const Basic> ACosh::create(const RCP<const Basic> &arg) const
2719
+ {
2720
+ return acosh(arg);
2721
+ }
2722
+
2723
+ RCP<const Basic> ATanh::create(const RCP<const Basic> &arg) const
2724
+ {
2725
+ return atanh(arg);
2726
+ }
2727
+
2728
+ RCP<const Basic> ACoth::create(const RCP<const Basic> &arg) const
2729
+ {
2730
+ return acoth(arg);
2731
+ }
2732
+
2733
+ RCP<const Basic> ASech::create(const RCP<const Basic> &arg) const
2734
+ {
2735
+ return asech(arg);
2736
+ }
2737
+
2738
+ KroneckerDelta::KroneckerDelta(const RCP<const Basic> &i,
2739
+ const RCP<const Basic> &j)
2740
+ : TwoArgFunction(i, j)
2741
+ {
2742
+ SYMENGINE_ASSIGN_TYPEID()
2743
+ SYMENGINE_ASSERT(is_canonical(i, j))
2744
+ }
2745
+
2746
+ bool KroneckerDelta::is_canonical(const RCP<const Basic> &i,
2747
+ const RCP<const Basic> &j) const
2748
+ {
2749
+ RCP<const Basic> diff = expand(sub(i, j));
2750
+ if (eq(*diff, *zero)) {
2751
+ return false;
2752
+ } else if (is_a_Number(*diff)) {
2753
+ return false;
2754
+ } else {
2755
+ // TODO: SymPy uses default key sorting to return in order
2756
+ return true;
2757
+ }
2758
+ }
2759
+
2760
+ RCP<const Basic> KroneckerDelta::create(const RCP<const Basic> &a,
2761
+ const RCP<const Basic> &b) const
2762
+ {
2763
+ return kronecker_delta(a, b);
2764
+ }
2765
+
2766
+ RCP<const Basic> kronecker_delta(const RCP<const Basic> &i,
2767
+ const RCP<const Basic> &j)
2768
+ {
2769
+ // Expand is needed to simplify things like `i-(i+1)` to `-1`
2770
+ RCP<const Basic> diff = expand(sub(i, j));
2771
+ if (eq(*diff, *zero)) {
2772
+ return one;
2773
+ } else if (is_a_Number(*diff)) {
2774
+ return zero;
2775
+ } else {
2776
+ // SymPy uses default key sorting to return in order
2777
+ return make_rcp<const KroneckerDelta>(i, j);
2778
+ }
2779
+ }
2780
+
2781
+ bool has_dup(const vec_basic &arg)
2782
+ {
2783
+ map_basic_basic d;
2784
+ auto it = d.end();
2785
+ for (const auto &p : arg) {
2786
+ it = d.find(p);
2787
+ if (it == d.end()) {
2788
+ insert(d, p, one);
2789
+ } else {
2790
+ return true;
2791
+ }
2792
+ }
2793
+ return false;
2794
+ }
2795
+
2796
+ LeviCivita::LeviCivita(const vec_basic &&arg) : MultiArgFunction(std::move(arg))
2797
+ {
2798
+ SYMENGINE_ASSIGN_TYPEID()
2799
+ SYMENGINE_ASSERT(is_canonical(get_vec()))
2800
+ }
2801
+
2802
+ bool LeviCivita::is_canonical(const vec_basic &arg) const
2803
+ {
2804
+ bool are_int = true;
2805
+ for (const auto &p : arg) {
2806
+ if (not(is_a_Number(*p))) {
2807
+ are_int = false;
2808
+ break;
2809
+ }
2810
+ }
2811
+ if (are_int) {
2812
+ return false;
2813
+ } else if (has_dup(arg)) {
2814
+ return false;
2815
+ } else {
2816
+ return true;
2817
+ }
2818
+ }
2819
+
2820
+ RCP<const Basic> LeviCivita::create(const vec_basic &a) const
2821
+ {
2822
+ return levi_civita(a);
2823
+ }
2824
+
2825
+ RCP<const Basic> eval_levicivita(const vec_basic &arg, int len)
2826
+ {
2827
+ int i, j;
2828
+ RCP<const Basic> res = one;
2829
+ for (i = 0; i < len; i++) {
2830
+ for (j = i + 1; j < len; j++) {
2831
+ res = mul(sub(arg[j], arg[i]), res);
2832
+ }
2833
+ res = div(res, factorial(i));
2834
+ }
2835
+ return res;
2836
+ }
2837
+
2838
+ RCP<const Basic> levi_civita(const vec_basic &arg)
2839
+ {
2840
+ bool are_int = true;
2841
+ int len = 0;
2842
+ for (const auto &p : arg) {
2843
+ if (not(is_a_Number(*p))) {
2844
+ are_int = false;
2845
+ break;
2846
+ } else {
2847
+ len++;
2848
+ }
2849
+ }
2850
+ if (are_int) {
2851
+ return eval_levicivita(arg, len);
2852
+ } else if (has_dup(arg)) {
2853
+ return zero;
2854
+ } else {
2855
+ return make_rcp<const LeviCivita>(std::move(arg));
2856
+ }
2857
+ }
2858
+
2859
+ Zeta::Zeta(const RCP<const Basic> &s, const RCP<const Basic> &a)
2860
+ : TwoArgFunction(s, a){SYMENGINE_ASSIGN_TYPEID()
2861
+ SYMENGINE_ASSERT(is_canonical(s, a))}
2862
+
2863
+ Zeta::Zeta(const RCP<const Basic> &s)
2864
+ : TwoArgFunction(s, one)
2865
+ {
2866
+ SYMENGINE_ASSIGN_TYPEID()
2867
+ SYMENGINE_ASSERT(is_canonical(s, one))
2868
+ }
2869
+
2870
+ bool Zeta::is_canonical(const RCP<const Basic> &s,
2871
+ const RCP<const Basic> &a) const
2872
+ {
2873
+ if (eq(*s, *zero))
2874
+ return false;
2875
+ if (eq(*s, *one))
2876
+ return false;
2877
+ if (is_a<Integer>(*s) and is_a<Integer>(*a)) {
2878
+ auto s_ = down_cast<const Integer &>(*s).as_int();
2879
+ if (s_ < 0 || s_ % 2 == 0)
2880
+ return false;
2881
+ }
2882
+ return true;
2883
+ }
2884
+
2885
+ RCP<const Basic> Zeta::create(const RCP<const Basic> &a,
2886
+ const RCP<const Basic> &b) const
2887
+ {
2888
+ return zeta(a, b);
2889
+ }
2890
+
2891
+ RCP<const Basic> zeta(const RCP<const Basic> &s, const RCP<const Basic> &a)
2892
+ {
2893
+ if (is_a_Number(*s)) {
2894
+ if (down_cast<const Number &>(*s).is_zero()) {
2895
+ return sub(div(one, i2), a);
2896
+ } else if (down_cast<const Number &>(*s).is_one()) {
2897
+ return infty(0);
2898
+ } else if (is_a<Integer>(*s) and is_a<Integer>(*a)) {
2899
+ auto s_ = down_cast<const Integer &>(*s).as_int();
2900
+ auto a_ = down_cast<const Integer &>(*a).as_int();
2901
+ RCP<const Basic> zeta;
2902
+ if (s_ < 0) {
2903
+ RCP<const Number> res = (s_ % 2 == 0) ? one : minus_one;
2904
+ zeta
2905
+ = mulnum(res, divnum(bernoulli(-s_ + 1), integer(-s_ + 1)));
2906
+ } else if (s_ % 2 == 0) {
2907
+ RCP<const Number> b = bernoulli(s_);
2908
+ RCP<const Number> f = factorial(s_);
2909
+ zeta = divnum(pownum(integer(2), integer(s_ - 1)), f);
2910
+ zeta = mul(zeta, mul(pow(pi, s), abs(b)));
2911
+ } else {
2912
+ return make_rcp<const Zeta>(s, a);
2913
+ }
2914
+ if (a_ < 0)
2915
+ return add(zeta, harmonic(-a_, s_));
2916
+ return sub(zeta, harmonic(a_ - 1, s_));
2917
+ }
2918
+ }
2919
+ return make_rcp<const Zeta>(s, a);
2920
+ }
2921
+
2922
+ RCP<const Basic> zeta(const RCP<const Basic> &s)
2923
+ {
2924
+ return zeta(s, one);
2925
+ }
2926
+
2927
+ Dirichlet_eta::Dirichlet_eta(const RCP<const Basic> &s) : OneArgFunction(s)
2928
+ {
2929
+ SYMENGINE_ASSIGN_TYPEID()
2930
+ SYMENGINE_ASSERT(is_canonical(s))
2931
+ }
2932
+
2933
+ bool Dirichlet_eta::is_canonical(const RCP<const Basic> &s) const
2934
+ {
2935
+ if (eq(*s, *one))
2936
+ return false;
2937
+ if (not(is_a<Zeta>(*zeta(s))))
2938
+ return false;
2939
+ return true;
2940
+ }
2941
+
2942
+ RCP<const Basic> Dirichlet_eta::rewrite_as_zeta() const
2943
+ {
2944
+ return mul(sub(one, pow(i2, sub(one, get_arg()))), zeta(get_arg()));
2945
+ }
2946
+
2947
+ RCP<const Basic> Dirichlet_eta::create(const RCP<const Basic> &arg) const
2948
+ {
2949
+ return dirichlet_eta(arg);
2950
+ }
2951
+
2952
+ RCP<const Basic> dirichlet_eta(const RCP<const Basic> &s)
2953
+ {
2954
+ if (is_a_Number(*s) and down_cast<const Number &>(*s).is_one()) {
2955
+ return log(i2);
2956
+ }
2957
+ RCP<const Basic> z = zeta(s);
2958
+ if (is_a<Zeta>(*z)) {
2959
+ return make_rcp<const Dirichlet_eta>(s);
2960
+ } else {
2961
+ return mul(sub(one, pow(i2, sub(one, s))), z);
2962
+ }
2963
+ }
2964
+
2965
+ bool Erf::is_canonical(const RCP<const Basic> &arg) const
2966
+ {
2967
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
2968
+ return false;
2969
+ if (could_extract_minus(*arg))
2970
+ return false;
2971
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
2972
+ return false;
2973
+ }
2974
+ return true;
2975
+ }
2976
+
2977
+ RCP<const Basic> Erf::create(const RCP<const Basic> &arg) const
2978
+ {
2979
+ return erf(arg);
2980
+ }
2981
+
2982
+ RCP<const Basic> erf(const RCP<const Basic> &arg)
2983
+ {
2984
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero()) {
2985
+ return zero;
2986
+ }
2987
+ if (is_a_Number(*arg)) {
2988
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
2989
+ if (not _arg->is_exact()) {
2990
+ return _arg->get_eval().erf(*_arg);
2991
+ }
2992
+ }
2993
+ RCP<const Basic> d;
2994
+ bool b = handle_minus(arg, outArg(d));
2995
+ if (b) {
2996
+ return neg(erf(d));
2997
+ }
2998
+ return make_rcp<const Erf>(d);
2999
+ }
3000
+
3001
+ bool Erfc::is_canonical(const RCP<const Basic> &arg) const
3002
+ {
3003
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero())
3004
+ return false;
3005
+ if (could_extract_minus(*arg))
3006
+ return false;
3007
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
3008
+ return false;
3009
+ }
3010
+ return true;
3011
+ }
3012
+
3013
+ RCP<const Basic> Erfc::create(const RCP<const Basic> &arg) const
3014
+ {
3015
+ return erfc(arg);
3016
+ }
3017
+
3018
+ RCP<const Basic> erfc(const RCP<const Basic> &arg)
3019
+ {
3020
+ if (is_a<Integer>(*arg) and down_cast<const Integer &>(*arg).is_zero()) {
3021
+ return one;
3022
+ }
3023
+ if (is_a_Number(*arg)) {
3024
+ RCP<const Number> _arg = rcp_static_cast<const Number>(arg);
3025
+ if (not _arg->is_exact()) {
3026
+ return _arg->get_eval().erfc(*_arg);
3027
+ }
3028
+ }
3029
+
3030
+ RCP<const Basic> d;
3031
+ bool b = handle_minus(arg, outArg(d));
3032
+ if (b) {
3033
+ return add(integer(2), neg(erfc(d)));
3034
+ }
3035
+ return make_rcp<const Erfc>(d);
3036
+ }
3037
+
3038
+ Gamma::Gamma(const RCP<const Basic> &arg) : OneArgFunction{arg}
3039
+ {
3040
+ SYMENGINE_ASSIGN_TYPEID()
3041
+ SYMENGINE_ASSERT(is_canonical(arg))
3042
+ }
3043
+
3044
+ bool Gamma::is_canonical(const RCP<const Basic> &arg) const
3045
+ {
3046
+ if (is_a<Integer>(*arg))
3047
+ return false;
3048
+ if (is_a<Rational>(*arg)
3049
+ and (get_den(down_cast<const Rational &>(*arg).as_rational_class()))
3050
+ == 2) {
3051
+ return false;
3052
+ }
3053
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
3054
+ return false;
3055
+ }
3056
+ return true;
3057
+ }
3058
+
3059
+ RCP<const Basic> Gamma::create(const RCP<const Basic> &arg) const
3060
+ {
3061
+ return gamma(arg);
3062
+ }
3063
+
3064
+ RCP<const Basic> gamma_positive_int(const RCP<const Basic> &arg)
3065
+ {
3066
+ SYMENGINE_ASSERT(is_a<Integer>(*arg))
3067
+ RCP<const Integer> arg_ = rcp_static_cast<const Integer>(arg);
3068
+ SYMENGINE_ASSERT(arg_->is_positive())
3069
+ return factorial((arg_->subint(*one))->as_int());
3070
+ }
3071
+
3072
+ RCP<const Basic> gamma_multiple_2(const RCP<const Basic> &arg)
3073
+ {
3074
+ SYMENGINE_ASSERT(is_a<Rational>(*arg))
3075
+ RCP<const Rational> arg_ = rcp_static_cast<const Rational>(arg);
3076
+ SYMENGINE_ASSERT(get_den(arg_->as_rational_class()) == 2)
3077
+ RCP<const Integer> n, k;
3078
+ RCP<const Number> coeff;
3079
+ n = quotient_f(*(integer(mp_abs(get_num(arg_->as_rational_class())))),
3080
+ *(integer(get_den(arg_->as_rational_class()))));
3081
+ if (arg_->is_positive()) {
3082
+ k = n;
3083
+ coeff = one;
3084
+ } else {
3085
+ n = n->addint(*one);
3086
+ k = n;
3087
+ if ((n->as_int() & 1) == 0) {
3088
+ coeff = one;
3089
+ } else {
3090
+ coeff = minus_one;
3091
+ }
3092
+ }
3093
+ // lakutata: the double factorial 3*5*...*(2k - 1) in an integer of any size
3094
+ // (an int overflowed from k = 10: gamma(-25/2) was wrong)
3095
+ integer_class j = 1;
3096
+ for (long i = 3; i < 2 * k->as_int(); i = i + 2) {
3097
+ j *= i;
3098
+ }
3099
+ coeff = mulnum(coeff, integer(std::move(j)));
3100
+ if (arg_->is_positive()) {
3101
+ return div(mul(coeff, sqrt(pi)), pow(i2, n));
3102
+ } else {
3103
+ return div(mul(pow(i2, n), sqrt(pi)), coeff);
3104
+ }
3105
+ }
3106
+
3107
+ RCP<const Basic> gamma(const RCP<const Basic> &arg)
3108
+ {
3109
+ if (is_a<Integer>(*arg)) {
3110
+ RCP<const Integer> arg_ = rcp_static_cast<const Integer>(arg);
3111
+ if (arg_->is_positive()) {
3112
+ // lakutata: the factorials above the limit stay as written
3113
+ if (arg_->as_integer_class() > GAMMA_LIMIT)
3114
+ return make_rcp<const Gamma>(arg);
3115
+ return gamma_positive_int(arg);
3116
+ } else {
3117
+ return ComplexInf;
3118
+ }
3119
+ } else if (is_a<Rational>(*arg)) {
3120
+ RCP<const Rational> arg_ = rcp_static_cast<const Rational>(arg);
3121
+ if ((get_den(arg_->as_rational_class())) == 2) {
3122
+ if (mp_abs(get_num(arg_->as_rational_class())) > 2 * GAMMA_LIMIT)
3123
+ return make_rcp<const Gamma>(arg);
3124
+ return gamma_multiple_2(arg);
3125
+ } else {
3126
+ return make_rcp<const Gamma>(arg);
3127
+ }
3128
+ } else if (is_a_Number(*arg)
3129
+ and not down_cast<const Number &>(*arg).is_exact()) {
3130
+ return down_cast<const Number &>(*arg).get_eval().gamma(*arg);
3131
+ }
3132
+ return make_rcp<const Gamma>(arg);
3133
+ }
3134
+
3135
+ LowerGamma::LowerGamma(const RCP<const Basic> &s, const RCP<const Basic> &x)
3136
+ : TwoArgFunction(s, x)
3137
+ {
3138
+ SYMENGINE_ASSIGN_TYPEID()
3139
+ SYMENGINE_ASSERT(is_canonical(s, x))
3140
+ }
3141
+
3142
+ bool LowerGamma::is_canonical(const RCP<const Basic> &s,
3143
+ const RCP<const Basic> &x) const
3144
+ {
3145
+ // Only special values are evaluated
3146
+ if (eq(*s, *one))
3147
+ return false;
3148
+ if (is_a<Integer>(*s)
3149
+ and down_cast<const Integer &>(*s).as_integer_class() > 1)
3150
+ return false;
3151
+ if (is_a<Integer>(*mul(i2, s)))
3152
+ return false;
3153
+ #ifdef HAVE_SYMENGINE_MPFR
3154
+ #if MPFR_VERSION_MAJOR > 3
3155
+ if (is_a<RealMPFR>(*s) && is_a<RealMPFR>(*x))
3156
+ return false;
3157
+ #endif
3158
+ #endif
3159
+ return true;
3160
+ }
3161
+
3162
+ RCP<const Basic> LowerGamma::create(const RCP<const Basic> &a,
3163
+ const RCP<const Basic> &b) const
3164
+ {
3165
+ return lowergamma(a, b);
3166
+ }
3167
+
3168
+ RCP<const Basic> lowergamma(const RCP<const Basic> &s,
3169
+ const RCP<const Basic> &x)
3170
+ {
3171
+ // Only special values are being evaluated
3172
+ if (is_a<Integer>(*s)) {
3173
+ RCP<const Integer> s_int = rcp_static_cast<const Integer>(s);
3174
+ if (s_int->is_one()) {
3175
+ return sub(one, exp(mul(minus_one, x)));
3176
+ } else if (s_int->as_integer_class() > 1) {
3177
+ s_int = s_int->subint(*one);
3178
+ return sub(mul(s_int, lowergamma(s_int, x)),
3179
+ mul(pow(x, s_int), exp(mul(minus_one, x))));
3180
+ } else {
3181
+ return make_rcp<const LowerGamma>(s, x);
3182
+ }
3183
+ } else if (is_a<Integer>(*(mul(i2, s)))) {
3184
+ RCP<const Number> s_num = rcp_static_cast<const Number>(s);
3185
+ s_num = subnum(s_num, one);
3186
+ if (eq(*s, *div(one, integer(2)))) {
3187
+ return mul(sqrt(pi),
3188
+ erf(sqrt(x))); // base case for s of the form n/2
3189
+ } else if (s_num->is_positive()) {
3190
+ return sub(mul(s_num, lowergamma(s_num, x)),
3191
+ mul(pow(x, s_num), exp(mul(minus_one, x))));
3192
+ } else {
3193
+ return div(add(lowergamma(add(s, one), x),
3194
+ mul(pow(x, s), exp(mul(minus_one, x)))),
3195
+ s);
3196
+ }
3197
+ #ifdef HAVE_SYMENGINE_MPFR
3198
+ #if MPFR_VERSION_MAJOR > 3
3199
+ } else if (is_a<RealMPFR>(*s) && is_a<RealMPFR>(*x)) {
3200
+ const auto &s_ = down_cast<const RealMPFR &>(*s).i.get_mpfr_t();
3201
+ const auto &x_ = down_cast<const RealMPFR &>(*x).i.get_mpfr_t();
3202
+ if (mpfr_cmp_si(x_, 0) >= 0) {
3203
+ mpfr_class t(std::max(mpfr_get_prec(s_), mpfr_get_prec(x_)));
3204
+ mpfr_class u(std::max(mpfr_get_prec(s_), mpfr_get_prec(x_)));
3205
+ mpfr_gamma_inc(t.get_mpfr_t(), s_, x_, MPFR_RNDN);
3206
+ mpfr_gamma(u.get_mpfr_t(), s_, MPFR_RNDN);
3207
+ mpfr_sub(t.get_mpfr_t(), u.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
3208
+ return real_mpfr(std::move(t));
3209
+ } else {
3210
+ throw NotImplementedError("Not implemented.");
3211
+ }
3212
+ #endif
3213
+ #endif
3214
+ }
3215
+ return make_rcp<const LowerGamma>(s, x);
3216
+ }
3217
+
3218
+ UpperGamma::UpperGamma(const RCP<const Basic> &s, const RCP<const Basic> &x)
3219
+ : TwoArgFunction(s, x)
3220
+ {
3221
+ SYMENGINE_ASSIGN_TYPEID()
3222
+ SYMENGINE_ASSERT(is_canonical(s, x))
3223
+ }
3224
+
3225
+ bool UpperGamma::is_canonical(const RCP<const Basic> &s,
3226
+ const RCP<const Basic> &x) const
3227
+ {
3228
+ // Only special values are evaluated
3229
+ if (eq(*s, *one))
3230
+ return false;
3231
+ if (is_a<Integer>(*s)
3232
+ and down_cast<const Integer &>(*s).as_integer_class() > 1)
3233
+ return false;
3234
+ if (is_a<Integer>(*mul(i2, s)))
3235
+ return false;
3236
+ #ifdef HAVE_SYMENGINE_MPFR
3237
+ #if MPFR_VERSION_MAJOR > 3
3238
+ if (is_a<RealMPFR>(*s) && is_a<RealMPFR>(*x))
3239
+ return false;
3240
+ #endif
3241
+ #endif
3242
+ return true;
3243
+ }
3244
+
3245
+ RCP<const Basic> UpperGamma::create(const RCP<const Basic> &a,
3246
+ const RCP<const Basic> &b) const
3247
+ {
3248
+ return uppergamma(a, b);
3249
+ }
3250
+
3251
+ RCP<const Basic> uppergamma(const RCP<const Basic> &s,
3252
+ const RCP<const Basic> &x)
3253
+ {
3254
+ // Only special values are being evaluated
3255
+ if (is_a<Integer>(*s)) {
3256
+ RCP<const Integer> s_int = rcp_static_cast<const Integer>(s);
3257
+ if (s_int->is_one()) {
3258
+ return exp(mul(minus_one, x));
3259
+ } else if (s_int->as_integer_class() > 1) {
3260
+ s_int = s_int->subint(*one);
3261
+ return add(mul(s_int, uppergamma(s_int, x)),
3262
+ mul(pow(x, s_int), exp(mul(minus_one, x))));
3263
+ } else {
3264
+ // TODO: implement unpolarfy to handle this case
3265
+ return make_rcp<const UpperGamma>(s, x);
3266
+ }
3267
+ } else if (is_a<Integer>(*(mul(i2, s)))) {
3268
+ RCP<const Number> s_num = rcp_static_cast<const Number>(s);
3269
+ s_num = subnum(s_num, one);
3270
+ if (eq(*s, *div(one, integer(2)))) {
3271
+ return mul(sqrt(pi),
3272
+ erfc(sqrt(x))); // base case for s of the form n/2
3273
+ } else if (s_num->is_positive()) {
3274
+ return add(mul(s_num, uppergamma(s_num, x)),
3275
+ mul(pow(x, s_num), exp(mul(minus_one, x))));
3276
+ } else {
3277
+ return div(sub(uppergamma(add(s, one), x),
3278
+ mul(pow(x, s), exp(mul(minus_one, x)))),
3279
+ s);
3280
+ }
3281
+ #ifdef HAVE_SYMENGINE_MPFR
3282
+ #if MPFR_VERSION_MAJOR > 3
3283
+ } else if (is_a<RealMPFR>(*s) && is_a<RealMPFR>(*x)) {
3284
+ const auto &s_ = down_cast<const RealMPFR &>(*s).i.get_mpfr_t();
3285
+ const auto &x_ = down_cast<const RealMPFR &>(*x).i.get_mpfr_t();
3286
+ if (mpfr_cmp_si(x_, 0) >= 0) {
3287
+ mpfr_class t(std::max(mpfr_get_prec(s_), mpfr_get_prec(x_)));
3288
+ mpfr_gamma_inc(t.get_mpfr_t(), s_, x_, MPFR_RNDN);
3289
+ return real_mpfr(std::move(t));
3290
+ } else {
3291
+ throw NotImplementedError("Not implemented.");
3292
+ }
3293
+ #endif
3294
+ #endif
3295
+ }
3296
+ return make_rcp<const UpperGamma>(s, x);
3297
+ }
3298
+
3299
+ bool LogGamma::is_canonical(const RCP<const Basic> &arg) const
3300
+ {
3301
+ if (is_a<Integer>(*arg)) {
3302
+ RCP<const Integer> arg_int = rcp_static_cast<const Integer>(arg);
3303
+ if (not arg_int->is_positive()) {
3304
+ return false;
3305
+ }
3306
+ if (eq(*integer(1), *arg_int) or eq(*integer(2), *arg_int)
3307
+ or eq(*integer(3), *arg_int)) {
3308
+ return false;
3309
+ }
3310
+ }
3311
+ return true;
3312
+ }
3313
+
3314
+ RCP<const Basic> LogGamma::rewrite_as_gamma() const
3315
+ {
3316
+ return log(gamma(get_arg()));
3317
+ }
3318
+
3319
+ RCP<const Basic> LogGamma::create(const RCP<const Basic> &arg) const
3320
+ {
3321
+ return loggamma(arg);
3322
+ }
3323
+
3324
+ RCP<const Basic> loggamma(const RCP<const Basic> &arg)
3325
+ {
3326
+ if (is_a<Integer>(*arg)) {
3327
+ RCP<const Integer> arg_int = rcp_static_cast<const Integer>(arg);
3328
+ if (not arg_int->is_positive()) {
3329
+ return Inf;
3330
+ }
3331
+ if (eq(*integer(1), *arg_int) or eq(*integer(2), *arg_int)) {
3332
+ return zero;
3333
+ } else if (eq(*integer(3), *arg_int)) {
3334
+ return log(integer(2));
3335
+ }
3336
+ }
3337
+ return make_rcp<const LogGamma>(arg);
3338
+ }
3339
+
3340
+ RCP<const Beta> Beta::from_two_basic(const RCP<const Basic> &x,
3341
+ const RCP<const Basic> &y)
3342
+ {
3343
+ if (x->__cmp__(*y) == -1) {
3344
+ return make_rcp<const Beta>(y, x);
3345
+ }
3346
+ return make_rcp<const Beta>(x, y);
3347
+ }
3348
+
3349
+ bool Beta::is_canonical(const RCP<const Basic> &x, const RCP<const Basic> &y)
3350
+ {
3351
+ if (x->__cmp__(*y) == -1) {
3352
+ return false;
3353
+ }
3354
+ if (is_a<Integer>(*x)
3355
+ or (is_a<Rational>(*x)
3356
+ and (get_den(down_cast<const Rational &>(*x).as_rational_class()))
3357
+ == 2)) {
3358
+ if (is_a<Integer>(*y)
3359
+ or (is_a<Rational>(*y)
3360
+ and (get_den(
3361
+ down_cast<const Rational &>(*y).as_rational_class()))
3362
+ == 2)) {
3363
+ return false;
3364
+ }
3365
+ }
3366
+ return true;
3367
+ }
3368
+
3369
+ RCP<const Basic> Beta::rewrite_as_gamma() const
3370
+ {
3371
+ return div(mul(gamma(get_arg1()), gamma(get_arg2())),
3372
+ gamma(add(get_arg1(), get_arg2())));
3373
+ }
3374
+
3375
+ RCP<const Basic> Beta::create(const RCP<const Basic> &a,
3376
+ const RCP<const Basic> &b) const
3377
+ {
3378
+ return beta(a, b);
3379
+ }
3380
+
3381
+ RCP<const Basic> beta(const RCP<const Basic> &x, const RCP<const Basic> &y)
3382
+ {
3383
+ // Only special values are being evaluated
3384
+ // lakutata: beta(x, 1 - x) is pi/sin(pi*x); SymEngine gave complexInfinity
3385
+ // (the poles are where x or y is a nonpositive integer, below)
3386
+ if (eq(*add(x, y), *one) and is_a<Rational>(*x)) {
3387
+ return div(pi, sin(mul(pi, x)));
3388
+ }
3389
+
3390
+ if (is_a<Integer>(*x)) {
3391
+ RCP<const Integer> x_int = rcp_static_cast<const Integer>(x);
3392
+ if (x_int->is_positive()) {
3393
+ if (is_a<Integer>(*y)) {
3394
+ RCP<const Integer> y_int = rcp_static_cast<const Integer>(y);
3395
+ if (y_int->is_positive()) {
3396
+ return div(
3397
+ mul(gamma_positive_int(x), gamma_positive_int(y)),
3398
+ gamma_positive_int(add(x, y)));
3399
+ } else {
3400
+ return ComplexInf;
3401
+ }
3402
+ } else if (is_a<Rational>(*y)) {
3403
+ RCP<const Rational> y_ = rcp_static_cast<const Rational>(y);
3404
+ if (get_den(y_->as_rational_class()) == 2) {
3405
+ return div(mul(gamma_positive_int(x), gamma_multiple_2(y)),
3406
+ gamma_multiple_2(add(x, y)));
3407
+ } else {
3408
+ return Beta::from_two_basic(x, y);
3409
+ }
3410
+ }
3411
+ } else {
3412
+ return ComplexInf;
3413
+ }
3414
+ }
3415
+
3416
+ if (is_a<Integer>(*y)) {
3417
+ RCP<const Integer> y_int = rcp_static_cast<const Integer>(y);
3418
+ if (y_int->is_positive()) {
3419
+ if (is_a<Rational>(*x)) {
3420
+ RCP<const Rational> x_ = rcp_static_cast<const Rational>(x);
3421
+ if (get_den(x_->as_rational_class()) == 2) {
3422
+ return div(mul(gamma_positive_int(y), gamma_multiple_2(x)),
3423
+ gamma_multiple_2(add(x, y)));
3424
+ } else {
3425
+ return Beta::from_two_basic(x, y);
3426
+ }
3427
+ }
3428
+ } else {
3429
+ return ComplexInf;
3430
+ }
3431
+ }
3432
+
3433
+ if (is_a<const Rational>(*x)
3434
+ and get_den(down_cast<const Rational &>(*x).as_rational_class()) == 2) {
3435
+ if (is_a<Integer>(*y)) {
3436
+ RCP<const Integer> y_int = rcp_static_cast<const Integer>(y);
3437
+ if (y_int->is_positive()) {
3438
+ return div(mul(gamma_multiple_2(x), gamma_positive_int(y)),
3439
+ gamma_multiple_2(add(x, y)));
3440
+ } else {
3441
+ return ComplexInf;
3442
+ }
3443
+ }
3444
+ if (is_a<const Rational>(*y)
3445
+ and get_den((down_cast<const Rational &>(*y)).as_rational_class())
3446
+ == 2) {
3447
+ return div(mul(gamma_multiple_2(x), gamma_multiple_2(y)),
3448
+ gamma_positive_int(add(x, y)));
3449
+ }
3450
+ }
3451
+ return Beta::from_two_basic(x, y);
3452
+ }
3453
+
3454
+ // lakutata: whether polygamma(n, x) is moved right by its recurrence: a
3455
+ // negative rational x not too far left, an order n nonnegative integer
3456
+ static bool polygamma_shifted(const RCP<const Basic> &n,
3457
+ const RCP<const Basic> &x)
3458
+ {
3459
+ if (not is_a<Integer>(*n) or down_cast<const Integer &>(*n).is_negative()
3460
+ or not mp_fits_ulong_p(down_cast<const Integer &>(*n).as_integer_class())
3461
+ or not is_a<Rational>(*x)
3462
+ or not down_cast<const Rational &>(*x).is_negative()) {
3463
+ return false;
3464
+ }
3465
+ return mp_abs(get_num(down_cast<const Rational &>(*x).as_rational_class()))
3466
+ <= 1000 * get_den(down_cast<const Rational &>(*x).as_rational_class());
3467
+ }
3468
+
3469
+ bool PolyGamma::is_canonical(const RCP<const Basic> &n,
3470
+ const RCP<const Basic> &x)
3471
+ {
3472
+ // lakutata: the nonpositive integers and the negative rationals moved right
3473
+ if ((is_a<Integer>(*x) and not down_cast<const Integer &>(*x).is_positive())
3474
+ or polygamma_shifted(n, x)) {
3475
+ return false;
3476
+ }
3477
+ if (is_a<Integer>(*x)
3478
+ and down_cast<const Integer &>(*x).as_integer_class() > GAMMA_LIMIT) {
3479
+ return true;
3480
+ }
3481
+ if (eq(*n, *zero)) {
3482
+ if (eq(*x, *one)) {
3483
+ return false;
3484
+ }
3485
+ if (is_a<Rational>(*x)) {
3486
+ auto x_ = rcp_static_cast<const Rational>(x);
3487
+ auto den = get_den(x_->as_rational_class());
3488
+ if (den == 2 or den == 3 or den == 4) {
3489
+ return false;
3490
+ }
3491
+ }
3492
+ }
3493
+ return true;
3494
+ }
3495
+
3496
+ RCP<const Basic> PolyGamma::rewrite_as_zeta() const
3497
+ {
3498
+ if (not is_a<Integer>(*get_arg1())) {
3499
+ return rcp_from_this();
3500
+ }
3501
+ RCP<const Integer> n = rcp_static_cast<const Integer>(get_arg1());
3502
+ if (not(n->is_positive())) {
3503
+ return rcp_from_this();
3504
+ }
3505
+ if ((n->as_int() & 1) == 0) {
3506
+ return neg(mul(factorial(n->as_int()), zeta(add(n, one), get_arg2())));
3507
+ } else {
3508
+ return mul(factorial(n->as_int()), zeta(add(n, one), get_arg2()));
3509
+ }
3510
+ }
3511
+
3512
+ RCP<const Basic> PolyGamma::create(const RCP<const Basic> &a,
3513
+ const RCP<const Basic> &b) const
3514
+ {
3515
+ return polygamma(a, b);
3516
+ }
3517
+
3518
+ RCP<const Basic> polygamma(const RCP<const Basic> &n_,
3519
+ const RCP<const Basic> &x_)
3520
+ {
3521
+ // Only special values are being evaluated
3522
+ // lakutata: the poles are the nonpositive integers only (SymEngine gave
3523
+ // complexInfinity for every number not positive); a negative rational is
3524
+ // moved right by psi^(n)(x) = psi^(n)(x + 1) - (-1)^n n!/x^(n+1), the
3525
+ // other numbers (complex ones) are kept for their numeric value
3526
+ if (is_a<Integer>(*x_)
3527
+ and not down_cast<const Integer &>(*x_).is_positive()) {
3528
+ return ComplexInf;
3529
+ }
3530
+ if (polygamma_shifted(n_, x_)) {
3531
+ const unsigned long order
3532
+ = mp_get_ui(down_cast<const Integer &>(*n_).as_integer_class());
3533
+ const RCP<const Basic> coefficient
3534
+ = mul(integer(order % 2 == 0 ? -1 : 1), factorial(order));
3535
+ RCP<const Basic> x = x_, correction = zero;
3536
+ while (down_cast<const Rational &>(*x).is_negative()) {
3537
+ correction = add(correction,
3538
+ mul(coefficient, pow(x, integer(-long(order) - 1))));
3539
+ x = add(x, one);
3540
+ }
3541
+ return add(polygamma(n_, x), correction);
3542
+ }
3543
+ if (is_a_Number(*x_) and not is_a<Integer>(*x_) and not is_a<Rational>(*x_)) {
3544
+ return make_rcp<const PolyGamma>(n_, x_);
3545
+ }
3546
+ // lakutata: not at the integers above the limit of the exact numbers (the
3547
+ // value of digamma there is a harmonic number of as many terms)
3548
+ if (is_a<Integer>(*x_)
3549
+ and down_cast<const Integer &>(*x_).as_integer_class() > GAMMA_LIMIT) {
3550
+ return make_rcp<const PolyGamma>(n_, x_);
3551
+ }
3552
+ if (is_a<Integer>(*n_) and is_a<Integer>(*x_)) {
3553
+ auto n = down_cast<const Integer &>(*n_).as_int();
3554
+ auto x = down_cast<const Integer &>(*x_).as_int();
3555
+ if (n == 0) {
3556
+ return sub(harmonic(x - 1, 1), EulerGamma);
3557
+ } else if (n % 2 == 1) {
3558
+ return mul(factorial(n), zeta(add(n_, one), x_));
3559
+ }
3560
+ }
3561
+ if (eq(*n_, *zero)) {
3562
+ if (eq(*x_, *one)) {
3563
+ return neg(EulerGamma);
3564
+ }
3565
+ if (is_a<Rational>(*x_)) {
3566
+ RCP<const Rational> x = rcp_static_cast<const Rational>(x_);
3567
+ const auto den = get_den(x->as_rational_class());
3568
+ const auto num = get_num(x->as_rational_class());
3569
+ const integer_class r = num % den;
3570
+ RCP<const Basic> res;
3571
+ if (den == 2) {
3572
+ res = sub(mul(im2, log(i2)), EulerGamma);
3573
+ } else if (den == 3) {
3574
+ // lakutata: by the remainder (psi(4/3) from psi(1/3)), not the
3575
+ // numerator
3576
+ if (r == 1) {
3577
+ res = add(neg(div(div(pi, i2), sqrt(i3))),
3578
+ sub(div(mul(im3, log(i3)), i2), EulerGamma));
3579
+ } else {
3580
+ res = add(div(div(pi, i2), sqrt(i3)),
3581
+ sub(div(mul(im3, log(i3)), i2), EulerGamma));
3582
+ }
3583
+ } else if (den == 4) {
3584
+ if (r == 1) {
3585
+ res = add(div(pi, im2), sub(mul(im3, log(i2)), EulerGamma));
3586
+ } else {
3587
+ res = add(div(pi, i2), sub(mul(im3, log(i2)), EulerGamma));
3588
+ }
3589
+ } else {
3590
+ return make_rcp<const PolyGamma>(n_, x_);
3591
+ }
3592
+ rational_class a(0), f(r, den);
3593
+ for (unsigned long i = 0; i < (num - r) / den; ++i) {
3594
+ a += 1 / (f + i);
3595
+ }
3596
+ return add(Rational::from_mpq(a), res);
3597
+ }
3598
+ }
3599
+ return make_rcp<const PolyGamma>(n_, x_);
3600
+ }
3601
+
3602
+ RCP<const Basic> digamma(const RCP<const Basic> &x)
3603
+ {
3604
+ return polygamma(zero, x);
3605
+ }
3606
+
3607
+ RCP<const Basic> trigamma(const RCP<const Basic> &x)
3608
+ {
3609
+ return polygamma(one, x);
3610
+ }
3611
+
3612
+ Abs::Abs(const RCP<const Basic> &arg) : OneArgFunction(arg)
3613
+ {
3614
+ SYMENGINE_ASSIGN_TYPEID()
3615
+ SYMENGINE_ASSERT(is_canonical(arg))
3616
+ }
3617
+
3618
+ bool Abs::is_canonical(const RCP<const Basic> &arg) const
3619
+ {
3620
+ if (is_a<Integer>(*arg) or is_a<Rational>(*arg) or is_a<Complex>(*arg))
3621
+ return false;
3622
+ if (is_a_Number(*arg) and not down_cast<const Number &>(*arg).is_exact()) {
3623
+ return false;
3624
+ }
3625
+ if (is_a<Abs>(*arg)) {
3626
+ return false;
3627
+ }
3628
+
3629
+ if (could_extract_minus(*arg)) {
3630
+ return false;
3631
+ }
3632
+
3633
+ return true;
3634
+ }
3635
+
3636
+ RCP<const Basic> Abs::create(const RCP<const Basic> &arg) const
3637
+ {
3638
+ return abs(arg);
3639
+ }
3640
+
3641
+ RCP<const Basic> abs(const RCP<const Basic> &arg)
3642
+ {
3643
+ if (is_a<Integer>(*arg)) {
3644
+ RCP<const Integer> arg_ = rcp_static_cast<const Integer>(arg);
3645
+ if (arg_->is_negative()) {
3646
+ return arg_->neg();
3647
+ } else {
3648
+ return arg_;
3649
+ }
3650
+ } else if (is_a<Rational>(*arg)) {
3651
+ RCP<const Rational> arg_ = rcp_static_cast<const Rational>(arg);
3652
+ if (arg_->is_negative()) {
3653
+ return arg_->neg();
3654
+ } else {
3655
+ return arg_;
3656
+ }
3657
+ } else if (is_a<Complex>(*arg)) {
3658
+ RCP<const Complex> arg_ = rcp_static_cast<const Complex>(arg);
3659
+ return sqrt(Rational::from_mpq(arg_->real_ * arg_->real_
3660
+ + arg_->imaginary_ * arg_->imaginary_));
3661
+ } else if (is_a_Number(*arg)
3662
+ and not down_cast<const Number &>(*arg).is_exact()) {
3663
+ return down_cast<const Number &>(*arg).get_eval().abs(*arg);
3664
+ }
3665
+ if (is_a<Abs>(*arg)) {
3666
+ return arg;
3667
+ }
3668
+
3669
+ // lakutata: the numeric factor taken out, as SymPy (abs(-2*x) is 2*abs(x))
3670
+ if (is_a<Mul>(*arg)
3671
+ and not down_cast<const Mul &>(*arg).get_coef()->is_one()) {
3672
+ map_basic_basic factors = down_cast<const Mul &>(*arg).get_dict();
3673
+ return mul(abs(down_cast<const Mul &>(*arg).get_coef()),
3674
+ abs(Mul::from_dict(one, std::move(factors))));
3675
+ }
3676
+ RCP<const Basic> d;
3677
+ // lakutata: abs(-u) is abs(u), evaluated again (abs(-abs(x)) is abs(x))
3678
+ if (handle_minus(arg, outArg(d)) and not eq(*d, *arg))
3679
+ return abs(d);
3680
+ return make_rcp<const Abs>(d);
3681
+ }
3682
+
3683
+ Max::Max(const vec_basic &&arg) : MultiArgFunction(std::move(arg))
3684
+ {
3685
+ SYMENGINE_ASSIGN_TYPEID()
3686
+ SYMENGINE_ASSERT(is_canonical(get_vec()))
3687
+ }
3688
+
3689
+ bool Max::is_canonical(const vec_basic &arg) const
3690
+ {
3691
+ if (arg.size() < 2)
3692
+ return false;
3693
+
3694
+ bool non_number_exists = false;
3695
+
3696
+ for (const auto &p : arg) {
3697
+ if (is_a<Complex>(*p) or is_a<Max>(*p))
3698
+ return false;
3699
+ if (not is_a_Number(*p))
3700
+ non_number_exists = true;
3701
+ }
3702
+ if (not std::is_sorted(arg.begin(), arg.end(), RCPBasicKeyLess()))
3703
+ return false;
3704
+
3705
+ return non_number_exists; // all arguments cant be numbers
3706
+ }
3707
+
3708
+ RCP<const Basic> Max::create(const vec_basic &a) const
3709
+ {
3710
+ return max(a);
3711
+ }
3712
+
3713
+ RCP<const Basic> max(const vec_basic &arg)
3714
+ {
3715
+ bool number_set = false;
3716
+ RCP<const Number> max_number, difference;
3717
+ set_basic new_args;
3718
+
3719
+ for (const auto &p : arg) {
3720
+ if (is_a<Complex>(*p))
3721
+ throw SymEngineException("Complex can't be passed to max!");
3722
+
3723
+ if (is_a_Number(*p)) {
3724
+ if (not number_set) {
3725
+ max_number = rcp_static_cast<const Number>(p);
3726
+
3727
+ } else {
3728
+ if (eq(*p, *Inf)) {
3729
+ return Inf;
3730
+ } else if (eq(*p, *NegInf)) {
3731
+ continue;
3732
+ }
3733
+ difference = down_cast<const Number &>(*p).sub(*max_number);
3734
+
3735
+ if (difference->is_zero() and not difference->is_exact()) {
3736
+ if (max_number->is_exact())
3737
+ max_number = rcp_static_cast<const Number>(p);
3738
+ } else if (difference->is_positive()) {
3739
+ max_number = rcp_static_cast<const Number>(p);
3740
+ }
3741
+ }
3742
+ number_set = true;
3743
+
3744
+ } else if (is_a<Max>(*p)) {
3745
+ for (const auto &l : down_cast<const Max &>(*p).get_args()) {
3746
+ if (is_a_Number(*l)) {
3747
+ if (not number_set) {
3748
+ max_number = rcp_static_cast<const Number>(l);
3749
+
3750
+ } else {
3751
+ difference = rcp_static_cast<const Number>(l)->sub(
3752
+ *max_number);
3753
+
3754
+ if (difference->is_zero()
3755
+ and not difference->is_exact()) {
3756
+ if (max_number->is_exact())
3757
+ max_number = rcp_static_cast<const Number>(l);
3758
+ } else if (difference->is_positive()) {
3759
+ max_number = rcp_static_cast<const Number>(l);
3760
+ }
3761
+ }
3762
+ number_set = true;
3763
+ } else {
3764
+ new_args.insert(l);
3765
+ }
3766
+ }
3767
+ } else {
3768
+ new_args.insert(p);
3769
+ }
3770
+ }
3771
+
3772
+ if (number_set)
3773
+ new_args.insert(max_number);
3774
+
3775
+ vec_basic final_args(new_args.size());
3776
+ std::copy(new_args.begin(), new_args.end(), final_args.begin());
3777
+
3778
+ if (final_args.size() > 1) {
3779
+ return make_rcp<const Max>(std::move(final_args));
3780
+ } else if (final_args.size() == 1) {
3781
+ return final_args[0];
3782
+ } else {
3783
+ throw SymEngineException("Empty vec_basic passed to max!");
3784
+ }
3785
+ }
3786
+
3787
+ Min::Min(const vec_basic &&arg) : MultiArgFunction(std::move(arg))
3788
+ {
3789
+ SYMENGINE_ASSIGN_TYPEID()
3790
+ SYMENGINE_ASSERT(is_canonical(get_vec()))
3791
+ }
3792
+
3793
+ bool Min::is_canonical(const vec_basic &arg) const
3794
+ {
3795
+ if (arg.size() < 2)
3796
+ return false;
3797
+
3798
+ bool non_number_exists = false;
3799
+
3800
+ for (const auto &p : arg) {
3801
+ if (is_a<Complex>(*p) or is_a<Min>(*p))
3802
+ return false;
3803
+ if (not is_a_Number(*p))
3804
+ non_number_exists = true;
3805
+ }
3806
+ if (not std::is_sorted(arg.begin(), arg.end(), RCPBasicKeyLess()))
3807
+ return false;
3808
+
3809
+ return non_number_exists; // all arguments cant be numbers
3810
+ }
3811
+
3812
+ RCP<const Basic> Min::create(const vec_basic &a) const
3813
+ {
3814
+ return min(a);
3815
+ }
3816
+
3817
+ RCP<const Basic> min(const vec_basic &arg)
3818
+ {
3819
+ bool number_set = false;
3820
+ RCP<const Number> min_number, difference;
3821
+ set_basic new_args;
3822
+
3823
+ for (const auto &p : arg) {
3824
+ if (is_a<Complex>(*p))
3825
+ throw SymEngineException("Complex can't be passed to min!");
3826
+
3827
+ if (is_a_Number(*p)) {
3828
+ if (not number_set) {
3829
+ min_number = rcp_static_cast<const Number>(p);
3830
+
3831
+ } else {
3832
+ if (eq(*p, *Inf)) {
3833
+ continue;
3834
+ } else if (eq(*p, *NegInf)) {
3835
+ return NegInf;
3836
+ }
3837
+ difference = min_number->sub(*rcp_static_cast<const Number>(p));
3838
+
3839
+ if (difference->is_zero() and not difference->is_exact()) {
3840
+ if (min_number->is_exact())
3841
+ min_number = rcp_static_cast<const Number>(p);
3842
+ } else if (difference->is_positive()) {
3843
+ min_number = rcp_static_cast<const Number>(p);
3844
+ }
3845
+ }
3846
+ number_set = true;
3847
+
3848
+ } else if (is_a<Min>(*p)) {
3849
+ for (const auto &l : down_cast<const Min &>(*p).get_args()) {
3850
+ if (is_a_Number(*l)) {
3851
+ if (not number_set) {
3852
+ min_number = rcp_static_cast<const Number>(l);
3853
+
3854
+ } else {
3855
+ difference = min_number->sub(
3856
+ *rcp_static_cast<const Number>(l));
3857
+
3858
+ if (difference->is_zero()
3859
+ and not difference->is_exact()) {
3860
+ if (min_number->is_exact())
3861
+ min_number = rcp_static_cast<const Number>(l);
3862
+ } else if (difference->is_positive()) {
3863
+ min_number = rcp_static_cast<const Number>(l);
3864
+ }
3865
+ }
3866
+ number_set = true;
3867
+ } else {
3868
+ new_args.insert(l);
3869
+ }
3870
+ }
3871
+ } else {
3872
+ new_args.insert(p);
3873
+ }
3874
+ }
3875
+
3876
+ if (number_set)
3877
+ new_args.insert(min_number);
3878
+
3879
+ vec_basic final_args(new_args.size());
3880
+ std::copy(new_args.begin(), new_args.end(), final_args.begin());
3881
+
3882
+ if (final_args.size() > 1) {
3883
+ return make_rcp<const Min>(std::move(final_args));
3884
+ } else if (final_args.size() == 1) {
3885
+ return final_args[0];
3886
+ } else {
3887
+ throw SymEngineException("Empty vec_basic passed to min!");
3888
+ }
3889
+ }
3890
+
3891
+ UnevaluatedExpr::UnevaluatedExpr(const RCP<const Basic> &arg)
3892
+ : OneArgFunction(arg)
3893
+ {
3894
+ SYMENGINE_ASSIGN_TYPEID()
3895
+ SYMENGINE_ASSERT(is_canonical(arg))
3896
+ }
3897
+
3898
+ bool UnevaluatedExpr::is_canonical(const RCP<const Basic> &arg) const
3899
+ {
3900
+ return true;
3901
+ }
3902
+
3903
+ RCP<const Basic> UnevaluatedExpr::create(const RCP<const Basic> &arg) const
3904
+ {
3905
+ return make_rcp<const UnevaluatedExpr>(arg);
3906
+ }
3907
+
3908
+ RCP<const Basic> unevaluated_expr(const RCP<const Basic> &arg)
3909
+ {
3910
+ return make_rcp<const UnevaluatedExpr>(arg);
3911
+ }
3912
+
3913
+ } // namespace SymEngine