diff --git a/stdlib/LinearAlgebra/src/rowvector.jl b/stdlib/LinearAlgebra/src/rowvector.jl index 1b63a35d70625..493e19b8f46d0 100644 --- a/stdlib/LinearAlgebra/src/rowvector.jl +++ b/stdlib/LinearAlgebra/src/rowvector.jl @@ -60,3 +60,7 @@ struct RowVector{T,V<:AbstractVector} <: AbstractMatrix{T} end end const ConjRowVector{T,CV<:ConjVector} = RowVector{T,CV} + +# Issue #24590: an inner product on a vector space induces an inner product on the dual space. +dot(x::Transpose{<:AbstractVector{<:Number}}, y::Transpose{<:AbstractVector{<:Number}}) = dot(transpose(x), transpose(y)) +dot(x::Adjoint{<:AbstractVector{<:Number}}, y::Adjoint{<:AbstractVector{<:Number}}) = dot(adjoint(y), adjoint(x)) # note order (y,x): this is to get the correct conjugation \ No newline at end of file diff --git a/stdlib/LinearAlgebra/test/adjtrans.jl b/stdlib/LinearAlgebra/test/adjtrans.jl index 9dd5b068a5dcd..5fc73ac47e576 100644 --- a/stdlib/LinearAlgebra/test/adjtrans.jl +++ b/stdlib/LinearAlgebra/test/adjtrans.jl @@ -460,4 +460,12 @@ end @test B == A .* A' end +@testset "Issue #24590" begin + for T in (Transpose, Adjoint) + @test dot(T([1, 2, 3, 4]), T([2, 3, 6, 10])) == 66 + @test dot(T([1, 2, 3, 4]), (1+2im)*T([2, 3, 6, 10])) == (1+2im)*66 + @test dot((1+2im)*T([1, 2, 3, 4]), T([2, 3, 6, 10])) == (1-2im)*66 + end +end + end # module TestAdjointTranspose