-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Poor performance for dot(::RowVector, ::RowVector) #487
Comments
See also the discussion in JuliaLang/julia#22220 about whether (I'm skeptical of this proposal, as I explained on the mailing list, but it is a possibility.) |
I don't think that's my proposal as I agree it should return a number. Perhaps |
Sorry for misunderstanding you. @dlfivefifty, In any case, if we agree that |
Good point. for |
Can you explain more clearly why it should return |
My definition indeed gives @garrison, one simple reason is that your suggested Another way to see it is to consider the case where |
How about |
Probably the most efficient thing (to be non-allocating in as many cases as possible) would be something like: dot(x::RowVector, y::RowVector) = dot(transpose(x), transpose(y))
dot(x::RowVector{<:Number,<:ConjArray}, y::RowVector{<:Number,<:ConjArray}) = dot(adjoint(y), adjoint(x)) with a similar optimization for |
I assume it will also make sense to have |
@garrison, I don't think so. |
@stevengj Since |
Yes it should be closed: julia> a = rand(5)
5-element Array{Float64,1}:
0.027497381913224928
0.47043712559107065
0.22305578781443836
0.24976730756765697
0.27624822089770085
julia> dot(a',a')
0.41051786710273175 |
It hits the fallback
|
We should have
dot(x::RowVector, y::RowVector) = dot(transpose(x), transpose(y))
(see mailing list). Mathematically, an inner product on a vector space induces an inner product on the dual space, so this seems unambiguous to me.The text was updated successfully, but these errors were encountered: