numga 2.0.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 (97) hide show
  1. numga-2.0.0/LICENSE +21 -0
  2. numga-2.0.0/PKG-INFO +113 -0
  3. numga-2.0.0/README.md +58 -0
  4. numga-2.0.0/numga/__init__.py +71 -0
  5. numga-2.0.0/numga/algebra/__init__.py +6 -0
  6. numga-2.0.0/numga/algebra/algebra.py +580 -0
  7. numga-2.0.0/numga/algebra/bitops.py +88 -0
  8. numga-2.0.0/numga/algebra/description.py +190 -0
  9. numga-2.0.0/numga/algebra/self_product.py +58 -0
  10. numga-2.0.0/numga/algebras.py +120 -0
  11. numga-2.0.0/numga/backend/__init__.py +7 -0
  12. numga-2.0.0/numga/backend/context.py +323 -0
  13. numga-2.0.0/numga/backend/dense.py +183 -0
  14. numga-2.0.0/numga/backend/exact.py +171 -0
  15. numga-2.0.0/numga/backend/jax.py +265 -0
  16. numga-2.0.0/numga/backend/numpy.py +144 -0
  17. numga-2.0.0/numga/backend/sparse.py +164 -0
  18. numga-2.0.0/numga/backend/torch.py +286 -0
  19. numga-2.0.0/numga/binding.py +320 -0
  20. numga-2.0.0/numga/expression.py +210 -0
  21. numga-2.0.0/numga/extension.py +230 -0
  22. numga-2.0.0/numga/extensions/__init__.py +3 -0
  23. numga-2.0.0/numga/extensions/_linalg.py +63 -0
  24. numga-2.0.0/numga/extensions/_scalar_functions.py +23 -0
  25. numga-2.0.0/numga/extensions/arithmetic.py +130 -0
  26. numga-2.0.0/numga/extensions/coefficients.py +18 -0
  27. numga-2.0.0/numga/extensions/decompose.py +91 -0
  28. numga-2.0.0/numga/extensions/fields.py +373 -0
  29. numga-2.0.0/numga/extensions/forms.py +183 -0
  30. numga-2.0.0/numga/extensions/grade_transforms.py +50 -0
  31. numga-2.0.0/numga/extensions/invariant_decomposition.py +243 -0
  32. numga-2.0.0/numga/extensions/inverse.py +186 -0
  33. numga-2.0.0/numga/extensions/logexp.py +230 -0
  34. numga-2.0.0/numga/extensions/norms.py +103 -0
  35. numga-2.0.0/numga/extensions/optimized.py +162 -0
  36. numga-2.0.0/numga/extensions/outermorphism.py +86 -0
  37. numga-2.0.0/numga/extensions/roots.py +114 -0
  38. numga-2.0.0/numga/extensions/scalar.py +104 -0
  39. numga-2.0.0/numga/extensions/spectra.py +91 -0
  40. numga-2.0.0/numga/extensions/systems.py +253 -0
  41. numga-2.0.0/numga/extensions/trace.py +122 -0
  42. numga-2.0.0/numga/extensor/__init__.py +4 -0
  43. numga-2.0.0/numga/extensor/application.py +156 -0
  44. numga-2.0.0/numga/extensor/extensor.py +979 -0
  45. numga-2.0.0/numga/extensor/fields.py +320 -0
  46. numga-2.0.0/numga/extensor/namespaces.py +78 -0
  47. numga-2.0.0/numga/extensor/operands.py +144 -0
  48. numga-2.0.0/numga/flyweight.py +39 -0
  49. numga-2.0.0/numga/gatype/__init__.py +36 -0
  50. numga-2.0.0/numga/gatype/dispatch.py +480 -0
  51. numga-2.0.0/numga/gatype/errors.py +19 -0
  52. numga-2.0.0/numga/gatype/factory.py +181 -0
  53. numga-2.0.0/numga/gatype/gatype.py +900 -0
  54. numga-2.0.0/numga/gatype/metric.py +71 -0
  55. numga-2.0.0/numga/gatype/orientation.py +48 -0
  56. numga-2.0.0/numga/gatype/pattern.py +155 -0
  57. numga-2.0.0/numga/gatype/propagation.py +345 -0
  58. numga-2.0.0/numga/gatype/queries.py +211 -0
  59. numga-2.0.0/numga/gatype/rules.py +137 -0
  60. numga-2.0.0/numga/gatype/traits.py +619 -0
  61. numga-2.0.0/numga/multivector/__init__.py +4 -0
  62. numga-2.0.0/numga/multivector/factory.py +204 -0
  63. numga-2.0.0/numga/multivector/subalgebra.py +117 -0
  64. numga-2.0.0/numga/operator/__init__.py +5 -0
  65. numga-2.0.0/numga/operator/factory.py +724 -0
  66. numga-2.0.0/numga/operator/format.py +110 -0
  67. numga-2.0.0/numga/operator/kernel.py +198 -0
  68. numga-2.0.0/numga/render/__init__.py +41 -0
  69. numga-2.0.0/numga/render/camera.py +147 -0
  70. numga-2.0.0/numga/render/contours.py +141 -0
  71. numga-2.0.0/numga/render/drawing.py +279 -0
  72. numga-2.0.0/numga/render/flow.py +323 -0
  73. numga-2.0.0/numga/render/meshes.py +191 -0
  74. numga-2.0.0/numga/render/planar.py +12 -0
  75. numga-2.0.0/numga/render/quadrics.py +163 -0
  76. numga-2.0.0/numga/render/scene.py +58 -0
  77. numga-2.0.0/numga/render/simplices.py +399 -0
  78. numga-2.0.0/numga/render/solids.py +922 -0
  79. numga-2.0.0/numga/sparse/__init__.py +7 -0
  80. numga-2.0.0/numga/sparse/extensor.py +534 -0
  81. numga-2.0.0/numga/sparse/numeric.py +221 -0
  82. numga-2.0.0/numga/subspace/__init__.py +7 -0
  83. numga-2.0.0/numga/subspace/factory.py +317 -0
  84. numga-2.0.0/numga/subspace/subspace.py +274 -0
  85. numga-2.0.0/numga/topology.py +612 -0
  86. numga-2.0.0/numga/wgsl/__init__.py +24 -0
  87. numga-2.0.0/numga/wgsl/dialect.py +1643 -0
  88. numga-2.0.0/numga/wgsl/library.py +94 -0
  89. numga-2.0.0/numga/wgsl/page.py +43 -0
  90. numga-2.0.0/numga/wgsl/runner.py +395 -0
  91. numga-2.0.0/numga.egg-info/PKG-INFO +113 -0
  92. numga-2.0.0/numga.egg-info/SOURCES.txt +95 -0
  93. numga-2.0.0/numga.egg-info/dependency_links.txt +1 -0
  94. numga-2.0.0/numga.egg-info/requires.txt +16 -0
  95. numga-2.0.0/numga.egg-info/top_level.txt +1 -0
  96. numga-2.0.0/pyproject.toml +64 -0
  97. numga-2.0.0/setup.cfg +4 -0
