clifford v1.0-2

0

Monthly downloads

0th

Percentile

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 Grassman algebra, are discussed. Conformal geometric algebra theory is implemented.

Readme

The clifford package: Clifford algebra in R

Build
Status CRAN\_Status\_Badge Rdoc Codecov test
coverage

Overview

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)
#> [1] 3

Function signature() is based on lorentz::sol() and its argument specifes 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
#> scalar ( -1 )

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
#> + 6e_5 + 8e_1,3,6 + 4e_10 + 5e_6,10 + 3e_10,12 + 2e_14 + 7e_10,14 +
#> 1e_5,9,15 + 9e_1,19
summary(x^3)
#> Element of a Clifford algebra 
#> Typical terms:   + 30e_5  ...   - 378e_1,5,9,10,14,15,19 
#> Number of terms: 49 
#> Magnitude: 22747521

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")

Functions in clifford

Name Description
dual The dual of a clifford object
numeric_to_clifford Coercion from numeric to Clifford form
drop Drop redundant information
Ops.clifford Arithmetic Ops Group Methods for clifford objects
allcliff Clifford object containing all possible terms
homog Homogenous Clifford objects
magnitude Magnitude of a clifford object
even Even and odd clifford objects
neg Grade negation
lowlevel Low-level helper functions for clifford objects
print Print clifford objects
antivector Antivectors or pseudovectors
as.vector Coerce a clifford vector to a numeric vector
quaternion Quaternions using Clifford algebras
rcliff Random clifford objects
zero The zero Clifford object
Conj Conjugate of a Clifford object
clifford-package clifford
summary.clifford Summary methods for clifford objects
term Deal with terms
Extract.clifford Extract or Replace Parts of a clifford
zap Zap small values in a clifford object
getcoeffs Get coefficients of a Clifford object
rev Reverse of a Clifford object
grade The grade of a clifford object
signature The signature of the Clifford algebra
clifford Create, coerce, and test for clifford objects
No Results!

Vignettes of clifford

Name
clifford.Rnw
clifford.bib
No Results!

Last month downloads

Details

Type Package
License GPL (>= 2)
LazyData yes
VignetteBuilder knitr
LinkingTo Rcpp,BH
SystemRequirements C++11
URL https://github.com/RobinHankin/clifford.git
BugReports https://github.com/RobinHankin/clifford/issues
NeedsCompilation yes
Packaged 2020-03-08 18:44:58 UTC; rhankin
Repository CRAN
Date/Publication 2020-03-08 20:20:02 UTC
linkingto BH
suggests knitr , lorentz , onion , testthat
imports Rcpp (>= 0.12.5)
Contributors

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/clifford)](http://www.rdocumentation.org/packages/clifford)