tomtom
1
Hello, may have found a bug about inv() and transpose():
julia> mat = reshape([1.0 2.0; 3.0 4.0], 2, 2)
2×2 Array{Float64,2}:
1.0 2.0
3.0 4.0
julia> inv(mat)
2×2 Array{Float64,2}:
-2.0 1.0
1.5 -0.5
julia> inv(transpose(mat) )
2×2 Array{Float64,2}:
-2.0 1.5
1.0 -0.5
julia> mat1 = reshape([3.0], 1, 1)
1×1 Array{Float64,2}:
3.0
julia> inv(mat1)
1×1 Array{Float64,2}:
0.3333333333333333
julia> inv(copy(transpose(mat1) ) )
1×1 Array{Float64,2}:
0.3333333333333333
julia> inv(transpose(mat1) )
ERROR: MethodError: no method matching ldiv!(::Float64, ::Array{Float64,2})
cdsousa
2
Either my basic math is failing miserably or that result is exactly correct…
(Edit: Sorry, forget it please, my browser was hiding the last command.)
DNF
3
I suggest editing your post to break out this last line. It is very easy to miss right now.
Per
4
A fix would be to define:
LinearAlgebra.ldiv!(a::Number, B::AbstractVecOrMat) = ( B ./= a )
1 Like
The same issue is present for adjoint
and @Per’s suggestion also fixes that.
This is related to (but not exactly the same as the first issue mentioned at) https://github.com/JuliaLang/julia/issues/28782