Conversation
…on multiplication conventions
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Adds support for treating complexified quaternions as Lorentz-group spinors (STA rotors) by switching complex-quaternion normalization/“norm” behavior to the spinor norm, and documents the geometric-algebra foundations. Also restructures test/docs environments and extends test coverage for the new Lorentz behavior.
Changes:
- Implement spinor-norm behavior for
abs,abs2,absvec,abs2veconComplex-component quaternions (and add_hypotsupport). - Add a dedicated Lorentz/STA normalization test suite and update existing math tests accordingly.
- Expand documentation with new Geometric Algebra and Spacetime Algebra pages; introduce workspace-style test/docs projects and a more capable test runner CLI.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/quaternion.jl |
Adds _hypot and new vector normalize methods used by rotor normalization. |
src/math.jl |
Changes abs/abs2/absvec/abs2vec semantics for Complex components to use spinor norm. |
test/runtests.jl |
Reworks test runner with CLI filtering (--file, --tags, etc.) and adds lorentz.jl to the suite. |
test/math.jl |
Updates expected values for complex norms to match the new spinor-norm definitions. |
test/lorentz.jl |
New tests validating STA/Lorentz normalization and _hypot behavior for boosts/rotations/phases. |
test/basis.jl |
Skips selected basis/normalization tests for Symbolics.Num due to simplification limitations. |
test/base.jl |
Adjusts Symbolics rotor test and LaTeX rendering expectations. |
test/Project.toml |
Introduces a dedicated test environment with explicit deps/compat. |
test.jl |
Removes the old top-level test/coverage runner script. |
docs/src/geometric_algebra.md |
New documentation page deriving quaternion conventions from GA. |
docs/src/spacetime_algebra.md |
New documentation page explaining complexified quaternions and the spinor norm in STA. |
docs/src/references.bib |
Adds citations used by the new GA/STA docs. |
docs/make.jl |
Adds the new docs pages and conditional inclusion of local notes/remotes. |
docs/local_notes.jl |
Optional “local notes” integration for docs builds (detects and wires extra pages/remotes). |
docs/serve.jl |
Adds a simple LiveServer-based doc serving script. |
docs/Project.toml |
Adds workspace-style sources entry for local package development. |
Project.toml |
Adds [workspace] and removes test-only extras/targets in favor of test/Project.toml. |
.gitignore |
Ignores optional local docs notes and some tool configuration files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # We need that helper to normalize complex quaternions | ||
| normalize(v::AbstractVector{Complex{T}}) where T = v ./ _hypot(v) | ||
|
|
||
| # We simplify for real-valued quaternions, falling back on the default `hypot` | ||
| normalize(v::AbstractVector) = v ./ hypot(v...) |
There was a problem hiding this comment.
Defining normalize(v::AbstractVector{Complex{T}}) and especially normalize(v::AbstractVector) here adds/overrides methods for LinearAlgebra.normalize globally (since using LinearAlgebra is in scope). This changes normalization semantics for all vectors in user code once Quaternionic is loaded (e.g. normalize([1,2,3]) will now call hypot(v...), and Complex vectors will use the spinor norm), which is a breaking/unsafe side effect unrelated to quaternions.
Consider restricting these methods to quaternion-component types only (e.g. SVector{4,...}), or using an internal helper (e.g. _normalize_components) that rotor calls, while leaving LinearAlgebra.normalize behavior unchanged for general vectors.
| # We need that helper to normalize complex quaternions | |
| normalize(v::AbstractVector{Complex{T}}) where T = v ./ _hypot(v) | |
| # We simplify for real-valued quaternions, falling back on the default `hypot` | |
| normalize(v::AbstractVector) = v ./ hypot(v...) | |
| # Internal helper to normalize quaternion component vectors without extending | |
| # LinearAlgebra.normalize for all AbstractVector values. | |
| _normalize_components(v::AbstractVector{Complex{T}}) where T = v ./ _hypot(v) | |
| # Real-valued quaternion components can use the default hypot-based magnitude. | |
| _normalize_components(v::AbstractVector) = v ./ hypot(v...) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Preview docs here