https://github.com/brainandforce/cliffordnumbers.jl

A fast, simple, static multivector (Clifford number) implementation for Julia.

https://github.com/brainandforce/cliffordnumbers.jl

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary

Keywords

clifford-algebra exterior-algebra geometric-algebra grassmann-algebra julia numerical-library
Last synced: 10 months ago · JSON representation

Repository

A fast, simple, static multivector (Clifford number) implementation for Julia.

Basic Info
  • Host: GitHub
  • Owner: brainandforce
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Homepage:
  • Size: 2.09 MB
Statistics
  • Stars: 27
  • Watchers: 3
  • Forks: 0
  • Open Issues: 9
  • Releases: 11
Topics
clifford-algebra exterior-algebra geometric-algebra grassmann-algebra julia numerical-library
Created over 3 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog Contributing Funding License

README.md

CliffordNumbers.jl

Stable Dev Build Status Coverage Aqua.jl

CliffordNumbers.jl is a simple, statically sized multivector (Clifford number) implementation for Julia using graded representations. This allows for common multivector operations, particularly the various products of geometric algebra, to be easily implemented with extremely high performance (faster than matrix multiplications of matrix representations) without depending on any linear algebra library. Additionally, the multivectors provided by this package can be stored inline in arrays or other data structures.

Why use Clifford numbers?

Clifford algebras are algebras of orthonormality: they expand a real or complex vector space with a notion of normal vectors (those with unit square, or unit magnitude) and orthogonal vectors.

The term "geometric algebra" is synonymous in a mathematical sense with Clifford algebra, but is used by a practicioners of a new pedagogical movement to emphasize their use in applied mathematics. In particular, additive representations are favored over matrix representations for reasons of clarity, and the package implements all representations of elements and operations on them in this manner.

If you work with 3D graphics, you may already be familiar with the use of Clifford algebras: the quaternions used to represent rotation are a Clifford algebra. Specifically, they are isomorphic to the even subalgebra of the algebra of physical space, and the elements represent rotations in 3D. The full algebra of physical space augments rotations with reflections, allowing any point isometry (combined with dilations) to be represented.

Clifford algebras are also ubiquitous in physics, as the orthonormality relationship applies to 3D space and (3+1)D spacetime. The Pauli matrices are a matrix representation of the algebra of physical space, and the Dirac matrices are a matrix representation of the spacetime algebra. These Clifford algebras naturally extend vector algebra, and even allow for calculus to be done with them.

Here is a short guide to the most commonly used algebras, which can be extended to any number of dimensions. * VGA (vanilla geometric algebra): A drop-in replacement for standard vector algebra, suitable for classical and quantum physics. Common operations like the cross product and dot product have equivalents in VGA, and can be extended to spaces of arbitrary dimension. * PGA (projective geometric algebra): Extends VGA with a degenerate dimension so that points, lines, planes, and related objects can be represented at arbitrary offsets from the origin. Not only can it represents point isometries, it can also seamlessly combine them with arbitrary translations. * CGA (conformal geometric algebra): Extends VGA with one positive squaring and one negative squaring dimension, and allows for the representation of k-spheres. Two-dimensional CGA is the algebra of compass and straightedge constructions. * STA (spacetime algebra): The algebra of Minkowski space, with spatial dimensions squaring to values of the opposite sign of temporal dimensions.

Elements of all of the above algebras are constructible in this package.

Types

This package exports AbstractCliffordNumber{Q,T} and its subtypes, which describe the behavior of multivectors with algebra Q and scalar type T<:Union{Real,Complex}. This is a subtype of Number, and therefore acts as a scalar for the purpose of broadcasting. For this reason, we provide an nblades function separate from Base.length to count the number of blades represented by a type.

To index an AbstractCliffordNumber, we provide the BladeIndex{Q} type, which allows for arbitrary components to be indexed, and the BitIndices{Q,C<:AbstractCliffordNumber{Q}} type, which provides all valid indices of instances of C that are not constrained to be zero. Indexing with ordinary integers is disallowed, but Tuple(::AbstractCliffordNumber) obtains the backing Tuple.

AbstractCliffordNumber{Q,T} includes the following concrete subtypes: * CliffordNumber{Q,T,L}, which represents the coefficients associated with all basis blades. * EvenCliffordNumber{Q,T,L} and OddCliffordNumber{Q,T,L}, which represents multivectors with only basis blades of even or odd grade being nonzero. These are especially important when dealing with physically realizable Euclidean transformations (rotations and translations). * KVector{K,Q,T,L}, which represents multivectors with only basis blades of grade K being nonzero. This is especially useful for representing common vectors, bivectors, pseudovectors, etc.

Promotion and conversion

The type promotion system is heavily leveraged to minimize the memory footprint needed to represent the results of various operations. Promotion can convert the numeric types associated with two AbstractCliffordNumber{Q} instances (for instance, the sum of KVector{1,APS,Int} and KVector{1,APS,Float64} is KVector{1,APS,Float64}), but it can also leverage grade information to promote to smaller types: the sum of KVector{1,APS,Int} and KVector{3,APS,Int} is an OddCliffordNumber{APS,Int}, but the sum of KVector{1,APS,Int} and KVector{2,APS,Int} is a CliffordNumber{APS,Int}.

