spacecore 0.3.0__tar.gz → 0.3.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 (197) hide show
  1. spacecore-0.3.1/CHANGELOG.md +306 -0
  2. spacecore-0.3.1/CONTRIBUTING.md +13 -0
  3. spacecore-0.3.1/MANIFEST.in +12 -0
  4. spacecore-0.3.1/PKG-INFO +206 -0
  5. spacecore-0.3.1/README.md +165 -0
  6. spacecore-0.3.1/docs/dev/0.3.1-docs-inventory.md +102 -0
  7. spacecore-0.3.1/docs/dev/0.3.1-docstring-audit.md +48 -0
  8. spacecore-0.3.1/docs/dev/docstring_style.md +134 -0
  9. spacecore-0.3.1/docs/source/_static/custom.css +22 -0
  10. spacecore-0.3.1/docs/source/api/backend.rst +58 -0
  11. spacecore-0.3.1/docs/source/api/context.rst +42 -0
  12. spacecore-0.3.1/docs/source/api/functionals.rst +80 -0
  13. spacecore-0.3.1/docs/source/api/index.rst +15 -0
  14. spacecore-0.3.1/docs/source/api/linalg.rst +78 -0
  15. spacecore-0.3.1/docs/source/api/linops.rst +132 -0
  16. spacecore-0.3.1/docs/source/api/spaces.rst +198 -0
  17. spacecore-0.3.1/docs/source/conf.py +89 -0
  18. spacecore-0.3.1/docs/source/design/backend_ops_array_api.rst +57 -0
  19. spacecore-0.3.1/docs/source/design/batching.rst +45 -0
  20. spacecore-0.3.1/docs/source/design/capability_dispatch.rst +80 -0
  21. spacecore-0.3.1/docs/source/design/checking_policy.rst +69 -0
  22. spacecore-0.3.1/docs/source/design/context_ownership.rst +58 -0
  23. spacecore-0.3.1/docs/source/design/conversion_policy.rst +57 -0
  24. spacecore-0.3.1/docs/source/design/dtype_policy.rst +62 -0
  25. spacecore-0.3.1/docs/source/design/geometry.rst +85 -0
  26. spacecore-0.3.1/docs/source/design/index.rst +19 -0
  27. spacecore-0.3.1/docs/source/design/jax_integration.rst +44 -0
  28. spacecore-0.3.1/docs/source/design/performance.rst +19 -0
  29. spacecore-0.3.1/docs/source/index.rst +85 -0
  30. spacecore-0.3.1/docs/source/release_notes.rst +462 -0
  31. spacecore-0.3.1/docs/source/tutorials/backend_ops.rst +104 -0
  32. spacecore-0.3.1/docs/source/tutorials/context.rst +103 -0
  33. spacecore-0.3.1/docs/source/tutorials/conversion_policy.rst +102 -0
  34. spacecore-0.3.1/docs/source/tutorials/index.rst +88 -0
  35. spacecore-0.3.1/docs/source/tutorials/linops.rst +139 -0
  36. spacecore-0.3.1/docs/source/tutorials/regularized_ot.rst +662 -0
  37. spacecore-0.3.1/docs/source/tutorials/spaces.rst +124 -0
  38. spacecore-0.3.1/docs/source/tutorials/weighted_tikhonov.rst +194 -0
  39. spacecore-0.3.1/examples/__init__.py +0 -0
  40. spacecore-0.3.1/examples/weighted_tikhonov.py +267 -0
  41. {spacecore-0.3.0 → spacecore-0.3.1}/pyproject.toml +1 -1
  42. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/__init__.py +7 -9
  43. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_contextual/_policies.py +1 -0
  44. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_contextual/_state.py +33 -32
  45. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_version.py +1 -1
  46. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/__init__.py +1 -0
  47. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/_ops.py +57 -53
  48. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/cupy/_ops.py +3 -1
  49. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/jax/_ops.py +46 -32
  50. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/numpy/_ops.py +41 -32
  51. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/torch/_ops.py +13 -4
  52. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/functional/_linear.py +3 -8
  53. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/functional/_quadratic.py +7 -1
  54. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linalg/_cg.py +6 -2
  55. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linalg/_lanczos.py +8 -5
  56. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linalg/_lsqr.py +2 -0
  57. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linalg/_power.py +3 -0
  58. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/_algebra.py +35 -18
  59. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/_base.py +7 -6
  60. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/_dense.py +27 -14
  61. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/_diagonal.py +16 -4
  62. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/_metric.py +4 -1
  63. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/_sparse.py +37 -16
  64. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/product/_base.py +5 -7
  65. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/product/_from_single.py +9 -2
  66. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/product/_to_single.py +9 -2
  67. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/_structure.py +1 -2
  68. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/base/_inner_product.py +3 -1
  69. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/base/_jordan.py +0 -1
  70. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/checks/_base.py +4 -11
  71. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/concrete/_dense_vector.py +4 -2
  72. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/concrete/_hermitian.py +15 -14
  73. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/concrete/_product.py +33 -19
  74. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/concrete/_stacked.py +26 -18
  75. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/types/_misc.py +1 -1
  76. spacecore-0.3.1/spacecore.egg-info/PKG-INFO +206 -0
  77. spacecore-0.3.1/spacecore.egg-info/SOURCES.txt +191 -0
  78. spacecore-0.3.1/tests/__init__.py +0 -0
  79. spacecore-0.3.1/tests/_helpers.py +103 -0
  80. spacecore-0.3.1/tests/backend/__init__.py +0 -0
  81. spacecore-0.3.1/tests/backend/test_backend_consistency.py +142 -0
  82. spacecore-0.3.1/tests/backend/test_backend_loops.py +119 -0
  83. spacecore-0.3.1/tests/backend/test_backend_ops_delegation.py +256 -0
  84. spacecore-0.3.1/tests/backend/test_backend_registry.py +102 -0
  85. spacecore-0.3.1/tests/backend/test_cupy_ops.py +66 -0
  86. spacecore-0.3.1/tests/backend/test_jax_ops.py +43 -0
  87. spacecore-0.3.1/tests/backend/test_numpy_ops.py +39 -0
  88. spacecore-0.3.1/tests/backend/test_torch_consistency.py +51 -0
  89. spacecore-0.3.1/tests/backend/test_torch_ops.py +108 -0
  90. spacecore-0.3.1/tests/conftest.py +7 -0
  91. spacecore-0.3.1/tests/context/__init__.py +0 -0
  92. spacecore-0.3.1/tests/context/test_checked_method.py +133 -0
  93. spacecore-0.3.1/tests/context/test_context.py +34 -0
  94. spacecore-0.3.1/tests/context/test_context_manager.py +46 -0
  95. spacecore-0.3.1/tests/context/test_context_resolution.py +115 -0
  96. spacecore-0.3.1/tests/context/test_enable_checks.py +126 -0
  97. spacecore-0.3.1/tests/context/test_errors.py +46 -0
  98. spacecore-0.3.1/tests/examples/__init__.py +0 -0
  99. spacecore-0.3.1/tests/examples/test_weighted_tikhonov.py +109 -0
  100. spacecore-0.3.1/tests/functional/test_functional.py +243 -0
  101. spacecore-0.3.1/tests/functional/test_metric_gradient.py +242 -0
  102. spacecore-0.3.1/tests/integration/__init__.py +0 -0
  103. spacecore-0.3.1/tests/integration/test_imports.py +34 -0
  104. spacecore-0.3.1/tests/integration/test_public_api.py +122 -0
  105. spacecore-0.3.1/tests/integration/test_smoke_jax.py +29 -0
  106. spacecore-0.3.1/tests/integration/test_smoke_numpy.py +22 -0
  107. spacecore-0.3.1/tests/integration/test_smoke_torch.py +34 -0
  108. spacecore-0.3.1/tests/linalg/__init__.py +1 -0
  109. spacecore-0.3.1/tests/linalg/test_expm.py +255 -0
  110. spacecore-0.3.1/tests/linalg/test_krylov.py +939 -0
  111. spacecore-0.3.1/tests/linalg/test_metric_solvers.py +68 -0
  112. spacecore-0.3.1/tests/linops/__init__.py +0 -0
  113. spacecore-0.3.1/tests/linops/test_adjoint_identity.py +870 -0
  114. spacecore-0.3.1/tests/linops/test_algebra.py +533 -0
  115. spacecore-0.3.1/tests/linops/test_algebra_linop.py +242 -0
  116. spacecore-0.3.1/tests/linops/test_batched_apply.py +79 -0
  117. spacecore-0.3.1/tests/linops/test_batched_lifting.py +181 -0
  118. spacecore-0.3.1/tests/linops/test_block_diagonal_linop.py +27 -0
  119. spacecore-0.3.1/tests/linops/test_conversion_linops.py +62 -0
  120. spacecore-0.3.1/tests/linops/test_dense_linop.py +322 -0
  121. spacecore-0.3.1/tests/linops/test_diagonal_linop.py +162 -0
  122. spacecore-0.3.1/tests/linops/test_linop_jit.py +166 -0
  123. spacecore-0.3.1/tests/linops/test_product_linop_batching.py +201 -0
  124. spacecore-0.3.1/tests/linops/test_product_structure.py +231 -0
  125. spacecore-0.3.1/tests/linops/test_sparse_linop.py +345 -0
  126. spacecore-0.3.1/tests/linops/test_stacked_linop.py +18 -0
  127. spacecore-0.3.1/tests/linops/test_sum_to_single_linop.py +18 -0
  128. spacecore-0.3.1/tests/linops/test_to_dense.py +277 -0
  129. spacecore-0.3.1/tests/spaces/__init__.py +0 -0
  130. spacecore-0.3.1/tests/spaces/test_conversion_spaces.py +45 -0
  131. spacecore-0.3.1/tests/spaces/test_geometry.py +243 -0
  132. spacecore-0.3.1/tests/spaces/test_hermitian_space.py +54 -0
  133. spacecore-0.3.1/tests/spaces/test_product_space.py +68 -0
  134. spacecore-0.3.1/tests/spaces/test_product_structure.py +262 -0
  135. spacecore-0.3.1/tests/spaces/test_space_apply.py +157 -0
  136. spacecore-0.3.1/tests/spaces/test_space_checks.py +164 -0
  137. spacecore-0.3.1/tests/spaces/test_space_hierarchy.py +654 -0
  138. spacecore-0.3.1/tests/spaces/test_spectrum.py +237 -0
  139. spacecore-0.3.1/tests/spaces/test_stacked_space.py +142 -0
  140. spacecore-0.3.1/tests/spaces/test_vector_space.py +55 -0
  141. spacecore-0.3.1/tests/spaces/test_vectorized_checks.py +145 -0
  142. spacecore-0.3.1/tutorials/1_BackendOps.ipynb +628 -0
  143. spacecore-0.3.1/tutorials/2_Context.ipynb +602 -0
  144. spacecore-0.3.1/tutorials/3_Space.ipynb +821 -0
  145. spacecore-0.3.1/tutorials/4_LinOp.ipynb +951 -0
  146. spacecore-0.3.1/tutorials/5_Conversion_Policy.ipynb +208 -0
  147. spacecore-0.3.1/tutorials/6_Regularized_Opt_Transport.ipynb +789 -0
  148. spacecore-0.3.1/tutorials/7_Quadratic_Program.ipynb +320 -0
  149. spacecore-0.3.1/tutorials/8_Linalg_MatrixFree.ipynb +560 -0
  150. spacecore-0.3.1/tutorials/9_Linalg_Comparison.ipynb +558 -0
  151. spacecore-0.3.1/tutorials/README.md +33 -0
  152. spacecore-0.3.1/tutorials/weighted_tikhonov.ipynb +539 -0
  153. spacecore-0.3.0/PKG-INFO +0 -247
  154. spacecore-0.3.0/README.md +0 -206
  155. spacecore-0.3.0/spacecore.egg-info/PKG-INFO +0 -247
  156. spacecore-0.3.0/spacecore.egg-info/SOURCES.txt +0 -78
  157. {spacecore-0.3.0 → spacecore-0.3.1}/LICENSE +0 -0
  158. {spacecore-0.3.0 → spacecore-0.3.1}/setup.cfg +0 -0
  159. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_batching.py +0 -0
  160. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_checks.py +0 -0
  161. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_contextual/__init__.py +0 -0
  162. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_contextual/_bound.py +0 -0
  163. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/_tree.py +0 -0
  164. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/_context.py +0 -0
  165. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/_family.py +0 -0
  166. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/cupy/__init__.py +0 -0
  167. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/jax/__init__.py +0 -0
  168. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/jax/_pytree.py +0 -0
  169. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/numpy/__init__.py +0 -0
  170. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/backend/torch/__init__.py +0 -0
  171. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/functional/__init__.py +0 -0
  172. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/functional/_base.py +0 -0
  173. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/functional/_composed.py +0 -0
  174. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linalg/__init__.py +0 -0
  175. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linalg/_expm.py +0 -0
  176. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linalg/_utils.py +0 -0
  177. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/__init__.py +0 -0
  178. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/product/__init__.py +0 -0
  179. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/linop/product/_block.py +0 -0
  180. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/__init__.py +0 -0
  181. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/base/__init__.py +0 -0
  182. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/base/_coordinate.py +0 -0
  183. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/base/_space.py +0 -0
  184. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/base/_star.py +0 -0
  185. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/base/_vector.py +0 -0
  186. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/checks/__init__.py +0 -0
  187. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/checks/_coordinate.py +0 -0
  188. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/checks/_product.py +0 -0
  189. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/concrete/__init__.py +0 -0
  190. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/space/concrete/_dense_coordinate.py +0 -0
  191. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/types/__init__.py +0 -0
  192. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/types/_array.py +0 -0
  193. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore/types/_dtype.py +0 -0
  194. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore.egg-info/dependency_links.txt +0 -0
  195. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore.egg-info/requires.txt +0 -0
  196. {spacecore-0.3.0 → spacecore-0.3.1}/spacecore.egg-info/top_level.txt +0 -0
  197. {spacecore-0.3.0 → spacecore-0.3.1}/tests/test_backend_ops_complex.py +0 -0
