Computing Inverse of a stack of matrices

An alternative to StaticArrays is my Grassmann.jl package, which can do multi-linear algebra without ever defining higher order array interfaces. Newly released v0.6 deprecated StaticArrays

using Grassmann, StaticArrays
A = rand(SMatrix{3,3,Float64},1000,4);
B = Chain{ℝ3,1,Chain{ℝ3,1}}.(A);

The tests show that Chain{V,1,Chain{V,1}} is a bit slower at inv than SMatrix, yet it is actually many times faster at computing determinants as the det timing test shows:

julia> @btime inv.($A);
  128.939 μs (4002 allocations: 593.83 KiB)

julia> @btime inv.($B);
  181.841 μs (4002 allocations: 906.33 KiB)

julia> @btime det.($A);
  92.142 μs (4002 allocations: 93.83 KiB)

julia> @btime det.($B);
  14.172 μs (2 allocations: 31.33 KiB)

As you can see, Grassmann algebra provides a foundation (entirely independent of StaticArrays) for doing multi-linear algebra. It also is faster for some other methods like \ linear solve method.

Instead of using a traditional StaticArray interface, the Grassmann foundation is used. This is represented with a different memory layout, which can be used in interesting ways.

I’m sure there are many more optimizations possible on Grassmann in the future.