- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 14
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 #302
Comments
Is |
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, JuliaLang/julia#6057, and JuliaLang/julia#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:https://github.com/JuliaLang/julia/blob/70477b7e5cec35910237c3277ef004b31c90ea3f/base/linalg/generic.jl#L278-L287
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: