Skip to main content
Log in

Computational Aspects of Geometric Algebra Products of Two Homogeneous Multivectors

  • Published:
Advances in Applied Clifford Algebras Aims and scope Submit manuscript

Abstract

This paper addresses the study of the complexity of products in geometric algebra. More specifically, this paper focuses on both the number of operations required to compute a product, in a dedicated program for example, and the complexity to enumerate these operations. In practice, studies on time and memory costs of products in geometric algebra have been limited to the complexity in the worst case, where all the components of the multivector are considered. Standard usage of Geometric Algebra is far from this situation since multivectors are likely to be sparse and usually full homogeneous, i.e., having their non-zero terms over a single grade. We provide a complete computational study on the main Geometric Algebra products of two full homogeneous multivectors, that are outer, inner, and geometric products. We show tight bounds on the number of the arithmetic operations required for these products. We also show that some algorithms reach this number of arithmetic operations.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4

Similar content being viewed by others

Notes

  1. There is, of course, only one product in a Geometric Algebra, namely, the geometric (Clifford) product. We follow common practice in also calling the derived bilinear operators, inner and outer “products”.

References

  1. Abłamowicz, R., Fauser, B.: Clifford and Graßmann Hopf algebras via the BIGEBRA package for Maple. Comput. Phys. Commun. 170(2), 115–130 (2005)

    Article  ADS  MATH  Google Scholar 

  2. Abłamowicz, R., Fauser, B.: On Parallelizing the Clifford Algebra Product for CLIFFORD. Adv. Appl. Clifford Algebras 24(2), 553–567 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  3. Breuils, S., Nozick, V., Fuchs, L.: A Geometric Algebra Implementation using Binary Tree. Adv. Appl. Clifford Algebras 27(3), 2133–2151 (2017)

    Article  MathSciNet  MATH  Google Scholar 

  4. Breuils, S., Nozick, V., Fuchs, L.: Garamon: A Geometric Algebra Library Generator. Adv. Appl. Clifford Algebras 29(4), 69 (2019)

    Article  MathSciNet  MATH  Google Scholar 

  5. Breuils, S., Nozick, V., Sugimoto, A., Hitzer, E.: Quadric Conformal Geometric Algebra of \({\mathbb{R} }^{9,6}\). Adv. Appl. Clifford Algebras 28(2), 35 (2018)

    Article  MATH  Google Scholar 

  6. Charrier, P., Klimek, M., Steinmetz, C., Hildenbrand, D.: Geometric algebra enhanced precompiler for C++, OpenCL and Mathematica’s OpenCLLink. Adv. Appl. Clifford Algebras 24(2), 613–630 (2014)

    Article  MATH  Google Scholar 

  7. Colapinto, P.: Spatial computing with conformal geometric algebra. PhD thesis, University of California Santa Barbara, (2011)

  8. De Ganja,Keninck, S.: https://github.com/enkimute/ganja.js.git. Accessed: 2019-11-11

  9. De Keninck, S., Dorst, L.: Geometric Algebra Levenberg-Marquardt. In Advances in Computer Graphics (Cham, 2019), Gavrilova, M., Chang, J., Thalmann, N. M., Hitzer, E., Ishikawa, H.: Eds., Springer International Publishing, pp. 511–522

  10. Dorst, L., Fontijne, D., Mann, S.: Geometric Algebra for Computer Science. Morgan Kaufmann, An Object-Oriented Approach to Geometry (2007)

    Google Scholar 

  11. Fernandes, L. A. F.: GATL: Geometric Algebra Template Library. https://github.com/laffernandes/gatl.git

  12. Flajolet, P., Sedgewick, R.: Analytic combinatorics. Cambridge University Press, (2009)

  13. Fontijne, D.: Efficient Implementation of Geometric Algebra. PhD thesis, University of Amsterdam, (2007)

  14. Fontijne, D., Dorst, L., Bouma, T., Mann, S.: GAviewer, interactive visualization software for geometric algebra. http://www.geometricalgebra.net/downloads.html (2010)

  15. Fuchs, L., Théry, L.: Implementing geometric algebra products with binary trees. Adv. Appl. Clifford Algebras 24(2), 589–611 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  16. Goldman, R., Mann, S.: R(4, 4) As a Computational Framework for 3-Dimensional Computer Graphics. Adv. Appl. Clifford Algebras 25(1), 113–149 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  17. Graham, R.L., Knuth, D.E., Patashnik, O., Liu, S.: Concrete mathematics: a foundation for computer science. Comput. Phys. 3(5), 106–107 (1989)

    Article  ADS  MATH  Google Scholar 

  18. Grassmann, H.: Die lineale Ausdehungslehre: ein neuer Zweig der Mathematik, dargestellt und durch Anwendungen auf die übrigen Zweige der Mathematik, wie auch die Statik, Mechanik, die Lehre von Magnetismus und der Krystallonomie erläutert. Wigand, Leipzig (1844)

    Google Scholar 

  19. Hagmark, P.-E., Lounesto, P.: Walsh Functions, pp. 531–540. Netherlands, Dordrecht, Clifford Algebras and Cayley-Dickson Process. Springer (1986)

    MATH  Google Scholar 

  20. Hestenes, D.: Grassmann’s vision. In Hermann Günther Graßmann (1809–1877): Visionary Mathematician, Scientist and Neohumanist Scholar. Springer, 1996, pp. 243–254

  21. Kanatani, K.: Understanding Geometric Algebra: Hamilton, Grassmann, and Clifford for Computer Vision and Graphics. A. K. Peters Ltd, Natick, MA, USA (2015)

    Book  MATH  Google Scholar 

  22. Lasenby, J., Hadfield, H., Lasenby, A.: Calculating the Rotor Between Conformal Objects. Advances in Applied Clifford Algebras 29(5), 102 (2019)

    Article  MathSciNet  MATH  Google Scholar 

  23. Leopardi, P.: GluCat: Generic library of universal Clifford algebra templates. http://glucat.sourceforge.net/

  24. Leopardi, P.: A generalized FFT for Clifford algebras. Bull. Belgian Mathematical Society-Simon Stevin 11(5), 663–688 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  25. Perwass, C.: Geometric algebra with applications in engineering, vol. 4 of Geometry and Computing. Springer, (2009)

  26. Sousa, E.V., Fernandes, L.A.: TbGAL: A Tensor-Based Library for Geometric Algebra. Adv. Appl. Clifford Algebras 30(2), 1–33 (2020)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Stephane Breuils.

