Julia: inv(transpose(X)) missing a method?

Created on 20 Aug 2018  路  4Comments  路  Source: JuliaLang/julia

On 0.7/1.0 I am seeing the following issue:

julia> X = [0.707107 0.707107 0.0; 0.707107 -0.707107 0.0; 0.0 0.0 1.0];

julia> inv(Array(transpose(X))) # Works

julia> inv(transpose(X))
ERROR: LoadError: MethodError: no method matching transpose(::LinearAlgebra.LDLt{Float64,LinearAlgebra.SymTridiagonal{Float64,Array{Float64,1}}})

It should probably be possible to just invert this type of matrix.

bug linear algebra

Most helpful comment

I agree that we should support this operation. We probably need to enable general testing of Transpose and Adjoint in the test suite (which unfortunately will make the linear algebra tests even slower.)

All 4 comments

I agree that we should support this operation. We probably need to enable general testing of Transpose and Adjoint in the test suite (which unfortunately will make the linear algebra tests even slower.)

This is not the first case of missing methods with Adjoint/Transpose types in the LinearAlgebra package (see e.g. issues #28714 and #27132, the latter being fixed in PR #27916).

As for tests to add, there seems to be quite a few. A quick grep indicates that the following LinearAlgebra test files do not even contain the word transpose

cholesky.jl
eigen.jl
hessenberg.jl
pinv.jl
special.jl
structuredbroadcast.jl
trickyarithmetic.jl

(They might not include tests for adjoints either but grep is less helpful there.)

Could there be a way to automatically add tests for Adjoint/Transpose types whenever a test involves a matrix? Using some kind of modified @test macro perhaps?

From Discourse: inv(transpose(reshape([3.0], 1, 1))) also fails, but with ERROR: MethodError: no method matching ldiv!(::Float64, ::Array{Float64,2}).

This issue seems to be solved, right?

On Julia 1.1.1:

X = [0.707107 0.707107 0.0; 0.707107 -0.707107 0.0; 0.0 0.0 1.0];
inv(transpose(X))

Result:

3脳3 LinearAlgebra.Transpose{Float64,Array{Float64,2}}:
  0.707107   0.707107  0.0
  0.707107  -0.707107  0.0
 -0.0       -0.0       1.0
Was this page helpful?
0 / 5 - 0 ratings

Related issues

tkoolen picture tkoolen  路  3Comments

manor picture manor  路  3Comments

i-apellaniz picture i-apellaniz  路  3Comments

dpsanders picture dpsanders  路  3Comments

wilburtownsend picture wilburtownsend  路  3Comments