CliffordNumbers.jl: implementing numeric primitives for geometry | Flores | JuliaCon Global 2025
Автор: The Julia Programming Language
Загружено: 2025-12-12
Просмотров: 286
CliffordNumbers.jl: implementing numeric primitives for geometry by Brandon Flores
PreTalx: https://pretalx.com/juliacon-2025/tal...
Historically, linear algebra has served as one of the mathematical foundations of computational geometry. The straightforward mapping of points to vectors and linear transformations to matrices can be extended to model a wide variety of geometric objects in arbitrary numbers of dimensions. However, an alternative approach, geometric algebra, has gained traction in the past decade. Geometric algebras can model objects in 3D space, such as points, lines, planes, circles, and spheres, but can also model more complex settings, such as the Minkowski space of special relativity.
Geometric algebra associates geometric objects and transformations with elements of a Clifford algebra. The elements of Clifford algebras, multivectors, can be added and scaled like vectors, but the algebra also admits new products: the wedge product*, which generalizes the cross product to produce higher-dimensional geometric objects, and the *geometric product or *Clifford product*, that composes isometries or applies them to geometric objects. While geometric algebra cannot completely replace linear algebra - geometric algebras bake in assumptions about metrics and orthogonality - it provides a more concise language for the expression of a wide variety of concepts and provides guarantees relevant to geometric operations that are not always available in approaches based on linear algebra. In essence, geometric algebra serves as a mathematical expression of the rule of least power for computational geometry.
CliffordNumbers.jl provides dense and sparse representations of the elements of Clifford algebras, as well as high-performance implementations of all key operations used in geometric algebra. This is facilitated by leveraging a significant fraction of the tools Julia provides: multiple dispatch, promotion, parametric types, generated functions, and type domain computation. Most commonly, matrix representations of Clifford algebras are used when working with their elements: for instance, the Pauli sigma matrices and Dirac gamma matrices. By contrast, CliffordNumbers.jl uses a matrix-free additive representation and encodes the algebra structure in the provided operations, allowing for more compact storage of algebra elements, and making the construction of algebra elements more transparent to the user.
Much of Julia's geometry ecosystem leverages the LinearAlgebra standard library, `AbstractVector` and `AbstractMatrix`, particularly their static implementations `SVector` and `SMatrix` in StaticArrays.jl for performance reasons. CliffordNumbers.jl makes the radical design decision to subtype `Number`, as Clifford algebras are hypercomplex number systems, foregoing a hard dependency on the LinearAlgebra standard library. This is not without precedent: the complex numbers and quaternions are Clifford algebras used to represent rotations in 2D and 3D, and these are also `Number` subtypes in the Julia ecosystem! The existence of a package like CliffordNumbers.jl highlights the importance of providing generic implementations of geometric objects and constructs that don't require an `AbstractArray` representation.
Developing CliffordNumbers.jl has been facilitated by the design and documentation of Julia, but it has also highlighted gaps worthy of the attention of all developers working on Julia. These gaps do not prevent the implementation of CliffordNumbers.jl, but improvements to the areas highlighted will simplify some of the most complex code in the package. Some of these problems are actively being worked on, such as improved constant propagation, which will reduce the need for generated functions that are used to maximize the performance of operations such as geometric products. Others may not be implemented due to complexity issues, such as allowing some types of computations in type parameters, but this package provides a case for allowing a limited subset of arithmetic in the type domain.
However, the most notable omission is an interface for `Number` subtypes. `AbstractCliffordNumber` diverges from the behavior of other `Number` subtypes, and it is unclear whether this breaks the assumptions made by Julia or its widely used packages. Two key behaviors that need to be clarified are the construction and conversion of `Number` types should necessarily be identical, and the expected behavior when indexing a `Number`. A thorough specification of the `Number` interface benefits both developers working on numerical packages and anyone who works with numbers in programming - in other words, everyone!
CliffordNumbers.jl provides a fresh, alternative perspective to implementing geometry in Julia, akin to the fresh perspective to computing Julia itself has produced. Besides its direct utility for solving geometric problems, it also presents a point of reference for the technical future of Julia.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: