-
Notifications
You must be signed in to change notification settings - Fork 10
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 boolean dtype #12
Conversation
what does adding bool dtypes return ? Can you add tests ? |
@prasunanand I've not added bool dtype to addition function as I think that adding won't return bool. Or if we treat 'true' + 'true' as 'true' or maybe 'false' (I'm not sure if either one is correct or not). I've added tests for bool dtype initialisation, get_dimension, get_elements. Let me know if more tests are to be added. |
Numpy gives answer as True if any of the operands in True. https://pastebin.com/0uZ928eX |
Check how Ruby treats boolean add . |
Ruby does not support boolean addition. https://pastebin.com/ke0KRcWY |
@prasunanand Should I implement boolean add then? |
Yeah |
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.
Also add test for nm + true
I'm sorry, but what is nm + true? |
nm = NMatrix.new([2,2], [true, false, true, true]) |
Got it. Thanks for clarifying. |
@prasunanand I've made changes and now nm_bool + bool works. I've added tests for it too. Also, I've noticed that subtract operation doesn't give right answer when some constant is subtracted from matrix, like
gives I'm still going through code to see how subtraction is implemented. Please have a look and let me know if this is a bug or not. |
Issue: #10
VALUE <-> bool conversion reference: https://ruby.fandom.com/wiki/C_API/Boolean_values