X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Frelational.cpp;h=86e2c2e8399bde1fbea5eb4db966e69aa2870f27;hp=05fe56e8b0103b8348ad6d7d418c8a17b11d0d7d;hb=882ddd98da749458e15d31f0eb261feb3ff8f9f1;hpb=b66548802c56b34d6b212a0196d622937841ca61 diff --git a/ginac/relational.cpp b/ginac/relational.cpp index 05fe56e8..86e2c2e8 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -3,7 +3,7 @@ * Implementation of relations between expressions */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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