Dear all, I found out that the program #include <iostream> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main(int argc, char** argv) { symbol x("x"); ex_to<power>(x*x).dbgprint(); return 0; } gives the output [power object] This is because in basic::dbgprint a print_context is constructed from std::cerr and not a print_dflt. Changing, in basic::dbgprint, the line this->print(std::cerr); into this->print(print_dflt(std::cerr)); solves this problem. Now the output is x^2 as expected. Best, Chris
Hi! On Thu, Sep 23, 2004 at 11:58:23AM +0200, Chris Dams wrote:
This is because in basic::dbgprint a print_context is constructed from std::cerr and not a print_dflt. Changing, in basic::dbgprint, the line this->print(std::cerr); into this->print(print_dflt(std::cerr)); solves this problem.
Ok. Thanks! Bye, Christian -- / Physics is an algorithm \/ http://www.uni-mainz.de/~bauec002/
On Thu, 30 Sep 2004, Christian Bauer wrote:
On Thu, Sep 23, 2004 at 11:58:23AM +0200, Chris Dams wrote:
This is because in basic::dbgprint a print_context is constructed from std::cerr and not a print_dflt. Changing, in basic::dbgprint, the line this->print(std::cerr); into this->print(print_dflt(std::cerr)); solves this problem.
Ok. Thanks!
Oh, maybe I'm just dense, but I fail to see why it worked fine with mul or add or any other object. Since basic::dbgprint isn't overridden anywhere, why did it fail with power objects only? Curious -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>
Hi! On Thu, Sep 30, 2004 at 09:46:41PM +0200, Richard B. Kreckel wrote:
Since basic::dbgprint isn't overridden anywhere, why did it fail with power objects only?
Because power, unlike other algebraic classes, chooses to override print_dflt instead of print_context. Bye, Christian -- / Physics is an algorithm \/ http://www.uni-mainz.de/~bauec002/
participants (3)
-
Chris Dams
-
Christian Bauer
-
Richard B. Kreckel