-
-
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
Generic vecdot requires dot be implemented for scalars #14781
Comments
Is Line 214 in 70477b7
norm .
|
JuMP types aren't subtypes of number AIUI, they're numberlike containers but inheriting from Number would result in too many behaviors that aren't all wanted. There have been other issues that mentioned having an AbstractScalar above Number in the hierarchy. |
Yes not a number. |
See https://groups.google.com/forum/#!topic/julia-users/cPZnKPK4Hbw, #6057, and #11067 for the origins of this behavior. @stevengj has determined how these functions work so we should hear him about ideas here. |
|
Tidying up old issues/PRs. |
The definition of
vecdot
(and its documentation) requires that user types definedot
for scalars, instead of*
like I would have guessed:julia/base/linalg/generic.jl
Lines 278 to 287 in 70477b7
I'm not sure what case this is expected to handle, but it increases the burden on people defining custom types, as in addition to multiplication (e.g.
*(MyType,Number)
and*(Number,MyType)
) users must also define an analogousdot
just for this case (and in the case of JuMP, where we have multiple types, all the other interaction terms).I'm wondering if its too general. If the current functionality is desirable, then perhaps a generic
dot(x::Any,y::Any) = x*y
could be defined as a fallback?The text was updated successfully, but these errors were encountered: