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).
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. TheQtype parameter ofAbstractCliffordNumber{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:
CliffordNumbers.Algebrassubmodule to replace theCliffordNumbers.Metricsmodule.Algebras.GA{D}that describes anyDdimensional geometric algebra, each of which contains2^Dbasis blades.Algebras.ModelGA{D,N} <: Algebras.GA{D}, representing geometric algebras ofDdimensions that modelNdimensions (whereNcannot be less thanD). Subtypes would includeVGA{N} <: ModelGA{N,N},PGA{N} <: ModelGA{N+1,N}, andCGA{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).AbstractCliffordNumber{Q,T}type would require thatQsubtypeAlgebras.GA. (this would need to be propagated manually to all concrete subtypes for consistency).