Ethics declarations

Conflict of Interest Statement

The authors declare that there is no conflict of interest.

Declaration

Data sharing not applicable to this article as no datasets were generated or analysed during the current study.

Additional information

Communicated by Uwe Kaehler.

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Simplification of the Ratio of Section 4.3

If \(g_a < g_b\), then Eq. (45) can be rewritten as

$$\begin{aligned} \displaystyle \frac{p^\textrm{th}_{\cdot }}{p^\textrm{ds}_{\cdot }} = \frac{\displaystyle \left( {\begin{array}{c}d\\ g_b - g_a\end{array}}\right) \left( {\begin{array}{c}d+ g_a - g_b \\ g_a \end{array}}\right) }{\displaystyle \left( {\begin{array}{c}d\\ g_a\end{array}}\right) \left( {\begin{array}{c}d\\ g_b\end{array}}\right) } . \end{aligned}$$
(91)

Simplifying this equation can be achieved by revealing either \(\left( {\begin{array}{c}d\\ g_b\end{array}}\right) \) or \(\left( {\begin{array}{c}d\\ g_a\end{array}}\right) \) in its upper term. This is merely performed through first applying the symmetry property of the binomial coefficient as follows.

$$\begin{aligned} \displaystyle \frac{p^\textrm{th}_{\cdot }}{p^\textrm{ds}_{\cdot }} = \frac{\displaystyle \left( {\begin{array}{c}d\\ d + g_a - g_b\end{array}}\right) \left( {\begin{array}{c}d+ g_a - g_b \\ g_a\end{array}}\right) }{\displaystyle \left( {\begin{array}{c}d\\ g_a\end{array}}\right) \left( {\begin{array}{c}d\\ g_b\end{array}}\right) } . \end{aligned}$$
(92)

