Skip to content

Yet another rework of the algebra type parameters #17

Description

@brainandforce

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions