]>
Now that we have QuadraticForm available, let's put it to use. Given some quadratic form described by an by matrix over a field , the domain CliffordAlgebra(n, K, Q) defines a vector space of dimension over . This is an interesting domain since complex numbers, quaternions, exterior algebras and spin algebras are all examples of Clifford algebras.
The basic idea is this: the quadratic form defines a basis for the vector space , the direct product of with itself times. From this, the Clifford algebra generates a basis of elements given by all the possible products of the in order without duplicates, that is,
1, , , , , , , , and so on.
The algebra is defined by the relations
Now look at the snapshot of its definition given below. Lines 9-10 show part of the definitions of the Exports. A Clifford algebra over a field is asserted to be a ring, an algebra over , and a vector space over . Its explicit exports include which returns the -th unit element.
The Implementation part begins by defining a local variable to hold the list of all where runs over the unit vectors from 1 to the dimension . Another local variable is set to , computed once and for all. The representation for the domain is PrimitiveArray(K), which is a basic array of elements from domain . Line 18 defines as shorthand for the more lengthy expression , which computes a primitive array of length filled with 's from domain .
Lines 19-22 define the sum of two elements and straightforwardly. First, a new array of all 's is created, then filled with the sum of the corresponding elements. Indexing for primitive arrays starts at 0. The definition of the product of and first requires the definition of a local function addMonomProd. Axiom knows it is local since it is not an exported function. The types of all local functions must be declared.