tensoratlas 0.1.0__py3-none-any.whl

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 (153) hide show
  1. tensoratlas/__init__.py +37 -0
  2. tensoratlas/_internal/sympy_matrix_guard.py +53 -0
  3. tensoratlas/abstract_tensor.py +3632 -0
  4. tensoratlas/algebraic_semantic_geometry.py +365 -0
  5. tensoratlas/api.py +62 -0
  6. tensoratlas/basic_algebraic_reduce.py +479 -0
  7. tensoratlas/basis.py +560 -0
  8. tensoratlas/builtin_maps.py +696 -0
  9. tensoratlas/bundle_identity.py +75 -0
  10. tensoratlas/cache_utils.py +73 -0
  11. tensoratlas/calculus.py +78 -0
  12. tensoratlas/canonical_keys.py +343 -0
  13. tensoratlas/canonicalization_core.py +152 -0
  14. tensoratlas/charts.py +2196 -0
  15. tensoratlas/comparison_utils.py +72 -0
  16. tensoratlas/completion_manager.py +170 -0
  17. tensoratlas/conflict_priority_geometry_engine.py +295 -0
  18. tensoratlas/connection_curvature.py +580 -0
  19. tensoratlas/contracts/__init__.py +12 -0
  20. tensoratlas/contracts/bridges.py +24 -0
  21. tensoratlas/contracts/normal_forms.py +28 -0
  22. tensoratlas/contracts/provenance.py +22 -0
  23. tensoratlas/coordinate_catalog.json +495 -0
  24. tensoratlas/core/__init__.py +462 -0
  25. tensoratlas/core/components.py +899 -0
  26. tensoratlas/core/conventions.py +162 -0
  27. tensoratlas/core/coordinate_map_data.py +195 -0
  28. tensoratlas/core/coordinate_tools.py +723 -0
  29. tensoratlas/core/curvature.py +112 -0
  30. tensoratlas/core/derivatives.py +236 -0
  31. tensoratlas/core/exterior_forms.py +410 -0
  32. tensoratlas/core/field_transformations.py +212 -0
  33. tensoratlas/core/graded_algebra.py +213 -0
  34. tensoratlas/core/indices.py +78 -0
  35. tensoratlas/core/manifolds.py +86 -0
  36. tensoratlas/core/multiterm_identities.py +466 -0
  37. tensoratlas/core/permutation_canonicalization.py +187 -0
  38. tensoratlas/core/permutation_group_backend.py +601 -0
  39. tensoratlas/core/realization.py +101 -0
  40. tensoratlas/core/symbolic_arrays.py +254 -0
  41. tensoratlas/core/symbolic_utils.py +95 -0
  42. tensoratlas/core/symmetries.py +131 -0
  43. tensoratlas/core/tensor_expr.py +439 -0
  44. tensoratlas/core/tensor_heads.py +206 -0
  45. tensoratlas/core/tensor_identities.py +116 -0
  46. tensoratlas/core/tensor_monomial_encoding.py +795 -0
  47. tensoratlas/core/variational_calculus.py +452 -0
  48. tensoratlas/core/vector_calculus.py +379 -0
  49. tensoratlas/covariant_variational_geometry.py +311 -0
  50. tensoratlas/critical_pair_rewrite_engine.py +121 -0
  51. tensoratlas/curvature_normal_forms.py +327 -0
  52. tensoratlas/curvature_relations.py +324 -0
  53. tensoratlas/declarations.py +660 -0
  54. tensoratlas/differential_forms_frame.py +306 -0
  55. tensoratlas/display.py +75 -0
  56. tensoratlas/dummy_multiterm_reduction.py +156 -0
  57. tensoratlas/errors.py +35 -0
  58. tensoratlas/examples/__init__.py +107 -0
  59. tensoratlas/examples/canonicalization.py +13 -0
  60. tensoratlas/examples/cartan_geometry.py +21 -0
  61. tensoratlas/examples/coordinate_calculus.py +24 -0
  62. tensoratlas/examples/differential_forms.py +12 -0
  63. tensoratlas/examples/electromagnetism.py +20 -0
  64. tensoratlas/examples/geometric_algebra.py +25 -0
  65. tensoratlas/examples/physical_tensors.py +66 -0
  66. tensoratlas/examples/relativity.py +51 -0
  67. tensoratlas/examples/tensor_theory.py +147 -0
  68. tensoratlas/examples/usability.py +66 -0
  69. tensoratlas/examples/visualizations.py +444 -0
  70. tensoratlas/exterior.py +85 -0
  71. tensoratlas/exterior_geometry.py +374 -0
  72. tensoratlas/exterior_spin_algebra.py +501 -0
  73. tensoratlas/fields.py +959 -0
  74. tensoratlas/geometric_algebra/__init__.py +17 -0
  75. tensoratlas/geometric_algebra/algebra.py +199 -0
  76. tensoratlas/geometric_algebra/multivector.py +207 -0
  77. tensoratlas/geometric_algebra/operations.py +46 -0
  78. tensoratlas/geometry_components.py +161 -0
  79. tensoratlas/geometry_foundations.py +406 -0
  80. tensoratlas/geometry_models.py +240 -0
  81. tensoratlas/geometry_rewrite_transport.py +207 -0
  82. tensoratlas/geometry_workflows.py +92 -0
  83. tensoratlas/graph_iso.py +19 -0
  84. tensoratlas/identity_basis_expansion.py +239 -0
  85. tensoratlas/indexed_api.py +190 -0
  86. tensoratlas/indexed_compare.py +3 -0
  87. tensoratlas/indexed_config.py +49 -0
  88. tensoratlas/indexed_core.py +4 -0
  89. tensoratlas/indexed_expr.py +3 -0
  90. tensoratlas/indexed_normal_form.py +5 -0
  91. tensoratlas/indexed_normalization.py +13 -0
  92. tensoratlas/indexed_patterns.py +3 -0
  93. tensoratlas/indexed_pipeline.py +30 -0
  94. tensoratlas/indexed_reconstruct.py +101 -0
  95. tensoratlas/indexed_render.py +3 -0
  96. tensoratlas/indexed_rewrite.py +4 -0
  97. tensoratlas/indexed_spaces.py +3 -0
  98. tensoratlas/ir_curvature_completion.py +240 -0
  99. tensoratlas/ir_curvature_rewriting.py +176 -0
  100. tensoratlas/ir_rewriting.py +236 -0
  101. tensoratlas/mappings.py +238 -0
  102. tensoratlas/normal_forms.py +850 -0
  103. tensoratlas/notebook_examples.py +435 -0
  104. tensoratlas/performance_engineering.py +122 -0
  105. tensoratlas/priority_reduction.py +203 -0
  106. tensoratlas/priority_rewrite_engine.py +280 -0
  107. tensoratlas/public_api.py +1354 -0
  108. tensoratlas/py.typed +0 -0
  109. tensoratlas/relativity/__init__.py +61 -0
  110. tensoratlas/relativity/curvature.py +366 -0
  111. tensoratlas/relativity/geodesics.py +84 -0
  112. tensoratlas/relativity/inspection.py +152 -0
  113. tensoratlas/relativity/metrics.py +225 -0
  114. tensoratlas/relativity/plotting.py +16 -0
  115. tensoratlas/return_policy.py +57 -0
  116. tensoratlas/rewrite_families.py +367 -0
  117. tensoratlas/semantic_core.py +631 -0
  118. tensoratlas/semantic_exterior_spin.py +286 -0
  119. tensoratlas/semantic_identity_components.py +293 -0
  120. tensoratlas/semantic_ir.py +542 -0
  121. tensoratlas/semantic_matching.py +707 -0
  122. tensoratlas/semantic_ops.py +148 -0
  123. tensoratlas/semantic_rewrite.py +276 -0
  124. tensoratlas/semantic_transport_rewrite.py +438 -0
  125. tensoratlas/semantic_transport_rules.py +404 -0
  126. tensoratlas/signed_contraction_canonicalization.py +185 -0
  127. tensoratlas/simplification_core.py +29 -0
  128. tensoratlas/simplification_policy.py +95 -0
  129. tensoratlas/standard_tensor_library.py +168 -0
  130. tensoratlas/symbolic_decision.py +176 -0
  131. tensoratlas/symbolic_simplification_policy.py +103 -0
  132. tensoratlas/symmetry_confluence_engine.py +308 -0
  133. tensoratlas/tensor_algebra.py +1732 -0
  134. tensoratlas/tensor_core.py +1188 -0
  135. tensoratlas/tensor_expr_canonicalization.py +604 -0
  136. tensoratlas/tensor_indices.py +2217 -0
  137. tensoratlas/tensor_valued_forms/__init__.py +27 -0
  138. tensoratlas/tensor_valued_forms/cartan.py +72 -0
  139. tensoratlas/tensor_valued_forms/valued.py +183 -0
  140. tensoratlas/tensorform_engine.py +343 -0
  141. tensoratlas/tensorform_planning.py +251 -0
  142. tensoratlas/tensorform_special.py +165 -0
  143. tensoratlas/tensorform_types.py +99 -0
  144. tensoratlas/unified_reduction.py +174 -0
  145. tensoratlas/validation.py +49 -0
  146. tensoratlas/variational_gr.py +283 -0
  147. tensoratlas/variational_tensor_expr.py +501 -0
  148. tensoratlas/variational_workflows.py +270 -0
  149. tensoratlas-0.1.0.dist-info/METADATA +235 -0
  150. tensoratlas-0.1.0.dist-info/RECORD +153 -0
  151. tensoratlas-0.1.0.dist-info/WHEEL +5 -0
  152. tensoratlas-0.1.0.dist-info/licenses/LICENSE +674 -0
  153. tensoratlas-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,37 @@
