Ops.clifford: Arithmetic Ops Group Methods for 'clifford' objects

Ops.cliffordR Documentation

Arithmetic Ops Group Methods for clifford objects



Allows arithmetic operators to be used for multivariate polynomials such as addition, multiplication, integer powers, etc.


## S3 method for class 'clifford'
Ops(e1, e2)
C1 %.% C2
C1 %dot% C2
C1 %^% C2
C1 %X% C2
C1 %star% C2
C1 % % C2
C1 %euc% C2
C1 %o% C2
C1 %_|% C2
C1 %|_% C2



Objects of class clifford or coerced if needed


Scalar, length one numeric vector


Boolean, with default TRUE meaning to return the constant coerced to numeric, and FALSE meaning to return a (constant) Clifford object


The function Ops.clifford() passes unary and binary arithmetic operators “+”, “-”, “*”, “/” and “^” to the appropriate specialist function.

Functions c_foo() are low-level helper functions that wrap the C code; function maxyterm() returns the maximum index in the terms of its arguments.

The package has several binary operators:

Geometric product A*B = geoprod(A,B) \mjeqn\displaystyle AB=\sum_r,s\left\langle A\right\rangle_r\left\langle B\right\rangle_ssee PDF
Inner product A %.% B = cliffdotprod(A,B) \mjeqn\displaystyle A\cdot B=\sum_r\neq 0\atop s\ne 0^\vphantoms\neq 0\left\langle\left\langle A\right\rangle_r\left\langle B\right\rangle_s\right\rangle_\left|s-r\right|see PDF
Outer productA %^% B = wedge(A,B) \mjeqn\displaystyle A\wedge B=\sum_r,s\left\langle\left\langle A\right\rangle_r\left\langle B\right\rangle_s\right\rangle_s+rsee PDF
Fat dot productA %o% B = fatdot(A,B) \mjeqn\displaystyle A\bullet B=\sum_r,s\left\langle\left\langle A\right\rangle_r\left\langle B\right\rangle_s\right\rangle_\left|s-r\right|see PDF
Left contractionA %_|% B = lefttick(A,B) \mjeqn\displaystyle A\rfloor B=\sum_r,s\left\langle\left\langle A\right\rangle_r\left\langle B\right\rangle_s\right\rangle_s-rsee PDF
Right contractionA %|_% B = righttick(A,B) \mjeqn\displaystyle A\lfloor B=\sum_r,s\left\langle\left\langle A\right\rangle_r\left\langle B\right\rangle_s\right\rangle_r-ssee PDF
Cross productA %X% B = cross(A,B) \mjeqn\displaystyle A\times B=\frac12_\vphantomj\left(AB-BA\right)see PDF
Scalar productA %star% B = star(A,B) \mjeqn\displaystyle A\ast B=\sum_r,s\left\langle\left\langle A\right\rangle_r\left\langle B\right\rangle_s\right\rangle_0see PDF
Euclidean productA %euc% B = eucprod(A,B) \mjeqn\displaystyle A\star B= A\ast B^\daggersee PDF

In R idiom, the geometric product geoprod(.,.) has to be indicated with a “*” (as in A*B) and so the binary operator must be %*%: we need a different idiom for scalar product, which is why %star% is used.

Because geometric product is often denoted by juxtaposition, package idiom includes a % % b for geometric product.

Binary operator %dot% is a synonym for %.%, which causes problems for rmarkdown.

Function clifford_inverse() returns an inverse for nonnull Clifford objects \mjseqnCl(p,q) for \mjeqnp+q\leq 5p+5 <= 5, and a few other special cases. The functionality is problematic as nonnull blades always have an inverse; but function is.blade() is not yet implemented. Blades (including null blades) have a pseudoinverse, but this is not implemented yet either.

The scalar product of two clifford objects is defined as the zero-grade component of their geometric product:


A\ast B=\left\langle AB\right\rangle_0\qquad\mboxNB: notation used by both Perwass and Hestenes omitted; see PDF

In package idiom the scalar product is given by A %star% B or scalprod(A,B). Hestenes and Perwass both use an asterisk for scalar product as in “\mjeqnA*BA*B”, but in package idiom, the asterisk is reserved for geometric product.

Note: in the package, A*B is the geometric product.

The Euclidean product (or Euclidean scalar product) of two clifford objects is defined as


A\star B= A\ast B^\dagger= \left\langle AB^\dagger\right\rangle_0\qquad\mboxPerwass omitted: see PDF

where \mjeqnB^\dagger? denotes Conjugate [as in Conj(a)]. In package idiom the Euclidean scalar product is given by eucprod(A,B) or A %euc% B, both of which return A * Conj(B).

Note that the scalar product \mjeqnA\ast A? can be positive or negative [that is, A %star% A may be any sign], but the Euclidean product is guaranteed to be non-negative [that is, A %euc% A is always positive or zero].

Dorst defines the left and right contraction (Chisholm calls these the left and right inner product) as \mjeqnA\rfloor Bsee PDF and \mjeqnA\lfloor Bsee PDF. See the vignette for more details.

Division, as in idiom x/y, is defined as x*clifford_inverse(y). Function clifford_inverse() uses the method set out by Hitzer and Sangwine but is limited to \mjeqnp+q\leq 5p+q <= 5.


The high-level functions documented here return a clifford object. The low-level functions are not really intended for the end-user.


In the clifford package the caret “^” is reserved for multiplicative powers, as in A^3=A*A*A. All the different Clifford products have binary operators for convenience including the wedge product %^%. Compare the stokes package, where multiplicative powers do not really make sense and A^B is interpreted as a wedge product of differential forms \mjseqnA and \mjseqnB. In stokes, the wedge product is the sine qua non for the whole package and needs a terse idiomatic representation (although there A%^%B returns the wedge product too).


Robin K. S. Hankin


E. Hitzer and S. Sangwine 2017. “Multivector and multivector matrix inverses in real Clifford algebras”. Applied Mathematics and Computation 311:375-389


u <- rcliff(5)
v <- rcliff(5)
w <- rcliff(5)


u+(v+w) == (u+v)+w            # should be TRUE by associativity of "+"
u*(v*w) == (u*v)*w            # should be TRUE by associativity of "*"
u*(v+w) == u*v + u*w          # should be TRUE by distributivity

# Now if x,y are _vectors_ we have:

x <- as.1vector(sample(5))
y <- as.1vector(sample(5))
x*y == x%.%y + x%^%y
x %^% y == x %^% (y + 3*x)  
x %^% y == (x*y-x*y)/2        # should be TRUE 

#  above are TRUE for x,y vectors (but not for multivectors, in general)

## Inner product "%.%" is not associative:
x <- rcliff(5,g=2)
y <- rcliff(5,g=2)
z <- rcliff(5,g=2)
x %.% (y %.% z) == (x %.% y) %.% z

## Other products should work as expected:

x %|_% y   ## left contraction
x %_|% y   ## right contraction
x %o% y    ## fat dot product

clifford documentation built on May 2, 2022, 9:09 a.m.