-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
re-allow vector*(1-row matrix) and transpose thereof #20423
Changes from 1 commit
7f977ed
30f9cd1
9e24fbf
b799c16
c7ad5e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,12 +154,9 @@ end | |
sum(@inbounds(return rowvec[i]*vec[i]) for i = 1:length(vec)) | ||
end | ||
@inline *(rowvec::RowVector, mat::AbstractMatrix) = transpose(mat.' * transpose(rowvec)) | ||
*(vec::AbstractVector, mat::AbstractMatrix) = throw(DimensionMismatch( | ||
"Cannot left-multiply a matrix by a vector")) # Should become a deprecation | ||
*(::RowVector, ::RowVector) = throw(DimensionMismatch("Cannot multiply two transposed vectors")) | ||
@inline *(vec::AbstractVector, rowvec::RowVector) = vec .* rowvec | ||
*(vec::AbstractVector, rowvec::AbstractVector) = throw(DimensionMismatch("Cannot multiply two vectors")) | ||
*(mat::AbstractMatrix, rowvec::RowVector) = throw(DimensionMismatch("Cannot right-multiply matrix by transposed vector")) | ||
|
||
# Transposed forms | ||
A_mul_Bt(::RowVector, ::AbstractVector) = throw(DimensionMismatch("Cannot multiply two transposed vectors")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this implemented somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So you want to allow this one too, Steven? In this case it would return a matrix, another generalized form of the outer product. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @StefanKarpinski, yes, it is implemented and I included a test: it falls back on the generic matrix×matrix since |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this method didn't previously exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did. AFAICT, it had a similar implementation modulo inlining. (I have trouble with the mobile version of GitHub, sorry).