Then, Eq. (92) can be simplified using the trinomial property defined in [17]:

$$\begin{aligned} \displaystyle \frac{p^\textrm{th}_{\cdot }}{p^\textrm{ds}_{\cdot }} = \frac{\displaystyle \left( {\begin{array}{c}d\\ g_a \end{array}}\right) \left( {\begin{array}{c}d - g_a \\ d-g_b\end{array}}\right) }{\displaystyle \left( {\begin{array}{c}d\\ g_a\end{array}}\right) \left( {\begin{array}{c}d\\ g_b\end{array}}\right) } . \end{aligned}$$
(93)

For any grade and any dimension, \(\left( {\begin{array}{c}d\\ g_a\end{array}}\right) \ne 0\). We thus simplify Eq. (93) as below.

$$\begin{aligned} \displaystyle \frac{p^\textrm{th}_{\cdot }}{p^\textrm{ds}_{\cdot }} = \frac{ \displaystyle \left( {\begin{array}{c}d - g_a \\ d-g_b\end{array}}\right) }{\displaystyle \left( {\begin{array}{c}d\\ g_b\end{array}}\right) } . \end{aligned}$$
(94)

Finally, the symmetry property of the binomial coefficient applied to the left term yields

$$\begin{aligned} \displaystyle \frac{p^\textrm{th}_{\cdot }}{p^\textrm{ds}_{\cdot }} = \frac{ \displaystyle \left( {\begin{array}{c}d - g_a \\ g_b-g_a\end{array}}\right) }{\displaystyle \left( {\begin{array}{c}d\\ g_b\end{array}}\right) }. \end{aligned}$$
(95)

As for the outer product, \(\forall g_a \ge 0, \left( {\begin{array}{c}d - g_a \\ g_b-g_a\end{array}}\right) \le \left( {\begin{array}{c}d\\ g_b\end{array}}\right) \).

If \(g_a \ge g_b\), a similar reasoning results in:

$$\begin{aligned} \displaystyle \frac{p^\textrm{th}_{\cdot }}{p^\textrm{ds}_{\cdot }} = \frac{ \displaystyle \left( {\begin{array}{c}d - g_b \\ g_a-g_b\end{array}}\right) }{\displaystyle \left( {\begin{array}{c}d\\ g_a\end{array}}\right) } , \end{aligned}$$
(96)

and the same conclusion holds.

Proof of Proposition 5.2

Proof

In addition to the symmetry property and the trinomial property, we will use here the Vandermonde’s convolution property of the binomial coefficient whose proof can be found in Chapter 5 of [17]. We first introduce a variable to drop divisions. Let us define

$$\begin{aligned} s=\frac{g_b - g_a + g_c }{2}. \end{aligned}$$
(97)

Let us assume, without loss of generality, that \(g_a > g_b\). Then, as \(g_c \in \mathcal {I} = \{|g_a - g_b |,|g_a - g_b |+2, \dots , g_a + g_b \} \),

$$\begin{aligned} s \in \{ 0, 1, \ldots , g_b \}. \end{aligned}$$
(98)

This yields

$$\begin{aligned} \begin{array}{rl} &{} \displaystyle \sum _{g_c \in \mathcal {I}} \left( {\begin{array}{c}d\\ g_c\end{array}}\right) \displaystyle \left( {\begin{array}{c}g_c\\ \displaystyle \frac{ g_a - g_b + g_c }{2} \end{array}}\right) \left( {\begin{array}{c}d-g_c\\ \displaystyle \frac{g_a + g_b - g_c}{2}\end{array}}\right) \\ &{}\quad = \displaystyle \sum _{s=0}^{g_b} \left( {\begin{array}{c}d\\ 2s + g_a - g_b \end{array}}\right) \left( {\begin{array}{c}2s + g_a - g_b\\ s + g_a - g_b \end{array}}\right) \left( {\begin{array}{c}d- 2s + g_b -g_a\\ g_b - s\end{array}}\right) . \end{array} \end{aligned}$$
(99)

