lapcpp 1.1.0__tar.gz → 1.1.1__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 (73) hide show
  1. {lapcpp-1.1.0 → lapcpp-1.1.1}/CHANGELOG.md +11 -0
  2. {lapcpp-1.1.0 → lapcpp-1.1.1}/CONTRIBUTING.md +1 -1
  3. {lapcpp-1.1.0/lapcpp.egg-info → lapcpp-1.1.1}/PKG-INFO +19 -6
  4. {lapcpp-1.1.0 → lapcpp-1.1.1}/README.md +18 -5
  5. {lapcpp-1.1.0 → lapcpp-1.1.1}/docs/api.md +12 -6
  6. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp/__init__.py +1 -1
  7. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp/_lapjv.pyi +8 -1
  8. {lapcpp-1.1.0 → lapcpp-1.1.1/lapcpp.egg-info}/PKG-INFO +19 -6
  9. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp.egg-info/SOURCES.txt +1 -0
  10. {lapcpp-1.1.0 → lapcpp-1.1.1}/src/_lapjv/_lapjv.cpp +216 -216
  11. {lapcpp-1.1.0 → lapcpp-1.1.1}/src/_lapjv/_lapjv.pyx +10 -6
  12. {lapcpp-1.1.0 → lapcpp-1.1.1}/src/_lapjv/solver.cpp +23 -22
  13. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/README.md +16 -0
  14. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/native/test_solver.cpp +56 -0
  15. lapcpp-1.1.1/tests/test_float32_working_precision.py +325 -0
  16. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/test_lapjv.py +110 -41
  17. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/constraints/numpy-armv7-build.txt +0 -0
  18. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/README.md +0 -0
  19. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/check_dist.py +0 -0
  20. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/check_wheel.py +0 -0
  21. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/conftest.py +0 -0
  22. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/install_numpy_compat.py +0 -0
  23. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/pytest.ini +0 -0
  24. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/requirements.txt +0 -0
  25. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/test_benchmarks.py +0 -0
  26. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/test_editable_install.py +0 -0
  27. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/tests/test_setup.py +0 -0
  28. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/benchmark_batch.yaml +0 -0
  29. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/benchmark_single.yaml +0 -0
  30. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/benchmark_tracking.yaml +0 -0
  31. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/integration.yaml +0 -0
  32. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/native.yaml +0 -0
  33. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/prepublish.yaml +0 -0
  34. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/publish.yaml +0 -0
  35. {lapcpp-1.1.0 → lapcpp-1.1.1}/.github/workflows/tests.yaml +0 -0
  36. {lapcpp-1.1.0 → lapcpp-1.1.1}/LICENSE +0 -0
  37. {lapcpp-1.1.0 → lapcpp-1.1.1}/MANIFEST.in +0 -0
  38. {lapcpp-1.1.0 → lapcpp-1.1.1}/NOTICE +0 -0
  39. {lapcpp-1.1.0 → lapcpp-1.1.1}/benchmarks/README.md +0 -0
  40. {lapcpp-1.1.0 → lapcpp-1.1.1}/benchmarks/_common.py +0 -0
  41. {lapcpp-1.1.0 → lapcpp-1.1.1}/benchmarks/benchmark_batch.py +0 -0
  42. {lapcpp-1.1.0 → lapcpp-1.1.1}/benchmarks/benchmark_single.py +0 -0
  43. {lapcpp-1.1.0 → lapcpp-1.1.1}/benchmarks/benchmark_tracking.py +0 -0
  44. {lapcpp-1.1.0 → lapcpp-1.1.1}/benchmarks/ci_run.py +0 -0
  45. {lapcpp-1.1.0 → lapcpp-1.1.1}/examples/basic.py +0 -0
  46. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp/__init__.pyi +0 -0
  47. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp/py.typed +0 -0
  48. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp.egg-info/dependency_links.txt +0 -0
  49. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp.egg-info/requires.txt +0 -0
  50. {lapcpp-1.1.0 → lapcpp-1.1.1}/lapcpp.egg-info/top_level.txt +0 -0
  51. {lapcpp-1.1.0 → lapcpp-1.1.1}/pyproject.toml +0 -0
  52. {lapcpp-1.1.0 → lapcpp-1.1.1}/setup.cfg +0 -0
  53. {lapcpp-1.1.0 → lapcpp-1.1.1}/setup.py +0 -0
  54. {lapcpp-1.1.0 → lapcpp-1.1.1}/src/_lapjv/LICENSE +0 -0
  55. {lapcpp-1.1.0 → lapcpp-1.1.1}/src/_lapjv/completion.cpp +0 -0
  56. {lapcpp-1.1.0 → lapcpp-1.1.1}/src/_lapjv/lapjv.h +0 -0
  57. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/LICENSE +0 -0
  58. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/assignment_checks.py +0 -0
  59. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/check_native_errors.py +0 -0
  60. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/check_scipy_free.py +0 -0
  61. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/conftest.py +0 -0
  62. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/cost_eps.csv.gz +0 -0
  63. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/lapjv_cases.py +0 -0
  64. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/native/CMakeLists.txt +0 -0
  65. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/native/faults.h +0 -0
  66. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/regression_cases.py +0 -0
  67. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/test_batch_paths.py +0 -0
  68. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/test_core.py +0 -0
  69. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/test_cross_package.py +0 -0
  70. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/test_edge_cases.py +0 -0
  71. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/test_package.py +0 -0
  72. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/test_regressions.py +0 -0
  73. {lapcpp-1.1.0 → lapcpp-1.1.1}/tests/typing/return_types.py +0 -0
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1 - 2026-10-28
4
+
5
+ - Use float64 potentials, distances and reduced-cost arithmetic for float32
6
+ rectangular and finite-limit assignments. Matrix storage stays float32;
7
+ required square assignments already used float64 working arithmetic.
8
+ - Preserve cost conversion, represented half-limit rounding, original-input
9
+ totals, APIs and initialization policies. Float64 working arithmetic improves
10
+ numerical robustness without guaranteeing exactness for arbitrary cost ranges.
11
+ - Add exact-objective regressions for small differences beside large costs,
12
+ including augmenting search and represented finite-limit rounding.
13
+
3
14
  ## 1.1.0 - 2026-10-26
