# Grassmann.jl A\\b 3x faster than Julia's StaticArrays.jl

**URL:** https://discourse.julialang.org/t/grassmann-jl-a-b-3x-faster-than-julias-staticarrays-jl/41451
**Category:** Performance
**Tags:** package, announcement, array
**Created:** [June 15, 2020, 4:12pm UTC](https://discourse.julialang.org/t/grassmann-jl-a-b-3x-faster-than-julias-staticarrays-jl/41451 "2020-06-15T16:12:53Z")
**Posts on this page:** 1
**Showing post:** 35

<div class="post-metadata">

### Author: ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)
#### Post date: [August 14, 2020, 8:13pm UTC](https://discourse.julialang.org/t/grassmann-jl-a-b-3x-faster-than-julias-staticarrays-jl/41451/35 "2020-08-14T20:13:03Z")

</div>

> [@PetrKryslUCSD](#):
>
> Except that it appears to be faster for small matrices.

This was because of a special explicit case for dimensions 1 and 2 and 3, which are now accounted for in Grassmann.jl also.

Also, support has been added for Moore-Penrose inverses for underdetermined and overdetermined linear systems. For underdetermined cases, the exterior product algorithm works ~20x faster than the `SMatrix` algorithm, and it is numerically stable. For overdetermined equations, the method used is based on the traditional normal equations, and this is prone to more numerical instability.

Hence, underdetermined systems are faster and numerically stable with Grassmann.jl than StaticArrays.jl, while over determined systems have a fast method which isn’t quite as numerical stable.

```Julia
julia> @btime vandermonde(Chain(0.2,0.3,0.4,0.5,0.6),Chain(0.2,0.234,0.315,0.465,0.7),ℝ3)
  151.526 ns (3 allocations: 432 bytes)
0.36140000000000005v₁ - 1.4604285714285716v₂ + 3.364285714285713v₃

```

In addition to that, a `vandermonde` feature as been added for Vandermonde constructors, to help make polynomial fitting very very fast. I have some more plans for polynomial fitting and linear algebra in the future, as well as other basis calculations.

 ![Screenshot_2020-08-14_16-24-14](https://global.discourse-cdn.com/julialang/original/3X/f/0/f0dcdf0746c43b6e6e78f48a95607c536ae82a27.png)

Also, if you load `UnicodePlots` then you can add a 4th argument with number of plot points to see.

---

_[View the full topic](https://discourse.julialang.org/t/grassmann-jl-a-b-3x-faster-than-julias-staticarrays-jl/41451)._