numga-2.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Eelco Hoogendoorn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
numga-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: numga
3
+ Version: 2.0.0
4
+ Summary: Geometric algebra and extensors in NumPy, JAX, PyTorch and WebGPU
5
+ Author-email: Eelco Hoogendoorn <hoogendoorn.eelco@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2022 Eelco Hoogendoorn
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/EelcoHoogendoorn/numga
29
+ Project-URL: Repository, https://github.com/EelcoHoogendoorn/numga
30
+ Project-URL: Documentation, https://github.com/EelcoHoogendoorn/numga/blob/main/docs/README.md
31
+ Project-URL: Issues, https://github.com/EelcoHoogendoorn/numga/issues
32
+ Keywords: geometric algebra,clifford algebra,extensors,numpy,jax,pytorch,webgpu
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Science/Research
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
39
+ Classifier: Topic :: Scientific/Engineering :: Physics
40
+ Requires-Python: >=3.11
41
+ Description-Content-Type: text/markdown
42
+ License-File: LICENSE
43
+ Requires-Dist: numpy>=2.0
44
+ Provides-Extra: linalg
45
+ Requires-Dist: scipy>=1.13; extra == "linalg"
46
+ Provides-Extra: wgpu
47
+ Requires-Dist: wgpu>=0.32; extra == "wgpu"
48
+ Provides-Extra: jax
49
+ Requires-Dist: jax>=0.5; extra == "jax"
50
+ Provides-Extra: torch
51
+ Requires-Dist: torch>=2.3; extra == "torch"
52
+ Provides-Extra: test
53
+ Requires-Dist: pytest>=7; extra == "test"
54
+ Dynamic: license-file
55
+
56
+ # numga
57
+
58
+ [![CI](https://github.com/EelcoHoogendoorn/numga/actions/workflows/ci.yml/badge.svg)](https://github.com/EelcoHoogendoorn/numga/actions/workflows/ci.yml)
59
+
60
+ Geometric algebra with extensors in NumPy, JAX, PyTorch and WebGPU.
61
+
62
+ Extensors generalize matrices and tensors from vectors to multivectors, and from the inner and tensor products to every product of geometric algebra.
63
+
64
+ <table>
65
+ <tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/relativity/gravitational_waves/"><b>Gravitational waves</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/relativity/gravitational_waves/waves.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/gravitational_waves_inside.gif" alt="Crystals of atoms ringing as a gravitational wave passes, seen from inside a closed universe whose great circles are strung with its mesh's vertices" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/thermodynamics/snowflake/"><b>Snowflake thermodynamics</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/thermodynamics/snowflake/snowflake.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/snowflake.gif" alt="A seed of ice in undercooled water growing into a six-armed dendrite" width="100%"></td></tr>
66
+ <tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/geometry/scenegraph/"><b>Scenegraph and camera optics</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/geometry/scenegraph/scenegraph.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/scenegraph.gif" alt="A robot arm in 3D, and its picture on a camera sensor" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/mechanics/rattleback/"><b>Spin reversal by rolling contact</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/mechanics/rattleback/rattleback.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/rattleback.gif" alt="A wooden rattleback spun the wrong way, rocking, stopping and spinning back" width="100%"></td></tr>
67
+ <tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/estimation/multiview/"><b>Summing cones into splats</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/estimation/multiview/multiview_reconstruction.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/multiview_convergence.gif" alt="Cameras aligning on a scene" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/quantum/condensate/"><b>Quantized vortices in a Bose–Einstein condensate</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/quantum/condensate/condensate.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/condensate.gif" alt="A rotating condensate settling into a lattice of quantized vortices" width="100%"></td></tr>
68
+ </table>
69
+
70
+ **Explore live:** [a rotating black hole](https://eelcohoogendoorn.github.io/numga/examples/relativity/kerr/kerr_webgpu.html) · [a gravitational wave](https://eelcohoogendoorn.github.io/numga/examples/relativity/gravitational_waves/gravitational_waves_webgpu.html)
71
+
72
+ ## Extensors
73
+
74
+ **[An introduction to extensors, and a gallery of what they do](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/extensors.md)**: from a robot arm and its camera to a snowflake, a dynamo and a closed universe, each example a picture and the few lines of extensor code that compute it.
75
+
76
+ A short example of the extensor syntax: building unary maps and bilinear forms, and solving for the vibration modes of four point masses on springs:
77
+
78
+ ```python
79
+ points = mv.point([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]) # four unit masses
80
+ inertia = (points & points.commutator(Bivector)).sum(axis=0) # Antibivector <- Bivector
81
+
82
+ springs = points[:, None] & points[None, :] # [points, points] Antibivector: a line through each pair
83
+ stiffness = (springs * (springs & Bivector)).sum(axis=(0, 1)) / 2 # Antibivector <- Bivector
84
+ # the vibration modes, between two bilinear energy forms
85
+ values, modes = (Bivector & stiffness).eigh(Bivector & inertia)
86
+ ```
87
+
88
+ The full example: [vibration modes](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/examples/mechanics/modes/modes.ipynb) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/mechanics/modes/modes.ipynb)
89
+
90
+ ## Documentation
91
+
92
+ * [Tutorials](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/README.md#overview-and-tutorials): step-by-step primers on [geometric algebra](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/tutorial/geometric-algebra/00-introduction.md) and [extensors](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/tutorial/extensors/00-introduction.md).
93
+ * [Guides and reference](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/README.md#guides-and-reference): [extensor syntax](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/extensor_syntax.md), [orientation](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/orientation.md), [fields](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/fields.md), [simplicial topologies](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/topology.md), [WebGPU shaders and rendering](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/rendering.md), [conventions](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/conventions.md) and [internals](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/internals.md).
94
+ * [Examples](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/examples/README.md): over 200 runnable notebooks across geometry, estimation, surfaces, mechanics, fluids, optics, electromagnetism, relativity, quantum physics and thermodynamics.
95
+
96
+ ## Articles
97
+
98
+ [Conceptual articles](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/articles/README.md) on extensors, orientation, the regressive product, complementarity, discrete differential geometric algebra and coupled thermodynamics, and how extensors relate to linear algebra, tensors and forms.
99
+
100
+ ## Install and run
101
+
102
+ Install from PyPI:
103
+
104
+ ```sh
105
+ pip install numga
106
+ ```
107
+
108
+ To install `numga` with the `examples` package from GitHub and run an example:
109
+
110
+ ```sh
111
+ pip install "numga[examples] @ https://github.com/EelcoHoogendoorn/numga/archive/HEAD.tar.gz"
112
+ python -m examples.mechanics.modes.scenarios
113
+ ```
numga-2.0.0/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # numga
2
+
3
+ [![CI](https://github.com/EelcoHoogendoorn/numga/actions/workflows/ci.yml/badge.svg)](https://github.com/EelcoHoogendoorn/numga/actions/workflows/ci.yml)
4
+
5
+ Geometric algebra with extensors in NumPy, JAX, PyTorch and WebGPU.
6
+
7
+ Extensors generalize matrices and tensors from vectors to multivectors, and from the inner and tensor products to every product of geometric algebra.
8
+
9
+ <table>
10
+ <tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/relativity/gravitational_waves/"><b>Gravitational waves</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/relativity/gravitational_waves/waves.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/gravitational_waves_inside.gif" alt="Crystals of atoms ringing as a gravitational wave passes, seen from inside a closed universe whose great circles are strung with its mesh's vertices" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/thermodynamics/snowflake/"><b>Snowflake thermodynamics</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/thermodynamics/snowflake/snowflake.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/snowflake.gif" alt="A seed of ice in undercooled water growing into a six-armed dendrite" width="100%"></td></tr>
11
+ <tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/geometry/scenegraph/"><b>Scenegraph and camera optics</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/geometry/scenegraph/scenegraph.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/scenegraph.gif" alt="A robot arm in 3D, and its picture on a camera sensor" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/mechanics/rattleback/"><b>Spin reversal by rolling contact</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/mechanics/rattleback/rattleback.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/rattleback.gif" alt="A wooden rattleback spun the wrong way, rocking, stopping and spinning back" width="100%"></td></tr>
12
+ <tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/estimation/multiview/"><b>Summing cones into splats</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/estimation/multiview/multiview_reconstruction.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/multiview_convergence.gif" alt="Cameras aligning on a scene" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/quantum/condensate/"><b>Quantized vortices in a Bose–Einstein condensate</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/quantum/condensate/condensate.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/condensate.gif" alt="A rotating condensate settling into a lattice of quantized vortices" width="100%"></td></tr>
13
+ </table>
14
+
15
+ **Explore live:** [a rotating black hole](https://eelcohoogendoorn.github.io/numga/examples/relativity/kerr/kerr_webgpu.html) · [a gravitational wave](https://eelcohoogendoorn.github.io/numga/examples/relativity/gravitational_waves/gravitational_waves_webgpu.html)
16
+
17
+ ## Extensors
18
+
19
+ **[An introduction to extensors, and a gallery of what they do](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/extensors.md)**: from a robot arm and its camera to a snowflake, a dynamo and a closed universe, each example a picture and the few lines of extensor code that compute it.
20
+
21
+ A short example of the extensor syntax: building unary maps and bilinear forms, and solving for the vibration modes of four point masses on springs:
22
+
23
+ ```python
24
+ points = mv.point([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]) # four unit masses
25
+ inertia = (points & points.commutator(Bivector)).sum(axis=0) # Antibivector <- Bivector
26
+
27
+ springs = points[:, None] & points[None, :] # [points, points] Antibivector: a line through each pair
28
+ stiffness = (springs * (springs & Bivector)).sum(axis=(0, 1)) / 2 # Antibivector <- Bivector
29
+ # the vibration modes, between two bilinear energy forms
30
+ values, modes = (Bivector & stiffness).eigh(Bivector & inertia)
31
+ ```
32
+
33
+ The full example: [vibration modes](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/examples/mechanics/modes/modes.ipynb) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/mechanics/modes/modes.ipynb)
34
+
35
+ ## Documentation
36
+
37
+ * [Tutorials](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/README.md#overview-and-tutorials): step-by-step primers on [geometric algebra](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/tutorial/geometric-algebra/00-introduction.md) and [extensors](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/tutorial/extensors/00-introduction.md).
38
+ * [Guides and reference](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/README.md#guides-and-reference): [extensor syntax](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/extensor_syntax.md), [orientation](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/orientation.md), [fields](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/fields.md), [simplicial topologies](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/topology.md), [WebGPU shaders and rendering](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/rendering.md), [conventions](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/conventions.md) and [internals](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/internals.md).
39
+ * [Examples](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/examples/README.md): over 200 runnable notebooks across geometry, estimation, surfaces, mechanics, fluids, optics, electromagnetism, relativity, quantum physics and thermodynamics.
40
+
41
+ ## Articles
42
+
43
+ [Conceptual articles](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/articles/README.md) on extensors, orientation, the regressive product, complementarity, discrete differential geometric algebra and coupled thermodynamics, and how extensors relate to linear algebra, tensors and forms.
44
+
45
+ ## Install and run
46
+
47
+ Install from PyPI:
48
+
49
+ ```sh
50
+ pip install numga
51
+ ```
52
+
53
+ To install `numga` with the `examples` package from GitHub and run an example:
54
+
55
+ ```sh
56
+ pip install "numga[examples] @ https://github.com/EelcoHoogendoorn/numga/archive/HEAD.tar.gz"
57
+ python -m examples.mechanics.modes.scenarios
58
+ ```
@@ -0,0 +1,71 @@
1
+ """The top-level `numga` namespace exposes geometric algebras (`Algebra`), blade subspaces
2
+ (`SubSpace`), extensor types and traits (`GAType`, `Orientation`, `Trait`), multilinear values and
3
+ maps (`Extensor`, `MultivectorFactory`, `OperatorFactory`), and backend execution contexts
4
+ (`ExactContext`, `NumpyContext`, `JaxContext`, `TorchContext`). Optional JAX and PyTorch contexts
5
+ load lazily on attribute access so importing `numga` requires only NumPy.
6
+
7
+ Algebraic conventions and product rules are introduced in `docs/conventions.md`, extensor map and
8
+ binding syntax in `docs/extensor_syntax.md`, intrinsic and extrinsic orientation in
9
+ `docs/orientation.md`, discrete fields over sites in `docs/fields.md`, simplicial complexes in
10
+ `docs/topology.md`, WebGPU shaders and rendering in `docs/rendering.md`, and type-dispatch and
11
+ backend internals in `docs/internals.md`."""
12
+
13
+ from __future__ import annotations
14
+
15
+ from .algebra import Algebra, AlgebraDescription
16
+ from .backend import Context, ExactContext, NumpyContext
17
+ from .binding import AxisTransform, AxisTransformKind, BindingPlan
18
+ from .extensor import Extensor, concatenate, stack, where
19
+ from .extension import ExtensionMethod
20
+ from . import expression
21
+ from .gatype import (
22
+ EMPTY_TRAITS,
23
+ ROTOR_TRAITS,
24
+ AmbiguousGATypeDispatchWarning,
25
+ Blade,
26
+ BladeProduct,
27
+ CoefficientOrthogonal,
28
+ GAType,
29
+ GATypeDispatch,
30
+ GATypeError,
31
+ GATypeFactory,
32
+ GATypePattern,
33
+ CliffordConjugateProduct,
34
+ CliffordConjugateProductNonzero,
35
+ CliffordConjugateProductOne,
36
+ CliffordConjugateProductScalar,
37
+ CliffordConjugateProductZero,
38
+ GradeInvolutionProduct,
39
+ Orientation,
40
+ ProductFact,
41
+ ProductRelation,
42
+ ProductResult,
43
+ SelfProduct,
44
+ ReverseProduct,
45
+ ReverseProductNonzero,
46
+ ReverseProductOne,
47
+ ReverseProductScalar,
48
+ ReverseProductZero,
49
+ Trait,
50
+ TraitSet,
51
+ Versor,
52
+ VersorProduct,
53
+ )
54
+ from .multivector import MultivectorFactory
55
+ from .operator import OperatorFactory, SymbolicKernel
56
+ from .subspace import SubSpace, SubSpaceFactory, SupportKey
57
+
58
+ # Default extension overloads register once core classes exist.
59
+ from . import extensions as _extensions
60
+
61
+ __version__ = "2.0.0"
62
+
63
+
64
+ def __getattr__(name: str) -> type[Context]:
65
+ if name == "JaxContext":
66
+ from .backend.jax import JaxContext
67
+ return JaxContext
68
+ if name == "TorchContext":
69
+ from .backend.torch import TorchContext
70
+ return TorchContext
71
+ raise AttributeError(f"module 'numga' has no attribute {name!r}")
@@ -0,0 +1,6 @@
1
+ """The `numga.algebra` package defines backend-independent geometric algebra descriptions,
2
+ canonical bit-mask blades, and Cayley product tables."""
3
+
4
+ from .algebra import Algebra, BladeProduct, OrientedBlade, ProductTable
5
+ from .description import AlgebraDescription, parse_description
6
+