X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Ftime_antipode.cpp;h=f44c0b98f799954cb0f83d0debc25d3545122756;hp=d716ea24117031c417fbb6ae0a294255ad3ebdb0;hb=3ab7092e925aba28498d7508f50da9f913dcffd2;hpb=8a0b98516194d0591a12bd82369820fb5c05e216;ds=sidebyside diff --git a/check/time_antipode.cpp b/check/time_antipode.cpp index d716ea24..f44c0b98 100644 --- a/check/time_antipode.cpp +++ b/check/time_antipode.cpp @@ -9,8 +9,12 @@ * point of view it boils down to power series expansion. It also has quite * an intriguing check for consistency, which is why we include it here. * - * This program is based on work by Isabella Bierenbaum and Dirk Kreimer. - * For details, please see the diploma theses of Isabella Bierenbaum. + * This program is based on work by + * Isabella Bierenbaum and + * Dirk Kreimer . + * For details, please ask for the diploma theses of Isabella Bierenbaum. + * Also, this file is based on an early version of their program, they now + * have production-code that is somewhat more efficient than the stuff below. */ /* @@ -33,7 +37,8 @@ #include "times.h" #include -#include +#include +#include // whether to run this beast or not: static const bool do_test = true; @@ -46,13 +51,9 @@ const constant TrOne("Tr[One]", numeric(4)); /* Extract only the divergent part of a series and discard the rest. */ static ex div_part(const ex &exarg, const symbol &x, unsigned grad) { - unsigned order = grad; - ex exser; - // maybe we have to generate more terms on the series (obnoxious): - do { - exser = exarg.series(x==0, order); - ++order; - } while (exser.degree(x) < 0); + const ex exser = exarg.series(x==0, grad); + if (exser.degree(x)<0) + throw runtime_error("divergent part truncation disaster"); ex exser_trunc; for (int i=exser.ldegree(x); i<0; ++i) exser_trunc += exser.coeff(x,i)*pow(x,i); @@ -170,7 +171,7 @@ public: unsigned total_edges(void) const; private: vertex *vert; - list children; + vector children; }; const node & node::operator=(const node &n) @@ -191,7 +192,7 @@ void node::add_child(const node &childnode, bool cut) ex node::evaluate(const symbol &x, unsigned grad) const { ex product = 1; - for (list::const_iterator i=children.begin(); i!=children.end(); ++i) { + for (vector::const_iterator i=children.begin(); i!=children.end(); ++i) { if (!i->second) product *= i->first.evaluate(x,grad); else @@ -203,7 +204,7 @@ ex node::evaluate(const symbol &x, unsigned grad) const unsigned node::total_edges(void) const { unsigned accu = 0; - for (list::const_iterator i=children.begin(); i!=children.end(); ++i) { + for (vector::const_iterator i=children.begin(); i!=children.end(); ++i) { accu += i->first.total_edges(); ++accu; }