Skip to content

Conversation

isuruf
Copy link
Member

@isuruf isuruf commented Sep 27, 2017

No description provided.

b = sympify(expr)
vec.push_back(b.thisptr)
symengine.cse(replacements, reduced_exprs, vec)
return (vec_pair_to_list(replacements), vec_basic_to_list(reduced_exprs))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure on returning the results in a tuple? SymPy, if I'm not wrong, doesn't do that and might lead to an inconsistency later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SymPy does return a tuple. (At least in git master)

@isuruf isuruf requested review from certik and ShikharJ September 28, 2017 02:43
@@ -81,7 +81,8 @@ install:

- set PATH=C:\Python%PYTHON_VERSION%;C:\Python%PYTHON_VERSION%\Scripts;%PATH%
- pip install nose pytest
- pip install --install-option="--no-cython-compile" cython
- if [%COMPILER%]==[MinGW-w64] pip install --install-option="--no-cython-compile" cython==0.26
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@certik, you were right. Downgrading cython fixed the error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. It's better to pick a particular version of Cython, since they seem to break things for us from time to time.

Copy link
Member

@ShikharJ ShikharJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add some SymPy style test cases? Just so we can be sure that its compatible?

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @ShikharJ said, let's add some SymPy style tests, to ensure we have the same interface. Otherwise this looks good.

@@ -81,7 +81,8 @@ install:

- set PATH=C:\Python%PYTHON_VERSION%;C:\Python%PYTHON_VERSION%\Scripts;%PATH%
- pip install nose pytest
- pip install --install-option="--no-cython-compile" cython
- if [%COMPILER%]==[MinGW-w64] pip install --install-option="--no-cython-compile" cython==0.26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. It's better to pick a particular version of Cython, since they seem to break things for us from time to time.

e2 = (x + y)*w
substs, reduced = cse([e1, e2])
assert substs == [(x0, x + y)]
assert reduced == [x0*z, x0*w]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only added a few tests here to test the interface. All the tests in C++ are taken from the sympy test suite and there's no point reproducing here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's just for the interface / API, not the correctness, which is (and must) be tested in C++.

@isuruf isuruf merged commit b03f044 into symengine:master Sep 28, 2017
@isuruf
Copy link
Member Author

isuruf commented Sep 28, 2017

Thanks for the reviews

@isuruf isuruf deleted the cse2 branch September 28, 2017 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants