Merged
Conversation
Member
Author
|
@prasunanand I've raised SyntaxError if greater or lesser comparison is done on complex numbers as Ruby also does not support this for Complex type. But, numpy supports it (Python complex doesn't) by doing a comparison on real part and then on imaginary. Should I keep it this way or change it to work like numpy? Or I could make comparison based on the magnitude of complex numbers. Ruby Complex example [1] pry(main)> a = 2+3i
=> (2+3i)
[2] pry(main)> b = 23i
=> (0+23i)
[3] pry(main)> b = 2+3i
=> (2+3i)
[4] pry(main)> a == b
=> true
[5] pry(main)> b = 2+4i
=> (2+4i)
[6] pry(main)> a < b
NoMethodError: undefined method `<' for (2+3i):Complex
from (pry):6:in `__pry__'numpy complex128 example >>> import numpy as np
>>> a = np.array([2+3j, 2+4j])
>>> a[0]
(2+3j)
>>> a[1]
(2+4j)
>>> a[0] == a[1]
False
>>> a[0] < a[1]
True
>>> a[0] = 4+2j
>>> a[0] < a[1]
False
>>> a[1] = 2+100j
>>> a[0] < a[1]
False |
Member
|
When in doubt, go the numpy way :) |
Member
Author
|
@prasunanand this PR is complete from my end. Please review it when free. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed compiler warnings for sparse.c. Also, fixed a switch statement typo.
To prevent the nesting of switch(input->sptype) and switch(input->dtype), I passed the input->dtype to get_dense_from_* functions.
Will also fix compiler warnings for remaining files.