We apply the trinomial revision property to the two leftmost terms in Eq. (99), resulting in

$$\begin{aligned} \begin{array}{rl} &{} \displaystyle \sum _{s=0}^{g_b} \left( {\begin{array}{c}d\\ s+g_a-g_b \end{array}}\right) \left( {\begin{array}{c}d-s + g_b - g_a\\ s \end{array}}\right) \left( {\begin{array}{c}d- 2s + g_b -g_a\\ g_b - s\end{array}}\right) . \end{array} \end{aligned}$$

Next, we apply the same property to the two rightmost terms, yielding

$$\begin{aligned} \begin{array}{rl} &{} \displaystyle \sum _{s=0}^{g_b} \left( {\begin{array}{c}d\\ s+g_a-g_b\end{array}}\right) \left( {\begin{array}{c}d-s + g_b - g_a\\ g_b \end{array}}\right) \left( {\begin{array}{c}g_b\\ s\end{array}}\right) . \end{array} \end{aligned}$$
(100)

The symmetry property is then applied to the leftmost term. We have

$$\begin{aligned} \begin{array}{rl} &{} \displaystyle \sum _{s=0}^{g_b} \left( {\begin{array}{c}d\\ d-s+g_b-g_a\end{array}}\right) \left( {\begin{array}{c}d-s + g_b - g_a\\ g_b \end{array}}\right) \left( {\begin{array}{c}g_b\\ s\end{array}}\right) . \end{array} \end{aligned}$$
(101)

Again, we apply the trinomial revision property to the two leftmost terms in Eq. (101). We now have

$$\begin{aligned} \begin{array}{rl} &{} \displaystyle \left( {\begin{array}{c}d\\ g_b\end{array}}\right) \sum _{s=0}^{g_b} \left( {\begin{array}{c}d - g_b\\ d-s-g_a \end{array}}\right) \left( {\begin{array}{c}g_b\\ s\end{array}}\right) . \end{array} \end{aligned}$$
(102)

Note that \(\left( {\begin{array}{c}d\\ g_b\end{array}}\right) \) does not depend on s. Applying the Vandermonde’s convolution property to Eq. (102) results in

$$\begin{aligned} \begin{array}{rl} &{} \displaystyle \left( {\begin{array}{c}d\\ g_b\end{array}}\right) \left( {\begin{array}{c}d \\ d-g_a \end{array}}\right) . \end{array} \end{aligned}$$
(103)

After using the symmetry property on the right term, we see that Eq. (64) holds. \(\square \)

Proof of Lemma 6.4

Let us prove it by induction using the recursive formula (68). The base case is \(g_c = 0\). The recursive formula (68) yields:

$$\begin{aligned} \begin{array}{r@{}l} \text {at depth } 0 \quad \\ \text {computation:~} &{} ~~\mathfrak {c}_{\lambda } \mathrel {+}= \mathfrak {a}_{\gamma } \wedge \mathfrak {b}_{\delta },\quad \text {if }|\lambda | = g_c \\ \text {recursive calls:~} &{} \mathfrak {a}_{\sigma } \wedge \mathfrak {b}_{0} + \overline{\mathfrak {a}_{0}} \wedge \mathfrak {b}_{\sigma } , ~~~ \sigma \in [ \max ( \lambda )+1, \ldots , d ] \end{array}. \end{aligned}$$
(104)

We remark that each node of the resulting outer product prefix tree of grade 1 is 2. Then, all the siblings of grade 1 induce the same number of products. Let us assume that the proposition holds for a given grade of \(\mathfrak {c}\), called \(k_c \in \mathbb {N}\). Then the recursive products associated with any nodes \(\mathfrak {c}_{\lambda }\) of grade \(k_c\) can be seen as the sum of products with the same number of terms. For any node, each single product can be written as

