# Higher dimensional cross product in LinearAlgebra

**URL:** <https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919>\
**Category:** Internals & Design\
**Tags:** question, linearalgebra, math\
**Created:** [October 7, 2020, 10:53am UTC](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919 "2020-10-07T10:53:45Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![prandtl](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@prandtl](https://discourse.julialang.org/u/prandtl)\
**Post date:** [October 10, 2020, 1:04pm UTC](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919/22 "2020-10-10T13:04:38Z")

</div>

Dual vectetors and pseudovectors arent the same thing by the way.

> **[GitHub - chakravala/Grassmann.jl: ⟨Leibniz-Grassmann-Clifford⟩ multilinear...](https://github.com/chakravala/Grassmann.jl)**
>
> ⟨Leibniz-Grassmann-Clifford⟩ multilinear differential geometric algebra - GitHub - chakravala/Grassmann.jl: ⟨Leibniz-Grassmann-Clifford⟩ multilinear differential geometric algebra

[![](https://global.discourse-cdn.com/julialang/original/3X/9/2/922de804f873c7914861c50feb406108837fc134.jpeg "Differential geometric algebra foundations: Grassmann.jl Ascend") ](https://www.youtube.com/watch?v=7hlDRLEhc8o)

---

<div class="post-metadata">

**Author:** ![Orbots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orbots/32/3392_2.png) [@Orbots](https://discourse.julialang.org/u/Orbots)\
**Post date:** [October 13, 2020, 9:31pm UTC](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919/23 "2020-10-13T21:31:58Z")

</div>

Speaking for the wedge product in geometric algebra. GA typically doesn’t use covectors, what @Mason refers to a dual vectors. The basis would be present in a very concrete form rather than implied by position and type of array.

GA is most efficient with a dedicated package where something like `(1.0e₁ + 2.0e₂) ∧ 3.0e₃` is recognized. However you could do GA using `Array` and standard operators. For example, you can replace each of the `eᵢ` basis 1-blades with the pauli matrices. In that case you’d want `∧` to do the right thing. I think I’m making a case for defining `∧` in terms of other operators. In this case I’m defining it using the geometric product, where the geometric product is the standard Matrix-Matrix product.

```julia
julia> ∧(a,b) = 0.5*(a*b - b*a)
∧ (generic function with 1 method)

julia> ga = ((1.0e₁+2.0e₂)∧3.0e₃)*(1.0e₁∧1.0e₃)
Multivector{Float64,2}
⟨-3.0⟩₀ + ⟨6.0e₁₂⟩₂

julia> la = ((1.0σ₁+2.0σ₂)∧3.0σ₃)*(1.0σ₁∧1.0σ₃)
2×2 Array{Complex{Float64},2}:
 -3.0+6.0im 0.0+0.0im
  0.0+0.0im -3.0-6.0im

julia> la == -3.0I + 6.0*σ₁∧σ₂
true

```

---

<div class="post-metadata">

**Author:** ![Olof\_Salberger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olof_salberger/32/4850_2.png) [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)\
**Post date:** [October 15, 2020, 1:35am UTC](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919/24 "2020-10-15T01:35:52Z")

</div>

That’s the Weyl matrix representation of a Clifford algebra and is something entirely different. The question here was whether wedge products of n vectors that don’t have a type wrapper should return an n-dimensional antisymmetric tensor (or more generally, whether wedge products should be indexable as such).

In that case, covariance vs contravariance matters. The Weyl representation on the other hand would represents our original set of vectors (and arbitrary Clifford basis elements) as matrices acting on a spinor representation.

I don’t think LinearAlgebra should support Clifford algebras/GA out of the box using the euclidean dot product as a default, because LinearAlgebra.dot() is not a quadratic form for Complex vectors (it takes the complex conjugate of the first vector) and so would break the algebra in that case, and if there is no natural choice of a default dot product, there’s a very wide range of choices of quadratic form that are all useful (for example, in real 4d, the metrics with signature + + + +, + + + -, and + + - - are all very commonly used). Better to leave that to packages.

However, all such packages could safely use/extend the LinearAlgebra wedge product though, since the wedge product is uniquely defined for any vector space without dependence on metric, and including it in the extended standard library would be for standardization between packages, and attempt to avoid a situation where people have to worry about whether they are importing PackageA.(∧) or PackageB.(∧) .

---

<div class="post-metadata">

**Author:** ![Orbots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orbots/32/3392_2.png) [@Orbots](https://discourse.julialang.org/u/Orbots)\
**Post date:** [October 15, 2020, 2:02am UTC](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919/25 "2020-10-15T02:02:28Z")

</div>

> [@Orbots](#):
>
> I think I’m making a case for defining `∧` in terms of other operators.

not suggesting this

> [@Olof\_Salberger](#):
>
> I don’t think LinearAlgebra should support Clifford algebras/GA out of the box

what “those other operators” could be would require someone with knowledge of how tensors and geometric/clifford products are related.

I agree that any `∧` in base or LinearAlgebra should be as slim as possible and not make any assumptions. For example I’d prefer if `∧(a::Array, b::Array)` wasn’t even implemented concretely, as it lacks context. Although it could be imagined to have a reasonable value under GA since it’s a metric independent operator. But yeah, supporting GA in LinearAlgebra would be madness.

---

<div class="post-metadata">

**Author:** ![OliverEvans96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oliverevans96/32/4177_2.png) [@OliverEvans96](https://discourse.julialang.org/u/OliverEvans96)\
**Post date:** [October 15, 2020, 3:33pm UTC](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919/26 "2020-10-15T15:33:41Z")

</div>

@chakravala replied to this post on Reddit:

[https://www.reddit.com/r/Julia/comments/jbonra/higher\_dimensional\_cross\_product\_post\_banned\_on/](https://www.reddit.com/r/Julia/comments/jbonra/higher_dimensional_cross_product_post_banned_on/)

---

<div class="post-metadata">

**Author:** ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)\
**Post date:** [October 20, 2020, 3:08am UTC](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919/27 "2020-10-20T03:08:48Z")

</div>

(post deleted by author)

[Previous page](https://discourse.julialang.org/t/higher-dimensional-cross-product-in-linearalgebra/47919.md?page=1)