4
15
 
5
16
  - Bound row-reduction initialization on large rectangular required and finite-limit
@@ -78,7 +78,7 @@ solver families. Preserve the LAPX and original upstream attribution in `NOTICE`
78
78
  manual runs of the five-candidate comparison, with JSON artifacts.
79
79
 
80
80
  Set up the PyPI Trusted Publisher for this repository, `publish.yaml`, environment
81
- `pypi`, before publishing. Tag `v1.1.0` only when releasing version 1.1.0. The
81
+ `pypi`, before publishing. Tag `v1.1.1` only when releasing version 1.1.1. The
82
82
  manual prepublish workflow creates artifacts without uploading them to PyPI.
83
83
  Benchmark workflows accept counterpart and LAPX repository refs. LAPX defaults
84
84
  to the `v0.11.1` release; record all
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lapcpp
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Native C++ linear assignment solvers with implicit rejection and batch solving
5
5
  Home-page: https://github.com/rathaROG/lapcpp
6
6
  Author: Ratha SIV
@@ -125,21 +125,34 @@ lapjv_batch(costs, extend_cost=False, cost_limit=np.inf, return_cost=True,
125
125
  | --- | --- |
126
126
  | `cost` / `costs` | Real numeric arrays with shape `(N, M)` / `(B, N, M)`. |
127
127
  | `extend_cost=True` | Allows rectangular inputs when the limit is infinite; no square padding is used. |
128
- | `cost_limit` | A finite value permits unmatched endpoints at a penalty of `cost_limit / 2` each. Finite limits also permit rectangles and apply to square inputs. |
128
+ | `cost_limit` | A finite value permits unmatched endpoints, each charged `cost_limit / 2` rounded to the selected cost dtype. Finite limits also permit rectangles and apply to square inputs. |
129
129
  | `return_cost` | Defaults to `True`; totals sum selected original costs in float64 and exclude rejection penalties. `False` omits totals and skips the sum. |
130
130
  | `precision` | `"native"` preserves float32/float64; other real numeric inputs use float64. Explicit `"float32"` / `"float64"` select working costs. |
131
131
  | `output` | `"indices"` returns aligned row/column arrays; `"pairs"` returns `(K, 2)` arrays. |
132
132
  | `n_threads` | Batch only. `0` / `None` selects automatically; negative values use one worker; positive values are capped by batch size. |
133
133
 
134
+ All solver paths use float64 potentials, distances and reduced-cost arithmetic,
135
+ while matrix storage follows `precision`. Finite-limit half-penalties retain
136
+ rounding in that selected cost dtype before search. This reduces cancellation
137
+ with float32 costs without widening the whole matrix. Extreme cost ranges and
138
+ cost conversion can still obscure small objective differences; this is not an
139
+ arbitrary-range exactness guarantee.
140
+
134
141
  Rows are sorted and all returned indices are int64. They identify the selected
135
142
  pairs; unmatched items are absent. Batch results contain lists because each
136
143
  problem may select a different number of pairs. Equal-cost optima may return
137
144
  different assignments across solvers or precisions.
138
145
 
139
- With a finite limit `L`, the optimized objective is
140
- `sum(selected costs) + (N + M - 2*K) * L/2`.
141
- The reported `total` contains only the first term. Joint rejection is different
142
- from solving a full assignment and then filtering high-cost pairs.
146
+ With a finite limit `L`, define `h = cost_dtype(L/2)`, where `cost_dtype` is
147
+ the cost storage dtype selected by `precision`. The optimized objective is
148
+ `sum(selected represented costs) + (N + M - 2*K) * h`, where `N` and `M`
149
+ are the input dimensions and `K` is the number of selected pairs.
150
+ Represented costs are the input values after conversion to that cost dtype.
151
+
152
+ The reported `total` separately sums the selected **original-input values** in
153
+ float64 and excludes rejection penalties. It can differ from the represented-cost
154
+ sum when conversion rounds input values. Joint rejection is different from
155
+ solving a full assignment and then filtering high-cost pairs.
143
156
  See [API details](docs/api.md) for numerical and memory behavior.
144
157
 
145
158
  ## Development and checks
@@ -59,21 +59,34 @@ lapjv_batch(costs, extend_cost=False, cost_limit=np.inf, return_cost=True,
59
59
  | --- | --- |
60
60
  | `cost` / `costs` | Real numeric arrays with shape `(N, M)` / `(B, N, M)`. |
61
61
  | `extend_cost=True` | Allows rectangular inputs when the limit is infinite; no square padding is used. |
62
- | `cost_limit` | A finite value permits unmatched endpoints at a penalty of `cost_limit / 2` each. Finite limits also permit rectangles and apply to square inputs. |
62
+ | `cost_limit` | A finite value permits unmatched endpoints, each charged `cost_limit / 2` rounded to the selected cost dtype. Finite limits also permit rectangles and apply to square inputs. |
63
63
  | `return_cost` | Defaults to `True`; totals sum selected original costs in float64 and exclude rejection penalties. `False` omits totals and skips the sum. |
64
64
  | `precision` | `"native"` preserves float32/float64; other real numeric inputs use float64. Explicit `"float32"` / `"float64"` select working costs. |
65
65
  | `output` | `"indices"` returns aligned row/column arrays; `"pairs"` returns `(K, 2)` arrays. |
66
66
  | `n_threads` | Batch only. `0` / `None` selects automatically; negative values use one worker; positive values are capped by batch size. |
67
67
 
68
+ All solver paths use float64 potentials, distances and reduced-cost arithmetic,
69
+ while matrix storage follows `precision`. Finite-limit half-penalties retain
70
+ rounding in that selected cost dtype before search. This reduces cancellation
71
+ with float32 costs without widening the whole matrix. Extreme cost ranges and
72
+ cost conversion can still obscure small objective differences; this is not an
73
+ arbitrary-range exactness guarantee.
74
+
68
75
  Rows are sorted and all returned indices are int64. They identify the selected
69
76
  pairs; unmatched items are absent. Batch results contain lists because each
70
77
  problem may select a different number of pairs. Equal-cost optima may return
71
78
  different assignments across solvers or precisions.
72
79
 
73
- With a finite limit `L`, the optimized objective is
74
- `sum(selected costs) + (N + M - 2*K) * L/2`.
75
- The reported `total` contains only the first term. Joint rejection is different
76
- from solving a full assignment and then filtering high-cost pairs.
80
+ With a finite limit `L`, define `h = cost_dtype(L/2)`, where `cost_dtype` is
81
+ the cost storage dtype selected by `precision`. The optimized objective is
82
+ `sum(selected represented costs) + (N + M - 2*K) * h`, where `N` and `M`
83
+ are the input dimensions and `K` is the number of selected pairs.
84
+ Represented costs are the input values after conversion to that cost dtype.
85
+
86
+ The reported `total` separately sums the selected **original-input values** in
87
+ float64 and excludes rejection penalties. It can differ from the represented-cost
88
+ sum when conversion rounds input values. Joint rejection is different from
89
+ solving a full assignment and then filtering high-cost pairs.
77
90
  See [API details](docs/api.md) for numerical and memory behavior.
78
91
 
79
92
  ## Development and checks
@@ -44,12 +44,18 @@ are converted to float64. Explicit conversion to float32 rejects finite values
44
44
  or limits outside the float32 range. Integer inputs are converted to float64,
45
45
  so integers outside its exact range can lose precision.
46
46
 
47
- The required square path keeps potentials and distances in float64 even with
48
- float32 costs. Rectangular and finite-limit paths use the selected working
49
- precision; rejection penalties are represented in that precision. The returned
50
- total always sums the original selected costs in float64 before any requested
51
- float32 conversion. Changing precision can change the optimal assignment of
52
- the rounded working problem.
47
+ All paths keep potentials, distances and reduced-cost arithmetic in float64,
48
+ while matrix storage follows the selected cost precision. For finite limits,
49
+ each half-penalty is rounded in that cost dtype; the represented halves are
50
+ combined there before search uses float64. The returned total always sums the
51
+ original selected costs in float64 before any requested float32 conversion.
52
+ Changing precision can change the optimal assignment of the rounded working
53
+ problem.
54
+
55
+ Float64 working arithmetic reduces cancellation with float32 costs without
56
+ widening the whole matrix. It cannot restore costs rounded by conversion, and
57
+ sufficiently extreme magnitude differences can still obscure small objective
58
+ differences. It is not an arbitrary-range exactness guarantee.
53
59
 
54
60
  Suitable aligned, contiguous, native-endian arrays are borrowed. Layout,
55
61
  endianness or dtype conversion can require an input copy. Native rectangles
@@ -1,7 +1,7 @@
1
1
  """Native C++ linear assignment solvers with implicit rejection and batch solving."""
2
2
  from ._lapjv import lapjv, lapjv_batch
3
3
 
4
- __version__ = "1.1.0"
4
+ __version__ = "1.1.1"
5
5
  __author__ = 'Ratha SIV'
6
6
  __description__ = 'Native C++ linear assignment solvers with implicit rejection and batch solving.'
7
7
  __homepage__ = 'https://github.com/rathaROG/lapcpp'
@@ -1,6 +1,13 @@
1
1
  # Copyright (c) 2026 Ratha SIV | MIT License
2
2
 
3
- """Static signatures and documentation for the lapcpp entry points."""
3
+ """Static signatures and documentation for the lapcpp entry points.
4
+
5
+ Precision selects cost storage/conversion. All paths use float64 working
6
+ potentials, distances, and reduced-cost arithmetic. Finite half-limits remain
7
+ rounded in the selected cost dtype; returned totals use original input costs.
8
+ Widening does not restore converted-away distinctions or guarantee exactness
9
+ for arbitrary cost ranges.
10
+ """
4
11
 
5
12
  from typing import Any, List, Optional, Tuple, Union, overload
6
13
  from typing import Literal, Protocol
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lapcpp
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Native C++ linear assignment solvers with implicit rejection and batch solving
5
5
  Home-page: https://github.com/rathaROG/lapcpp
6
6
  Author: Ratha SIV
@@ -125,21 +125,34 @@ lapjv_batch(costs, extend_cost=False, cost_limit=np.inf, return_cost=True,
125
125
  | --- | --- |
126
126
  | `cost` / `costs` | Real numeric arrays with shape `(N, M)` / `(B, N, M)`. |
127
127
  | `extend_cost=True` | Allows rectangular inputs when the limit is infinite; no square padding is used. |
128
- | `cost_limit` | A finite value permits unmatched endpoints at a penalty of `cost_limit / 2` each. Finite limits also permit rectangles and apply to square inputs. |
128
+ | `cost_limit` | A finite value permits unmatched endpoints, each charged `cost_limit / 2` rounded to the selected cost dtype. Finite limits also permit rectangles and apply to square inputs. |
129
129
  | `return_cost` | Defaults to `True`; totals sum selected original costs in float64 and exclude rejection penalties. `False` omits totals and skips the sum. |
130
130
  | `precision` | `"native"` preserves float32/float64; other real numeric inputs use float64. Explicit `"float32"` / `"float64"` select working costs. |
131
131
  | `output` | `"indices"` returns aligned row/column arrays; `"pairs"` returns `(K, 2)` arrays. |
132
132
  | `n_threads` | Batch only. `0` / `None` selects automatically; negative values use one worker; positive values are capped by batch size. |
133
133
 
134
+ All solver paths use float64 potentials, distances and reduced-cost arithmetic,
135
+ while matrix storage follows `precision`. Finite-limit half-penalties retain
136
+ rounding in that selected cost dtype before search. This reduces cancellation
137
+ with float32 costs without widening the whole matrix. Extreme cost ranges and
138
+ cost conversion can still obscure small objective differences; this is not an
139
+ arbitrary-range exactness guarantee.
140
+
134
141
  Rows are sorted and all returned indices are int64. They identify the selected
135
142
  pairs; unmatched items are absent. Batch results contain lists because each
136
143
  problem may select a different number of pairs. Equal-cost optima may return
137
144
  different assignments across solvers or precisions.
138
145
 
139
- With a finite limit `L`, the optimized objective is
140
- `sum(selected costs) + (N + M - 2*K) * L/2`.
141
- The reported `total` contains only the first term. Joint rejection is different
142
- from solving a full assignment and then filtering high-cost pairs.
146
+ With a finite limit `L`, define `h = cost_dtype(L/2)`, where `cost_dtype` is
147
+ the cost storage dtype selected by `precision`. The optimized objective is
148
+ `sum(selected represented costs) + (N + M - 2*K) * h`, where `N` and `M`
149
+ are the input dimensions and `K` is the number of selected pairs.
150
+ Represented costs are the input values after conversion to that cost dtype.
151
+
152
+ The reported `total` separately sums the selected **original-input values** in
153
+ float64 and excludes rejection penalties. It can differ from the represented-cost
154
+ sum when conversion rounds input values. Joint rejection is different from
155
+ solving a full assignment and then filtering high-cost pairs.
143
156
  See [API details](docs/api.md) for numerical and memory behavior.
144
157
 
145
158
  ## Development and checks
@@ -61,6 +61,7 @@ tests/test_batch_paths.py
61
61
  tests/test_core.py
62
62
  tests/test_cross_package.py
63
63
  tests/test_edge_cases.py
64
+ tests/test_float32_working_precision.py
64
65
  tests/test_lapjv.py
65
66
  tests/test_package.py
66
67
  tests/test_regressions.py