MyNixOS website logo
Description

Arbitrary Dimensional Clifford Algebras.

A suite of routines for Clifford algebras, using the 'Map' class of the Standard Template Library. Canonical reference: Hestenes (1987, ISBN 90-277-1673-0, "Clifford algebra to geometric calculus"). Special cases including Lorentz transforms, quaternion multiplication, and Grassmann algebra, are discussed. Vignettes presenting conformal geometric algebra, quaternions and split quaternions, dual numbers, and Lorentz transforms are included. The package follows 'disordR' discipline.

The clifford package: Clifford algebra in R

CRAN_Status_Badge Codecov testcoverage

The clifford package provides R-centric functionality for working with Clifford algebras of arbitrary dimension and signature. A detailed vignette is provided in the package.

Installation

You can install the released version of the clifford package from CRAN with:

# install.packages("clifford")  # uncomment this to install the package
library("clifford")
set.seed(0)

The clifford package in use

The basic creation function is clifford(), which takes a list of basis blades and a vector of coefficients:

(a <- clifford(list(1,2,1:4,2:3),1:4))
#> Element of a Clifford algebra, equal to
#> + 1e_1 + 2e_2 + 4e_23 + 3e_1234
(b <- clifford(list(2,2:3,1:2),c(-2,3,-3)))
#> Element of a Clifford algebra, equal to
#> - 2e_2 - 3e_12 + 3e_23

So a and b are multivectors. Clifford objects are a vector space and we can add them using +:

a+b
#> Element of a Clifford algebra, equal to
#> + 1e_1 - 3e_12 + 7e_23 + 3e_1234

See how the e2 term vanishes and the e_23 term is summed. The package includes a large number of products:

a*b        # geometric product (also "a % % b")
#> Element of a Clifford algebra, equal to
#> - 16 + 6e_1 - 3e_2 - 2e_12 + 14e_3 + 12e_13 + 3e_123 - 9e_14 + 9e_34 - 6e_134
a %^% b    # outer product
#> Element of a Clifford algebra, equal to
#> - 2e_12 + 3e_123
a %.% b    # inner product
#> Element of a Clifford algebra, equal to
#> - 16 + 6e_1 - 3e_2 + 14e_3 - 9e_14 + 9e_34 - 6e_134
a %star% b # scalar product
#> [1] -16
a %euc% b  # Euclidean product
#> [1] 8

The package can deal with non positive-definite inner products. Suppose we wish to deal with an inner product of

\begin{pmatrix}+1 & 0 & 0 & 0 & 0\\0 &+1 & 0 & 0 & 0\\0 & 0 &+1 & 0 & 0\\0 & 0 & 0 &-1 & 0\\0 & 0 & 0 & 0 &-1\end{pmatrix}

where the diagonal is a number of +1 terms followed by a number of -1 terms. The package idiom for this would be to use signature():

signature(3)

Function signature() is based on lorentz::sol() and its argument specifies the number of basis blades that square to +1, the others squaring to -1. Thus e_1^2=e_2^2=e_3^2=1 and e_4^2=e_5^2=-1:

basis(1)
#> Element of a Clifford algebra, equal to
#> + 1e_1
basis(1)^2
#> Element of a Clifford algebra, equal to
#> scalar ( 1 )
basis(4)
#> Element of a Clifford algebra, equal to
#> + 1e_4
basis(4)^2
#> Element of a Clifford algebra, equal to
#> the zero clifford element (0)

The package uses the STL map class with dynamic bitset keys for efficiency and speed and can deal with objects of arbitrary dimensions. Thus:

options("basissep" = ",")
(x <- rcliff(d=20))
#> Element of a Clifford algebra, equal to
#> + 5 - 1e_2 + 6e_5 + 2e_4,7 - 3e_10 - 5e_11 + 3e_14 + 1e_10,14 + 4e_5,9,15 +
#> 9e_18,19
summary(x^3)
#> Element of a Clifford algebra 
#> Typical terms:  140  ...  + 216e_5,9,10,14,15,18,19 
#> Number of terms: 44 
#> Magnitude: 25376

References

  • D. Hestenes 1987. Clifford algebra to geometric calculus, Kluwer.
  • J. Snygg 2010. A new approach to differential geometry using Clifford’s geometric algebra. Berghauser.
  • C. Perwass 2009. Geometric algebra with applications in engineering. Springer.

Further information

For more detail, see the package vignette

vignette("clifford")

Metadata

Version

1.1-1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows