We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The overload dot(x::Adjoint, y::Adjoint) assumes that the number eltypes of the inputs commute under multiplication, so that dot(x', y') == sum(x .* y') == conj(sum(x' .* y)) == conj(dot(x, y)) https://github.com/JuliaLang/julia/blob/1aac07efe44c229abf41b9c50031783f46bed4bf/stdlib/LinearAlgebra/src/generic.jl#L889
dot(x::Adjoint, y::Adjoint)
dot(x', y') == sum(x .* y') == conj(sum(x' .* y)) == conj(dot(x, y))
For numbers that don't commute under multiplication (like Quaternions), this definition is incorrect. A short demo:
julia> using Quaternions, LinearAlgebra julia> mydot(x, y) = mapreduce(mydot, +, x, y); # define our own recursive dot function julia> mydot(x::Number, y::Number) = dot(x, y) julia> x = [quatrand() for _ in 1:2, _ in 1:2]; julia> y = [quatrand() for _ in 1:2, _ in 1:2]; julia> dot(x, y) ≈ mydot(x, y) # fine true julia> dot(transpose(x), transpose(y)) ≈ mydot(transpose(x), transpose(y)) # fine true julia> dot(x', y') ≈ mydot(x', y') # uh-oh false julia> method = @which dot(x', y') dot(x::Adjoint, y::Adjoint) in LinearAlgebra at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/generic.jl:922 julia> Base.delete_method(method) julia> dot(x', y') ≈ mydot(x', y') # all good true
This could be handled by restricting the types to Union{Real,Complex}, e.g.
Union{Real,Complex}
dot(x::Adjoint{Union{Real,Complex}}, y::Adjoint{Union{Real,Complex}}) = conj(dot(parent(x), parent(y)))
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
The overload
dot(x::Adjoint, y::Adjoint)
assumes that the number eltypes of the inputs commute under multiplication, so thatdot(x', y') == sum(x .* y') == conj(sum(x' .* y)) == conj(dot(x, y))
https://github.com/JuliaLang/julia/blob/1aac07efe44c229abf41b9c50031783f46bed4bf/stdlib/LinearAlgebra/src/generic.jl#L889
For numbers that don't commute under multiplication (like Quaternions), this definition is incorrect. A short demo:
This could be handled by restricting the types to
Union{Real,Complex}
, e.g.The text was updated successfully, but these errors were encountered: