First off, does anybody know of an existing implementation of the wedge product in Julia? I performed a pretty expensive search and came up empty.
For my application I need to compute
\wedge_{i=1}^{n-1}\boldsymbol{v}_i,\quad\boldsymbol{v} \in \mathbb{R}^n
I know that the i^{\mathrm{th}} element of the wedge product can be computed as the cofactor of the (n,i) entry of M, where M is defined as
M= \begin{bmatrix} \boldsymbol{v}_1^{\top}\\ \vdots \\ \boldsymbol{v}_{n-1}^\top \\ \boldsymbol{1}^\top \end{bmatrix}
Currently, I’ve implemented this as
using LinearAlgebra
using RecursiveArrayTools
function wedge(v::AbstractArray{T}) where {T<:AbstractArray}
n = length(v[1])
M = VectorOfArray(v)'
T([ (-1)^(n+j)*det(M[:,filter(x->x≠j,collect(1:n))]) for j ∈ 1:n] )
end
For n=3, the wedge product should be equivalent to the cross product.
n = 3
data = [rand(n) for i ∈ 1:n-1]
maximum(abs.(wedge(data) - cross(data...))) # 2.7755575615628914e-17
However, this seems horribly inefficient for when n is large as the determinate of an n-1\times n-1 is computed n times.
Does anybody know of a more eloquent approach? One thought is to decompose M into a form where computing the determinate is trivial, e.g. LU decomposition, and then perform rank-1 updates.