Skip to content
New issue

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

RowVector issue #24590 #26992

Closed
wants to merge 2 commits into from
Closed

RowVector issue #24590 #26992

wants to merge 2 commits into from

Conversation

alexandrebrilhante
Copy link
Contributor

I've worked on issue JuliaLang/LinearAlgebra.jl#487 to include @stevengj's fix for dot(x::RowVector, y::Vector).

@fredrikekre fredrikekre added the linear algebra Linear algebra label May 5, 2018
@fredrikekre
Copy link
Member

RowVector is deprecated, so this should presumably instead be defined for Adjoint and Transpose (you can use the typealias AdjOrTransAbsVec which includes all Adjoint and Transpose wrapped AbstractVector).

@stevengj
Copy link
Member

stevengj commented May 5, 2018

Thanks!

First, however, realize that the RowVector is deprecated in favor of Adjoint and Transpose types as of #25217, so you'll actually want methods on those types. Something like:

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

Second, the test shouldn't be in a separate file, though. Just add a few tests to stdlib/LinearAlgebra/test/adjtrans.jl. You'll need to test both Transpose and Adjoint, and make sure that it does the conjugation in the correct argument. For example

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants