deep_causality_metric
Metric signature types and sign conventions for Clifford algebras and physics.
Overview
This crate provides a foundational set of types for working with metric signatures in Clifford algebras Cl(p, q, r), Riemannian geometry, and physics applications.
Key Features
- Single Source of Truth: Consolidates all metric signature logic into one crate
- Zero Dependencies: Serves as a foundational leaf crate in the dependency graph
- Type-Safe Conventions: Compile-time enforcement of physics sign conventions
- Cross-Crate Integration: Enables consistent metric handling across multivector, tensor, topology, and physics crates
Core Types
| Type | Description |
|---|---|
Metric |
Core signature enum Cl(p, q, r) |
MetricError |
Error type for metric operations |
LorentzianMetric |
Trait for convention wrappers |
EastCoastMetric |
(-+++) convention newtype |
WestCoastMetric |
(+---) convention newtype |
Sign Conventions
| Convention | Signature | g_{μν} | Used By |
|---|---|---|---|
| East Coast | (-+++) | diag(-1,1,1,1) | MTW, GR textbooks |
| West Coast | (+---) | diag(1,-1,-1,-1) | Weinberg, Particle physics |
Type Aliases
For domain-specific clarity:
| Alias | Target | Domain |
|---|---|---|
RelativityMetric |
EastCoastMetric |
General Relativity |
ParticleMetric |
WestCoastMetric |
Particle Physics |
PhysicsMetric |
RelativityMetric |
Default (GR) |
Usage
Basic Metric Operations
use Metric;
// Create a standard 4D Minkowski metric (West Coast convention)
let minkowski = Minkowski;
assert_eq!;
assert_eq!; // time is +1
assert_eq!; // space is -1
// Get signature tuple (p, q, r)
assert_eq!;
// Create from signature
let euclidean = from_signature;
assert_eq!;
Type-Safe Convention Wrappers
use ;
// East Coast convention (-+++) for General Relativity
let east = minkowski_4d;
assert_eq!;
assert_eq!;
assert!;
// West Coast convention (+---) for Particle Physics
let west = minkowski_4d;
assert_eq!;
assert_eq!;
assert!;
Convention Conversion
use ;
// Convert from West Coast to East Coast
let west = Minkowski;
let east = from_west_coast.unwrap;
// Convert back
let west_again = from_east_coast.unwrap;
Using Type Aliases
use ;
// For GR code
// For particle physics code
Mathematical Background
Clifford Algebra Signature
A Clifford algebra Cl(p, q, r) over ℝⁿ where n = p + q + r is defined by:
$$e_i \cdot e_j + e_j \cdot e_i = 2g_{ij}$$
where the metric tensor g has:
- p eigenvalues of +1
- q eigenvalues of -1
- r eigenvalues of 0 (degenerate)
Metric Variants
| Variant | Signature | Example Uses |
|---|---|---|
Euclidean(n) |
(n, 0, 0) | Standard ℝⁿ |
NonEuclidean(n) |
(0, n, 0) | Anti-Euclidean |
Minkowski(n) |
(1, n-1, 0) | Spacetime (West Coast) |
PGA(n) |
(n-1, 0, 1) | Projective Geometric Algebra |
Generic{p,q,r} |
(p, q, r) | General Cl(p,q,r) |
Custom{...} |
bitmask | Up to 64 dimensions |
Feature Flags
| Feature | Default | Description |
|---|---|---|
std |
✓ | Standard library support |
alloc |
✓ | Allocation support (via std) |
For no_std environments, disable default features:
[]
= { = "0.1", = false, = ["alloc"] }
Contribution
Contributions are welcomed especially related to documentation, example code, and fixes. If unsure where to start, just open an issue and ask.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in deep_causality by you, shall be licensed under the MIT licence, without any additional terms or conditions.
Licence
This project is licensed under the MIT license.
Security
For details about security, please read the security policy.