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 Reals set #1686
Add Reals set #1686
Conversation
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.
Thanks for sending this PR. Got a couple of questions
symengine/sets.cpp
Outdated
@@ -233,6 +233,46 @@ vec_basic Interval::get_args() const | |||
return {start_, end_, boolean(left_open_), boolean(right_open_)}; | |||
} | |||
|
|||
RCP<const Set> Reals::set_intersection(const RCP<const Set> &o) const | |||
{ | |||
return o; |
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.
o
could have complex values right?
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.
Thanks for pointing this out. I'll try to figure out how to do this. Ideas on how to handle complex numbers are welcome. I am thinking:
Interval, Empty - Must be real and can be handled as currently
FiniteSet - Can contain complex numbers. Could be handled directly
all others - Can contain complex numbers so create Intersection object
symengine/sets.cpp
Outdated
|
||
RCP<const Set> Reals::set_union(const RCP<const Set> &o) const | ||
{ | ||
return reals(); |
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.
Same here
Thanks! There is a failure in https://travis-ci.org/github/symengine/symengine/jobs/727822895:
Not sure if it is related to this PR? |
The test failure seems to be related to this PR. I reverted and ran the tests without fail. I will try to resolve it. |
I see that I also missed adding Reals to is_a_Set. I'll do that. |
Hi, I've run clang-format and found that the code formatting is good. Thanks for fixing the formatting. |
I have
|
I see the code formatting issue. Is this fixed automatically or should I fix manually? |
You have to manually apply the commands from the message. |
symengine/sets.cpp
Outdated
if (is_a<Reals>(*o)) { | ||
set_basic container; | ||
for (const auto &elem : container_) { | ||
if (is_a<Complex>(*elem)) { |
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.
Instead of checking if the value is a complex number here, we should check if the value is not a real number. For eg: symbols should be considered complex since we don't know what the value is going to be.
Thanks for your patience! I have updated again:
The intersection doesn't fully work because of missing functionality in the |
Now also the code coverage check passes. Are we good to go? |
Thanks for the PR |
Implementation of the set of real numbers: Reals.