Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet another rework of the algebra type parameters #17

Open
brainandforce opened this issue Jun 16, 2024 · 0 comments
Open

Yet another rework of the algebra type parameters #17

brainandforce opened this issue Jun 16, 2024 · 0 comments

Comments

@brainandforce
Copy link
Owner

Before this package was released, I had a type, QuadraticForm{P,Q,R}, that represented the number of dimensions in the algebra with a positive square (P), negative square (Q), and zero square (R). This worked really well in terms of being able to specify an algebra, but it was impossible to have more fine-grained control over how algebra elements are displayed (for instance, having the zero squaring element of a PGA or the negative squaring element of STA correspond to the element at zero.

Before the package was released, I changed over to the current system, which uses special types (subtypes of AbstractSignature, or anything implementing its interface) to indicate the algebra. One of the problems with this design is that it is difficult to dispatch on the values of type parameters in a method signature. This can be solved by forcing the algebra instances to be singleton types and encoding critical information (such as the number of dimensions in the algebra) in the type parameters. The Q type parameter of AbstractCliffordNumber{Q} would need to be constrainted to a set of types, which could help with validation.

Perhaps the types don't technically need to be singletons; they could include other information such as a set of basis vectors for the algebra. But the fastest implementations would be empty singleton types.

Here's a broad overview of the proposed changes:

  • A new CliffordNumbers.Algebras submodule to replace the CliffordNumbers.Metrics module.
  • A supertype, Algebras.GA{D} that describes any D dimensional geometric algebra, each of which contains 2^D basis blades.
    • A supertype, Algebras.ModelGA{D,N} <: Algebras.GA{D}, representing geometric algebras of D dimensions that model N dimensions (where N cannot be less than D). Subtypes would include VGA{N} <: ModelGA{N,N}, PGA{N} <: ModelGA{N+1,N}, and CGA{N} <: ModelGA{N+2,N} (note that these subtype relations cannot always be specified this simply in the language, this is just the general idea).
    • Their instances would be singletons, and a number of methods would need to be defined for them.
  • The AbstractCliffordNumber{Q,T} type would require that Q subtype Algebras.GA. (this would need to be propagated manually to all concrete subtypes for consistency).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant