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
Handle Piecewise in TransformVisitor (for e.g. cse) #1953
Conversation
@@ -1,5 +1,7 @@ | |||
cmake_minimum_required(VERSION 2.8.12) | |||
|
|||
if (POLICY CMP0074) | |||
cmake_policy(SET CMP0074 NEW) |
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 allows me to set the environment variable FLINT_ROOT
for example. I think this is rather harmless to enable, no?
symengine/visitor.cpp
Outdated
auto new_branch = apply(branch); | ||
// decltype(cond) new_cond = | ||
// rcp_static_cast<some-kind-of-boolean-cse-symbol?>(apply(rcp_static_cast<const | ||
// Basic>(cond))); |
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 couldn't figure out how to do subexpression elimination on the conditionals, so before merging I should probably just delete these comments...
symengine/tests/basic/test_cse.cpp
Outdated
@@ -1,19 +1,25 @@ | |||
#include "catch.hpp" | |||
#include "symengine/dict.h" | |||
#include "symengine/logic.h" |
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.
Duplicate
symengine/tests/basic/test_cse.cpp
Outdated
@@ -1,19 +1,25 @@ | |||
#include "catch.hpp" | |||
#include "symengine/dict.h" |
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 <
instead of "
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, my IDE seem to have "helped" me here... dropping those includes.
TransformVisitor seems to be missing other classes as well. Can you open an issue? |
auto pw2 = piecewise({{pow(x, i2), Gt(add(x, y), i2)}, | ||
{sqrt(y), Gt(add(x, y), i3)}, |
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 swap the two conditions? They don't make much sense.
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.
Sorry about that, fixed in 3570b30
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.
Looks like you only changed one part of the test
Sure, but it's not obvious to me what other classes you are referring to? |
I didn't do a thorough check, but found classes like |
This should enable cse to also pierce into
Piecewise
instances.Fixed gh-1952.
Thank you @isuruf for the pointer!