-
-
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
add functors SubFun, DivFun, and PowFun #12322
Conversation
needs tests - Line 9 in a3f0605
|
tests added |
One minor point: we really have three division functions: |
What about |
Those names seem better. |
Since this is just a minor change. I will merge this tomorrow, if there's no objection. |
I'm not sure if these two PRs affect each other in any way, but you might want to note the candidate introduction of I suspect there will be some who would be happy about avoiding |
I think #12292 can be addressed using |
Yes, if we only want to cover a fixed list of operations, indeed we can just use manually-defined functors rather than going the parametric route. |
add functors SubFun, DivFun, and PowFun
You may add a functor for |
Why not add a parametric |
At least my objection for adding something parametric on a symbol defined in
|
I didn't mean for it to be symbol based: I meant use existing functors as parameters, eg |
I wonder whether @simonbyrne was asking whether Lines 43 to 98 in db8b4ee
call(::MulFun, x, y) = x * y into call(::DotMulFun, x, y) = x .* y ?
|
This does sound more reasonable.
But, yeah, this is why I didn't think this is what you meant... |
Maybe somethign like this: call{F<:ScalarFunctor}(Dot{F}, v::Vector, w::Vector) = [F(v[i],w[i]) for i=1:length(v)] but, you know the actual general version (probably using broadcast). |
Several basic functors (subtraction, division, and power) are currently missing (which should be an oversight). This PR adds them.
These functors will be useful in the Sparse module. Since this is a very quick-fix, I make a quick PR for this, instead of putting these small changes to the SparseVector PR (which might take a relatively long time to get merged).