$$\begin{aligned} \mathfrak {c}_{\lambda } = \mathfrak {a}_{\mu } \wedge \mathfrak {b}_{\nu }. \end{aligned}$$
(105)

This product expands at the grade of \(k_c + 1\) is as follows.

$$\begin{aligned} \begin{array}{r@{}l} \text {at depth } k_c +1 \\ \text {computation:~} &{} ~~\mathfrak {c}_{\lambda } \mathrel {+}= \mathfrak {a}_{\gamma } \wedge \mathfrak {b}_{\delta },\quad \text {if }|\lambda | = g_c \\ \text {recursive calls:~} &{} \mathfrak {c}_{\lambda + \sigma } = \mathfrak {a}_{\mu + \sigma } \wedge \mathfrak {b}_{\nu } + \overline{\mathfrak {a}_{\mu }} \wedge \mathfrak {b}_{\nu + \sigma } , ~~~ \sigma \in [ \max ( \lambda )+1, \ldots , d ] \end{array} \end{aligned}$$
(106)

Again, we remark that for any nodes of \(\mathfrak {c}\) of grade \(k_c + 1\), the number of products remains the same. Thus, by induction, the number of outer products remains the same for any node of the resulting prefix tree having the same grade (depth).

Proof of Theorem 6.10

Proof

This proof is split into three parts, each of which is dedicated to one term in Eq. (90). As for the outer and inner products, the number of recursive calls remains the same for any nodes of grade \(g_c\). Moreover, there are \(\left( {\begin{array}{c}d\\ g_c\end{array}}\right) \) products for each node of grade \(g_c\) of the resulting multivector in the d-dimensional vector space. Let us denote by \(n_{g_a,g_b,g_c}\) the number of recursive calls with respect to grades \(g_a,g_b\), and \(g_c\). The overall complexity is then

$$\begin{aligned} c_*^\textrm{rec} = \mathcal {O} \Bigg ( \left( {\begin{array}{c}d\\ g_c\end{array}}\right) n_{g_a,g_b,g_c} \Bigg ). \end{aligned}$$
(107)

Let us now employ the recursive formula of Eq. (89). We remark that the recursive calls that increase the grade of the resulting multivector are those coming only from the outer product of Eq. (68), corresponding to the last recursive call of Eq. (89). As previously studied in Eq. (69), for each possible grade of \(\mathfrak {c}\), the number of calls associated with the recursive outer product is

$$\begin{aligned} \left( {\begin{array}{c}g_c\\ g_a\end{array}}\right)= & {} \left( {\begin{array}{c}g_c\\ \frac{1}{2}(g_a - g_b + (g_a + g_b))\end{array}}\right) \nonumber \\= & {} \left( {\begin{array}{c}d\\ \frac{1}{2}(g_a - g_b + g_c)\end{array}}\right) . \end{aligned}$$
(108)

Then, for any of the recursive outer product calls of the recursive geometric product, the recursive calls can be split into

$$\begin{aligned} \begin{array}{r@{}l} \text {at depth } n \\ \text {computation:~} &{} \mathfrak {c}_{\lambda } \mathrel {+}= \mathfrak {a}_{\gamma } \times \mathfrak {b}_{\delta },\quad \text {if }|\lambda | \in \mathcal {I}, \vert \gamma \vert = g_a \\ \text {recursive calls 1:~} &{} \mathfrak {c}_{\lambda } = \sum _{ i = \sigma }^{d} \textbf{m}(i) \overline{\mathfrak {a}_{\gamma +i}} * \mathfrak {b}_{\delta +i} ~~~ \sigma \in [ \max ( \lambda )+1, \ldots , d ] \\ \text {recursive calls 2:~} &{} \mathfrak {c}_{\lambda + \sigma } = \mathfrak {a}_{\gamma + \sigma } * \mathfrak {b}_{\delta } , ~~~ \sigma \in [ \max ( \lambda )+1, \ldots , d ] \end{array} \end{aligned}$$
(109)

