8000 update metric signature interface docs Β· Jollywatt/GeometricAlgebra.jl@4b80b05 Β· GitHub
[go: up one dir, main page]

Skip to content

Commit 4b80b05

Browse files
committed
update metric signature interface docs
1 parent 04ae355 commit 4b80b05

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

β€Ždocs/src/design.mdβ€Ž

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,31 @@ As well as defining the geometric algebra, the signature is used to specify basi
6868

6969
| Required methods | Description |
7070
|:-----------------|:------------|
71-
| `dimension(sig)` | The dimension of the underlying vector space, or number of basis vectors.
72-
| `basis_vector_square(sig, i)` | The scalar square of the `i`th basis vector. |
71+
| `canonical_signature(sig)` | Canonical representation as a tuple (e.g., `Cl(1,3)` becomes `(1,-1,-1,-1)`).
7372

74-
| Optional methods | Description |
75-
|:-----------------|:------------|
76-
| `show_signature(io, sig)` | Show the metric signature in a compact human-readable form.
77-
| `show_basis_blade(io, sig, indices)` | Print a basis blade with the given indices (e.g., `v12` or `π’†β‚βˆ§π’†β‚‚`).
78-
| `bits_to_indices(sig, bits)` | Define display order of indices for a basis blade (must also implement `basis_blade_parity(sig, bits)` consistently).
79-
| `componentstype(sig, N)` | Preferred array type for `Multivector{sig}` components. (E.g., `Vector`, `MVector`, `SparseVector`, etc.)
80-
| `use_symbolic_optim(sig)` | Whether to use symbolic code generation to optimise multivector products. (Default is true for low dimensions.)
73+
| Optional methods | Description | Default
74+
|:-----------------|:------------|:-------
75+
| `dimension(sig)` | The dimension of the underlying vector space | `length(canonical_signature(sig))`
76+
| `basis_vector_square(sig, i)` | The scalar square of the `i`th basis vector | `canonical_signature(sig)[i]`
77+
| `show_signature(io, sig)` | Print the metric signature in a compact human-readable form | `show(io, sig)`
78+
| `show_basis_blade(io, sig, indices)` | Print a basis blade with the given indices (e.g., `v12` or `π’†β‚βˆ§π’†β‚‚`) | prints like `v12`
79+
| `bits_to_indices(sig, bits)` | Define the order of indices for a basis blade (must also implement `basis_blade_parity(sig, bits)` consistently) | always increasing like `v123`
80+
| `componentstype(sig, N)` | Preferred array type for `Multivector{sig}` components. (E.g., `Vector`, `MVector`, `SparseVector`, etc.) | `SVector` if small, `Vector` if large
81+
| `use_symbolic_optim(sig)` | Whether to use symbolic code generation to optimise multivector products. | True for low dimensions
8182

8283

8384
Below is an example of how one might define a β€œprojectivised” signature which adds a projective dimension ``𝐯_0`` squaring to ``-1`` to any signature:
8485
```@example ga
85-
import GeometricAlgebra: dimension, basis_vector_square, show_signature, show_basis_blade
86+
import GeometricAlgebra: canonical_signature, show_signature, show_basis_blade
8687
8788
struct β„™{Sig} end
8889
β„™(sig) = β„™{sig}()
8990
90-
dimension(::β„™{Sig}) where Sig = dimension(Sig) + 1
91-
basis_vector_square(::β„™{Sig}, i) where Sig = i == 1 ? -1 : basis_vector_square(Sig, i - 1)
91+
canonical_signature(::β„™{Sig}) where Sig = (-1, canonical_signature(Sig)...)
9292
show_signature(io::IO, ::β„™{Sig}) where Sig = print(io, "β„™($Sig)")
93-
9493
show_basis_blade(io::IO, ::β„™, indices::Vector) = print(io, "v", join(indices .- 1))
9594
96-
basis(β„™(3)) |> sum
95+
basis(β„™(3))
9796
```
9897

9998

0 commit comments

Comments
Β (0)
0