We provide the scalar_promote and scalar_convert functions to allow for promotion of the scalar types backing an AbstractCliffordNumber without needlessly expanding the represented grades.

Indexing

Although AbstractCliffordNumber instances are scalars, the BladeIndex{Q} type can be used to retrieve coefficients associated with specific basis blades. The full set of BladeIndex{Q} types for some x::AbstractCliffordNumber can be generated with BitIndices(x), and this is a binary ordered vector of BladeIndex{Q} objects.

Mathematical operations are defined generically by working with the BladeIndex{Q} objects associated with an AbstractCliffordNumber{Q,T}. Elementwise operations on each element of a BitIndices instance returns a TransformedBitIndices, a wrapper which lazily associates a function with a BitIndices object, and this can be used to implement grade dependent operations, such as (anti)automorphisms.

Operations

The following mathematical operations are supported by this package: * Addition (+), subtraction and negation (-) between algebra elements, or between algebra elements and scalars * Products of the Clifford algebra: * The geometric product (*) * The wedge product () and regressive product () * Left () and right () contractions * The dot product and the Hestenes dot product * The commutator product (×) and anticommutator product () * Inverses for Clifford numbers which have them * Scalar left (/) and right (\) division, including rational division (//) * Efficient muladd operations involving scalars and multivectors * Involutions and duals * The reverse (using Base.adjoint/' or Base.reverse), * Main involution (grade_involution) * Clifford conjugation (using Base.conj) * Left and right complements (left_complement and right_complement) * The modulus and absolute value (with abs2 and abs) * Exponentiation * Efficiently raising multivectors to integer powers * Natural exponentials of multivectors

Some of the names or implementations of various operations may change in the near future.

Note that AbstractCliffordNumber{Q,T} is a scalar type, so dotted operators do not apply any operations to each coefficient individually. However, they can be used to perform elementwise operations on collections of Clifford numbers.

Acknowledgements

The inspiration for this work was the textbook Geometric Algebra for Computer Science (popularly abberviated to GA4CS) by Leo Dorst, Daniel Fontijne, and Stephen Mann. Originally, this package was written as an exercise to implement much of the library described in the book, but I decided to publish it once I was able to figure out how to optimize multivector products.

I also want to acknowledge the community at bivector.net, particularly its associated Discord server, for providing me with a large amount of knowledge regarding geometric algebras. Particular community members I'd like to acknowledge include: - sudgylacmoe (@sudgy), who put together the video A Swift Introduction to Geometric Algebra which helped me discover geometric algebra; he has many other excellent introductory YouTube videos and a document of counterexamples in geometric algebra that informed much of the testing of this package. - Eelco Hoogendoorn (@EelcoHoogendoorn) for numerous discussions of the Dirac-Hestenes equation and the application of geometric algebra to problems in quantum mechanics. - Joseph Wilson (@jollywatt), author of the currently unregistered Julia package GeometricAlgebra.jl. - Chris Doran (@chrisjldoran) for discussion about this package's development and implementation.

This work is dedicated to my best friends: Dr. Michael Davies (@medav), Kristel Forlano, and Danica Gressel (@DanicaGressel).

Owner

  • Name: Brandon Flores
  • Login: brainandforce
  • Kind: user
  • Location: Madison, WI

Chemist in the Fredrickson Group at UW-Madison

GitHub Events

Total
  • Create event: 7
  • Commit comment event: 3
  • Release event: 2
  • Issues event: 5
  • Watch event: 7
  • Delete event: 6
  • Issue comment event: 18
  • Push event: 91
  • Pull request event: 12
Last Year
  • Create event: 7
  • Commit comment event: 3
  • Release event: 2
  • Issues event: 5
  • Watch event: 7
  • Delete event: 6
  • Issue comment event: 18
  • Push event: 91
  • Pull request event: 12

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 2
  • Total pull requests: 1
  • Average time to close issues: 4 months
  • Average time to close pull requests: 12 minutes
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 1.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 1
  • Average time to close issues: 4 months
  • Average time to close pull requests: 12 minutes
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 1.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • brainandforce (11)
  • chakravala (1)
  • mikeingold (1)
  • JuliaTagBot (1)
Pull Request Authors
  • brainandforce (12)
  • ajahraus (2)
Top Labels
Issue Labels
skill issue (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • julia 5 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 11
juliahub.com: CliffordNumbers

A fast, simple, static multivector (Clifford number) implementation for Julia.

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 5 Total
Rankings
Dependent repos count: 9.5%
Average: 25.0%
Dependent packages count: 40.6%
Last synced: 11 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v2 composite
  • julia-actions/cache v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-docdeploy v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/documentation.yml actions
  • actions/checkout v3 composite
  • julia-actions/setup-julia v1 composite