Skip to content

Quaternions and Abstract Algebra

Anders Peterson edited this page Dec 6, 2017 · 7 revisions

The org.ojalgo.algebra package contain a collection of interfaces related to abstract algebra: Group, Field, Ring, VectorSpace... The definition of these concepts are very abstract, but they've been turned into Java interfaces that are actually used throughout ojAlgo. For instance the concept of multiplication is defined in the Operation.Multiplication interface. Any-/everything in ojAlgo that can be multiplied implements that interface.

In ojAlgo there is a org.ojalgo.scalar.Quaternion class that extends java.lang.Number and implements org.ojalgo.scalar.Scalar which in turn extends a number of the interfaces from the org.ojalgo.algebra package. Quaternions are not widely used or generally well understood. In ojAlgo they're tagging along as just another scalar, and there is quite a lot of code that works with any scalar...

org.ojalgo.array

You can create 1-, 2- or N-dimensional, sparse or dense, arrays of Quaternion:s – and they can be arbitrarily large (using long indices).

org.ojalgo.function

There is large set of implemented quaternion valued functions QuaternionFunction and QuaternionAggregator

org.ojalgo.matrix

Anything you can do with matrices and vectors in ojAlgo, you can do with quaternion elements. This includes calculating various matrix decompositions. Potentially you can do things like SVD:s or EvD:s using quaternion elements. At this point there are no tests that specifically test quaternion functionality. Essentially the code for ComplexNumber matrices and decompositions were generalised to work for any scalar which then includes quaternions.

The are most likely other/more parts of ojAlgo that can easily be extended to also work with quaternions.

Be aware that quaternion functionality is just "tagging along". Code is written to work with any scalar. The real number implementations are generally well tested, rational number and complex number implementations are somewhat tested, but there are typically no (few) tests that explicitly test quaternions.

Clone this wiki locally