@@ -0,0 +1,306 @@
1
+ # Changelog
2
+
3
+ All notable changes to SpaceCore are documented in this file.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and the project adheres to [Semantic Versioning](https://semver.org/).
7
+
8
+ ## [0.3.1]
9
+
10
+ SpaceCore 0.3.1 is a release-candidate stabilization release for the `0.3.x`
11
+ API. It focuses on documentation consistency, tutorial execution, release
12
+ artifact checks, and public API audit cleanup. It does not add new solver
13
+ families or SDPLab-specific downstream integration.
14
+
15
+ ### Documentation
16
+
17
+ - Reworked API reference landing pages for backend, context, spaces, linear
18
+ operators, functionals, and linalg.
19
+ - Added design notes for context ownership, batching, and capability dispatch.
20
+ - Clarified conversion and dtype policy documentation for explicit target
21
+ contexts.
22
+ - Clarified adjoint documentation to distinguish coordinate transpose,
23
+ Euclidean adjoint, and metric/Riesz-represented adjoint behavior.
24
+
25
+ ### Examples and Tutorials
26
+
27
+ - Added a SpaceCore-only weighted Tikhonov worked example demonstrating
28
+ weighted spaces, metric adjoints, lazy operator algebra, CG, and an
29
+ independent dense NumPy reference solve.
30
+ - Integrated the weighted Tikhonov example into tests and documentation.
31
+
32
+ ### Testing and CI
33
+
34
+ - Documentation CI now builds Sphinx with warnings as errors.
35
+ - Release-candidate checks include full tests, strict docs build, public API
36
+ audit, artifact build, `twine check`, clean wheel installation, and smoke
37
+ testing.
38
+
39
+ ### Known limitations
40
+
41
+ - Optional backend behavior depends on installed optional dependencies. CuPy is
42
+ not required for the core release-candidate gate.
43
+ - The advanced regularized OT tutorial is an illustrative SpaceCore/JAX/Optax
44
+ example, not a claim that SpaceCore ships a production OT solver.
45
+
46
+ ## [0.3.0]
47
+
48
+ SpaceCore 0.3.0 is a breaking release for the unstable `0.x` series. Space
49
+ capabilities are now derived from actual structure, dtype, and inner product,
50
+ and conversions rebuild spaces through public factories so stale capabilities
51
+ are not retained.
52
+
53
+ ### Migration
54
+
55
+ | 0.2.x | 0.3.0 |
56
+ | --- | --- |
57
+ | `space.eigh(x)` | `space.spectral_decompose(x)` for eigenvalues and frame |
58
+ | `space.eigh(x)` | `space.spectrum(x)` for eigenvalues only |
59
+ | `sc.VectorSpace((n,))` | `sc.DenseVectorSpace((n,))` |
60
+ | `sc.VectorSpace((d, d))` | `sc.DenseCoordinateSpace((d, d))` |
61
+ | `ProductInnerProductSpace(...)` | `ProductSpace(...)` |
62
+ | `ProductStarSpace(...)` | `ProductSpace(...)` |
63
+ | `ProductJordanAlgebraSpace(...)` | `ProductSpace(...)` |
64
+ | `ProductEuclideanJordanAlgebraSpace(...)` | `ProductSpace(...)` |
65
+ | `StackedInnerProductSpace(...)` | `StackedSpace(...)` |
66
+ | `StackedStarSpace(...)` | `StackedSpace(...)` |
67
+ | `StackedJordanAlgebraSpace(...)` | `StackedSpace(...)` |
68
+ | `StackedEuclideanJordanAlgebraSpace(...)` | `StackedSpace(...)` |
69
+ | `BatchSpace` and `space.batch(...)` | leading-axis batched arrays with `vapply(...)` / `rvapply(...)` |
70
+ | `op.vapply(xs, batch_space=...)` | `op.vapply(xs)` |
71
+ | global context conversion policies | explicit `Context` construction and `obj.convert(ctx)` |
72
+ | global dtype preservation policies | target-context dtype during explicit conversion |
73
+
74
+ Prominent `eigh` replacement:
75
+
76
+ ```python
77
+ space.eigh(x)
78
+ # -> space.spectral_decompose(x) # eigenvalues and frame
79
+ # -> space.spectrum(x) # eigenvalues only
80
+ ```
81
+
82
+ ### Added
83
+
84
+ - `spectrum`, `spectral_decompose`, and `from_spectrum` as the public spectral
85
+ contract for Jordan spaces.
86
+ - `ElementwiseJordanSpace` for real or complex elementwise Jordan algebras.
87
+ - `EuclideanElementwiseJordanSpace` for real Euclidean elementwise Jordan
88
+ algebras.
89
+ - Jordan capability hierarchy separating `JordanAlgebraSpace` from
90
+ `EuclideanJordanAlgebraSpace`.
91
+ - `ProductStructure`, `TupleStructure`, `PytreeStructure`, and
92
+ `ProductSpace.from_template` for structured product elements.
93
+ - `ProductSpectralDecomposition` for product spectral data independent of
94
+ product element structure.
95
+ - `StackedSpace` for leading-axis repeated leaf spaces.
96
+ - Vectorizable axis-aware validation checks.
97
+ - `InnerProduct.validate_for(space)` and construction-time validation for
98
+ `WeightedInnerProduct`.
99
+ - `scripts/api_audit.py` for repository and downstream migration audits.
100
+
101
+ ### Changed
102
+
103
+ - `VectorSpace` is an abstract linear-capability base.
104
+ - Previous concrete `VectorSpace` use cases moved to `DenseVectorSpace` for
105
+ one-dimensional dense vectors and `DenseCoordinateSpace` for generic dense
106
+ coordinate arrays.
107
+ - `DenseVectorSpace` is now a plain one-dimensional vector space with star and
108
+ no Jordan capability by default.
109
+ - Elementwise Euclidean-Jordan capability is selected only for real dtype with
110
+ `EuclideanInnerProduct`.
111
+ - `ProductSpace(...)` and `StackedSpace(...)` are the only public product and
112
+ stacked constructors; they auto-dispatch to private implementation classes.
113
+ - `convert()` for elementwise, product, and stacked spaces recomputes
114
+ capabilities through public factories.
115
+ - `ProductSpace.spectral_decompose` returns explicit product spectral data
116
+ rather than routing decompositions through element structure adapters.
117
+
118
+ ### Removed
119
+
120
+ - Removed `eigh` from spaces. Use `spectral_decompose` when both eigenvalues
121
+ and a reconstruction frame are needed, or `spectrum` for eigenvalues only.
122
+ - Removed public specialized product and stacked constructors from the public
123
+ API.
124
+ - Removed `BatchSpace`, `Space.batch`, and `batch_space=` arguments from public
125
+ batching APIs. Use leading-axis vectorization through `vapply` and `rvapply`.
126
+ - Removed global context-policy and dtype-policy APIs. Conversion now follows
127
+ the requested target `Context` directly.
128
+
129
+ ## [0.2.0]
130
+
131
+ SpaceCore 0.2.0 is a major API expansion. The backend layer now sits on the
132
+ Array API standard. Operators gained a lazy algebra with adjoint views,
133
+ composition, sums, and scaling. A new `Functional` hierarchy provides
134
+ scalar-valued maps with gradients and pull-backs. A new `spacecore.linalg`
135
+ module ships four JIT-compatible iterative solvers. Spaces, operators, and
136
+ functionals share a single validation pattern via `checked_method`, and the
137
+ public API is documented to numpydoc standard with doctest coverage.
138
+
139
+ This release introduces breaking changes; see [Migration](#migration-from-01x).
140
+
141
+ ### Added
142
+
143
+ #### Backend
144
+
145
+ - Migrated `BackendOps` to the Array API standard via `array-api-compat`.
146
+ - `CuPyOps` and the `cupy` backend family as an optional install
147
+ (`pip install 'spacecore[cupy]'`).
148
+ - `BackendOps.is_complex_dtype` for backend-aware complex detection.
149
+ - `BackendOps.real_dtype` for extracting the real dtype matching a complex one.
150
+ - Broadened backend coverage for array creation, dtype conversion, sparse
151
+ conversion, indexing, reductions, linear algebra, loop primitives
152
+ (`fori_loop`, `while_loop`, `cond`), tree helpers, and vectorized mapping.
153
+ - JAX pytree registration for operator, space, and functional types so they
154
+ pass through `jax.jit`, `jax.vmap`, and `jax.grad` boundaries.
155
+
156
+ #### Context and checking
157
+
158
+ - Public free-function API in `spacecore._contextual`: `set_context`,
159
+ `get_context`, `resolve_context_priority`, `register_ops`, and the
160
+ resolution-policy accessors.
161
+ - Extended `checked_method` to support validation against `self` and multiple
162
+ input argument positions.
163
+ - Reusable space-validation checks: backend, dtype, shape, Hermitian,
164
+ square-matrix, product-structure, and product-component checks. Documented
165
+ at `docs/source/design/checking_policy.rst`.
166
+
167
+ #### Spaces
168
+
169
+ - `BatchSpace` for batched elements with explicit batch shape and batch-axis
170
+ metadata.
171
+
172
+ #### Linear operators
173
+
174
+ - Lazy operator algebra:
175
+ - `A @ B` composes operators.
176
+ - `A + B` sums operators.
177
+ - `alpha * A` scales an operator.
178
+ - `A.H` returns a cached adjoint view satisfying `A.H.H is A`.
179
+ - Algebraic simplification eliminates `I`, `Zero`, `alpha = 0`, `alpha = 1`,
180
+ and flattens nested sums.
181
+ - New operator types: `IdentityLinOp`, `ZeroLinOp`, `MatrixFreeLinOp`,
182
+ `DiagonalLinOp`.
183
+ - Structural `LinOp.is_hermitian()` reporting `True`, `False`, or `None`
184
+ (unknown) without applying incorrect Euclidean assumptions for custom space
185
+ geometries.
186
+ - `LinOp.to_dense()` for materializing operators as backend arrays.
187
+ - Product-structured operators and batched lifting:
188
+ - `ProductLinOp`
189
+ - `BlockDiagonalLinOp`
190
+ - `StackedLinOp`
191
+ - `SumToSingleLinOp`
192
+ - `vapply` / `rvapply` paths for batched operator application.
193
+
194
+ #### Functionals
195
+
196
+ - `Functional` as an abstract base for scalar-valued maps on spaces, with
197
+ `value`, `grad`, `hess_apply`, and batched counterparts.
198
+ - Linear functionals: `LinearFunctional`, `InnerProductFunctional`,
199
+ `MatrixFreeLinearFunctional`.
200
+ - Quadratic forms: `QuadraticForm`, `LinOpQuadraticForm`.
201
+ - `Functional.compose` and `ComposedFunctional` for pull-backs along linear
202
+ operators, with specializations that preserve the concrete functional type
203
+ when possible.
204
+
205
+ #### Linear algebra
206
+
207
+ The `spacecore.linalg` module is new in 0.2.0. It provides JIT-compatible
208
+ iterative solvers and structured result types.
209
+
210
+ - Iterative solvers:
211
+ - `cg` for Hermitian positive-definite systems.
212
+ - `lsqr` for rectangular least-squares problems.
213
+ - `power_iteration` for dominant-eigenpair estimates of a `LinOp` or
214
+ `QuadraticForm`.
215
+ - `lanczos_smallest` for smallest-Ritz-eigenpair estimates of Hermitian
216
+ operators.
217
+ - `expm_multiply` for Krylov matrix-exponential actions `exp(t A) v` on
218
+ Hermitian operators, with complex `t` supported for Schrodinger-type
219
+ evolution.
220
+ - Structured result types `CGResult`, `LSQRResult`, `PowerIterationResult`,
221
+ `LanczosResult`, and `ExpmMultiplyResult`, each carrying convergence
222
+ diagnostics and a compact `__repr__`.
223
+ - Solvers are geometry-aware: norms, inner products, and the default initial
224
+ vector use `Space.inner` and `Space.norm` rather than assuming Euclidean
225
+ geometry. This makes the solvers correct on custom inner products such as
226
+ RKHS or weighted spaces.
227
+
228
+ #### Documentation
229
+
230
+ - Numpydoc-standard public docstrings with runnable doctests for solvers,
231
+ spaces, operators, functionals, backends, and contextual helpers.
232
+ - API reference pages for backend ops, spaces, linear operators, functionals,
233
+ and linear algebra.
234
+ - JAX integration design note at `docs/source/design/jax_integration.rst`
235
+ covering trace-time operator algebra and recommended JIT usage.
236
+ - Tutorials for backend operations, linear operators, and matrix-free linalg
237
+ workflows.
238
+
239
+ #### Tooling
240
+
241
+ - Optional dependency groups: `[jax]`, `[torch]`, `[cupy]`, `[examples]`,
242
+ `[docs]`, `[dev]`.
243
+ - Explicit `__all__` at the top level covering new backends, operators,
244
+ functionals, solvers, result types, validation checks, and contextual
245
+ helpers.
246
+ - CI runs a JIT-traceability audit in `--check` mode and enforces a 70%
247
+ coverage floor via `pytest-cov`.
248
+ - Cross-backend tests covering NumPy, JAX, Torch, and optional CuPy.
249
+
250
+ ### Changed
251
+
252
+ - Restructured `_contextual` to hide implementation details while preserving
253
+ the public API via free functions.
254
+ - Replaced manual `if self._enable_checks` guards with `checked_method` across
255
+ `Space`, `LinOp`, and `Functional`. Inline guards are now reserved for
256
+ non-membership checks such as dense-array assertions and custom output-shape
257
+ checks.
258
+ - Improved `VectorSpace`, `HermitianSpace`, and `ProductSpace` conversion
259
+ behavior, validation, batching support, and docstrings.
260
+ - Improved linear-operator equality, representation, conversion, and JAX
261
+ pytree behavior.
262
+ - `spacecore.__version__` now resolves from package metadata via
263
+ `importlib.metadata` instead of a hand-maintained constant.
264
+ - Bumped the package version to `0.2.0`.
265
+
266
+ ### Fixed
267
+
268
+ - `LinOp.__eq__` returns `NotImplemented` instead of raising
269
+ `NotImplementedError` on the base class, so `op == None` and
270
+ `op in some_list` no longer raise.
271
+ - `DenseLinOp.is_hermitian` and `SparseLinOp.is_hermitian` return `None` for
272
+ custom space geometries instead of applying an incorrect Euclidean
273
+ matrix-symmetry test.
274
+
275
+ ### Migration from 0.1.x
276
+
277
+ - `BackendOps.eps` is now a method `eps(dtype)` rather than a property.
278
+ Callers must pass a dtype, typically `ctx.dtype`.
279
+ - The implementation attribute `DenseLinOp.A` is now a `cached_property`
280
+ backed by `_A`. The public attribute access `op.A` is unchanged.
281
+ - `LinOp.__eq__` returns `NotImplemented` rather than raising; downstream code
282
+ relying on the exception should be updated to handle the new behavior.
283
+ - Several module-internal helpers in `spacecore._contextual` moved to private
284
+ modules. Use the public functions re-exported from `spacecore._contextual`
285
+ (`set_context`, `get_context`, `resolve_context_priority`, `register_ops`,
286
+ `set_resolution_policy`, and the dtype-policy accessors) rather than
287
+ importing from internal modules.
288
+
289
+ ### Known limitations
290
+
291
+ - `cg`, `lsqr`, and `power_iteration` do not structurally validate operator
292
+ properties (positive-definiteness, full Hermiticity) and may silently
293
+ produce incorrect results on inputs that violate their preconditions. See
294
+ each function's `Notes` section for details.
295
+ - Operator algebra runs Python-level simplification at construction time. For
296
+ maximum JIT efficiency, assemble operator expressions outside the
297
+ `jax.jit` boundary; see the JAX integration design note.
298
+ - `MatrixFreeLinOp` stores its callables in pytree auxiliary data.
299
+ Constructing one inside a JIT-traced function with a new lambda each call
300
+ triggers retracing. Construct outside the traced region with a stable
301
+ callable reference.
302
+ - The CuPy backend is provided as a preview. Coverage of non-standard
303
+ operations and sparse handling may evolve in a subsequent release.
304
+
305
+ [0.3.0]: https://github.com/Pavlo3P/SpaceCore/releases/tag/v0.3.0
306
+ [0.2.0]: https://github.com/Pavlo3P/SpaceCore/releases/tag/v0.2.0
@@ -0,0 +1,13 @@
1
+ # Contributing
2
+
3
+ Bug reports, feature requests, and pull requests are welcome.
4
+
5
+ For local development:
6
+
7
+ ```bash
8
+ python -m pip install -e ".[dev,docs]"
9
+ pytest
10
+ ruff check .
11
+ ```
12
+
13
+ Please include tests or documentation updates for behavior changes.
@@ -0,0 +1,12 @@
1
+ include CHANGELOG.md
2
+ include CONTRIBUTING.md
3
+
4
+ recursive-include docs/source *.rst *.py *.css
5
+ recursive-include docs/dev *.md
6
+ recursive-include examples *.py
7
+ recursive-include tests *.py
8
+ recursive-include tutorials *.ipynb *.md
9
+
10
+ global-exclude *.py[cod]
11
+ global-exclude __pycache__
12
+ global-exclude .DS_Store
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: spacecore
3
+ Version: 0.3.1
4
+ Summary: Backend-agnostic vector spaces and linear operators.
5
+ Author: Pavlo Pelikh
6
+ License-Expression: Apache-2.0
7
+ Keywords: linear-algebra,jax,pytorch,numpy,operators,spaces
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: array-api-compat>=1.14.0
18
+ Requires-Dist: numpy>=2.0.0
19
+ Requires-Dist: scipy>=1.17
20
+ Provides-Extra: jax
21
+ Requires-Dist: jax>=0.9.1; extra == "jax"
22
+ Provides-Extra: torch
23
+ Requires-Dist: torch>=2.0; extra == "torch"
24
+ Provides-Extra: cupy
25
+ Requires-Dist: cupy>=13.0; extra == "cupy"
26
+ Provides-Extra: examples
27
+ Requires-Dist: matplotlib>=3.8; extra == "examples"
28
+ Requires-Dist: optax>=0.2; extra == "examples"
29
+ Provides-Extra: docs
30
+ Requires-Dist: sphinx>=8.0; extra == "docs"
31
+ Requires-Dist: pydata-sphinx-theme>=0.16; extra == "docs"
32
+ Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
33
+ Requires-Dist: sphinx-design>=0.6; extra == "docs"
34
+ Requires-Dist: numpydoc>=1.8; extra == "docs"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0; extra == "dev"
37
+ Requires-Dist: pytest-cov>=5; extra == "dev"
38
+ Requires-Dist: ruff>=0.6; extra == "dev"
39
+ Requires-Dist: numpydoc>=1.7; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # SpaceCore
43
+
44
+ [![CI](https://github.com/Pavlo3P/SpaceCore/actions/workflows/ci.yml/badge.svg)](https://github.com/Pavlo3P/SpaceCore/actions/workflows/ci.yml)
45
+ [![PyPI](https://img.shields.io/pypi/v/spacecore.svg)](https://pypi.org/project/spacecore/)
46
+ [![Python](https://img.shields.io/pypi/pyversions/spacecore.svg)](https://pypi.org/project/spacecore/)
47
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
48
+
49
+ SpaceCore provides typed vector spaces, structured elements, linear operators,
50
+ functionals, and small linear-algebra utilities for backend-aware numerical
51
+ code. An operator is a typed map `A : X -> Y` between spaces, not merely an
52
+ array. Spaces carry the rules needed to validate elements, compute inner
53
+ products, flatten structured values, and interpret adjoints.
54
+
55
+ The execution backend is explicit. A `Context` owns the backend operations,
56
+ default dtype, and validation policy used by spaces and operators. NumPy is the
57
+ baseline backend; JAX, Torch, and CuPy are optional backends when their extras
58
+ are installed.
59
+
60
+ SpaceCore's native solvers are intentionally small. They are a correctness
61
+ baseline and substrate layer for space-aware algorithms, not a replacement for
62
+ mature solver ecosystems such as SciPy, PETSc, Krylov.jl, or PyLops. External
63
+ adapters and backend-specific fast paths can be layered on top where breadth or
64
+ performance is required.
65
+
66
+ ## Install
67
+
68
+ ```bash
69
+ pip install spacecore
70
+ pip install "spacecore[jax]"
71
+ pip install "spacecore[torch]"
72
+ pip install "spacecore[cupy]"
73
+ ```
74
+
75
+ Python 3.11+ is required.
76
+
77
+ ## Quick Start
78
+
79
+ ```python
80
+ import numpy as np
81
+ import spacecore as sc
82
+
83
+ ctx = sc.Context(sc.NumpyOps(), dtype=np.float64)
84
+ X = sc.DenseCoordinateSpace((2,), ctx)
85
+ A = sc.DenseLinOp(ctx.asarray([[2.0, 0.0], [0.0, 3.0]]), X, X, ctx)
86
+ b = ctx.asarray([4.0, 9.0])
87
+
88
+ result = sc.cg(A, b, tol=1e-12, maxiter=10)
89
+ print(result.x)
90
+ print(result.converged)
91
+ ```
92
+
93
+ Expected output:
94
+
95
+ ```text
96
+ [2. 3.]
97
+ True
98
+ ```
99
+
100
+ ## Core Ideas
101
+
102
+ **Spaces.** `DenseCoordinateSpace`, `DenseVectorSpace`,
103
+ `ElementwiseJordanSpace`, `EuclideanElementwiseJordanSpace`, `HermitianSpace`,
104
+ `ProductSpace`, and `StackedSpace` describe element structure and geometry.
105
+ Dense coordinate spaces can use Euclidean or weighted inner products.
106
+
107
+ ```python
108
+ import numpy as np
109
+ import spacecore as sc
110
+
111
+ ctx = sc.Context(sc.NumpyOps(), dtype=np.float64)
112
+ weights = ctx.asarray([2.0, 5.0])
113
+ X = sc.DenseCoordinateSpace((2,), ctx, geometry=sc.WeightedInnerProduct(weights))
114
+ x = ctx.asarray([1.0, 2.0])
115
+ y = ctx.asarray([3.0, 4.0])
116
+
117
+ print(X.inner(x, y))
118
+ print(X.riesz(x))
119
+ ```
120
+
121
+ Expected output:
122
+
123
+ ```text
124
+ 46.0
125
+ [ 2. 10.]
126
+ ```
127
+
128
+ **Linear operators.** `DenseLinOp`, `SparseLinOp`, `DiagonalLinOp`,
129
+ `MatrixFreeLinOp`, `IdentityLinOp`, `ZeroLinOp`, and the algebraic operators
130
+ represent maps `A : X -> Y`. `apply` computes the forward map. `rapply`
131
+ computes the metric adjoint: the coordinate conjugate transpose only agrees
132
+ with it when both spaces use Euclidean geometry.
133
+
134
+ ```python
135
+ import numpy as np
136
+ import spacecore as sc
137
+
138
+ ctx = sc.Context(sc.NumpyOps(), dtype=np.float64)
139
+ X = sc.DenseCoordinateSpace((2,), ctx)
140
+ A = sc.DiagonalLinOp(ctx.asarray([2.0, 3.0]), X, ctx)
141
+
142
+ print(A.apply(ctx.asarray([1.0, 2.0])))
143
+ print(A.rapply(ctx.asarray([1.0, 1.0])))
144
+ ```
145
+
146
+ Expected output:
147
+
148
+ ```text
149
+ [2. 6.]
150
+ [2. 3.]
151
+ ```
152
+
153
+ **Functionals.** `LinearFunctional`, `InnerProductFunctional`,
154
+ `MatrixFreeLinearFunctional`, `QuadraticForm`, and `LinOpQuadraticForm` model
155
+ scalar-valued maps on spaces. Gradients are represented in the domain geometry.
156
+
157
+ **Linear algebra.** `cg`, `lsqr`, `lanczos_smallest`, `power_iteration`, and
158
+ `expm_multiply` operate on SpaceCore operators and spaces. They document their
159
+ mathematical preconditions; for example `cg` expects a square Hermitian positive
160
+ definite map `A : X -> X` with respect to `X.inner`.
161
+
162
+ **Backends.** `NumpyOps` is always available. `JaxOps`, `TorchOps`, and
163
+ `CuPyOps` are exported only when their optional dependencies are installed.
164
+ Backend portability means SpaceCore uses the same abstract operations and data
165
+ model; it does not erase backend-specific dtype, device, sparse, tracing, or
166
+ autograd behavior.
167
+
168
+ ## Batching
169
+
170
+ A space describes one element type. Batched computation is handled by vectorized
171
+ application methods such as `vapply`, `rvapply`, `vvalue`, and backend
172
+ vectorization. Batching does not change the mathematical domain or codomain of
173
+ an operator unless the operator itself is explicitly built over a stacked or
174
+ product space.
175
+
176
+ ## Documentation
177
+
178
+ - [Tutorials](https://pavlo3p.github.io/SpaceCore/tutorials/index.html)
179
+ - [Design notes](https://pavlo3p.github.io/SpaceCore/design/index.html)
180
+ - [API reference](https://pavlo3p.github.io/SpaceCore/api/index.html)
181
+ - [Release notes](https://pavlo3p.github.io/SpaceCore/release_notes.html)
182
+
183
+ ## Project Status
184
+
185
+ SpaceCore is experimental `0.3.x` software. Core abstractions are usable for
186
+ research and prototyping, but API details may still change before a stable
187
+ release.
188
+
189
+ ## Contributing
190
+
191
+ Bug reports, feature requests, and PRs are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
192
+
193
+ ## License
194
+
195
+ Apache 2.0. See [LICENSE](LICENSE).
196
+
197
+ ## Citation
198
+
199
+ ```bibtex
200
+ @software{spacecore,
201
+ author = {Pavlo Pelikh},
202
+ title = {SpaceCore: Backend-aware vector spaces and linear operators},
203
+ url = {https://github.com/Pavlo3P/SpaceCore},
204
+ year = {2026},
205
+ }
206
+ ```