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.
- tensoratlas/__init__.py +37 -0
- tensoratlas/_internal/sympy_matrix_guard.py +53 -0
- tensoratlas/abstract_tensor.py +3632 -0
- tensoratlas/algebraic_semantic_geometry.py +365 -0
- tensoratlas/api.py +62 -0
- tensoratlas/basic_algebraic_reduce.py +479 -0
- tensoratlas/basis.py +560 -0
- tensoratlas/builtin_maps.py +696 -0
- tensoratlas/bundle_identity.py +75 -0
- tensoratlas/cache_utils.py +73 -0
- tensoratlas/calculus.py +78 -0
- tensoratlas/canonical_keys.py +343 -0
- tensoratlas/canonicalization_core.py +152 -0
- tensoratlas/charts.py +2196 -0
- tensoratlas/comparison_utils.py +72 -0
- tensoratlas/completion_manager.py +170 -0
- tensoratlas/conflict_priority_geometry_engine.py +295 -0
- tensoratlas/connection_curvature.py +580 -0
- tensoratlas/contracts/__init__.py +12 -0
- tensoratlas/contracts/bridges.py +24 -0
- tensoratlas/contracts/normal_forms.py +28 -0
- tensoratlas/contracts/provenance.py +22 -0
- tensoratlas/coordinate_catalog.json +495 -0
- tensoratlas/core/__init__.py +462 -0
- tensoratlas/core/components.py +899 -0
- tensoratlas/core/conventions.py +162 -0
- tensoratlas/core/coordinate_map_data.py +195 -0
- tensoratlas/core/coordinate_tools.py +723 -0
- tensoratlas/core/curvature.py +112 -0
- tensoratlas/core/derivatives.py +236 -0
- tensoratlas/core/exterior_forms.py +410 -0
- tensoratlas/core/field_transformations.py +212 -0
- tensoratlas/core/graded_algebra.py +213 -0
- tensoratlas/core/indices.py +78 -0
- tensoratlas/core/manifolds.py +86 -0
- tensoratlas/core/multiterm_identities.py +466 -0
- tensoratlas/core/permutation_canonicalization.py +187 -0
- tensoratlas/core/permutation_group_backend.py +601 -0
- tensoratlas/core/realization.py +101 -0
- tensoratlas/core/symbolic_arrays.py +254 -0
- tensoratlas/core/symbolic_utils.py +95 -0
- tensoratlas/core/symmetries.py +131 -0
- tensoratlas/core/tensor_expr.py +439 -0
- tensoratlas/core/tensor_heads.py +206 -0
- tensoratlas/core/tensor_identities.py +116 -0
- tensoratlas/core/tensor_monomial_encoding.py +795 -0
- tensoratlas/core/variational_calculus.py +452 -0
- tensoratlas/core/vector_calculus.py +379 -0
- tensoratlas/covariant_variational_geometry.py +311 -0
- tensoratlas/critical_pair_rewrite_engine.py +121 -0
- tensoratlas/curvature_normal_forms.py +327 -0
- tensoratlas/curvature_relations.py +324 -0
- tensoratlas/declarations.py +660 -0
- tensoratlas/differential_forms_frame.py +306 -0
- tensoratlas/display.py +75 -0
- tensoratlas/dummy_multiterm_reduction.py +156 -0
- tensoratlas/errors.py +35 -0
- tensoratlas/examples/__init__.py +107 -0
- tensoratlas/examples/canonicalization.py +13 -0
- tensoratlas/examples/cartan_geometry.py +21 -0
- tensoratlas/examples/coordinate_calculus.py +24 -0
- tensoratlas/examples/differential_forms.py +12 -0
- tensoratlas/examples/electromagnetism.py +20 -0
- tensoratlas/examples/geometric_algebra.py +25 -0
- tensoratlas/examples/physical_tensors.py +66 -0
- tensoratlas/examples/relativity.py +51 -0
- tensoratlas/examples/tensor_theory.py +147 -0
- tensoratlas/examples/usability.py +66 -0
- tensoratlas/examples/visualizations.py +444 -0
- tensoratlas/exterior.py +85 -0
- tensoratlas/exterior_geometry.py +374 -0
- tensoratlas/exterior_spin_algebra.py +501 -0
- tensoratlas/fields.py +959 -0
- tensoratlas/geometric_algebra/__init__.py +17 -0
- tensoratlas/geometric_algebra/algebra.py +199 -0
- tensoratlas/geometric_algebra/multivector.py +207 -0
- tensoratlas/geometric_algebra/operations.py +46 -0
- tensoratlas/geometry_components.py +161 -0
- tensoratlas/geometry_foundations.py +406 -0
- tensoratlas/geometry_models.py +240 -0
- tensoratlas/geometry_rewrite_transport.py +207 -0
- tensoratlas/geometry_workflows.py +92 -0
- tensoratlas/graph_iso.py +19 -0
- tensoratlas/identity_basis_expansion.py +239 -0
- tensoratlas/indexed_api.py +190 -0
- tensoratlas/indexed_compare.py +3 -0
- tensoratlas/indexed_config.py +49 -0
- tensoratlas/indexed_core.py +4 -0
- tensoratlas/indexed_expr.py +3 -0
- tensoratlas/indexed_normal_form.py +5 -0
- tensoratlas/indexed_normalization.py +13 -0
- tensoratlas/indexed_patterns.py +3 -0
- tensoratlas/indexed_pipeline.py +30 -0
- tensoratlas/indexed_reconstruct.py +101 -0
- tensoratlas/indexed_render.py +3 -0
- tensoratlas/indexed_rewrite.py +4 -0
- tensoratlas/indexed_spaces.py +3 -0
- tensoratlas/ir_curvature_completion.py +240 -0
- tensoratlas/ir_curvature_rewriting.py +176 -0
- tensoratlas/ir_rewriting.py +236 -0
- tensoratlas/mappings.py +238 -0
- tensoratlas/normal_forms.py +850 -0
- tensoratlas/notebook_examples.py +435 -0
- tensoratlas/performance_engineering.py +122 -0
- tensoratlas/priority_reduction.py +203 -0
- tensoratlas/priority_rewrite_engine.py +280 -0
- tensoratlas/public_api.py +1354 -0
- tensoratlas/py.typed +0 -0
- tensoratlas/relativity/__init__.py +61 -0
- tensoratlas/relativity/curvature.py +366 -0
- tensoratlas/relativity/geodesics.py +84 -0
- tensoratlas/relativity/inspection.py +152 -0
- tensoratlas/relativity/metrics.py +225 -0
- tensoratlas/relativity/plotting.py +16 -0
- tensoratlas/return_policy.py +57 -0
- tensoratlas/rewrite_families.py +367 -0
- tensoratlas/semantic_core.py +631 -0
- tensoratlas/semantic_exterior_spin.py +286 -0
- tensoratlas/semantic_identity_components.py +293 -0
- tensoratlas/semantic_ir.py +542 -0
- tensoratlas/semantic_matching.py +707 -0
- tensoratlas/semantic_ops.py +148 -0
- tensoratlas/semantic_rewrite.py +276 -0
- tensoratlas/semantic_transport_rewrite.py +438 -0
- tensoratlas/semantic_transport_rules.py +404 -0
- tensoratlas/signed_contraction_canonicalization.py +185 -0
- tensoratlas/simplification_core.py +29 -0
- tensoratlas/simplification_policy.py +95 -0
- tensoratlas/standard_tensor_library.py +168 -0
- tensoratlas/symbolic_decision.py +176 -0
- tensoratlas/symbolic_simplification_policy.py +103 -0
- tensoratlas/symmetry_confluence_engine.py +308 -0
- tensoratlas/tensor_algebra.py +1732 -0
- tensoratlas/tensor_core.py +1188 -0
- tensoratlas/tensor_expr_canonicalization.py +604 -0
- tensoratlas/tensor_indices.py +2217 -0
- tensoratlas/tensor_valued_forms/__init__.py +27 -0
- tensoratlas/tensor_valued_forms/cartan.py +72 -0
- tensoratlas/tensor_valued_forms/valued.py +183 -0
- tensoratlas/tensorform_engine.py +343 -0
- tensoratlas/tensorform_planning.py +251 -0
- tensoratlas/tensorform_special.py +165 -0
- tensoratlas/tensorform_types.py +99 -0
- tensoratlas/unified_reduction.py +174 -0
- tensoratlas/validation.py +49 -0
- tensoratlas/variational_gr.py +283 -0
- tensoratlas/variational_tensor_expr.py +501 -0
- tensoratlas/variational_workflows.py +270 -0
- tensoratlas-0.1.0.dist-info/METADATA +235 -0
- tensoratlas-0.1.0.dist-info/RECORD +153 -0
- tensoratlas-0.1.0.dist-info/WHEEL +5 -0
- tensoratlas-0.1.0.dist-info/licenses/LICENSE +674 -0
- tensoratlas-0.1.0.dist-info/top_level.txt +1 -0
tensoratlas/__init__.py
ADDED
|
@@ -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
|