Open ericphanson opened 5 years ago
Basically we haven't provided overloads for all the functions in LinearAlgebra
for all the relevant types... it's typically a matter of chipping away at this.
+1
It would also be great to add support for Symmetric
. I am working on a new package for forecasting and having it would be great to speed up many calculations.
We'd be really happy to merge some code to make Symmetric
(and Hermitian
) work better in various cases. To give some quick hints on how this could be fixed (we accept PRs ;-) ):
sqrt(m::StaticMatrixLike{T})
to dispatch to an internal _sqrt
implementation rather than dispatching on m::StaticMatrix
._sqrt
for the various types. There's a few general strategies which could be used:
drop_sdims(MMatrix(M))
(or maybe just a normal Matrix
) and pass to Base to do the hard work (see, eg, the svd
implementation). On the way back out, use similar_type
to wrap the results in an appropriate static array type, preserving the static array size and type where possible. Or try the option of using Base.invoke
to force use of the AbstractMatrix
fallback here.LinearAlgebra
, modifying where necessary to make it work for statically sized arrays. If you want to go really fast for small sizes possibly create an entirely unrolled version (see, eg, the lu()
implementation). This has the advantage of allowing optimizations for small sizes, but the disadvantage that we share less code with Base and being a lot more work, especially in tuning. Try this option if you want an adventure!
I hope this isn't a duplicate; I couldn't find an issue though. Here's an example:
As you can see, it works without the
Hermitian
wrapper, and it also works in the real case. I will just not use the Hermitian wrapper, but I thought maybe the problem should be noted somewhere.