Closed dlfivefifty closed 7 months ago
Base.literal_pow should be overloaded so that Q^2 works, i.e., we want the following to not error:
Base.literal_pow
Q^2
julia> Q = qr(randn(5,5)).Q 5×5 LinearAlgebra.QRCompactWYQ{Float64, Matrix{Float64}, Matrix{Float64}} julia> Q*Q 5×5 Matrix{Float64}: -0.908458 0.15328 0.171023 0.346546 0.0431982 -0.0574299 0.850477 -0.260641 -0.419498 0.171693 0.0887003 0.307879 0.330109 0.0439806 -0.886813 0.381531 0.369071 0.5402 0.521318 0.393233 0.134058 0.148969 -0.70854 0.655912 -0.166092 julia> Q^2 ERROR: MethodError: no method matching ^(::LinearAlgebra.QRCompactWYQ{Float64, Matrix{Float64}, Matrix{Float64}}, ::Int64) Closest candidates are: ^(::Regex, ::Integer) @ Base regex.jl:863 ^(::Missing, ::Integer) @ Base missing.jl:165 ^(::Missing, ::Number) @ Base missing.jl:123 ... Stacktrace: [1] literal_pow(f::typeof(^), x::LinearAlgebra.QRCompactWYQ{Float64, Matrix{Float64}, Matrix{Float64}}, ::Val{2}) @ Base ./intfuncs.jl:351 [2] top-level scope @ REPL[177]:1
Base.literal_pow
should be overloaded so thatQ^2
works, i.e., we want the following to not error: