X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Frelational.cpp;h=86e2c2e8399bde1fbea5eb4db966e69aa2870f27;hp=27f7b33b8372e178b3ee8144d5c348fdcf3d8305;hb=0e1c79a27b0567d8b9f5110b3a42647a71085aec;hpb=6d225ee55693c0617d254e6fa283c00c71bd2919 diff --git a/ginac/relational.cpp b/ginac/relational.cpp index 27f7b33b..86e2c2e8 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -33,7 +33,7 @@ namespace GiNaC { GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(relational, basic, print_func(&relational::do_print). - print_func(&basic::do_print_tree). + print_func(&relational::do_print_tree). print_func(&relational::do_print_python_repr)) ////////// @@ -164,7 +164,14 @@ ex relational::op(size_t i) const ex relational::map(map_function & f) const { - return (new relational(f(lh), f(rh), o))->setflag(status_flags::dynallocated); + const ex &mapped_lh = f(lh); + const ex &mapped_rh = f(rh); + + if (!are_ex_trivially_equal(lh, mapped_lh) + || !are_ex_trivially_equal(rh, mapped_rh)) + return (new relational(mapped_lh, mapped_rh, o))->setflag(status_flags::dynallocated); + else + return *this; } ex relational::eval(int level) const