-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inv(::StaticMatrix) should always return StaticMatrix #34
Conversation
Currently, `inv(SMatrix{4, 4}(rand(Float32, 4, 4)))` returns an `Array{T, Float32}`. I think it should return a `SMatrix{4, 4}`.
Currently only up to 3x3 returns Not that this PR is a bad idea at all, just I was hoping to either have a specialised algorithm (maybe just 4x4) or a way of avoiding the extra allocations within Julia to make it a bit speedier. |
By the way, this method was copied from Base. |
Other opinions? @c42f @SimonDanisch |
As for this PR, I think it's good to make the output type |
Let's see if we can get JuliaLang/LinearAlgebra.jl#370 fixed quickly, or else write our own workarounds. Then @c42f Do you think preserving immutability is very important? Preserving the static size, yes, but from a performance perspective the problem is largely the allocation and GC which is the same either way (an allocation is done in the working code in |
Hmm, well type inference should be fine either way. Performance-wise, forcing a copy into an To me it's just more consistent at the API level if the output type is always an
I dunno, the size dependent behaviour just seems a bit unfortunate. |
Very true. |
At the moment this returns a |
I think the underlying issue here has been solved for some time. |
clean up tied indices
Currently,
inv(SMatrix{4, 4}(rand(Float32, 4, 4)))
returns anArray{Float32, 2}
.I think it should return a
SMatrix{4, 4}
.