rustima 0.1.0__tar.gz → 0.3.0__tar.gz

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 (159) hide show
  1. rustima-0.3.0/CHANGELOG.md +112 -0
  2. {rustima-0.1.0 → rustima-0.3.0}/Cargo.lock +1 -1
  3. {rustima-0.1.0 → rustima-0.3.0}/Cargo.toml +4 -2
  4. {rustima-0.1.0 → rustima-0.3.0}/PKG-INFO +2 -1
  5. {rustima-0.1.0 → rustima-0.3.0}/benches/bench_fit.rs +2 -5
  6. {rustima-0.1.0 → rustima-0.3.0}/benches/bench_kalman.rs +5 -7
  7. {rustima-0.1.0 → rustima-0.3.0}/examples/high_order_bench.rs +0 -1
  8. rustima-0.3.0/lbfgsb_c/License.txt +60 -0
  9. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/lbfgsb.c +39 -39
  10. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/lbfgsb.h +16 -0
  11. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/linesearch.c +11 -11
  12. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/linpack.c +5 -5
  13. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/miniCBLAS.c +6 -6
  14. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/print.c +4 -4
  15. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/subalgorithms.c +45 -45
  16. {rustima-0.1.0 → rustima-0.3.0}/pyproject.toml +10 -2
  17. {rustima-0.1.0 → rustima-0.3.0}/python/rustima/__init__.py +9 -4
  18. {rustima-0.1.0 → rustima-0.3.0}/python/rustima/auto.py +27 -102
  19. {rustima-0.1.0 → rustima-0.3.0}/python/rustima/model.py +293 -183
  20. {rustima-0.1.0 → rustima-0.3.0}/python_tests/conftest.py +6 -2
  21. {rustima-0.1.0 → rustima-0.3.0}/python_tests/generate_fixtures.py +33 -7
  22. {rustima-0.1.0 → rustima-0.3.0}/python_tests/generate_matrix_fixtures.py +5 -1
  23. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_auto.py +7 -1
  24. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_exog.py +19 -16
  25. rustima-0.3.0/python_tests/test_extend.py +286 -0
  26. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_fit.py +11 -4
  27. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_forecast.py +1 -1
  28. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_inference.py +37 -39
  29. rustima-0.3.0/python_tests/test_init_correctness.py +112 -0
  30. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_input_validation.py +6 -6
  31. rustima-0.3.0/python_tests/test_matrix_cells.py +92 -0
  32. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_multi_order_accuracy.py +1 -1
  33. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_profile_trust_region.py +26 -11
  34. rustima-0.3.0/python_tests/test_robustness.py +99 -0
  35. rustima-0.3.0/python_tests/test_rolling.py +229 -0
  36. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_safety_guards.py +12 -3
  37. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_simple_diff.py +68 -1
  38. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_trend.py +10 -10
  39. rustima-0.3.0/python_tests/test_variance_parity.py +137 -0
  40. {rustima-0.1.0 → rustima-0.3.0}/src/batch.rs +90 -24
  41. {rustima-0.1.0 → rustima-0.3.0}/src/forecast.rs +239 -22
  42. {rustima-0.1.0 → rustima-0.3.0}/src/inference.rs +14 -2
  43. {rustima-0.1.0 → rustima-0.3.0}/src/initialization.rs +64 -40
  44. {rustima-0.1.0 → rustima-0.3.0}/src/kalman.rs +82 -32
  45. {rustima-0.1.0 → rustima-0.3.0}/src/lbfgsb_ffi.rs +0 -5
  46. {rustima-0.1.0 → rustima-0.3.0}/src/lib.rs +194 -100
  47. rustima-0.3.0/src/optimizer/mod.rs +835 -0
  48. rustima-0.3.0/src/optimizer/multistart.rs +726 -0
  49. rustima-0.3.0/src/optimizer/objective.rs +566 -0
  50. rustima-0.3.0/src/optimizer/runners.rs +405 -0
  51. rustima-0.3.0/src/optimizer/tests.rs +689 -0
  52. rustima-0.3.0/src/optimizer/transforms.rs +147 -0
  53. rustima-0.3.0/src/optimizer/trust_region.rs +868 -0
  54. {rustima-0.1.0 → rustima-0.3.0}/src/params.rs +6 -5
  55. {rustima-0.1.0 → rustima-0.3.0}/src/pipeline.rs +0 -1
  56. {rustima-0.1.0 → rustima-0.3.0}/src/score.rs +297 -385
  57. {rustima-0.1.0 → rustima-0.3.0}/src/start_params.rs +64 -339
  58. {rustima-0.1.0 → rustima-0.3.0}/src/state_space.rs +1 -13
  59. {rustima-0.1.0 → rustima-0.3.0}/src/types.rs +42 -3
  60. {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/matrix_tier_a.json +60 -30
  61. {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/matrix_tier_b.json +138 -69
  62. rustima-0.3.0/tests/fixtures/statsmodels_forecast_reference.json +1081 -0
  63. {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/statsmodels_reference.json +10 -5
  64. {rustima-0.1.0 → rustima-0.3.0}/uv.lock +1 -1
  65. rustima-0.1.0/.github/workflows/ci.yml +0 -64
  66. rustima-0.1.0/.github/workflows/nightly.yml +0 -83
  67. rustima-0.1.0/.github/workflows/release.yml +0 -242
  68. rustima-0.1.0/BENCHMARK_SPEC.md +0 -219
  69. rustima-0.1.0/benchmark_comprehensive.py +0 -152
  70. rustima-0.1.0/benchmark_higher_order.py +0 -178
  71. rustima-0.1.0/compare_all_orders.py +0 -240
  72. rustima-0.1.0/debug_loglike.py +0 -672
  73. rustima-0.1.0/debug_mismatch.py +0 -268
  74. rustima-0.1.0/docs/param_compare_2019.md +0 -105
  75. rustima-0.1.0/docs/ver5.2/spec_numerical_hessian.md +0 -257
  76. rustima-0.1.0/docs/ver5.2/spec_opg.md +0 -299
  77. rustima-0.1.0/docs/ver5.2/spec_simple_differencing.md +0 -551
  78. rustima-0.1.0/fit_summary_report.md +0 -335
  79. rustima-0.1.0/python_tests/bench_batch_forecast.py +0 -223
  80. rustima-0.1.0/python_tests/bench_comparison.py +0 -201
  81. rustima-0.1.0/python_tests/bench_full_comparison.py +0 -377
  82. rustima-0.1.0/python_tests/bench_grid_5x5.py +0 -433
  83. rustima-0.1.0/python_tests/bench_matrix_6x6_s7_s12_s24.py +0 -206
  84. rustima-0.1.0/python_tests/bench_matrix_parent.py +0 -190
  85. rustima-0.1.0/python_tests/bench_matrix_worker.py +0 -119
  86. rustima-0.1.0/python_tests/bench_memory_speed.py +0 -342
  87. rustima-0.1.0/python_tests/bench_pmdarima_compare.py +0 -165
  88. rustima-0.1.0/python_tests/bench_power_2019_2023.py +0 -220
  89. rustima-0.1.0/python_tests/bench_readme.py +0 -338
  90. rustima-0.1.0/python_tests/bench_report_arima.py +0 -278
  91. rustima-0.1.0/python_tests/bench_report_arimax.py +0 -270
  92. rustima-0.1.0/python_tests/bench_report_sarima.py +0 -317
  93. rustima-0.1.0/python_tests/bench_report_sarimax.py +0 -317
  94. rustima-0.1.0/python_tests/bench_s24_highorder.py +0 -259
  95. rustima-0.1.0/python_tests/bench_sarima_plot.py +0 -156
  96. rustima-0.1.0/python_tests/bench_sarima_retry_pmdarima_1y.py +0 -127
  97. rustima-0.1.0/python_tests/bench_sarima_scaling.py +0 -251
  98. rustima-0.1.0/python_tests/bench_sarima_worker.py +0 -136
  99. rustima-0.1.0/python_tests/bench_v5_report.py +0 -604
  100. rustima-0.1.0/python_tests/benchmark_vs_statsmodels.py +0 -433
  101. rustima-0.1.0/python_tests/build_ppt_pmdarima.py +0 -234
  102. rustima-0.1.0/python_tests/compare_profile_methods_2019.py +0 -136
  103. rustima-0.1.0/python_tests/compare_profile_methods_R.R +0 -54
  104. rustima-0.1.0/python_tests/compare_with_r.R +0 -73
  105. rustima-0.1.0/python_tests/diagnose_profile_tr_plateau.py +0 -93
  106. rustima-0.1.0/python_tests/gen_tex_report.py +0 -499
  107. rustima-0.1.0/python_tests/phase_c_power_auto.py +0 -139
  108. rustima-0.1.0/python_tests/phase_c_robustness.py +0 -150
  109. rustima-0.1.0/python_tests/report_convergence_failures.py +0 -301
  110. rustima-0.1.0/python_tests/run_fit_summary.py +0 -331
  111. rustima-0.1.0/python_tests/show_matrix_coefs.py +0 -78
  112. rustima-0.1.0/python_tests/verify_ll_at_same_params.py +0 -91
  113. rustima-0.1.0/python_tests/verify_sarima_vs_sarimax.py +0 -86
  114. rustima-0.1.0/result_v1/00_SUMMARY.md +0 -105
  115. rustima-0.1.0/result_v1/01_ARIMA_comparison.md +0 -51
  116. rustima-0.1.0/result_v1/02_SARIMA_s12_comparison.md +0 -192
  117. rustima-0.1.0/result_v1/02_SARIMA_s24_comparison.md +0 -192
  118. rustima-0.1.0/result_v1/02_SARIMA_s7_comparison.md +0 -192
  119. rustima-0.1.0/result_v1/03_ARIMAX_comparison.md +0 -50
  120. rustima-0.1.0/result_v1/04_SARIMAX_s12_comparison.md +0 -192
  121. rustima-0.1.0/result_v1/04_SARIMAX_s24_comparison.md +0 -192
  122. rustima-0.1.0/result_v1/04_SARIMAX_s7_comparison.md +0 -192
  123. rustima-0.1.0/result_v1/05_auto_arima_benchmark.md +0 -129
  124. rustima-0.1.0/result_v1/bench_all_models.py +0 -397
  125. rustima-0.1.0/result_v1/bench_auto_arima.py +0 -435
  126. rustima-0.1.0/src/optimizer.rs +0 -4054
  127. rustima-0.1.0/test.ipynb +0 -2108
  128. rustima-0.1.0/tests/fixtures/statsmodels_forecast_reference.json +0 -1077
  129. {rustima-0.1.0 → rustima-0.3.0}/.env.example +0 -0
  130. {rustima-0.1.0 → rustima-0.3.0}/.gitignore +0 -0
  131. {rustima-0.1.0 → rustima-0.3.0}/LICENSE +0 -0
  132. {rustima-0.1.0 → rustima-0.3.0}/README.md +0 -0
  133. {rustima-0.1.0 → rustima-0.3.0}/build.rs +0 -0
  134. {rustima-0.1.0 → rustima-0.3.0}/docs/PERF_DIAGNOSIS.md +0 -0
  135. {rustima-0.1.0 → rustima-0.3.0}/docs/SUPPORTED_COMBINATIONS.md +0 -0
  136. {rustima-0.1.0 → rustima-0.3.0}/docs/api_reference.md +0 -0
  137. {rustima-0.1.0 → rustima-0.3.0}/docs/error_codes.md +0 -0
  138. {rustima-0.1.0 → rustima-0.3.0}/docs/migration_guide.md +0 -0
  139. {rustima-0.1.0 → rustima-0.3.0}/docs/profiled_kalman_gls_plan.md +0 -0
  140. {rustima-0.1.0 → rustima-0.3.0}/docs/statsmodels_compat.md +0 -0
  141. {rustima-0.1.0 → rustima-0.3.0}/docs/ver5_convergence_improvement.md +0 -0
  142. {rustima-0.1.0 → rustima-0.3.0}/examples/bench_comprehensive.py +0 -0
  143. {rustima-0.1.0 → rustima-0.3.0}/examples/bench_vs_statsmodels.py +0 -0
  144. {rustima-0.1.0 → rustima-0.3.0}/examples/sarimax_exog_demo.py +0 -0
  145. {rustima-0.1.0 → rustima-0.3.0}/examples/sarimax_hourly_s24.py +0 -0
  146. {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/timer.c +0 -0
  147. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_batch.py +0 -0
  148. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_high_order_accuracy.py +0 -0
  149. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_matrix_tier_a.py +0 -0
  150. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_polars.py +0 -0
  151. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_prediction_quality.py +0 -0
  152. {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_smoke.py +0 -0
  153. {rustima-0.1.0 → rustima-0.3.0}/src/css.rs +0 -0
  154. {rustima-0.1.0 → rustima-0.3.0}/src/error.rs +0 -0
  155. {rustima-0.1.0 → rustima-0.3.0}/src/lbfgsb_wrapper.rs +0 -0
  156. {rustima-0.1.0 → rustima-0.3.0}/src/polynomial.rs +0 -0
  157. {rustima-0.1.0 → rustima-0.3.0}/src/test_helpers.rs +0 -0
  158. {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/.gitkeep +0 -0
  159. {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/statsmodels_fit_reference.json +0 -0
@@ -0,0 +1,112 @@
1
+ # Changelog
2
+
3
+ All notable changes to rustima are documented here.
4
+ Versions follow `0.MINOR.PATCH`, where breaking changes bump MINOR.
5
+
6
+ ## 0.3.0 — 2026-07-25
7
+
8
+ A diagnosis sweep of the engine (~1,800 adversarial inputs, 9 numerical
9
+ regimes against statsmodels, and a structural audit) found and fixed four
10
+ defects that returned **wrong numbers without raising**. Full report:
11
+ `planner/ver9/DIAGNOSIS_V9.md`.
12
+
13
+ > **Results from 0.2.x are not comparable to 0.3.0.** The log-likelihood,
14
+ > AIC and BIC of every model **without differencing** (`d=0, D=0`) were
15
+ > biased, and `inference="hessian"` standard errors were inflated. If you
16
+ > have published or stored numbers from 0.2.x, re-run them.
17
+
18
+ ### Breaking — corrected numerical results
19
+
20
+ - **Initial state covariance for non-differenced models.** `P₀` for the
21
+ stationary ARMA block used the DARE fixed point (the steady-state
22
+ *filtering* covariance) instead of the unconditional *Lyapunov*
23
+ covariance. For AR(1) this used `σ²` where the correct prior is
24
+ `σ²/(1-φ²)`. The error grows like `1/(1-φ²)` and does not vanish with
25
+ sample size: `Δloglike` ≈ −0.1 at φ=0.5, −62 at φ=0.995, and `ΔAIC`
26
+ +156 for a seasonal SAR=0.99 model. Fixed-parameter log-likelihoods now
27
+ match statsmodels to 1e-10. Models with `d≥1` were always correct.
28
+ - **Standard errors from `inference="hessian"`.** The Hessian was mapped
29
+ from unconstrained to constrained space with the Jacobian instead of its
30
+ inverse, applying the transform twice and inflating AR/MA standard
31
+ errors by up to 6.6×. Now matches statsmodels `cov_params_approx` to
32
+ five decimals. `inference="opg"` was unaffected.
33
+ - **False convergence with trend terms.** A deterministic trend made the
34
+ CSS/Burg start-parameter estimator see near-integration, saturating the
35
+ AR start on the constraint boundary where L-BFGS-B stalls and reports
36
+ `converged=True` with a gradient of order 100 — up to 192 nats below the
37
+ optimum. Start parameters are now detrended, and out-of-box estimates
38
+ fall back to zeros instead of clamping.
39
+ - **Near-cancellation detection.** AR and MA roots were compared against
40
+ the sign-flipped MA polynomial, so genuine cancellation (`θ = −φ`) was
41
+ never detected — the warning and the multi-start restart filter both ran
42
+ on the wrong condition.
43
+ - **Post-estimation ran a differently-initialized filter.** `forecast`,
44
+ `rolling_forecast`, `residuals`, `batch_forecast` and `diagnostics`
45
+ ignored the model's enforcement flags and silently used an approximate
46
+ diffuse initialization, so `res.llf` and `res.resid` / `res.diagnostics()`
47
+ described different models — Ljung-Box tested residuals the likelihood
48
+ never saw.
49
+
50
+ ### Breaking — stricter inputs and API
51
+
52
+ - Masked arrays are rejected by `SARIMAXModel` and `auto_arima` (previously
53
+ the mask was silently dropped and masked entries used as data).
54
+ - `sarimax_inference` validates the parameter-vector length instead of
55
+ returning empty arrays.
56
+ - `SARIMAXResult.param_names` raises if the Rust layout and the Python
57
+ naming disagree, instead of padding with `param_N` and printing values
58
+ under the wrong names.
59
+ - `sarimax_rolling_forecast` refuses configurations whose origin snapshots
60
+ would exceed 2 GiB (previously unbounded — 4.4 GB measured at n=1000,
61
+ s=365, and an allocation failure aborts the process).
62
+ - `sarimax_residuals` returns an additional `prediction_variances` key.
63
+ Code asserting an exact key set must be updated.
64
+ - Rust: the never-supported `SarimaxConfig.measurement_error` field is
65
+ removed.
66
+
67
+ ### Added
68
+
69
+ - `PredictionResult.conf_int(alpha=...)` and `.se_mean` —
70
+ `get_prediction()` now produces intervals across the whole range, not
71
+ only the out-of-sample tail.
72
+ - `sarimax_residuals` returns `prediction_variances` (one-step-ahead
73
+ prediction variance).
74
+ - `sarimax_forecast`, `sarimax_rolling_forecast`, `sarimax_residuals`,
75
+ `sarimax_batch_forecast` and `sarimax_diagnostics` accept
76
+ `enforce_stationarity` / `enforce_invertibility` (appended to the
77
+ signature; positional calls are unaffected).
78
+
79
+ ### Fixed
80
+
81
+ - **Deadlock in forked processes.** Rayon's global pool is not fork-safe:
82
+ any batch or grid call in a `fork()`ed child hung forever with no error
83
+ (reachable through `multiprocessing`'s fork context after a single
84
+ earlier batch call). Parallel entry points now fail fast with a clear
85
+ message, and the optimizer's internal parallel sections fall back to
86
+ sequential execution.
87
+ - Batch workers isolate panics per series, so the documented per-series
88
+ error isolation holds even if a worker panics.
89
+ - The analytical gradient no longer disappears near unit roots: the score
90
+ pass now shares the likelihood pass's `F_t ≤ 0` fallback and
91
+ steady-state adoption guard, keeping the gradient finite wherever the
92
+ log-likelihood is.
93
+ - The analytical score accounts for `∂P₀/∂θ` when the initialization
94
+ depends on the parameters.
95
+
96
+ ### Internal
97
+
98
+ - Single-sourced the trend basis, the flat-parameter count, and
99
+ single-series input validation (the last was duplicated into
100
+ `sarimax_grid_search`, the `auto_arima` hot path). Model flags moved from
101
+ adjacent positional booleans into a named struct.
102
+ - Removed dead code: `auto_arima`'s unused evaluation path, the
103
+ `measurement_error` plumbing, and the redundant Python numerical-Hessian
104
+ implementation.
105
+ - Python test suite 407 → 429, including regression tests for every defect
106
+ above and eight previously uncovered option-matrix combinations. CI is
107
+ green for the first time since 2026-05-23.
108
+
109
+ ## 0.2.0
110
+
111
+ Initial tagged release with the SARIMAX engine, `auto_arima`, batch
112
+ processing and the statsmodels-compatible Python API.
@@ -880,7 +880,7 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
880
880
 
881
881
  [[package]]
882
882
  name = "rustima"
883
- version = "0.1.0"
883
+ version = "0.3.0"
884
884
  dependencies = [
885
885
  "anyhow",
886
886
  "approx",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rustima"
3
- version = "0.1.0"
3
+ version = "0.3.0"
4
4
  edition = "2021"
5
5
  rust-version = "1.83"
6
6
  description = "High-performance SARIMAX engine with PyO3 bindings"
@@ -27,7 +27,9 @@ statrs = "0.18"
27
27
  rayon = "1.10"
28
28
 
29
29
  # Python bindings
30
- pyo3 = { version = "0.28", features = ["auto-initialize"] }
30
+ # auto-initialize 제거(2026-07-11): 크레이트 Python::with_gil 사용처 0 임베딩 불필요.
31
+ # 켜두면 manylinux(정적 python) 휠 빌드가 실패해 PyPI 릴리스를 막는다.
32
+ pyo3 = { version = "0.28" }
31
33
  numpy = "0.28"
32
34
 
33
35
  # Error handling
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rustima
3
- Version: 0.1.0
3
+ Version: 0.3.0
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Science/Research
6
6
  Classifier: Intended Audience :: Developers
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
16
17
  Classifier: Programming Language :: Rust
17
18
  Classifier: Topic :: Scientific/Engineering
18
19
  Classifier: Topic :: Scientific/Engineering :: Mathematics
@@ -1,6 +1,6 @@
1
1
  use criterion::{criterion_group, criterion_main, Criterion};
2
- use sarimax_rs::optimizer;
3
- use sarimax_rs::types::{SarimaxConfig, SarimaxOrder, Trend};
2
+ use rustima::optimizer;
3
+ use rustima::types::{SarimaxConfig, SarimaxOrder, Trend};
4
4
 
5
5
  /// Deterministic LCG data generator (fixed seed → reproducible data).
6
6
  fn generate_ar1_data(n: usize, phi: f64, seed: u64) -> Vec<f64> {
@@ -26,7 +26,6 @@ fn bench_fit_ar1(c: &mut Criterion) {
26
26
  enforce_invertibility: true,
27
27
  concentrate_scale: true,
28
28
  simple_differencing: false,
29
- measurement_error: false,
30
29
  };
31
30
 
32
31
  c.bench_function("fit_ar1_n500", |b| {
@@ -44,7 +43,6 @@ fn bench_fit_arima111(c: &mut Criterion) {
44
43
  enforce_invertibility: true,
45
44
  concentrate_scale: true,
46
45
  simple_differencing: false,
47
- measurement_error: false,
48
46
  };
49
47
 
50
48
  c.bench_function("fit_arima111_n500", |b| {
@@ -66,7 +64,6 @@ fn bench_fit_sarima_111_111_12(c: &mut Criterion) {
66
64
  enforce_invertibility: false,
67
65
  concentrate_scale: true,
68
66
  simple_differencing: false,
69
- measurement_error: false,
70
67
  };
71
68
 
72
69
  c.bench_function("fit_sarima111_111_12_n500", |b| {
@@ -1,9 +1,9 @@
1
1
  use criterion::{criterion_group, criterion_main, Criterion};
2
- use sarimax_rs::initialization::KalmanInit;
3
- use sarimax_rs::kalman::kalman_loglike;
4
- use sarimax_rs::params::SarimaxParams;
5
- use sarimax_rs::state_space::StateSpace;
6
- use sarimax_rs::types::{SarimaxConfig, SarimaxOrder, Trend};
2
+ use rustima::initialization::KalmanInit;
3
+ use rustima::kalman::kalman_loglike;
4
+ use rustima::params::SarimaxParams;
5
+ use rustima::state_space::StateSpace;
6
+ use rustima::types::{SarimaxConfig, SarimaxOrder, Trend};
7
7
 
8
8
  /// Deterministic LCG data generator (fixed seed → reproducible data).
9
9
  fn generate_ar1_data(n: usize, phi: f64, seed: u64) -> Vec<f64> {
@@ -30,7 +30,6 @@ fn bench_kalman_ar1(c: &mut Criterion) {
30
30
  enforce_invertibility: false,
31
31
  concentrate_scale: true,
32
32
  simple_differencing: false,
33
- measurement_error: false,
34
33
  };
35
34
  let params = SarimaxParams {
36
35
  trend_coeffs: vec![],
@@ -60,7 +59,6 @@ fn bench_kalman_arima111(c: &mut Criterion) {
60
59
  enforce_invertibility: false,
61
60
  concentrate_scale: true,
62
61
  simple_differencing: false,
63
- measurement_error: false,
64
62
  };
65
63
  let params = SarimaxParams {
66
64
  trend_coeffs: vec![],
@@ -28,7 +28,6 @@ fn run_test(label: &str, order: SarimaxOrder, n: usize) {
28
28
  enforce_invertibility: true,
29
29
  concentrate_scale: true,
30
30
  simple_differencing: false,
31
- measurement_error: false,
32
31
  };
33
32
 
34
33
  let start = Instant::now();
@@ -0,0 +1,60 @@
1
+ L-BFGS-B License
2
+ ================
3
+
4
+ This directory contains a C translation of L-BFGS-B (version 3.0):
5
+
6
+ - Original FORTRAN L-BFGS-B: Ciyou Zhu, Richard Byrd, Jorge Nocedal,
7
+ Jose Luis Morales (Northwestern University).
8
+ - C translation (L-BFGS-B-C): Stephen Becker, 2015
9
+ (stephen.becker@colorado.edu), https://github.com/stephenbeckr/L-BFGS-B-C
10
+
11
+ L-BFGS-B is released under the "New BSD License" (aka "Modified BSD License"
12
+ or "3-clause license").
13
+
14
+ New BSD License
15
+ ---------------
16
+
17
+ Redistribution and use in source and binary forms, with or without
18
+ modification, are permitted provided that the following conditions are met:
19
+
20
+ 1. Redistributions of source code must retain the above copyright notice,
21
+ this list of conditions and the following disclaimer.
22
+
23
+ 2. Redistributions in binary form must reproduce the above copyright notice,
24
+ this list of conditions and the following disclaimer in the documentation
25
+ and/or other materials provided with the distribution.
26
+
27
+ 3. Neither the name of the copyright holder nor the names of its contributors
28
+ may be used to endorse or promote products derived from this software
29
+ without specific prior written permission.
30
+
31
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
35
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41
+ POSSIBILITY OF SUCH DAMAGE.
42
+
43
+ Citation request (from the original authors)
44
+ --------------------------------------------
45
+
46
+ The authors of L-BFGS-B expect that all publications describing work using
47
+ this software, or all commercial products using it, quote at least one of
48
+ the references below:
49
+
50
+ R. H. Byrd, P. Lu and J. Nocedal. A Limited Memory Algorithm for Bound
51
+ Constrained Optimization (1995), SIAM Journal on Scientific and
52
+ Statistical Computing, 16, 5, pp. 1190-1208.
53
+
54
+ C. Zhu, R. H. Byrd and J. Nocedal. Algorithm 778: L-BFGS-B, FORTRAN
55
+ routines for large scale bound constrained optimization (1997), ACM
56
+ Transactions on Mathematical Software, 23, 4, pp. 550-560.
57
+
58
+ J.L. Morales and J. Nocedal. Remark on "Algorithm 778: L-BFGS-B, FORTRAN
59
+ routines for large scale bound constrained optimization" (2011), ACM
60
+ Transactions on Mathematical Software, 38, 1.
@@ -60,7 +60,7 @@ static integer c__1 = 1;
60
60
 
61
61
 
62
62
  /* Local variables */
63
- _Thread_local static integer ld, lr, lt, lz, lwa, lwn, lss, lxp, lws, lwt, lsy, lwy,
63
+ static _Thread_local integer ld, lr, lt, lz, lwa, lwn, lss, lxp, lws, lwt, lsy, lwy,
64
64
  lsnd;
65
65
 
66
66
  /* -jlm-jn */
@@ -343,45 +343,45 @@ static double c_b7 = 0.;
343
343
  fileType o__1=NULL;
344
344
 
345
345
  /* Local variables */
346
- _Thread_local static integer i__, k;
347
- _Thread_local static double gd, dr, rr, dtd;
348
- _Thread_local static integer col;
349
- _Thread_local static double tol;
350
- _Thread_local static logical wrk;
351
- _Thread_local static double stp, cpu1, cpu2;
352
- _Thread_local static integer head;
353
- _Thread_local static double fold;
354
- _Thread_local static integer nact;
355
- _Thread_local static double ddum;
356
- _Thread_local static integer info, nseg;
357
- _Thread_local static double time;
358
- _Thread_local static integer nfgv, ifun, iter;
359
- _Thread_local static integer wordTemp;
360
- _Thread_local static integer *word;
346
+ static _Thread_local integer i__, k;
347
+ static _Thread_local double gd, dr, rr, dtd;
348
+ static _Thread_local integer col;
349
+ static _Thread_local double tol;
350
+ static _Thread_local logical wrk;
351
+ static _Thread_local double stp, cpu1, cpu2;
352
+ static _Thread_local integer head;
353
+ static _Thread_local double fold;
354
+ static _Thread_local integer nact;
355
+ static _Thread_local double ddum;
356
+ static _Thread_local integer info, nseg;
357
+ static _Thread_local double time;
358
+ static _Thread_local integer nfgv, ifun, iter;
359
+ static _Thread_local integer wordTemp;
360
+ static _Thread_local integer *word;
361
361
  word = &wordTemp;
362
- _Thread_local static double time1, time2;
363
- _Thread_local static integer iback;
364
- _Thread_local static double gdold;
365
- _Thread_local static integer nfree;
366
- _Thread_local static logical boxed;
367
- _Thread_local static integer itail;
368
- _Thread_local static double theta;
369
- _Thread_local static double dnorm;
370
- _Thread_local static integer nskip, iword;
371
- _Thread_local static double xstep, stpmx;
372
- _Thread_local static integer ileave;
373
- _Thread_local static double cachyt;
374
- _Thread_local static integer itfile;
375
- _Thread_local static double epsmch;
376
- _Thread_local static logical updatd;
377
- _Thread_local static double sbtime;
378
- _Thread_local static logical prjctd;
379
- _Thread_local static integer iupdat;
380
- _Thread_local static double sbgnrm;
381
- _Thread_local static logical cnstnd;
382
- _Thread_local static integer nenter;
383
- _Thread_local static double lnscht;
384
- _Thread_local static integer nintol;
362
+ static _Thread_local double time1, time2;
363
+ static _Thread_local integer iback;
364
+ static _Thread_local double gdold;
365
+ static _Thread_local integer nfree;
366
+ static _Thread_local logical boxed;
367
+ static _Thread_local integer itail;
368
+ static _Thread_local double theta;
369
+ static _Thread_local double dnorm;
370
+ static _Thread_local integer nskip, iword;
371
+ static _Thread_local double xstep, stpmx;
372
+ static _Thread_local integer ileave;
373
+ static _Thread_local double cachyt;
374
+ static _Thread_local integer itfile;
375
+ static _Thread_local double epsmch;
376
+ static _Thread_local logical updatd;
377
+ static _Thread_local double sbtime;
378
+ static _Thread_local logical prjctd;
379
+ static _Thread_local integer iupdat;
380
+ static _Thread_local double sbgnrm;
381
+ static _Thread_local logical cnstnd;
382
+ static _Thread_local integer nenter;
383
+ static _Thread_local double lnscht;
384
+ static _Thread_local integer nintol;
385
385
 
386
386
  /* -jlm-jn */
387
387
  /* ************ */
@@ -5,6 +5,22 @@
5
5
  #ifndef lbfgsb_h
6
6
  #define lbfgsb_h
7
7
 
8
+ /* Portable thread-local shim. The C11 _Thread_local keyword is missing on:
9
+ * - MSVC C mode -> __declspec(thread)
10
+ * - gcc < 4.9 (manylinux2014 aarch64
11
+ * cross toolchain is gcc 4.8; it even
12
+ * accepts -std=c11 without the keyword) -> GNU __thread
13
+ * - any pre-C11 mode -> GNU __thread
14
+ * Modern clang/gcc with C11 keep the native keyword. */
15
+ #if defined(_MSC_VER) && !defined(__clang__)
16
+ #define _Thread_local __declspec(thread)
17
+ #elif defined(__GNUC__) && !defined(__clang__) && \
18
+ (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9))
19
+ #define _Thread_local __thread
20
+ #elif !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 201112L)
21
+ #define _Thread_local __thread
22
+ #endif
23
+
8
24
 
9
25
 
10
26
  /* Force 64-bit integers on all platforms (including Windows LLP64
@@ -43,18 +43,18 @@ static integer c__1 = 1;
43
43
 
44
44
 
45
45
  /* Table of constant values */
46
- _Thread_local static double c_b14 = FTOL;
47
- _Thread_local static double c_b15 = GTOL;
48
- _Thread_local static double c_b16 = XTOL;
49
- _Thread_local static double c_b17 = STEPMIN;
46
+ static _Thread_local double c_b14 = FTOL;
47
+ static _Thread_local double c_b15 = GTOL;
48
+ static _Thread_local double c_b16 = XTOL;
49
+ static _Thread_local double c_b17 = STEPMIN;
50
50
  /* System generated locals */
51
51
  integer i__1;
52
52
  double d__1;
53
53
 
54
54
 
55
55
  /* Local variables */
56
- _Thread_local static integer i__;
57
- _Thread_local static double a1, a2;
56
+ static _Thread_local integer i__;
57
+ static _Thread_local double a1, a2;
58
58
 
59
59
  /* Parameter adjustments */
60
60
  --z__;
@@ -170,10 +170,10 @@ int dcsrch(double *f, double *g, double *stp,
170
170
 
171
171
 
172
172
  /* Local variables */
173
- _Thread_local static double fm, gm, fx, fy, gx, gy, fxm, fym, gxm, gym, stx, sty;
174
- _Thread_local static integer stage;
175
- _Thread_local static double finit, ginit, width, ftest, gtest, stmin, stmax, width1;
176
- _Thread_local static logical brackt;
173
+ static _Thread_local double fm, gm, fx, fy, gx, gy, fxm, fym, gxm, gym, stx, sty;
174
+ static _Thread_local integer stage;
175
+ static _Thread_local double finit, ginit, width, ftest, gtest, stmin, stmax, width1;
176
+ static _Thread_local logical brackt;
177
177
 
178
178
  /*
179
179
  **********
@@ -496,7 +496,7 @@ L1000:
496
496
  double sqrt(double);
497
497
 
498
498
  /* Local variables */
499
- _Thread_local static double p, q, r__, s, sgnd, stpc, stpf, stpq, gamma, theta;
499
+ static _Thread_local double p, q, r__, s, sgnd, stpc, stpf, stpq, gamma, theta;
500
500
 
501
501
  /*
502
502
  **********
@@ -18,9 +18,9 @@ int dpofa(double *a, integer *lda, integer *n, integer *
18
18
  double sqrt(double);
19
19
 
20
20
  /* Local variables */
21
- _Thread_local static integer j, k;
22
- _Thread_local static double s, t;
23
- _Thread_local static integer jm1;
21
+ static _Thread_local integer j, k;
22
+ static _Thread_local double s, t;
23
+ static _Thread_local integer jm1;
24
24
 
25
25
  /*
26
26
  dpofa factors a double precision symmetric positive definite
@@ -115,8 +115,8 @@ int dtrsl(double *t, integer *ldt, integer *n,
115
115
  integer t_dim1, t_offset, i__1, i__2;
116
116
 
117
117
  /* Local variables */
118
- _Thread_local static integer j, jj, case__;
119
- _Thread_local static double temp;
118
+ static _Thread_local integer j, jj, case__;
119
+ static _Thread_local double temp;
120
120
  /*
121
121
  extern double ddot(integer *, double *, integer *, double *,
122
122
  integer *);
@@ -52,7 +52,7 @@
52
52
  integer i__1;
53
53
 
54
54
  /* Local variables */
55
- _Thread_local static integer i, m, ix, iy, mp1;
55
+ static _Thread_local integer i, m, ix, iy, mp1;
56
56
 
57
57
 
58
58
  /* constant times a vector plus a vector.
@@ -139,7 +139,7 @@ L40:
139
139
  integer i__1;
140
140
 
141
141
  /* Local variables */
142
- _Thread_local static integer i, m, ix, iy, mp1;
142
+ static _Thread_local integer i, m, ix, iy, mp1;
143
143
 
144
144
 
145
145
  /* copies a vector, x, to a vector, y.
@@ -226,9 +226,9 @@ double ddotRef(integer *n, double *dx, integer *incx, double *dy,
226
226
  double ret_val;
227
227
 
228
228
  /* Local variables */
229
- _Thread_local static integer i, m;
230
- _Thread_local static double dtemp;
231
- _Thread_local static integer ix, iy, mp1;
229
+ static _Thread_local integer i, m;
230
+ static _Thread_local double dtemp;
231
+ static _Thread_local integer ix, iy, mp1;
232
232
 
233
233
 
234
234
  /* forms the dot product of two vectors.
@@ -314,7 +314,7 @@ L60:
314
314
  integer i__1, i__2;
315
315
 
316
316
  /* Local variables */
317
- _Thread_local static integer i, m, nincx, mp1;
317
+ static _Thread_local integer i, m, nincx, mp1;
318
318
 
319
319
 
320
320
  /* scales a vector by a constant.
@@ -30,7 +30,7 @@ int prn1lb(integer *n, integer *m, double *l,
30
30
  integer i__1;
31
31
 
32
32
  /* Local variables */
33
- _Thread_local static integer i__;
33
+ static _Thread_local integer i__;
34
34
 
35
35
  /* Parameter adjustments */
36
36
  --x;
@@ -103,7 +103,7 @@ int prn1lb(integer *n, integer *m, double *l,
103
103
  integer i__1;
104
104
 
105
105
  /* Local variables */
106
- _Thread_local static integer i__, imod;
106
+ static _Thread_local integer i__, imod;
107
107
 
108
108
  /* Parameter adjustments */
109
109
  --g;
@@ -186,7 +186,7 @@ int prn3lb(integer *n, double *x, double *f, integer *
186
186
  integer i__1;
187
187
 
188
188
  /* Local variables */
189
- _Thread_local static integer i__;
189
+ static _Thread_local integer i__;
190
190
  /* Parameter adjustments */
191
191
  --x;
192
192
 
@@ -304,7 +304,7 @@ int errclb(integer *n, integer *m, double *factr,
304
304
  integer i__1;
305
305
 
306
306
  /* Local variables */
307
- _Thread_local static integer i__;
307
+ static _Thread_local integer i__;
308
308
 
309
309
  /* Parameter adjustments */
310
310
  --nbd;