-
-
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
Naive fix for #13171 #17075
Naive fix for #13171 #17075
Conversation
@@ -293,7 +293,7 @@ fldmod1{T<:Real}(x::T, y::T) = (fld1(x,y), mod1(x,y)) | |||
fldmod1{T<:Integer}(x::T, y::T) = (fld1(x,y), mod1(x,y)) | |||
|
|||
# transpose | |||
transpose(x) = x | |||
transpose(x) = error("transpose not implemented for $(typeof(x)). Consider permutedims.") |
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.
Why is this an error
and not something like ArgumentError
? I thought we were trying to move away from error()
?
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.
No reason beyond mimicking
julia/base/abstractarraymath.jl
Lines 9 to 10 in 9a66205
ctranspose(a::AbstractArray) = error("ctranspose not implemented for $(typeof(a)). Consider adding parentheses, e.g. A*(B*C') instead of A*B*C' to avoid explicit calculation of the transposed matrix.") | |
transpose(a::AbstractArray) = error("transpose not implemented for $(typeof(a)). Consider adding parentheses, e.g. A*(B*C.') instead of A*B*C' to avoid explicit calculation of the transposed matrix.") |
ArgumentError
, and if so should I change the linked definitions to ArgumentError
s as well? Thanks for reviewing! :)
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.
I think we should keep this PR self-contained for now - you can always open a PR for those others later. But yeah, I think something like ArgumentError
is more useful than error()
.
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.
Cheers, revised to throw
an ArgumentError
. Thanks!
Ideally it should be a |
I think packages will hit this more often. @JeffBezanson was also not happy about adding a lot of no-op As a follow up on the last comment, I'll mention that I'm trying to rebase my transpose immutable branch and realized that the |
+1 to decoupling speciously coupled concepts! |
Let's then try to remove the definitions for |
…ew missing `transpose` methods and correct a test that failed for lack of a `transpose` method.
Done. Thoughts? Thanks and best! |
Looks like |
Points for CI. What say you now, Travis? |
This needs to be a deprecation, not an immediate error. |
Thanks for the review and merge! |
Ref #13171. This fix's simplicity has me convinced that I'm either missing something or made a mistake.