and

$$\begin{aligned} \begin{array}{r@{}l} \text {at depth } n \\ \text {computation:~} &{} \mathfrak {c}_{\lambda } \mathrel {+}= \mathfrak {a}_{\gamma } \times \mathfrak {b}_{\delta },\quad \text {if }|\lambda | \in \mathcal {I}, \vert \gamma \vert = g_a\\ \text {recursive calls 1:~} &{} \mathfrak {c}_{\lambda } = \sum _{ i = \sigma }^{d} \textbf{m}(i) \overline{\mathfrak {a}_{\gamma +i}} * \mathfrak {b}_{\delta +i} ~~~ \sigma \in [ \max ( \lambda )+1, \ldots , d ] \\ \text {recursive calls 2:~} &{} \mathfrak {c}_{\lambda + \sigma } = \overline{\mathfrak {a}_{\gamma }} * \mathfrak {b}_{\delta + \sigma } , ~~~ \sigma \in [ \max ( \lambda )+1, \ldots , d ] \end{array}. \end{aligned}$$
(110)

We recognize the recursive right contraction of Eq. (79) in Eq. (109) whereas Eq. (110) corresponds to the recursive left contraction of Eq. (77). This indicates that for each recursive outer product call, recursive inner product calls are executed. Following the arguments of Theorem 6.8, we see that the number of required recursive calls is

$$\begin{aligned} n_{g_a,g_b,g_c}= & {} \left( {\begin{array}{c}g_c\\ \frac{1}{2}(g_a - g_b + g_c)\end{array}}\right) \nonumber \\{} & {} \left( {\begin{array}{c}d-g_c\\ \frac{1}{2}(g_a + g_b - g_c)\end{array}}\right) \end{aligned}$$
(111)

for any grade \(g_c \in \mathcal {I}\). By merging the above arguments, we have Eq. (90). \(\square \)

Pseudo-codes of the Recursive Products

In the optimized pseudo-code, the indices of the basis blades are represented with a binary label. This binary label is useful to optimize paths in the prefix tree. The binary label of a node is recursively computed using the binary label of its parent node. A node with a binary label \(\texttt{u}\) has its first child binary label computed by,

$$\begin{aligned} \mathrm {child\_label}(\texttt{u},\texttt{msb}) = \texttt{u} + \texttt{msb}, \end{aligned}$$
(112)

where \(+\) is the binary addition and \(\texttt{msb}\) is the binary label of the basis vector “added” to the basis blade by the outer product. So, \(\texttt{msb}\) contains only a single bit set to 1. Note that this bit set to 1 in \(\texttt{msb}\) cannot be a bit already set to 1 in \(\texttt{u}\), otherwise the parent node and its child would have the same grade.

The contribution of \(\texttt{msb}\) is the most significant bit of \(\mathrm {child\_label}(\texttt{label},\texttt{msb})\), i.e. the first bit to 1 encountered while reading the binary label from the left, which corresponds to the position of the 1-bit of \(\texttt{msb}\).

We show the pseudo-code of the optimized outer product with the definition of these functions in Algorithm 5. In this algorithm, \(\texttt{labelToMsb}\)\((\texttt{label})\) computes \(\texttt{msb}\), the most significant bit from the considered label, i.e., the first \(\texttt{1}\) encountered in the binary word \(\texttt{label}\) when reading from left to right.

figure e

We also give the pseudo-codes of the optimized left contraction, right contraction, and geometric product in Algorithms 6, 7, and 8 , respectively. The functions called inside these pseudo-codes are the same as those in Algorithm 5.

figure f
figure g
figure h

Rights and permissions

Springer Nature or its licensor holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Breuils, S., Nozick, V. & Sugimoto, A. Computational Aspects of Geometric Algebra Products of Two Homogeneous Multivectors. Adv. Appl. Clifford Algebras 33, 4 (2023). https://doi.org/10.1007/s00006-022-01249-5

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s00006-022-01249-5

Keywords

Mathematics Subject Classification

Navigation