Repository navigation
Computation between scalars - #358
Conversation
|
This is ready for review if anybody wants to take a look. I plan to merge this PR in a week or so if there's no feedback. I think a useful way to review this would be to try it out and compare to how you expect computation between scalars to behave. |
|
Thanks for looking @jim22k! There's one thing I almost forgot: docstrings! I will add docstrings to the new methods on Scalar before I merge. |
|
@jim22k, there's one more edge case for Scalar computation that I want to bring attention to.
All other scalar dunder methods (such as What should we do for infix and prefix operators for scalars? Should they always return GrB_Vector_eWiseAdd_BinaryOp((GrB_Vector)s, NULL, GrB_PLUS_FP64, GrB_PLUS_FP64, (GrB_Vector)t, (GrB_Vector)u, NULL);Also note that In summary, this PR currently matches old behavior to be backwards compatible, and otherwise infix methods return expressions to match with Vector and Matrix. This may be surprising at times, so we should consider being backwards incompatible. I want to come to consensus on this before merging. |
|
Here's my current position regarding the previous comment:
|
|
The changes ( If for some reason we wanted to change the behavior of They also aren't locked out of doing element-wise equality. They would just have to use the non-infix notation, which makes it explicitly clear what is being asked for (i.e. |
|
Perfect, thanks so much @jim22k for the careful consideration. I agree with everything you said, so sounds like we're in agreement! Now I just need to add those docstrings... |
|
This is in 🎉 🚀 🎉 ! This ended up being a bigger PR than I expected, but it makes a lot of improvements, and operations with scalars seems pretty nice. |
|
btw, one of the misc things added in this PR is running Pylint sometimes in CI. It is only informational--it doesn't fail the CI job. Pylint is actually how I learned awkward 2 is out and we needed to update (another misc update done in this PR), so I think it can actually be a useful check. I'm tempted to allow it to fail PRs, but let's do a "dry run" for now to see how it goes. |
Closes #199.
This is almost ready. It turns out we had most of the machinery already to support computation between scalars. I need to finish
scalar.selectand go over everything carefully one more time.I discovered that
expr.dupdidn't matchobj.dup, so I added tests to verify that signatures and docstrings match between expressions and objects.A good wayto review this may be to check it out locally and try it out.