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.
- rustima-0.3.0/CHANGELOG.md +112 -0
- {rustima-0.1.0 → rustima-0.3.0}/Cargo.lock +1 -1
- {rustima-0.1.0 → rustima-0.3.0}/Cargo.toml +4 -2
- {rustima-0.1.0 → rustima-0.3.0}/PKG-INFO +2 -1
- {rustima-0.1.0 → rustima-0.3.0}/benches/bench_fit.rs +2 -5
- {rustima-0.1.0 → rustima-0.3.0}/benches/bench_kalman.rs +5 -7
- {rustima-0.1.0 → rustima-0.3.0}/examples/high_order_bench.rs +0 -1
- rustima-0.3.0/lbfgsb_c/License.txt +60 -0
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/lbfgsb.c +39 -39
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/lbfgsb.h +16 -0
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/linesearch.c +11 -11
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/linpack.c +5 -5
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/miniCBLAS.c +6 -6
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/print.c +4 -4
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/subalgorithms.c +45 -45
- {rustima-0.1.0 → rustima-0.3.0}/pyproject.toml +10 -2
- {rustima-0.1.0 → rustima-0.3.0}/python/rustima/__init__.py +9 -4
- {rustima-0.1.0 → rustima-0.3.0}/python/rustima/auto.py +27 -102
- {rustima-0.1.0 → rustima-0.3.0}/python/rustima/model.py +293 -183
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/conftest.py +6 -2
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/generate_fixtures.py +33 -7
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/generate_matrix_fixtures.py +5 -1
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_auto.py +7 -1
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_exog.py +19 -16
- rustima-0.3.0/python_tests/test_extend.py +286 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_fit.py +11 -4
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_forecast.py +1 -1
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_inference.py +37 -39
- rustima-0.3.0/python_tests/test_init_correctness.py +112 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_input_validation.py +6 -6
- rustima-0.3.0/python_tests/test_matrix_cells.py +92 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_multi_order_accuracy.py +1 -1
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_profile_trust_region.py +26 -11
- rustima-0.3.0/python_tests/test_robustness.py +99 -0
- rustima-0.3.0/python_tests/test_rolling.py +229 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_safety_guards.py +12 -3
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_simple_diff.py +68 -1
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_trend.py +10 -10
- rustima-0.3.0/python_tests/test_variance_parity.py +137 -0
- {rustima-0.1.0 → rustima-0.3.0}/src/batch.rs +90 -24
- {rustima-0.1.0 → rustima-0.3.0}/src/forecast.rs +239 -22
- {rustima-0.1.0 → rustima-0.3.0}/src/inference.rs +14 -2
- {rustima-0.1.0 → rustima-0.3.0}/src/initialization.rs +64 -40
- {rustima-0.1.0 → rustima-0.3.0}/src/kalman.rs +82 -32
- {rustima-0.1.0 → rustima-0.3.0}/src/lbfgsb_ffi.rs +0 -5
- {rustima-0.1.0 → rustima-0.3.0}/src/lib.rs +194 -100
- rustima-0.3.0/src/optimizer/mod.rs +835 -0
- rustima-0.3.0/src/optimizer/multistart.rs +726 -0
- rustima-0.3.0/src/optimizer/objective.rs +566 -0
- rustima-0.3.0/src/optimizer/runners.rs +405 -0
- rustima-0.3.0/src/optimizer/tests.rs +689 -0
- rustima-0.3.0/src/optimizer/transforms.rs +147 -0
- rustima-0.3.0/src/optimizer/trust_region.rs +868 -0
- {rustima-0.1.0 → rustima-0.3.0}/src/params.rs +6 -5
- {rustima-0.1.0 → rustima-0.3.0}/src/pipeline.rs +0 -1
- {rustima-0.1.0 → rustima-0.3.0}/src/score.rs +297 -385
- {rustima-0.1.0 → rustima-0.3.0}/src/start_params.rs +64 -339
- {rustima-0.1.0 → rustima-0.3.0}/src/state_space.rs +1 -13
- {rustima-0.1.0 → rustima-0.3.0}/src/types.rs +42 -3
- {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/matrix_tier_a.json +60 -30
- {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/matrix_tier_b.json +138 -69
- rustima-0.3.0/tests/fixtures/statsmodels_forecast_reference.json +1081 -0
- {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/statsmodels_reference.json +10 -5
- {rustima-0.1.0 → rustima-0.3.0}/uv.lock +1 -1
- rustima-0.1.0/.github/workflows/ci.yml +0 -64
- rustima-0.1.0/.github/workflows/nightly.yml +0 -83
- rustima-0.1.0/.github/workflows/release.yml +0 -242
- rustima-0.1.0/BENCHMARK_SPEC.md +0 -219
- rustima-0.1.0/benchmark_comprehensive.py +0 -152
- rustima-0.1.0/benchmark_higher_order.py +0 -178
- rustima-0.1.0/compare_all_orders.py +0 -240
- rustima-0.1.0/debug_loglike.py +0 -672
- rustima-0.1.0/debug_mismatch.py +0 -268
- rustima-0.1.0/docs/param_compare_2019.md +0 -105
- rustima-0.1.0/docs/ver5.2/spec_numerical_hessian.md +0 -257
- rustima-0.1.0/docs/ver5.2/spec_opg.md +0 -299
- rustima-0.1.0/docs/ver5.2/spec_simple_differencing.md +0 -551
- rustima-0.1.0/fit_summary_report.md +0 -335
- rustima-0.1.0/python_tests/bench_batch_forecast.py +0 -223
- rustima-0.1.0/python_tests/bench_comparison.py +0 -201
- rustima-0.1.0/python_tests/bench_full_comparison.py +0 -377
- rustima-0.1.0/python_tests/bench_grid_5x5.py +0 -433
- rustima-0.1.0/python_tests/bench_matrix_6x6_s7_s12_s24.py +0 -206
- rustima-0.1.0/python_tests/bench_matrix_parent.py +0 -190
- rustima-0.1.0/python_tests/bench_matrix_worker.py +0 -119
- rustima-0.1.0/python_tests/bench_memory_speed.py +0 -342
- rustima-0.1.0/python_tests/bench_pmdarima_compare.py +0 -165
- rustima-0.1.0/python_tests/bench_power_2019_2023.py +0 -220
- rustima-0.1.0/python_tests/bench_readme.py +0 -338
- rustima-0.1.0/python_tests/bench_report_arima.py +0 -278
- rustima-0.1.0/python_tests/bench_report_arimax.py +0 -270
- rustima-0.1.0/python_tests/bench_report_sarima.py +0 -317
- rustima-0.1.0/python_tests/bench_report_sarimax.py +0 -317
- rustima-0.1.0/python_tests/bench_s24_highorder.py +0 -259
- rustima-0.1.0/python_tests/bench_sarima_plot.py +0 -156
- rustima-0.1.0/python_tests/bench_sarima_retry_pmdarima_1y.py +0 -127
- rustima-0.1.0/python_tests/bench_sarima_scaling.py +0 -251
- rustima-0.1.0/python_tests/bench_sarima_worker.py +0 -136
- rustima-0.1.0/python_tests/bench_v5_report.py +0 -604
- rustima-0.1.0/python_tests/benchmark_vs_statsmodels.py +0 -433
- rustima-0.1.0/python_tests/build_ppt_pmdarima.py +0 -234
- rustima-0.1.0/python_tests/compare_profile_methods_2019.py +0 -136
- rustima-0.1.0/python_tests/compare_profile_methods_R.R +0 -54
- rustima-0.1.0/python_tests/compare_with_r.R +0 -73
- rustima-0.1.0/python_tests/diagnose_profile_tr_plateau.py +0 -93
- rustima-0.1.0/python_tests/gen_tex_report.py +0 -499
- rustima-0.1.0/python_tests/phase_c_power_auto.py +0 -139
- rustima-0.1.0/python_tests/phase_c_robustness.py +0 -150
- rustima-0.1.0/python_tests/report_convergence_failures.py +0 -301
- rustima-0.1.0/python_tests/run_fit_summary.py +0 -331
- rustima-0.1.0/python_tests/show_matrix_coefs.py +0 -78
- rustima-0.1.0/python_tests/verify_ll_at_same_params.py +0 -91
- rustima-0.1.0/python_tests/verify_sarima_vs_sarimax.py +0 -86
- rustima-0.1.0/result_v1/00_SUMMARY.md +0 -105
- rustima-0.1.0/result_v1/01_ARIMA_comparison.md +0 -51
- rustima-0.1.0/result_v1/02_SARIMA_s12_comparison.md +0 -192
- rustima-0.1.0/result_v1/02_SARIMA_s24_comparison.md +0 -192
- rustima-0.1.0/result_v1/02_SARIMA_s7_comparison.md +0 -192
- rustima-0.1.0/result_v1/03_ARIMAX_comparison.md +0 -50
- rustima-0.1.0/result_v1/04_SARIMAX_s12_comparison.md +0 -192
- rustima-0.1.0/result_v1/04_SARIMAX_s24_comparison.md +0 -192
- rustima-0.1.0/result_v1/04_SARIMAX_s7_comparison.md +0 -192
- rustima-0.1.0/result_v1/05_auto_arima_benchmark.md +0 -129
- rustima-0.1.0/result_v1/bench_all_models.py +0 -397
- rustima-0.1.0/result_v1/bench_auto_arima.py +0 -435
- rustima-0.1.0/src/optimizer.rs +0 -4054
- rustima-0.1.0/test.ipynb +0 -2108
- rustima-0.1.0/tests/fixtures/statsmodels_forecast_reference.json +0 -1077
- {rustima-0.1.0 → rustima-0.3.0}/.env.example +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/.gitignore +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/LICENSE +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/README.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/build.rs +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/PERF_DIAGNOSIS.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/SUPPORTED_COMBINATIONS.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/api_reference.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/error_codes.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/migration_guide.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/profiled_kalman_gls_plan.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/statsmodels_compat.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/docs/ver5_convergence_improvement.md +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/examples/bench_comprehensive.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/examples/bench_vs_statsmodels.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/examples/sarimax_exog_demo.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/examples/sarimax_hourly_s24.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/lbfgsb_c/timer.c +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_batch.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_high_order_accuracy.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_matrix_tier_a.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_polars.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_prediction_quality.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/python_tests/test_smoke.py +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/src/css.rs +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/src/error.rs +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/src/lbfgsb_wrapper.rs +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/src/polynomial.rs +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/src/test_helpers.rs +0 -0
- {rustima-0.1.0 → rustima-0.3.0}/tests/fixtures/.gitkeep +0 -0
- {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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "rustima"
|
|
3
|
-
version = "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
|
-
|
|
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.
|
|
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
|
|
3
|
-
use
|
|
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
|
|
3
|
-
use
|
|
4
|
-
use
|
|
5
|
-
use
|
|
6
|
-
use
|
|
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![],
|
|
@@ -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
|
|
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
|
|
347
|
-
_Thread_local
|
|
348
|
-
_Thread_local
|
|
349
|
-
_Thread_local
|
|
350
|
-
_Thread_local
|
|
351
|
-
_Thread_local
|
|
352
|
-
_Thread_local
|
|
353
|
-
_Thread_local
|
|
354
|
-
_Thread_local
|
|
355
|
-
_Thread_local
|
|
356
|
-
_Thread_local
|
|
357
|
-
_Thread_local
|
|
358
|
-
_Thread_local
|
|
359
|
-
_Thread_local
|
|
360
|
-
_Thread_local
|
|
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
|
|
363
|
-
_Thread_local
|
|
364
|
-
_Thread_local
|
|
365
|
-
_Thread_local
|
|
366
|
-
_Thread_local
|
|
367
|
-
_Thread_local
|
|
368
|
-
_Thread_local
|
|
369
|
-
_Thread_local
|
|
370
|
-
_Thread_local
|
|
371
|
-
_Thread_local
|
|
372
|
-
_Thread_local
|
|
373
|
-
_Thread_local
|
|
374
|
-
_Thread_local
|
|
375
|
-
_Thread_local
|
|
376
|
-
_Thread_local
|
|
377
|
-
_Thread_local
|
|
378
|
-
_Thread_local
|
|
379
|
-
_Thread_local
|
|
380
|
-
_Thread_local
|
|
381
|
-
_Thread_local
|
|
382
|
-
_Thread_local
|
|
383
|
-
_Thread_local
|
|
384
|
-
_Thread_local
|
|
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
|
|
47
|
-
_Thread_local
|
|
48
|
-
_Thread_local
|
|
49
|
-
_Thread_local
|
|
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
|
|
57
|
-
_Thread_local
|
|
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
|
|
174
|
-
_Thread_local
|
|
175
|
-
_Thread_local
|
|
176
|
-
_Thread_local
|
|
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
|
|
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
|
|
22
|
-
_Thread_local
|
|
23
|
-
_Thread_local
|
|
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
|
|
119
|
-
_Thread_local
|
|
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
|
|
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
|
|
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
|
|
230
|
-
_Thread_local
|
|
231
|
-
_Thread_local
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
307
|
+
static _Thread_local integer i__;
|
|
308
308
|
|
|
309
309
|
/* Parameter adjustments */
|
|
310
310
|
--nbd;
|