-
Notifications
You must be signed in to change notification settings - Fork 65
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
Logic Classes and Sets #168
Conversation
symengine/lib/symengine_wrapper.pyx
Outdated
cdef Boolean e_ | ||
for e in args: | ||
e_ = sympify(e) | ||
s.insert(e_.thisptr) |
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.
@isuruf Why isn't insert
identified as a part of set_boolean
?
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.
Ping @isuruf.
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.
What do you mean by that?
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.
The builds fail because of the following error:
Cythonizing symengine_wrapper.pyx
Error compiling Cython file:
------------------------------------------------------------
...
def logical_and(*args):
cdef symengine.set_boolean s
cdef Boolean e_
for e in args:
e_ = sympify(e)
s.insert(e_.thisptr)
^
------------------------------------------------------------
C:\projects\symengine-py-l1jmr\symengine\lib\symengine_wrapper.pyx:3043:9: Object of type 'set_boolean' has no attribute 'insert'
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.
Since it says it is not defined, you have to define it in the pxd file
14e0256
to
8b1e426
Compare
4c0f4f2
to
352be01
Compare
@isuruf I'm out of ideas on fixing the current build failure. Can you please take a look, and suggest what can be done? |
Here is the relevant line, symengine.py/symengine/lib/symengine.pxd Line 43 in b409536
Similar line, symengine.py/symengine/lib/symengine.pxd Line 54 in b409536
|
@isuruf Those changes have already been applied. I was referring to the current build failure (the output was too big to post here), which you can view in the |
17eca44
to
11b40df
Compare
symengine/lib/symengine.pxd
Outdated
@@ -203,7 +206,7 @@ cdef extern from "<symengine/basic.h>" namespace "SymEngine": | |||
ctypedef map[RCP[Integer], unsigned] map_integer_uint "SymEngine::map_integer_uint" | |||
cdef struct RCPIntegerKeyLess | |||
cdef struct RCPBasicKeyLess | |||
ctypedef set[RCP[const_Basic], RCPBasicKeyLess] set_basic "SymEngine::set_basic" | |||
ctypedef set[RCP[Basic], RCPBasicKeyLess] set_basic "SymEngine::set_basic" |
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.
Why this change? Might be the issue
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.
I was getting this error without the above change:
Cythonizing symengine_wrapper.pyx
Error compiling Cython file:
------------------------------------------------------------
...
def finiteset(*args):
cdef symengine.set_basic s
cdef Basic e_
for e in args:
e_ = sympify(e)
s.insert(e_.thisptr)
^
------------------------------------------------------------
C:\projects\symengine-py\symengine\lib\symengine_wrapper.pyx:3922:19: Cannot assign type 'RCP[const Basic]' to 'RCP[const_Basic]'
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.
Cast e_.thisptr
to RCP[const_Basic]
instead of the above change.
e7db1df
to
58dbfa5
Compare
fca3ca6
to
1326a2d
Compare
@isuruf Can you help me in getting this sorted out? |
cdef Basic e_ | ||
for e in args: | ||
e_ = sympify(e) | ||
s.insert(<RCP[symengine.const_Basic]>(e_.thisptr)) |
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.
@isuruf This is still failing.
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.
The failure now is not because of that. Open symengine_wrapper.cpp
and see which line from symengine_wrapper.pyx
is causing the problem. You can find the line by scrolling above and looking for the first comment.
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.
@ShikharJ, what did you get?
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.
I was referring to the errors in the current log. This is fixed. The issues are only arising while running tests.
Ping @isuruf. |
5c3a9d8
to
ea09ced
Compare
@isuruf Can you help me in fixing the errors? |
symengine/lib/symengine_wrapper.pyx
Outdated
@@ -182,6 +182,34 @@ cdef c2py(RCP[const symengine.Basic] o): | |||
r = Function.__new__(conjugate) | |||
elif (symengine.is_a_PyNumber(deref(o))): | |||
r = PyNumber.__new__(PyNumber) | |||
elif (symengine.is_a_Piecewise(deref(o))): | |||
r = Piecewise.__new__(Piecewise) |
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.
Use Basic.__new__(Piecewise)
or otherwise you get a infinite cycle.
88555d8
to
9a4e1f9
Compare
This is ready for a review @isuruf. |
l = [] | ||
for i in range(0, len(a), 2): | ||
l.append((a[i]._sympy_(), a[i + 1]._sympy_())) | ||
return sympy.Piecewise(*l) |
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.
This is not tested.
symengine/tests/test_solve.py
Outdated
@@ -0,0 +1,17 @@ | |||
from symengine.utilities import raises | |||
from symengine.lib.symengine_wrapper import (Interval, EmptySet, FiniteSet, | |||
I, oo, solve, Eq, Symbol) |
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.
Can you fix the spacing here?
symengine/tests/test_sets.py
Outdated
from symengine.utilities import raises | ||
from symengine.lib.symengine_wrapper import (Interval, EmptySet, UniversalSet, FiniteSet, | ||
Union, Complement, ImageSet, ConditionSet, | ||
And, Or, oo, Symbol, true, Ge, Eq, Gt) |
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.
Fix formatting here.
symengine/tests/test_sets.py
Outdated
assert Interval(1, 1, True, True) == EmptySet() | ||
assert Interval(1, 2).union(Interval(2, 3)) == Interval(1, 3) | ||
|
||
|
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.
Remove whitespace here
Updated @isuruf. |
Thanks for the help @isuruf. |
No description provided.