1
+ """Public TensorAtlas package interface."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+ from typing import Any
7
+
8
+ from .public_api import (
9
+ __all__,
10
+ _LAZY_EXPORTS,
11
+ chart_property_names,
12
+ mapping_property_names,
13
+ resolve_public_attribute,
14
+ )
15
+
16
+ try:
17
+ __version__ = version("tensoratlas")
18
+ except PackageNotFoundError:
19
+ __version__ = "0.1.0"
20
+
21
+ if "__version__" not in __all__:
22
+ __all__ = tuple(__all__) + ("__version__",)
23
+
24
+
25
+ def __getattr__(name: str) -> Any:
26
+ value = resolve_public_attribute(__name__, name)
27
+ globals()[name] = value
28
+ return value
29
+
30
+
31
+ def __dir__() -> list[str]:
32
+ return sorted(set(globals()) | set(_LAZY_EXPORTS))
33
+
34
+
35
+ # Matrix simplification guards are intentionally not installed at package import time.
36
+ # Use tensoratlas.symbolic_simplification_policy.install_matrix_simplify_guard
37
+ # explicitly in workflows that need a guarded replacement for broad sympy.simplify calls.
@@ -0,0 +1,53 @@
1
+ """Opt-in SymPy integration hooks kept outside the public API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sympy as sp
6
+
7
+
8
+ def install_matrix_simplify_guard() -> bool:
9
+ """Install a bounded matrix simplification guard for compatibility tests.
10
+
11
+ This modifies ``sympy.simplify`` and is therefore intentionally internal and
12
+ opt-in. Normal TensorAtlas imports never patch SymPy.
13
+ """
14
+ try:
15
+ from ..normal_forms import TNFMatrix
16
+ except Exception:
17
+ TNFMatrix = ()
18
+ if getattr(sp.simplify, "_tensoratlas_matrix_guard", False):
19
+ return False
20
+ original_simplify = sp.simplify
21
+
22
+ def cheap_matrix_entry_simplify(entry):
23
+ entry = sp.cancel(entry)
24
+ try:
25
+ has_derivative = entry.has(sp.Derivative)
26
+ has_undefined = any(
27
+ getattr(node, "is_Function", False) and node.func.__name__ not in {"sin", "cos", "tan", "cot"}
28
+ for node in entry.atoms(sp.Function)
29
+ )
30
+ except Exception:
31
+ has_derivative = False
32
+ has_undefined = False
33
+ if has_derivative or has_undefined:
34
+ return entry
35
+ if entry.count_ops() <= 80 and any(entry.has(fn) for fn in (sp.sin, sp.cos, sp.tan, sp.cot)):
36
+ return sp.trigsimp(entry)
37
+ return entry
38
+
39
+ def guarded_simplify(expr, *args, **kwargs):
40
+ if TNFMatrix != () and isinstance(expr, TNFMatrix):
41
+ if all(entry == 0 for entry in expr):
42
+ return sp.zeros(expr.rows, expr.cols)
43
+ return sp.Matrix(expr.rows, expr.cols, lambda row, col: cheap_matrix_entry_simplify(expr[row, col]))
44
+ if isinstance(expr, sp.MatrixBase):
45
+ entries = list(expr)
46
+ if all(entry == 0 for entry in entries):
47
+ return sp.zeros(expr.rows, expr.cols)
48
+ return expr.applyfunc(cheap_matrix_entry_simplify)
49
+ return original_simplify(expr, *args, **kwargs)
50
+
51
+ guarded_simplify._tensoratlas_matrix_guard = True
52
+ sp.simplify = guarded_simplify
53
+ return True