Developing GA-FuL: A Generic Wide-Purpose Library for Computing with Geometric Algebra
<p>Main layers of the GA-FuL design.</p> "> Figure 2
<p>GA-FuL algebra layer generic multivector thin-wrapper classes.</p> "> Figure 3
<p>GA-FuL modeling layer interfaces for linear maps on generic multivectors.</p> "> Figure 4
<p>Public interfaces of GA-FuL meta-expressions in the meta-context sub-layer.</p> "> Figure 5
<p>Illustration of the geometric procedure for defining a family of rotations between two unit vectors.</p> ">
Abstract
:1. Introduction
2. Overview of Geometric Algebra
3. Overview of Existing GA Software
3.1. Computational Libraries
3.1.1. MATLAB Toolboxes
3.1.2. C++ Template Metaprogramming Libraries
3.1.3. Julia and Python Libraries
3.2. Library Generators
3.3. Optimizing Subroutine Generators
4. The Geometric Algebra Fulcrum Library (GA-FuL)
4.1. Core Design Intentions
- CDI-1: Abstracting multivector operations from concrete scalar representations. In practical computational applications, there are diversely useful representations for the mathematical concept of scalars, as classically introduced in abstract algebra [53]. The most common representation for numerical applications is for real scalars using the IEEE 754 floating-point number format [54]. For modern data-driven and machine learning applications [55], multi-dimensional arrays and tensors are the basic representations for scalar data [56]. Another very useful representation for scalars, used in most Computer Algebra Systems (CAS), is an expression tree which represents a symbolic scalar expression for mathematical manipulation applications [57]. The foundational requirement for GA-FuL design is to provide a unified generic implementation for storing and manipulating multivectors and performing common GA operations on any kind of useful scalar representation.
- CDI-2: Reducing memory requirements for sparse multivectors. One major obstacle in the way of using GA for practical computations is the memory storage requirements imposed by the structure of multivectors. Storing a full multivector in a n-dimensional GA requires scalars, while storing a full k-vector requires scalars. For the simplest of numerical scalar representations, 32-bit floating point numbers, a single multivector in a 30-dimensional GA requires 8 GBytes of memory, while a full 15-vector one requires nearly 1.16 GBytes of memory, assuming the use of memory arrays to store the scalars. For most practical GA applications, however, there is rarely a need for storing full multivectors or full k-vectors, and only sparse multivectors are sufficient. One feature of GA is to enable the creation of linear models of nonlinear geometric objects by embedding the original space into a higher-dimension GA space. This typically results in multivectors representing geometric objects using a significantly reduced number of scalars, not a full-sized multivector or k-vector. For example, a sparse multivector in five-dimensional conformal GA [24], containing only 5 out of 32 scalars, can represent points, planes, and spheres in three-dimensional Euclidean space. As such, another important requirement for the GA-FuL design is to provide a set of generic, memory-efficient data structures for storing the scalars of sparse multivectors in high-dimensional GAs.
- CDI-3: Providing metaprogramming capabilities. Generative programming [58,59] in general and metaprogramming [60,61] in particular incorporate the process of creating software systems that treat programs as data, enabling the transformation of existing programs or for the generation of new ones. This was the target of the predecessor system GMac for generating optimized computational numerical code from a series of GA expressions [47,49]. This design goal is carried on to GA-FuL, which would enable code generation targeting high-performance platforms such as CUDA, in addition to classical general purpose programming languages such as C\C++, C#, Java, JavaScript, Python, MATLAB scripts, etc.
- CDI-4: Introducing a layered system design for a wide spectrum of uses. The complexity imposed by the previous CDIs must be organized and managed through a layered design of the system. Each layer should specialize in one aspect of the system such as storage management, processing, algebraic and geometric abstractions, etc. In addition, a system of such capabilities would have a wide range of users and use cases. Typically, a user would use the system to create a numerical\symbolic prototype for some geometric modeling ideas, and then after some experimentation, would use metaprogramming system capabilities to generate optimized code for the final model targeting a specific programming language or environment. The design of GA-FuL attempts to realize this layered approach to allow users of different backgrounds to select the suitable level of coding they can handle. The coding level ranges from the very high level of coordinate-independent prototyping using abstract GA operations up to a fully controlled low-level direct manipulation of scalars and coordinates for high-performance computing purposes.
- CDI-5: Providing a unified, generic, and extensible API for several classes of applications. The final design goal of GA-FuL is to expose the system functionality through a good API. The API should have a unified public interface with uniform conventions to aid usability. Additionally, the API should be generic regarding the kinds of scalars and GAs it can handle, reflecting the capabilities of the underlying system. API extensibility is also important for future development of the system to aid in the addition of more features and widening system usage. Finally, the API should support the development of various classes of applications including, but not limited to, numerical prototyping computations, symbolic mathematical manipulations, signal processing, visualization, and metaprogramming.
4.2. Design Overview
- DOP-1: Separating behavior code from data. This is a design tenet that advocates for a distinct division between behavior code and data. Following this DOP principle in OOP entails grouping the behavior code into methods for a static class.
- DOP-2: Representing data with generic data structures. DOP is not dogmatic about the programming constructs used to employ and organize the code. Arrays\lists and dictionaries\maps are the two most widely used generic data structures in practice. However, one can also utilize other general data structures, such queues, trees, and sets.
- DOP-3: Making data immutable. In DOP, due to isolation of representational data structures from behavior code, data mutation is not permitted. Instead, data modifications are carried out by generating new data structure versions. A variable’s reference can be updated to point to a different version of the data, but the actual value of the data must never change.
- DOP-4: Separating data representation from data schema. Now that data and code are decoupled and generic immutable data structures are employed to describe it, the challenge is to articulate the shape of the data. The intended shape in DOP is represented by a data schema that is stored apart from the actual data. DOP-4’s primary advantage is that it gives developers the freedom to choose which data elements should have a schema and which ones should not.
4.3. GA-FuL Layers
4.3.1. Algebra Layer
- DOP-adhering representations for generic scalars, basis blades, multivectors, linear maps, etc.
- DOP-adhering processing tasks on the representations.
4.3.2. Modeling Layer
- // The predefined scalar processor for 64-bits
- // floating point numbers
- var scalarProcessor = ScalarProcessorOfFloat64.Instance;
- Create the CGA space object based on the selected
- kind of scalars
- var cga = XGaConformalSpace5D<double>.Create(scalarProcessor);
- // Encode 4 points as CGA null vectors
- var a = cga.EncodeIpnsRoundPoint(3.5, 4.3, 2.6);
- var b = cga.EncodeIpnsRoundPoint(-2.1, 3.4, 5);
- var c = cga.EncodeIpnsRoundPoint(7.4, -1.5, -4.5);
- var d = cga.EncodeIpnsRoundPoint(3, -2, 5);
- // Use the outer product to define the OPNS blade, encoding a
- sphere passing through points a, b, and c
- var sphere = a.Op(b).Op(c).Op(d);
- // Encode a line passing through a point parallel to
- a direction vector
- var line = cga.EncodeOpnsFlatLine(
- scalarProcessor.Vector3D(3.5, 4.3, 2.6),
- scalarProcessor.Vector3D(1, 1, 1)
- );
- // Project line on sphere to get a circle
- var circle = line.ProjectOpnsOn(sphere);
- // Decode the circle to separate its individual Euclidean
- // geometric components
- var circleComponents = circle.DecodeOpnsRound();
- // Center, radius, direction bivector, and normal of circle:
- var center = circleComponents.CenterToVector3D();
- var radius = circleComponents.RealRadius;
- var bivector = circleComponents.DirectionToBivector3D();
- var normal = circleComponents.NormalDirectionToVector3D();
- Encode a geometric object as a CGA blade\multivector. For example, the 5D CGA blades can represent the direction vectors, bivectors, points, point pairs, circles, spheres, lines, and planes of 3D Euclidean space. Additionally, CGA versors can encode all Euclidean and conformal maps such as rotations, translations, inversions, and reflections.
- Perform basic GA multivector algebraic operations on the encoded multivectors in the CGA space.
- Use simple member and extension methods to perform high-level geometric operations on the encoded multivectors. Examples include reflections, intersections, projections, translations, and rotations.
- Decode a CGA blade\multivector into a set of simpler components. For example, a 5D CGA blade representing a circle can be decoded into the circle’s center, radius, direction bivector, and normal vector.
4.3.3. Metaprogramming Layer
- Initialize a metaprogramming context object (MCO) by instancing the MetaContext class defined in the meta-context sub-layer.
- Use the MCO to define algebraic objects acting as input parameters to the computational block.
- Use algebraic operations, provided by GA-FuL algebra and modeling layers, to describe the intended algebraic steps.
- Select the expected output variables of the computational block from the algebraic objects computed.
- Set the TPL names of the input, intermediate, and output scalar variables to be used in the final generated code.
- Use the MCO to optimize the computational block.
- Initialize the intended code composer object (CCO) by instancing one of the classes defined in the code composers sub-layer.
- Generate the final TPL optimized computational code using the CCO.
- Propagation of constant values in metaexpressions on the right-hand side.
- Extraction of common subexpressions in right-hand-side metaexpressions into intermediate variables for reuse.
- Optional simplification of metaexpressions on the right hand side using an external computer algebra system\library.
- Pruning of intermediate variables having constant values or repeated right-hand-side metaexpressions or those not being used for computing an output variable.
- Optional reduction of the number of intermediate variables required.
4.3.4. System Utilities Layer
5. Examples of Applications Using GA-FuL
5.1. Modeling Inverse Kinematics of a 6R Robot
- // Stage 1: Initialize metaprogramming context
- 1 var context = new MetaContext();
- 2 context.AttachMathematicaExpressionEvaluator();
- 3 var cga = context.CreateCGaGeometricSpace5D();
- 4 var sp = context.ScalarProcessor;
- // Stage 2: Define symbolic inputs Staubli robot link lengths
- 5 var d1 = context["d1"];
- 6 var a3 = context["a3"];
- 7 var d4 = context["d4"];
- // desired position components of end-effector
- 8 var pX = context["Px"];
- 9 var pY = context["Py"];
- 10 var pZ = context["Pz"];
- // Stage 3: Perform algebraic computations
- // position of end-effector (a linear algebra vector)
- 11 var p = sp.Vector3D(pX, pY, pZ);
- // origin position (a linear algebra vector)
- 12 var p0 = sp.ZeroVector3D();
- // position of second joint (a linear algebra vector)
- 13 var p1 = p0 + sp.E3Vector3D(d1);
- // plane passing through p0, p1 and p (a CGA IPNS blade)
- 14 var cgaPlane = cga.EncodeIpnsFlatPlaneFromPoints(p0, p1, p);
- // sphere with center at p1 and radius a3 (a CGA IPNS blade)
- 15 var cgaSphere1 = cga.EncodeIpnsRealRoundSphere(a3, p1);
- // sphere with center at p and radius d4 (a CGA IPNS blade)
- 16 var cgaSphere2 = cga.EncodeIpnsRealRoundSphere(d4, p);
- // intersection point-pair of the plane and two spheres (a CGA IPNS blade)
- 17 var cgaPointPair = cgaSphere2.MeetIpns(cgaSphere1, cgaPlane);
- // extract one end-point from point-pair (a linear algebra vector)
- 18 var p2 = cgaPointPair.DecodeIpnsPointPairVGaPoint1AsVector3D();
- // normal vector to plane (a linear algebra vector)
- 19 var normal = cgaPlane.DecodeIpnsFlatVGaNormalAsVector3D();
- // cos of first joint angle theta1 (a scalar)
- 20 var theta1Cos = normal.GetAngleCosWithE1();
- // auxiliary lines l1, l2, and l3 (CGA OPNS blades)
- 21 var cgaLine1 = cga.EncodeOpnsFlatLineFromPoints(p0, p1);
- 22 var cgaLine2 = cga.EncodeOpnsFlatLineFromPoints(p1, p2);
- 23 var cgaLine3 = cga.EncodeOpnsFlatLineFromPoints(p2, p);
- // square roots of modules of auxiliary lines l1, l2, and l3 (scalars)
- 24 var l11 = cgaLine1.SpSquared().Sqrt();
- 25 var l22 = cgaLine2.SpSquared().Sqrt();
- 26 var l33 = cgaLine3.SpSquared().Sqrt();
- // cos angle between lines l1 and l2 (a scalar)
- 27 var theta2Cos = cgaLine2.Sp(cgaLine1) / (l11 * l22);
- // cos angle between lines l2 and l3 (a scalar)
- 28 var theta3Cos = cgaLine2.Sp(cgaLine3) / (l22 * l33);
- // Stage 4: Define target language variable names for inputs, outputs,
- // and intermediate variables, and optimize internal expression tree
- 29 d1.SetExternalName("d1");
- 30 a3.SetExternalName("a3");
- 31 d4.SetExternalName("d4");
- 32 pX.SetExternalName("px");
- 33 pY.SetExternalName("py");
- 34 pZ.SetExternalName("pz");
- 35 theta1Cos.SetAsOutput("theta1Cos");
- 36 theta2Cos.SetAsOutput("theta2Cos");
- 37 theta3Cos.SetAsOutput("theta3Cos");
- 38 context = context.OptimizeContext();
- 39 context.SetComputedExternalNamesByOrder(index => $"temp{index}");
- // Stage 5: Define a MATLAB code composer and Generate the final code
- 40 var codeComposer = context.CreateContextCodeComposer(
- GaFuLLanguageServerBase.MatlabFloat64()
- );
- 41 var code = codeComposer.Generate();
- 42 Console.WriteLine(code);
5.2. Library Generation of Arbitrary GAs
- % Creating two 3D Euclidean GA scalars and two vectors:
- a = ga3.EncodeScalar(3.5);
- b = ga3.EncodeScalar(-1.25);
- v = ga3.EncodeVector([1.2, -2.4, 1.3]);
- w = ga3.EncodeVector([-3.1, -1.6, 2.23]);
- % Any multivector object has several important properties:
- % The Grade of a k-vector, a full multivector returns -1
- % in this property
- v.Grade
- % The number of scalars per multivector, this is dependent
- % on the grade and GA space dimensions
- v.ScalarCount
- % The number of samples in this multivector
- v.SampleCount
- % The internal data array storing the scalars of this multivector
- v.Data
- % For any multivector, LaTeX code can be dispalyed as a string:
- a.getLaTeX()
- b.getLaTeX()
- v.getLaTeX()
- w.getLaTeX()
- % negative, reverse, grade involution, conjugate, dual, undual, inverse
- vn = v.negative(); % You can also use vn = -v;
- v.reverse().getLaTeX()
- v.gradeInvolution().getLaTeX()
- v.conjugate().getLaTeX()
- v.dual().getLaTeX()
- v.unDual().getLaTeX()
- v.inverse().getLaTeX()
- % Norm, squared norm
- v.norm()
- v.normSquared()
- % Linear combinations:
- s = v * 2 - w * 0.5 + a;
- % Products: geometric, outer, scalar, left\right contraction, inner
- v.gp(w).getLaTeX()
- v.op(w).getLaTeX()
- v.sp(w)
- v.lcp(w).getLaTeX()
- v.rcp(w).getLaTeX()
- v.fdp(w).getLaTeX()
- % Multivector parts
- m = a + v + w.dual();
- m.getLaTeX()
- m.getScalarPart().getLaTeX() % Same as m.getKVectorPart(0).getLaTeX()
- m.getVectorPart().getLaTeX() % Same as m.getKVectorPart(1).getLaTeX()
- m.getBivectorPart().getLaTeX() % Same as m.getKVectorPart(2).getLaTeX()
- m.getTrivectorPart().getLaTeX() % Same as m.getKVectorPart(3).getLaTeX()
- m.getDataArray()
5.3. Family of Rotations between Two Unit Vectors in 3D
5.4. Geometric Models for Power Systems Applications
5.5. New Efficient Implementation of the Resection Problem (Snellius–Pothenot)
6. Comparisons with Similar Software Libraries
6.1. Capability Comparisons
- Based on the presentation of Section 3, there are three main classes of GA libraries: numerical\symbolic computational libraries, library generators, and optimizing subroutine generators. Currently, there is no single system capable of performing all three classes of GA-based coding tasksmm except for GA-FuL.
- Very few systems can handle GAs with high dimensions (). Those that do include Gallant, Grassmann.jl, and TbGAL, as reported in [34]. GA-FuL can handle arbitrary GAs with any dimension as long as the number of scalar components in a single sparse multivector is reasonably small.
- GA-FuL is not yet capable of performing specialized matrix-based algorithms on arrays of multivectors (singular-value decomposition, eigendecomposition, etc.), similar to the ones performed by some MATLAB toolboxes. However, the design of GA-FuL’s modeling layer can be easily extended to implement such algorithms in the future.
- In contrast with some systems, in GA-FuL, several GAs can be utilized within a single model without any need (or overhead) for switching between algebras.
- In addition to GA-FuL’s predecessor system, GMac, only one other active system, GAALOP, can generate individual subroutines containing optimized code for a variety of target languages. GA-FuL is capable of generating similar subroutines with better code-generation capabilities and computational performance.
- Most good GA computational libraries can handle both symbolic and numeric scalar components of multivectors through the use of template metaprogramming methods. The same is present in GA-FuL algebra layer, where any kind of valid numeric or symbolic scalar can be used, including specialized scalars such as arbitrary precision or rational numbers, sampled signals, and symbolic expression trees.
- Some libraries, such as TbGAL, can only handle non-degenerate GAs where no basis vector squares to zero. This limitation is not present in GA-FuL, where any metric signature can be handled seamlessly.
- Very few libraries have intrinsic visualization capabilities, with Ganja.js being one of the best so far. GA-FuL has initially good visualization capabilities, and the addition of interactive animations is currently under development, gradually targeting the level of Ganja.js capabilities.
6.2. Design Comparisons
- Systems such as Garamon have a restrictively inefficient method for representing k-vectors in GAs with high dimensions. The use of dense arrays for representing k-vectors is the reason behind such a problem. Systems like Ganja.js and GA-FuL, avoid this design problem by using sparse data structures for representing k-vectors, which are highly sparse in most practical applications.
- In most GA systems, the most restrictive processing task is the computation of the geometric and derived bilinear products on general multivectors containing m basis blade components. Typical implementations have performance for bilinear products, severely impeding high values for m. In GA-FuL, as well in other systems such as Garamon and Ganja.js, a multivector represents per-grade k-vectors. This enables more efficient implementations for bilinear products.
- GA-FuL’s algebra layer is functionally comparable to computational GA libraries based on template metaprogramming methods. The main difference is that GA-FuL’s algebra layer is designed for prototyping and efficient memory usage, not for high processing performance. The code-generation facilities of GA-FuL are more than capable of achieving very high processing performance, so this objective is delegated to the metaprogramming layer in GA-FuL.
- Many GA-related programs ignore classical algebraic objects, such as complex numbers, quaternions, classical vectors, and polynomials, in favor of GA’s multivectors. In addition, some GA systems, such as TbGAL, focus only on geometric algebra (multivectors are restricted to become blades or versors), not on general Clifford algebras. For practical applications, however, this design choice introduces a significant coding overhead when interfacing with external packages and datasets relying on such classical algebraic objects. GA-FuL is designed to handle, convert, and mix classical algebraic objects as well as GA\CA multivectors within a single modeling task seamlessly.
- Some GA software systems, such as Gaigen, GAALOP, and GMac, use a DSL for expressing GA operations. This approach was found to be very limiting compared to using an API inside the host programming environment. GA-FuL can utilize the full capabilities of its underlying programming environment, the.NET framework, in service of its CDIs. Currently, this is the most common approach for GA software in general.
6.3. Performance Comparisons
- ExpApprox = {
- 1 + _P(1) + _P(1)*_P(1)/2 + _P(1)*_P(1)*_P(1)/6 +_P(1)*_P(1)*_P(1)
- *_P(1)/24
- }
- Motor = {
- // computes the motor between two points, lines or planes
- // as the sqrt of them
- !temp = 1+_P(1)/_P(2);
- !abstemp = abs(temp);
- temp/abstemp
- }
- // original points
- A1 = createPoint(ax, ay, az);
- B1 = createPoint(bx, by, bz);
- C1 = createPoint(cx, cy, cz);
- // arbitrary transformation
- !GT = ExpApprox(0.3*(e1^e3) + 0.2*(e2^e0));
- // corresponding target points
- ?At = GT * A1 * ~GT;
- ?Bt = GT * B1 * ~GT;
- ?Ct = GT * C1 * ~GT;
- // Transformation from A1 to At
- // (translation)
- !VA = Motor(At, A1);
- !A2 = VA * A1 * ~VA;
- !B2 = VA * B1 * ~VA;
- !C2 = VA * C1 * ~VA;
- // Transformation from B2 to Bt
- // based on the rotation from the line L2 to L1
- !L1 = *(*At ^ *Bt);
- !L2 = *(*At ^ *B2);
- !VB = Motor(L1, L2);
- !B3 = VB * B2 * ~VB;
- !C3 = VB * C2 * ~VB;
- // Transformation from C3 to Ct
- // based on the rotation of two planes
- !P1 = *(*L1 ^*Ct);
- !P2 = *(*L1 ^*C3);
- !VC = Motor(P1,P2);
- // complete transformation
- !V = VC * VB * VA;
- // interplation motor
- lerp = 1 * (1-t) + V * t;
- // interpolated points
- ?AI = lerp * A1 * ~lerp;
- ?BI = lerp * B1 * ~lerp;
- ?CI = lerp * C1 * ~lerp;
7. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
API | application programming interface |
AST | abstract syntax tree |
CA | Clifford algebra |
CAS | computer algebra system |
CCO | code composer object |
CDI | core design intention |
CGA | conformal geometric algebra |
DOP | data-oriented programming |
DSL | domain-specific language |
GA | geometric algebra |
HGA | homogeneous geometric algebra |
MCO | meta-context object |
OOP | object-oriented programming |
PGA | projective geometric algebra |
SKR | simple Kirchhoff rotation |
TPL | target programming language |
VGA | vector geometric algebra |
References
- Bayro-Corrochano, E. A Survey on Quaternion Algebra and Geometric Algebra Applications in Engineering and Computer Science 1995–2020. IEEE Access. 2021, 9, 104326–104355. [Google Scholar] [CrossRef]
- Corrochano, E. Bayro Corrochano: Eduardo Jose; Springer: Berlin/Heidelberg, Germany, 2019. [Google Scholar]
- Bayro-Corrochano, E. Geometric Algebra Applications Vol. II: Robot Modelling and Control; Springer International Publishing AG: Cham, Switzerland, 2020. [Google Scholar]
- Bhatti, U.; Yu, Z.; Yuan, L.; Zeeshan, Z.; Nawaz, S.; Bhatti, M.; Mehmood, A.; Ain, Q.; Wen, L. Geometric Algebra Applications in Geospatial Artificial Intelligence and Remote Sensing Image Processing. IEEE Access 2020, 8, 155783–155796. [Google Scholar] [CrossRef]
- Breuils, S.; Tachibana, K.; Hitzer, E. New Applications of Clifford’s Geometric Algebra. Adv. Appl. Clifford Algebr. 2022, 32, 17. [Google Scholar] [CrossRef]
- Doran, C. Geometric Algebra for Physicists; Cambridge University Press: Cambridge, UK, 2013. [Google Scholar]
- Dorst, L.; Fontijne, D.; Mann, S. Geometric Algebra for Computer Science (Revised Edition): An Object-Oriented Approach to Geometry; Morgan Kaufmann Publishers Inc.: Burlington, MA, USA, 2009. [Google Scholar]
- Dorst, L. A Guided Tour to the Plane-Based Geometric Algebra Pga, Version 2.0. 2022. Available online: https://bivector.net/PGA4CS.html (accessed on 15 June 2024).
- Gunn, C. Geometric Algebras for Euclidean Geometry. Adv. Appl. Clifford Algebr. 2016, 27, 185–208. [Google Scholar] [CrossRef]
- Gunn, C.G. Doing Euclidean Plane Geometry Using Projective Geometric Algebra. Adv. Appl. Clifford Algebr. 2016, 27, 1203–1232. [Google Scholar] [CrossRef]
- Gunn, C.G.; Keninck, S.D. Geometric algebra and computer graphics. In Proceedings of the ACM SIGGRAPH 2019 Courses. ACM, Los Angeles, CA, USA, 28 July 2019. [Google Scholar] [CrossRef]
- Hestenes, D.; Sobczyk, G. Clifford Algebra to Geometric Calculus; Springer: Dordrecht, The Netherlands, 1984. [Google Scholar] [CrossRef]
- Hestenes, D. New Foundations for Classical Mechanics, 2nd ed.; Number 99 in Fundamental Theories of Physics; Kluwer Academic Publishers: Dordrecht, The Netherlands, 2003. [Google Scholar]
- Hestenes, D. Tutorial on Geometric Calculus. Adv. Appl. Clifford Algebr. 2013, 24, 257–273. [Google Scholar] [CrossRef]
- Hildenbrand, D. Foundations of Geometric Algebra Computing; SpringerLink, Springer: Berlin/Heidelberg, Gernamny, 2013. [Google Scholar]
- Hildenbrand, D. Introduction to Geometric Algebra Computing, 1st ed.; Computer Science, CRC Press, Taylor & Francis Group: Boca Raton, FL, USA; A Chapman & Hall Book: London, UK, 2020. [Google Scholar]
- Josipović, M. Geometric Multiplication of Vectors; Springer eBooks, Birkhäuser: Cham, Switzerland, 2020. [Google Scholar]
- Kanatani, K. Understanding Geometric Algebra; Taylor & Francis Group: Milton Park, UK, 2020. [Google Scholar]
- Lengyel, E. Projective Geometric Algebra Illuminated; Terathon Software LLC: Lincoln, CA, USA, 2024. [Google Scholar]
- MacDonald, A. Linear and Geometric Algebra, nachdr ed.; Createspace: Scotts Valley, CA, USA, 2012. [Google Scholar]
- Macdonald, A. Vector and Geometric Calculus; CreateSpace Independent Publishing Platform: Scotts Valley, CA, USA, 2012; Volume 12. [Google Scholar]
- Macdonald, A. A Survey of Geometric Algebra and Geometric Calculus. Adv. Appl. Clifford Algebr. 2016, 27, 853–891. [Google Scholar] [CrossRef]
- Perwass, C. Geometric Algebra with Applications in Engineering; Number 4 in Geometry and Computing; Springer: Berlin/Heidelberg, Germany, 2009. [Google Scholar]
- Wareham, R.; Cameron, J.; Lasenby, J. Applications of Conformal Geometric Algebra in Computer Vision and Graphics. In Computer Algebra and Geometric Algebra with Applications; Springer: Berlin/Heidelberg, Germany, 2005; pp. 329–349. [Google Scholar] [CrossRef]
- Ivey, T.A. Cartan for Beginners, 2nd ed.; Number Volume 175 in Graduate Studies in Mathematics; American Mathematical Society: Providence, RI, USA, 2016. [Google Scholar]
- Eid, A.H. An Extended Implementation Framework for Geometric Algebra Operations on Systems of Coordinate Frames of Arbitrary Signature. Adv. Appl. Clifford Algebr. 2018, 28. [Google Scholar] [CrossRef]
- Eid, A.H. A Low-Memory Time-Efficient Implementation of Outermorphisms for Higher-Dimensional Geometric Algebras. Adv. Appl. Clifford Algebr. 2020, 30, 24. [Google Scholar] [CrossRef]
- Breuils, S.; Nozick, V.; Sugimoto, A.; Hitzer, E. Quadric Conformal Geometric Algebra of . Adv. Appl. Clifford Algebr. 2018, 28, 35. [Google Scholar] [CrossRef]
- Easter, R.B.; Hitzer, E. Double Conformal Geometric Algebra. Adv. Appl. Clifford Algebr. 2017, 27, 2175–2199. [Google Scholar] [CrossRef]
- Easter, R.B.; Hitzer, E. Conic and cyclidic sections in double conformal geometric algebra G8,2 with computing and visualization using Gaalop. Math. Methods Appl. Sci. 2019, 43, 334–357. [Google Scholar] [CrossRef]
- Hitzer, E.; Sangwine, S.J. Foundations of Conic Conformal Geometric Algebra and Compact Versors for Rotation, Translation and Scaling. Adv. Appl. Clifford Algebr. 2019, 29, 96. [Google Scholar] [CrossRef]
- Hrdina, J.; Návrat, A.; Vašík, P. Geometric Algebra for Conics. Adv. Appl. Clifford Algebr. 2018, 28, 66. [Google Scholar] [CrossRef]
- Zamora-Esquivel, J. G 6,3 Geometric Algebra; Description and Implementation. Adv. Appl. Clifford Algebr. 2014, 24, 493–514. [Google Scholar] [CrossRef]
- Sousa, E.V.; Fernandes, L.A.F. TbGAL: A Tensor-Based Library for Geometric Algebra. Adv. Appl. Clifford Algebr. 2020, 30, 27. [Google Scholar] [CrossRef]
- Fernandes, L.A.F. Exploring Lazy Evaluation and Compile-Time Simplifications for Efficient Geometric Algebra Computations. In Systems, Patterns and Data Engineering with Geometric Calculi; Springer International Publishing: Berlin/Heidelberg, Germany, 2021; pp. 111–131. [Google Scholar] [CrossRef]
- Sangwine, S.J.; Hitzer, E. Clifford Multivector Toolbox (for MATLAB). Adv. Appl. Clifford Algebr. 2016, 27, 539–558. [Google Scholar] [CrossRef]
- Velasco, M.; Zaplana, I.; Dória-Cerezo, A.; Martí, P. Symbolic and User-friendly Geometric Algebra Routines (SUGAR) for Computations in Matlab. arXiv 2024. [Google Scholar] [CrossRef]
- Bancila, M. Template Metaprogramming with C++; Packt Publishing: Birmingham, UK, 2022. [Google Scholar]
- Colapinto, P. Versor: Spatial Computing with Conformal Geometric Algebra. Master’s Thesis, University of California, Santa Barbara, CA, USA, 2011. Available online: http://versor.mat.ucsb.edu (accessed on 15 June 2024).
- Breitner, J. Lazy Evaluation: From Natural Semantics to a Machine-Checked Compiler Transformation; KIT Scientific Publishing Karlsruhe Institute of Technology: Karlsruhe, Germany, 2016. [Google Scholar]
- Fontijne, D.H.F. Efficient Implementation of Geometric Algebra; Universiteit van Amsterdam: Amsterdam, The Nederland, 2007; p. 229. [Google Scholar]
- Reed, M. Differential geometric algebra with Leibniz and Grassmann. Proc. JuliaCon 2019, 1. [Google Scholar]
- Fontijne, D. Gaigen 2: A geometric algebra implementation generator. In Proceedings of the 5th International Conference on Generative Programming and Component Engineering. ACM, GPCE06, Portland, OR, USA, 22–26 October 2006. [Google Scholar] [CrossRef]
- Wąsowski, A.; Berger, T. Domain-Specific Languages: Effective Modeling, Automation, and Reuse; Springer International Publishing: Berlin/Heidelberg, Germany, 2023. [Google Scholar] [CrossRef]
- Breuils, S.; Nozick, V.; Fuchs, L. Garamon: A Geometric Algebra Library Generator. Adv. Appl. Clifford Algebr. 2019, 29, 69. [Google Scholar] [CrossRef]
- De Keninck, S. Non-parametric Realtime Rendering of Subspace Objects in Arbitrary Geometric Algebras. In Lecture Notes in Computer Science; Springer International Publishing: Berlin/Heidelberg, Germany, 2019; pp. 549–555. [Google Scholar] [CrossRef]
- Eid, A.H.A. Optimized Automatic Code Generation for Geometric Algebra Based Algorithms with Ray Tracing Application. Ph.D. Thesis, Faculty of Engineering, Port-Said University, Port Fuad, Egypt, 2010. [Google Scholar] [CrossRef]
- Hastings, C. Hands-on Start to Wolfram Mathematica, 3rd ed.; Wolfram Media: Champaign, IL, USA, 2020. [Google Scholar]
- Eid, A.H.; Soliman, H.Y.; Abuelenin, S.M. Efficient ray-tracing procedure for radio wave propagation modeling using homogeneous geometric algebra. Electromagnetics 2020, 40, 388–408. [Google Scholar] [CrossRef]
- Montoya, F.G.; Eid, A.H. Formulating the geometric foundation of Clarke, Park, and FBD transformations by means of Clifford’s geometric algebra. Math. Methods Appl. Sci. 2021, 45, 4252–4277. [Google Scholar] [CrossRef]
- Price, M.J. C# 12 and.NET 8, 8th ed.; Packt Publishing: Birmingham, UK, 2023. [Google Scholar]
- Hestenes, D. The Genesis of Geometric Algebra: A Personal Retrospective. Adv. Appl. Clifford Algebr. 2016, 27, 351–379. [Google Scholar] [CrossRef]
- Spindler, K. Abstract Algebra with Applications: Volume 2: Rings and Fields; Routledge: London, UK, 1993. [Google Scholar]
- Goldberg, D. What every computer scientist should know about floating-point arithmetic. ACM Comput. Surv. 1991, 23, 5–48. [Google Scholar] [CrossRef]
- Steven, L.; Brunton, J.N.K. Data-Driven Science and Engineering; Cambridge University Press: Cambridge, UK, 2022. [Google Scholar]
- Wei, Y.; Ding, W. Theory and Computation of Tensors: Multi-Dimensional Arrays; Academic Press: Cambridge, MA, USA, 2016. [Google Scholar]
- Grabmeier, J.; Kaltofen, E.; Weispfenning, V. (Eds.) Computer Algebra Handbook; Springer-Verlag GmbH: Berlin, Germany, 2002. [Google Scholar]
- Strmečki, D.; Magdalenić, I.; Radosević, D. A Systematic Literature Review on the Application of Ontologies in Automatic Programming. Int. J. Softw. Eng. Knowl. Eng. 2018, 28, 559–591. [Google Scholar] [CrossRef]
- Krysztof Czarnecki, U.E. Generative Programming: Methods, Tools, and Applications; Addison-Wesley Professional: Boston, MA, USA, 2000. [Google Scholar]
- Lilis, Y.; Savidis, A. A Survey of Metaprogramming Languages. ACM Comput. Surv. 2020, 52, 1–39. [Google Scholar] [CrossRef]
- Štuikys, V.; Damaševičius, R. Meta-Programming and Model-Driven Meta-Program Development; Springer: London, UK, 2013. [Google Scholar] [CrossRef]
- Sharvit, Y. Data-Oriented Programming; Manning Publications Co. LLC.: Shelter Island, NY, USA, 2022; p. 424. [Google Scholar]
- Hrdina, J.; Návrat, A.; Vašík, P.; Dorst, L. Projective Geometric Algebra as a Subalgebra of Conformal Geometric algebra. Adv. Appl. Clifford Algebr. 2021, 31. [Google Scholar] [CrossRef]
- Simon, D. Evolutionary Optimization Algorithms; Wiley: Hoboken, NJ, USA, 2013. [Google Scholar]
- Ashlock, D. (Ed.) Evolutionary Computation for Modeling and Optimization; SpringerLink, Springer Science+Business Media, Inc.: New York, NY, USA, 2006. [Google Scholar]
- Poli, R.; Langdon, W.B.; McPhee, N.F. A Field Guide to Genetic Programming; Lulu Press: Morrisville, NC, USA, 2008; pp. 167–223. [Google Scholar]
- Lavor, C. A Geometric Algebra Invitation to Space-Time Physics, Robotics and Molecular Geometry.; SpringerBriefs in Mathematics Series; Springer: Cham, Switzerland, 2018. [Google Scholar]
- Perwass, C.B.; Farouki, R.T.; Noakes, L. A geometric product formulation for spatial Pythagorean hodograph curves with applications to Hermite interpolation. Comput. Aided Geom. Des. 2007, 24, 220–237. [Google Scholar] [CrossRef]
- Eid, A.H.; Montoya, F.G. A Systematic and Comprehensive Geometric Framework for Multiphase Power Systems Analysis and Computing in Time Domain. IEEE Access 2022, 10, 132725–132741. [Google Scholar] [CrossRef]
- Montoya, F.G.; Baños, R.; Alcayde, A.; Arrabal-Campos, F.M.; Roldán Pérez, J. Geometric algebra framework applied to symmetrical balanced three-phase systems for sinusoidal and non-sinusoidal voltage supply. Mathematics 2021, 9, 1259. [Google Scholar] [CrossRef]
- Montoya, F.G.; De Leon, F.; Arrabal-Campos, F.; Alcayde, A. Determination of instantaneous powers from a novel time-domain parameter identification method of non-linear single-phase circuits. IEEE Trans. Power Deliv. 2021, 37, 3608–3619. [Google Scholar] [CrossRef]
- Uzunović, T.; Montoya, F.G.; Osmanović, A.; Arrabal-Campos, F.M.; Alcayde, A.; Eid, A.H.; Šabanović, A. Combining Real-time Parameter Identification and Robust Control Algorithms for Effective Control of Electrical Machines. In Proceedings of the 2022 International Conference on Electrical Machines (ICEM), Valencia, Spain, 5–8 September 2022; pp. 2391–2396. [Google Scholar]
- Eid, A.H.; Montoya, F.G. A geometric procedure for computing differential characteristics of multi-phase electrical signals using geometric algebra. arXiv 2022, arXiv:2208.05917. [Google Scholar]
- Montoya, F.G.; Ventura, J.; Arrabal-Campos, F.M.; Alcayde, A.; Eid, A.H. Frequency Generalization via Darboux Bivector and Electrical Curves in Multi-Phase Power Systems. TechRxiv 2023. [Google Scholar] [CrossRef]
- Montoya, F.G.; Baños, R.; Alcayde, A.; Arrabal-Campos, F.M.; Roldán-Pérez, J. Geometric algebra applied to multiphase electrical circuits in mixed time–frequency domain by means of hypercomplex hilbert transform. Mathematics 2022, 10, 1419. [Google Scholar] [CrossRef]
- Ventura, J.; Martinez, F.; Manzano-Agugliaro, F.; Návrat, A.; Hrdina, J.; Eid, A.H.; Montoya, F.G. A novel geometric method based on conformal geometric algebra applied to the resection problem in two and three dimensions. J. Geod. 2024, 98, 47. [Google Scholar] [CrossRef]
Basis Blade | k (Grade) | j (Index in ) | (Index in ) |
---|---|---|---|
0 | 0 | 0 | |
1 | 0 | 1 | |
1 | 1 | 2 | |
2 | 0 | 3 | |
1 | 2 | 4 | |
2 | 1 | 5 | |
2 | 2 | 6 | |
3 | 0 | 7 | |
1 | 3 | 8 | |
2 | 3 | 9 | |
2 | 4 | 10 | |
3 | 1 | 11 | |
2 | 5 | 12 | |
3 | 2 | 13 | |
3 | 3 | 14 | |
4 | 0 | 15 |
Operation | Symbol | Equation |
---|---|---|
Reverse | ||
Grade Involution | ||
Squared Norm | ||
Inverse | ||
Dual | ||
Un-dual |
Operation | Expression | Equation |
---|---|---|
Outer Product | ||
Scalar Product | ||
Left-Contraction Product | ||
Right-Contraction Product | ||
Inner Product |
# Dimensions | Clarke Method (ms) | SKR Method (ms) |
---|---|---|
3 | 27.86 | 12.20 |
4 | 36.71 | 13.28 |
5 | 48.36 | 13.62 |
6 | 61.47 | 14.39 |
7 | 77.13 | 15.22 |
8 | 94.84 | 16.14 |
9 | 115.63 | 17.08 |
10 | 143.92 | 17.78 |
15 | 294.58 | 23.88 |
20 | 490.91 | 33.10 |
25 | 740.86 | 43.89 |
30 | 1057.39 | 56.34 |
35 | 1399.00 | 63.22 |
40 | 1812.72 | 71.17 |
45 | 2281.55 | 79.43 |
Method | Comp. Time (ms) | Remarks |
---|---|---|
Best algeb. method | 21.919 | Efficient and less intuitive |
CGA method | 196.122 | More intuitive, less efficient |
VGA method | 18.997 | Most efficient, highly intuitive |
Problem | Execution Time (s) | ||
---|---|---|---|
Name | Description | GAALOP | GA-FuL |
RotatingSquare | Rotate a fixed square using a parametric angle in 2D [8] | 9.582 | 9.532 |
SphereCenter | Compute center of sphere given 4 points on the sphere in 3D [7] | 20.779 | 19.013 |
ThreeSpheresIntersection | Compute the point pair of intersection of 3 spheres in 3D [7] | 54.072 | 55.048 |
Snellius–Pothenot Problem | Solve resection problem in 2D [76] | 600.921 | 168.923 |
ReconstructMotor | Reconstructing a motor from exact point correspondences in 3D [8] | 1064.652 | 179.460 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Eid, A.H.; Montoya, F.G. Developing GA-FuL: A Generic Wide-Purpose Library for Computing with Geometric Algebra. Mathematics 2024, 12, 2272. https://doi.org/10.3390/math12142272
Eid AH, Montoya FG. Developing GA-FuL: A Generic Wide-Purpose Library for Computing with Geometric Algebra. Mathematics. 2024; 12(14):2272. https://doi.org/10.3390/math12142272
Chicago/Turabian StyleEid, Ahmad Hosny, and Francisco G. Montoya. 2024. "Developing GA-FuL: A Generic Wide-Purpose Library for Computing with Geometric Algebra" Mathematics 12, no. 14: 2272. https://doi.org/10.3390/math12142272
APA StyleEid, A. H., & Montoya, F. G. (2024). Developing GA-FuL: A Generic Wide-Purpose Library for Computing with Geometric Algebra. Mathematics, 12(14), 2272. https://doi.org/10.3390/math12142272