From: Christian Bauer Date: Wed, 10 Nov 1999 22:35:47 +0000 (+0000) Subject: - modified GiNaC headers to Alexander's liking X-Git-Tag: release_0-5-0~184 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=66c0f31c678e6c1938d637636b230ea376c157c1 - modified GiNaC headers to Alexander's liking --- diff --git a/ginac/add.cpp b/ginac/add.cpp index 42e65bb9..9d054379 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -22,7 +22,8 @@ #include #include -#include "ginac.h" +#include "add.h" +#include "mul.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -33,7 +34,7 @@ add::add() { debugmsg("add default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; } add::~add() @@ -79,7 +80,7 @@ void add::destroy(bool call_parent) add::add(ex const & lh, ex const & rh) { debugmsg("add constructor from ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_2_ex(lh,rh); ASSERT(is_canonical()); @@ -88,7 +89,7 @@ add::add(ex const & lh, ex const & rh) add::add(exvector const & v) { debugmsg("add constructor from exvector",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_exvector(v); ASSERT(is_canonical()); @@ -98,7 +99,7 @@ add::add(exvector const & v) add::add(epvector const & v, bool do_not_canonicalize) { debugmsg("add constructor from epvector,bool",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; if (do_not_canonicalize) { seq=v; #ifdef EXPAIRSEQ_USE_HASHTAB @@ -114,7 +115,7 @@ add::add(epvector const & v, bool do_not_canonicalize) add::add(epvector const & v) { debugmsg("add constructor from epvector",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_epvector(v); ASSERT(is_canonical()); @@ -123,7 +124,7 @@ add::add(epvector const & v) add::add(epvector const & v, ex const & oc) { debugmsg("add constructor from epvector,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; overall_coeff=oc; construct_from_epvector(v); ASSERT(is_canonical()); @@ -132,7 +133,7 @@ add::add(epvector const & v, ex const & oc) add::add(epvector * vp, ex const & oc) { debugmsg("add constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_ADD; + tinfo_key = TINFO_add; ASSERT(vp!=0); overall_coeff=oc; construct_from_epvector(*vp); diff --git a/ginac/add.h b/ginac/add.h index 78383034..1b965197 100644 --- a/ginac/add.h +++ b/ginac/add.h @@ -22,6 +22,8 @@ #ifndef __GINAC_ADD_H__ #define __GINAC_ADD_H__ +#include + /** Sum of expressions. */ class add : public expairseq { @@ -106,4 +108,3 @@ extern type_info const & typeid_add; #define ex_to_add(X) static_cast(*(X).bp) #endif // ndef __GINAC_ADD_H__ - diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 8317f812..0b713b88 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -23,7 +23,13 @@ #include #include -#include "ginac.h" +#include "basic.h" +#include "ex.h" +#include "numeric.h" +#include "power.h" +#include "symbol.h" +#include "lst.h" +#include "ncmul.h" #include "utils.h" ////////// diff --git a/ginac/basic.h b/ginac/basic.h index 94393904..ebc130f7 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -26,6 +26,10 @@ #include #include +#include +#include +#include + class basic; class ex; class symbol; @@ -48,7 +52,7 @@ class basic public: basic() #ifdef INLINE_BASIC_CONSTRUCTORS - : tinfo_key(TINFO_BASIC), flags(0), refcount(0) + : tinfo_key(TINFO_basic), flags(0), refcount(0) { debugmsg("basic default constructor",LOGLEVEL_CONSTRUCT); // nothing to do @@ -177,42 +181,19 @@ extern type_info const & typeid_basic; extern int max_recursion_level; -/* -#ifndef _DEBUG -*/ +// convenience macros + #define is_of_type(OBJ,TYPE) \ (dynamic_cast(const_cast(&OBJ))!=0) -/* #define is_exactly_of_type(OBJ,TYPE) \ - (typeid(OBJ)==typeid(some_##TYPE)) -*/ -#define is_exactly_of_type(OBJ,TYPE) \ - ((OBJ).tinfo()==(some_##TYPE).tinfo()) - - - /* -#else -#define is_of_type(OBJ,TYPE) \ - (ASSERT(typeid(OBJ)!=typeid(exZERO())), \ - (dynamic_cast(const_cast(&OBJ))!=0)) - -#define is_exactly_of_type(OBJ,TYPE) \ - (ASSERT(typeid(OBJ)!=typeid(exZERO())), \ - (typeid(OBJ)==typeid(some_##TYPE)) -#endif // ndef _DEBUG -*/ + ((OBJ).tinfo()==TINFO_##TYPE) #define is_ex_of_type(OBJ,TYPE) \ (dynamic_cast(const_cast((OBJ).bp))!=0) -/* -#define is_ex_exactly_of_type(OBJ,TYPE) \ - (typeid(*(OBJ).bp)==typeid(some_##TYPE)) -*/ - #define is_ex_exactly_of_type(OBJ,TYPE) \ - ((*(OBJ).bp).tinfo()==(some_##TYPE).tinfo()) + ((*(OBJ).bp).tinfo()==TINFO_##TYPE) #define are_ex_trivially_equal(EX1,EX2) \ ((EX1).bp==(EX2).bp) diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 9c01f9a0..1e154b1a 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -22,7 +22,9 @@ #include -#include "ginac.h" +#include "clifford.h" +#include "ex.h" +#include "ncmul.h" #include "utils.h" ////////// @@ -36,7 +38,7 @@ clifford::clifford() debugmsg("clifford default constructor",LOGLEVEL_CONSTRUCT); serial=next_serial++; name=autoname_prefix()+ToString(serial); - tinfo_key=TINFO_CLIFFORD; + tinfo_key=TINFO_clifford; } clifford::~clifford() @@ -88,7 +90,7 @@ clifford::clifford(string const & initname) debugmsg("clifford constructor from string",LOGLEVEL_CONSTRUCT); name=initname; serial=next_serial++; - tinfo_key=TINFO_CLIFFORD; + tinfo_key=TINFO_clifford; } ////////// @@ -145,7 +147,7 @@ bool clifford::info(unsigned inf) const int clifford::compare_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_CLIFFORD); + ASSERT(other.tinfo() == TINFO_clifford); const clifford *o = static_cast(&other); if (serial==o->serial) { return indexed::compare_same_type(other); diff --git a/ginac/clifford.h b/ginac/clifford.h index 68a81a45..1bfd561a 100644 --- a/ginac/clifford.h +++ b/ginac/clifford.h @@ -23,6 +23,7 @@ #define __GINAC_CLIFFORD_H__ #include +#include /** Base class for clifford object */ class clifford : public indexed diff --git a/ginac/color.cpp b/ginac/color.cpp index fc78506a..f905693e 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -26,7 +26,12 @@ #include #include -#include "ginac.h" +#include "color.h" +#include "ex.h" +#include "coloridx.h" +#include "ncmul.h" +#include "numeric.h" +#include "relational.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -37,7 +42,7 @@ color::color() : type(invalid), representation_label(0) { debugmsg("color default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_COLOR; + tinfo_key=TINFO_color; } color::~color() @@ -88,7 +93,7 @@ color::color(color_types const t, unsigned const rl) : type(t), representation_l { debugmsg("color constructor from color_types,unsigned",LOGLEVEL_CONSTRUCT); ASSERT(representation_label(&other); if (type==o->type) { if (representation_label==o->representation_label) { @@ -351,7 +356,7 @@ int color::compare_same_type(basic const & other) const bool color::is_equal_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_COLOR); + ASSERT(other.tinfo() == TINFO_color); const color *o = static_cast(&other); if (type!=o->type) return false; if (representation_label!=o->representation_label) return false; diff --git a/ginac/color.h b/ginac/color.h index d900d84f..266496b2 100644 --- a/ginac/color.h +++ b/ginac/color.h @@ -24,6 +24,7 @@ #include #include +#include #define MAX_REPRESENTATION_LABELS 4 #define COLOR_EIGHT 8 // N*N-1 diff --git a/ginac/coloridx.cpp b/ginac/coloridx.cpp index be7768d7..ff4a5f45 100644 --- a/ginac/coloridx.cpp +++ b/ginac/coloridx.cpp @@ -21,7 +21,7 @@ #include -#include "ginac.h" +#include "coloridx.h" #include "utils.h" ////////// @@ -35,7 +35,7 @@ coloridx::coloridx() debugmsg("coloridx default constructor",LOGLEVEL_CONSTRUCT); // serial is incremented in idx::idx() name="color"+ToString(serial); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } coloridx::~coloridx() @@ -83,25 +83,25 @@ coloridx::coloridx(bool cov) : idx(cov) debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT); // serial is incremented in idx::idx(bool) name="color"+ToString(serial); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } coloridx::coloridx(string const & n, bool cov) : idx(n,cov) { debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } coloridx::coloridx(char const * n, bool cov) : idx(n,cov) { debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } coloridx::coloridx(unsigned const v, bool cov) : idx(v,cov) { debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_COLORIDX; + tinfo_key=TINFO_coloridx; } ////////// diff --git a/ginac/coloridx.h b/ginac/coloridx.h index 8f7e8254..4fb6a759 100644 --- a/ginac/coloridx.h +++ b/ginac/coloridx.h @@ -24,6 +24,7 @@ #include #include +#include class coloridx : public idx { diff --git a/ginac/constant.cpp b/ginac/constant.cpp index 2bfb4b32..6ea13a00 100644 --- a/ginac/constant.cpp +++ b/ginac/constant.cpp @@ -22,7 +22,9 @@ #include #include -#include "ginac.h" +#include "constant.h" +#include "numeric.h" +#include "ex.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -72,14 +74,14 @@ void constant::destroy(bool call_parent) // public constant::constant(string const & initname, ex (*efun)()) : - basic(TINFO_CONSTANT), name(initname), ef(efun), + basic(TINFO_constant), name(initname), ef(efun), number(0), fct_assigned(true), serial(next_serial++) { debugmsg("constant constructor from string, function",LOGLEVEL_CONSTRUCT); } constant::constant(string const & initname, numeric const & initnumber) : - basic(TINFO_CONSTANT), name(initname), ef(0), + basic(TINFO_constant), name(initname), ef(0), number(new numeric(initnumber)), fct_assigned(false), serial(next_serial++) { debugmsg("constant constructor from string, numeric",LOGLEVEL_CONSTRUCT); diff --git a/ginac/constant.h b/ginac/constant.h index e772ada8..488d8a3e 100644 --- a/ginac/constant.h +++ b/ginac/constant.h @@ -23,6 +23,7 @@ #define __GINAC_CONSTANT_H__ #include +#include /** This class holds constants, symbols with specific numerical value. Each * object of this class must either provide their own function to evaluate it diff --git a/ginac/container.pl b/ginac/container.pl index 4cb7f883..4f838e68 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -121,7 +121,7 @@ $interface=< -#include +#include typedef ${STLHEADER} ${STLT}; @@ -254,7 +254,8 @@ $implementation=< #include -#include "ginac.h" +#include "${CONTAINER}.h" +#include "ex.h" ${RESERVE_IMPLEMENTATION} @@ -264,7 +265,7 @@ ${RESERVE_IMPLEMENTATION} // public -${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER_UC}) +${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} default constructor",LOGLEVEL_CONSTRUCT); } @@ -311,7 +312,7 @@ void ${CONTAINER}::destroy(bool call_parent) // public -${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) : basic(TINFO_${CONTAINER_UC}) +${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from ${STLT}", LOGLEVEL_CONSTRUCT); @@ -322,7 +323,7 @@ ${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) : basic(TINFO_$ } } -${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER_UC}) +${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from ${STLT} *",LOGLEVEL_CONSTRUCT); ASSERT(vp!=0); @@ -330,7 +331,7 @@ ${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER_UC}) delete vp; } -${CONTAINER}::${CONTAINER}(ex const & e1) : basic(TINFO_${CONTAINER_UC}) +${CONTAINER}::${CONTAINER}(ex const & e1) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 1 ex", LOGLEVEL_CONSTRUCT); @@ -338,7 +339,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1) : basic(TINFO_${CONTAINER_UC}) seq.push_back(e1); } -${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2) : basic(TINFO_${CONTAINER_UC}) +${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 2 ex", LOGLEVEL_CONSTRUCT); @@ -348,7 +349,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2) : basic(TINFO_${CONTAIN } ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3) - : basic(TINFO_${CONTAINER_UC}) + : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 3 ex", LOGLEVEL_CONSTRUCT); @@ -359,7 +360,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3) } ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, - ex const & e4) : basic(TINFO_${CONTAINER_UC}) + ex const & e4) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 4 ex", LOGLEVEL_CONSTRUCT); @@ -371,7 +372,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, } ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, - ex const & e4, ex const & e5) : basic(TINFO_${CONTAINER_UC}) + ex const & e4, ex const & e5) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 5 ex", LOGLEVEL_CONSTRUCT); @@ -385,7 +386,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6) - : basic(TINFO_${CONTAINER_UC}) + : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 6 ex", LOGLEVEL_CONSTRUCT); @@ -400,7 +401,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, - ex const & e7) : basic(TINFO_${CONTAINER_UC}) + ex const & e7) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 7 ex", LOGLEVEL_CONSTRUCT); @@ -416,7 +417,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, - ex const & e7, ex const & e8) : basic(TINFO_${CONTAINER_UC}) + ex const & e7, ex const & e8) : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 8 ex", LOGLEVEL_CONSTRUCT); @@ -434,7 +435,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, ex const & e7, ex const & e8, ex const & e9) - : basic(TINFO_${CONTAINER_UC}) + : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 9 ex", LOGLEVEL_CONSTRUCT); @@ -454,7 +455,7 @@ ${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, ex const & e7, ex const & e8, ex const & e9, ex const &e10) - : basic(TINFO_${CONTAINER_UC}) + : basic(TINFO_${CONTAINER}) { debugmsg("${CONTAINER} constructor from 10 ex", LOGLEVEL_CONSTRUCT); diff --git a/ginac/diff.cpp b/ginac/diff.cpp index c8ef77b8..ff7855af 100644 --- a/ginac/diff.cpp +++ b/ginac/diff.cpp @@ -21,7 +21,20 @@ #include -#include "ginac.h" +#include "basic.h" +#include "ex.h" +#include "add.h" +#include "constant.h" +#include "expairseq.h" +#include "indexed.h" +#include "inifcns.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" +#include "series.h" +#include "symbol.h" /** Default implementation of ex::diff(). It prints and error message and returns a fail object. * @see ex::diff */ diff --git a/ginac/ex.cpp b/ginac/ex.cpp index 652005dd..c30efdda 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -21,7 +21,12 @@ #include -#include "ginac.h" +#include "ex.h" +#include "add.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers diff --git a/ginac/ex.h b/ginac/ex.h index d22dc86a..c07c3edb 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -23,6 +23,8 @@ #define __GINAC_EX_H__ #include +#include +#include class ex; class expand_options; diff --git a/ginac/expair.h b/ginac/expair.h index 3f98d412..372091db 100644 --- a/ginac/expair.h +++ b/ginac/expair.h @@ -17,6 +17,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef __GINAC_EXPAIR_H__ +#define __GINAC_EXPAIR_H__ + +#include +#include + /** A pair of expressions. * This similar to, but slightly extended STL's pair<> but we need to account * for methods like .compare() */ @@ -186,5 +192,4 @@ public: } }; - - +#endif // ndef __GINAC_EXPAIR_H__ diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index 7f8664ee..23ccaa96 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -21,7 +21,8 @@ #include #include -#include "ginac.h" +#include "expairseq.h" +#include "lst.h" #ifdef EXPAIRSEQ_USE_HASHTAB #error "!!!!!!!!TODO: expair_needs_further_processing not yet implemented for hashtabs, sorry. A.F." @@ -93,14 +94,14 @@ void expairseq::copy(expairseq const & other) // other constructors ////////// -expairseq::expairseq(ex const & lh, ex const & rh) : basic(TINFO_EXPAIRSEQ) +expairseq::expairseq(ex const & lh, ex const & rh) : basic(TINFO_expairseq) { debugmsg("expairseq constructor from ex,ex",LOGLEVEL_CONSTRUCT); construct_from_2_ex(lh,rh); ASSERT(is_canonical()); } -expairseq::expairseq(exvector const & v) : basic(TINFO_EXPAIRSEQ) +expairseq::expairseq(exvector const & v) : basic(TINFO_expairseq) { debugmsg("expairseq constructor from exvector",LOGLEVEL_CONSTRUCT); construct_from_exvector(v); @@ -109,7 +110,7 @@ expairseq::expairseq(exvector const & v) : basic(TINFO_EXPAIRSEQ) /* expairseq::expairseq(epvector const & v, bool do_not_canonicalize) : - basic(TINFO_EXPAIRSEQ) + basic(TINFO_expairseq) { debugmsg("expairseq constructor from epvector",LOGLEVEL_CONSTRUCT); if (do_not_canonicalize) { @@ -125,7 +126,7 @@ expairseq::expairseq(epvector const & v, bool do_not_canonicalize) : */ expairseq::expairseq(epvector const & v, ex const & oc) : - basic(TINFO_EXPAIRSEQ), overall_coeff(oc) + basic(TINFO_expairseq), overall_coeff(oc) { debugmsg("expairseq constructor from epvector,ex",LOGLEVEL_CONSTRUCT); construct_from_epvector(v); @@ -133,7 +134,7 @@ expairseq::expairseq(epvector const & v, ex const & oc) : } expairseq::expairseq(epvector * vp, ex const & oc) : - basic(TINFO_EXPAIRSEQ), overall_coeff(oc) + basic(TINFO_expairseq), overall_coeff(oc) { debugmsg("expairseq constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); ASSERT(vp!=0); diff --git a/ginac/expairseq.h b/ginac/expairseq.h index a19c78bb..faaa7532 100644 --- a/ginac/expairseq.h +++ b/ginac/expairseq.h @@ -22,6 +22,7 @@ #include #include +#include //#define EXPAIRSEQ_USE_HASHTAB @@ -50,7 +51,7 @@ class expairseq : public basic // default constructor, destructor, copy constructor assignment operator and helpers public: - expairseq() : basic(TINFO_EXPAIRSEQ) + expairseq() : basic(TINFO_expairseq) #ifdef EXPAIRSEQ_USE_HASHTAB , hashtabsize(0) #endif // def EXPAIRSEQ_USE_HASHTAB diff --git a/ginac/exprseq.cpp b/ginac/exprseq.cpp index ad200a46..3a97d4bb 100644 --- a/ginac/exprseq.cpp +++ b/ginac/exprseq.cpp @@ -31,7 +31,8 @@ #include #include -#include "ginac.h" +#include "exprseq.h" +#include "ex.h" #define RESERVE(s,size) (s).reserve(size) @@ -41,7 +42,7 @@ // public -exprseq::exprseq() : basic(TINFO_EXPRSEQ) +exprseq::exprseq() : basic(TINFO_exprseq) { debugmsg("exprseq default constructor",LOGLEVEL_CONSTRUCT); } @@ -88,7 +89,7 @@ void exprseq::destroy(bool call_parent) // public -exprseq::exprseq(exvector const & s, bool discardable) : basic(TINFO_EXPRSEQ) +exprseq::exprseq(exvector const & s, bool discardable) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from exvector", LOGLEVEL_CONSTRUCT); @@ -99,7 +100,7 @@ exprseq::exprseq(exvector const & s, bool discardable) : basic(TINFO_EXPRSEQ) } } -exprseq::exprseq(exvector * vp) : basic(TINFO_EXPRSEQ) +exprseq::exprseq(exvector * vp) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from exvector *",LOGLEVEL_CONSTRUCT); ASSERT(vp!=0); @@ -107,7 +108,7 @@ exprseq::exprseq(exvector * vp) : basic(TINFO_EXPRSEQ) delete vp; } -exprseq::exprseq(ex const & e1) : basic(TINFO_EXPRSEQ) +exprseq::exprseq(ex const & e1) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 1 ex", LOGLEVEL_CONSTRUCT); @@ -115,7 +116,7 @@ exprseq::exprseq(ex const & e1) : basic(TINFO_EXPRSEQ) seq.push_back(e1); } -exprseq::exprseq(ex const & e1, ex const & e2) : basic(TINFO_EXPRSEQ) +exprseq::exprseq(ex const & e1, ex const & e2) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 2 ex", LOGLEVEL_CONSTRUCT); @@ -125,7 +126,7 @@ exprseq::exprseq(ex const & e1, ex const & e2) : basic(TINFO_EXPRSEQ) } exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3) - : basic(TINFO_EXPRSEQ) + : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 3 ex", LOGLEVEL_CONSTRUCT); @@ -136,7 +137,7 @@ exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3) } exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, - ex const & e4) : basic(TINFO_EXPRSEQ) + ex const & e4) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 4 ex", LOGLEVEL_CONSTRUCT); @@ -148,7 +149,7 @@ exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, } exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, - ex const & e4, ex const & e5) : basic(TINFO_EXPRSEQ) + ex const & e4, ex const & e5) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 5 ex", LOGLEVEL_CONSTRUCT); @@ -162,7 +163,7 @@ exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6) - : basic(TINFO_EXPRSEQ) + : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 6 ex", LOGLEVEL_CONSTRUCT); @@ -177,7 +178,7 @@ exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, - ex const & e7) : basic(TINFO_EXPRSEQ) + ex const & e7) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 7 ex", LOGLEVEL_CONSTRUCT); @@ -193,7 +194,7 @@ exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, - ex const & e7, ex const & e8) : basic(TINFO_EXPRSEQ) + ex const & e7, ex const & e8) : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 8 ex", LOGLEVEL_CONSTRUCT); @@ -211,7 +212,7 @@ exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, ex const & e7, ex const & e8, ex const & e9) - : basic(TINFO_EXPRSEQ) + : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 9 ex", LOGLEVEL_CONSTRUCT); @@ -231,7 +232,7 @@ exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, ex const & e7, ex const & e8, ex const & e9, ex const &e10) - : basic(TINFO_EXPRSEQ) + : basic(TINFO_exprseq) { debugmsg("exprseq constructor from 10 ex", LOGLEVEL_CONSTRUCT); diff --git a/ginac/exprseq.h b/ginac/exprseq.h index 16d99bd3..f82a21c0 100644 --- a/ginac/exprseq.h +++ b/ginac/exprseq.h @@ -32,7 +32,7 @@ #define __GINAC_EXPRSEQ_H__ #include -#include +#include typedef vector exvector; diff --git a/ginac/exprseq_suppl.cpp b/ginac/exprseq_suppl.cpp index 2da0fea1..1482a58b 100644 --- a/ginac/exprseq_suppl.cpp +++ b/ginac/exprseq_suppl.cpp @@ -20,7 +20,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ginac.h" +#include "exprseq.h" +#include "ex.h" bool exprseq::info(unsigned inf) const { diff --git a/ginac/fail.cpp b/ginac/fail.cpp index c9d0e392..b97d0c4e 100644 --- a/ginac/fail.cpp +++ b/ginac/fail.cpp @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ginac.h" +#include "fail.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -28,7 +28,7 @@ // public -fail::fail() : basic(TINFO_FAIL) +fail::fail() : basic(TINFO_fail) { debugmsg("fail default constructor",LOGLEVEL_CONSTRUCT); } diff --git a/ginac/fail.h b/ginac/fail.h index 666d85f4..40897e2e 100644 --- a/ginac/fail.h +++ b/ginac/fail.h @@ -23,6 +23,8 @@ #ifndef __GINAC_FAIL_H__ #define __GINAC_FAIL_H__ +#include + class fail : public basic { // member functions diff --git a/ginac/function.cpp b/ginac/function.cpp index 77aa3c6b..0afb41eb 100644 --- a/ginac/function.cpp +++ b/ginac/function.cpp @@ -26,7 +26,8 @@ #include #include -#include "ginac.h" +#include "function.h" +#include "ex.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -37,7 +38,7 @@ function::function() : serial(0) { debugmsg("function default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::~function() @@ -84,7 +85,7 @@ void function::destroy(bool call_parent) function::function(unsigned ser) : serial(ser) { debugmsg("function constructor from unsigned",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } // the following lines have been generated for max. 10 parameters @@ -92,61 +93,61 @@ function::function(unsigned ser, ex const & param1) : exprseq(param1), serial(ser) { debugmsg("function constructor from unsigned,1*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2) : exprseq(param1, param2), serial(ser) { debugmsg("function constructor from unsigned,2*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3) : exprseq(param1, param2, param3), serial(ser) { debugmsg("function constructor from unsigned,3*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4) : exprseq(param1, param2, param3, param4), serial(ser) { debugmsg("function constructor from unsigned,4*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5) : exprseq(param1, param2, param3, param4, param5), serial(ser) { debugmsg("function constructor from unsigned,5*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6) : exprseq(param1, param2, param3, param4, param5, param6), serial(ser) { debugmsg("function constructor from unsigned,6*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7) : exprseq(param1, param2, param3, param4, param5, param6, param7), serial(ser) { debugmsg("function constructor from unsigned,7*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8) : exprseq(param1, param2, param3, param4, param5, param6, param7, param8), serial(ser) { debugmsg("function constructor from unsigned,8*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8, ex const & param9) : exprseq(param1, param2, param3, param4, param5, param6, param7, param8, param9), serial(ser) { debugmsg("function constructor from unsigned,9*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8, ex const & param9, ex const & param10) : exprseq(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10), serial(ser) { debugmsg("function constructor from unsigned,10*ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } // end of generated lines @@ -154,21 +155,21 @@ function::function(unsigned ser, ex const & param1, ex const & param2, ex const function::function(unsigned ser, exprseq const & es) : exprseq(es), serial(ser) { debugmsg("function constructor from unsigned,exprseq",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, exvector const & v, bool discardable) : exprseq(v,discardable), serial(ser) { debugmsg("function constructor from string,exvector,bool",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } function::function(unsigned ser, exvector * vp) : exprseq(vp), serial(ser) { debugmsg("function constructor from unsigned,exvector *",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } ////////// diff --git a/ginac/function.h b/ginac/function.h index ffc4eda4..b2fcd7ac 100644 --- a/ginac/function.h +++ b/ginac/function.h @@ -28,6 +28,7 @@ #include #include +#include class function; @@ -287,4 +288,3 @@ extern const function some_function; extern type_info const & typeid_function; #endif // ndef __GINAC_FUNCTION_H__ - diff --git a/ginac/function.pl b/ginac/function.pl index e40478d0..1a1fcbaa 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -72,7 +72,7 @@ function::function(unsigned ser, ${SEQ1}) : exprseq(${SEQ2}), serial(ser) { debugmsg(\"function constructor from unsigned,${N}*ex\",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_FUNCTION; + tinfo_key = TINFO_function; } END_OF_CONSTRUCTORS_IMPLEMENTATION @@ -147,6 +147,7 @@ $interface=< #include +#include class function; @@ -308,7 +309,8 @@ $implementation=< #include -#include "ginac.h" +#include "function.h" +#include "ex.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -319,7 +321,7 @@ $implementation=< -#include -#include - #include #include diff --git a/ginac/idx.cpp b/ginac/idx.cpp index a688c6d4..c2484683 100644 --- a/ginac/idx.cpp +++ b/ginac/idx.cpp @@ -21,7 +21,10 @@ #include -#include "ginac.h" +#include "idx.h" +#include "ex.h" +#include "lst.h" +#include "relational.h" #include "utils.h" ////////// @@ -30,7 +33,7 @@ // public -idx::idx() : basic(TINFO_IDX), symbolic(true), covariant(false) +idx::idx() : basic(TINFO_idx), symbolic(true), covariant(false) { debugmsg("idx default constructor",LOGLEVEL_CONSTRUCT); serial=next_serial++; @@ -82,28 +85,28 @@ void idx::destroy(bool call_parent) // public -idx::idx(bool cov) : basic(TINFO_IDX), symbolic(true), covariant(cov) +idx::idx(bool cov) : basic(TINFO_idx), symbolic(true), covariant(cov) { debugmsg("idx constructor from bool",LOGLEVEL_CONSTRUCT); serial=next_serial++; name="index"+ToString(serial); } -idx::idx(string const & n, bool cov) : basic(TINFO_IDX), +idx::idx(string const & n, bool cov) : basic(TINFO_idx), symbolic(true), name(n), covariant(cov) { debugmsg("idx constructor from string,bool",LOGLEVEL_CONSTRUCT); serial=next_serial++; } -idx::idx(char const * n, bool cov) : basic(TINFO_IDX), +idx::idx(char const * n, bool cov) : basic(TINFO_idx), symbolic(true), name(n), covariant(cov) { debugmsg("idx constructor from char*,bool",LOGLEVEL_CONSTRUCT); serial=next_serial++; } -idx::idx(unsigned const v, bool cov) : basic(TINFO_IDX), +idx::idx(unsigned const v, bool cov) : basic(TINFO_idx), symbolic(false), value(v), covariant(cov) { debugmsg("idx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); diff --git a/ginac/idx.h b/ginac/idx.h index 07c18b48..f32722f7 100644 --- a/ginac/idx.h +++ b/ginac/idx.h @@ -24,6 +24,7 @@ #include #include +#include class idx : public basic { diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index ffcf5141..7fcd8939 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -21,7 +21,9 @@ #include -#include "ginac.h" +#include "indexed.h" +#include "ex.h" +#include "idx.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -32,7 +34,7 @@ indexed::indexed() { debugmsg("indexed default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_INDEXED; + tinfo_key=TINFO_indexed; } indexed::~indexed() @@ -80,14 +82,14 @@ void indexed::destroy(bool call_parent) indexed::indexed(ex const & i1) : exprseq(i1) { debugmsg("indexed constructor from ex",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_INDEXED; + tinfo_key=TINFO_indexed; ASSERT(all_of_type_idx()); } indexed::indexed(ex const & i1, ex const & i2) : exprseq(i1,i2) { debugmsg("indexed constructor from ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_INDEXED; + tinfo_key=TINFO_indexed; ASSERT(all_of_type_idx()); } @@ -95,21 +97,21 @@ indexed::indexed(ex const & i1, ex const & i2, ex const & i3) : exprseq(i1,i2,i3) { debugmsg("indexed constructor from ex,ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_INDEXED; + tinfo_key=TINFO_indexed; ASSERT(all_of_type_idx()); } indexed::indexed(exvector const & iv) : exprseq(iv) { debugmsg("indexed constructor from exvector",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_INDEXED; + tinfo_key=TINFO_indexed; ASSERT(all_of_type_idx()); } indexed::indexed(exvector * ivp) : exprseq(ivp) { debugmsg("indexed constructor from exvector *",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_INDEXED; + tinfo_key=TINFO_indexed; ASSERT(all_of_type_idx()); } diff --git a/ginac/indexed.h b/ginac/indexed.h index 5aa53185..97e3e1a7 100644 --- a/ginac/indexed.h +++ b/ginac/indexed.h @@ -23,6 +23,7 @@ #define __GINAC_INDEXED_H__ #include +#include /** Base class for non-commutative indexed objects */ class indexed : public exprseq diff --git a/ginac/inifcns.cpp b/ginac/inifcns.cpp index 981e98e3..48567821 100644 --- a/ginac/inifcns.cpp +++ b/ginac/inifcns.cpp @@ -22,7 +22,18 @@ #include #include -#include "ginac.h" +#include "inifcns.h" +#include "ex.h" +#include "constant.h" +#include "lst.h" +#include "matrix.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" +#include "series.h" +#include "symbol.h" ////////// // dilogarithm @@ -126,7 +137,7 @@ ex Order_series(ex const & x, symbol const & s, ex const & point, int order) REGISTER_FUNCTION(Order, Order_eval, NULL, NULL, Order_series); /** linear solve. */ -ex lsolve(ex eqns, ex symbols) +ex lsolve(ex const &eqns, ex const &symbols) { // solve a system of linear equations if (eqns.info(info_flags::relation_equal)) { @@ -218,7 +229,7 @@ ex lsolve(ex eqns, ex symbols) } /** non-commutative power. */ -ex ncpower(ex basis, unsigned exponent) +ex ncpower(ex const &basis, unsigned exponent) { if (exponent==0) { return exONE(); @@ -232,4 +243,3 @@ ex ncpower(ex basis, unsigned exponent) return ncmul(v,1); } - diff --git a/ginac/inifcns.h b/ginac/inifcns.h index ecdfa897..095abf7c 100644 --- a/ginac/inifcns.h +++ b/ginac/inifcns.h @@ -22,6 +22,9 @@ #ifndef __GINAC_INIFCNS_H__ #define __GINAC_INIFCNS_H__ +#include +#include + /** Sine. */ DECLARE_FUNCTION_1P(sin) @@ -85,9 +88,9 @@ DECLARE_FUNCTION_2P(binomial) /** Order term function (for truncated power series). */ DECLARE_FUNCTION_1P(Order) -ex lsolve(ex eqns,ex symbols); +ex lsolve(ex const &eqns, ex const &symbols); -ex ncpower(ex basis, unsigned exponent); +ex ncpower(ex const &basis, unsigned exponent); inline bool is_order_function(ex const & e) { diff --git a/ginac/inifcns_gamma.cpp b/ginac/inifcns_gamma.cpp index f575aca5..73a64b3e 100644 --- a/ginac/inifcns_gamma.cpp +++ b/ginac/inifcns_gamma.cpp @@ -22,7 +22,12 @@ #include #include -#include "ginac.h" +#include "inifcns.h" +#include "ex.h" +#include "constant.h" +#include "numeric.h" +#include "power.h" +#include "symbol.h" ////////// // gamma function @@ -54,14 +59,14 @@ ex gamma_eval(ex const & x) numeric n = ex_to_numeric(x).sub(numHALF()); numeric coefficient = doublefactorial(n.mul(numTWO()).sub(numONE())); coefficient = coefficient.div(numTWO().power(n)); - return mul(coefficient,power(Pi,numHALF())); + return coefficient * power(Pi,numHALF()); } else { // trap negative x=(-n+1/2) // gamma(-n+1/2) -> Pi^(1/2)*(-2)^n/(1*3*..*(2*n-1)) numeric n = abs(ex_to_numeric(x).sub(numHALF())); numeric coefficient = numeric(-2).power(n); coefficient = coefficient.div(doublefactorial(n.mul(numTWO()).sub(numONE())));; - return mul(coefficient,power(Pi,numHALF())); + return coefficient * power(Pi,numHALF()); } } } diff --git a/ginac/inifcns_trans.cpp b/ginac/inifcns_trans.cpp index 85443307..fae65318 100644 --- a/ginac/inifcns_trans.cpp +++ b/ginac/inifcns_trans.cpp @@ -23,7 +23,11 @@ #include #include -#include "ginac.h" +#include "inifcns.h" +#include "ex.h" +#include "constant.h" +#include "numeric.h" +#include "power.h" ////////// // exponential function diff --git a/ginac/isospin.cpp b/ginac/isospin.cpp index 5f527d7a..05ca5fbe 100644 --- a/ginac/isospin.cpp +++ b/ginac/isospin.cpp @@ -22,7 +22,9 @@ #include -#include "ginac.h" +#include "isospin.h" +#include "ex.h" +#include "ncmul.h" #include "utils.h" ////////// @@ -36,7 +38,7 @@ isospin::isospin() debugmsg("isospin default constructor",LOGLEVEL_CONSTRUCT); serial=next_serial++; name=autoname_prefix()+ToString(serial); - tinfo_key=TINFO_ISOSPIN; + tinfo_key=TINFO_isospin; } isospin::~isospin() @@ -88,7 +90,7 @@ isospin::isospin(string const & initname) debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT); name=initname; serial=next_serial++; - tinfo_key=TINFO_ISOSPIN; + tinfo_key=TINFO_isospin; } ////////// @@ -145,7 +147,7 @@ bool isospin::info(unsigned inf) const int isospin::compare_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_ISOSPIN); + ASSERT(other.tinfo() == TINFO_isospin); const isospin *o = static_cast(&other); if (serial==o->serial) { return indexed::compare_same_type(other); diff --git a/ginac/isospin.h b/ginac/isospin.h index 56ae1b79..331a70e6 100644 --- a/ginac/isospin.h +++ b/ginac/isospin.h @@ -23,6 +23,7 @@ #define __GINAC_ISOSPIN_H__ #include +#include /** Base class for isospin object */ class isospin : public indexed diff --git a/ginac/lorentzidx.cpp b/ginac/lorentzidx.cpp index af35a457..02611668 100644 --- a/ginac/lorentzidx.cpp +++ b/ginac/lorentzidx.cpp @@ -21,7 +21,7 @@ #include -#include "ginac.h" +#include "lorentzidx.h" #include "utils.h" ////////// @@ -35,7 +35,7 @@ lorentzidx::lorentzidx() : orthogonal_only(false), dim_parallel_space(0) debugmsg("lorentzidx default constructor",LOGLEVEL_CONSTRUCT); // serial is incremented in idx::idx() name="mu"+ToString(serial); - tinfo_key=TINFO_LORENTZIDX; + tinfo_key=TINFO_lorentzidx; } lorentzidx::~lorentzidx() @@ -90,7 +90,7 @@ lorentzidx::lorentzidx(bool cov, bool oonly, unsigned dimp) : } else { name="mu"+ToString(serial); } - tinfo_key=TINFO_LORENTZIDX; + tinfo_key=TINFO_lorentzidx; } lorentzidx::lorentzidx(string const & n, bool cov, bool oonly, unsigned dimp) @@ -98,7 +98,7 @@ lorentzidx::lorentzidx(string const & n, bool cov, bool oonly, unsigned dimp) { debugmsg("lorentzidx constructor from string,bool,bool,unsigned", LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_LORENTZIDX; + tinfo_key=TINFO_lorentzidx; } lorentzidx::lorentzidx(char const * n, bool cov, bool oonly, unsigned dimp) @@ -106,14 +106,14 @@ lorentzidx::lorentzidx(char const * n, bool cov, bool oonly, unsigned dimp) { debugmsg("lorentzidx constructor from char*,bool,bool,unsigned", LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_LORENTZIDX; + tinfo_key=TINFO_lorentzidx; } lorentzidx::lorentzidx(unsigned const v, bool cov) : idx(v,cov), orthogonal_only(false), dim_parallel_space(0) { debugmsg("lorentzidx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_LORENTZIDX; + tinfo_key=TINFO_lorentzidx; } ////////// diff --git a/ginac/lorentzidx.h b/ginac/lorentzidx.h index 8f9bbf40..00149408 100644 --- a/ginac/lorentzidx.h +++ b/ginac/lorentzidx.h @@ -24,6 +24,7 @@ #include #include +#include class lorentzidx : public idx { diff --git a/ginac/lst.cpp b/ginac/lst.cpp index 7fd3e407..0c752ccd 100644 --- a/ginac/lst.cpp +++ b/ginac/lst.cpp @@ -31,7 +31,8 @@ #include #include -#include "ginac.h" +#include "lst.h" +#include "ex.h" #define RESERVE(s,size) // no reserve needed for list @@ -41,7 +42,7 @@ // public -lst::lst() : basic(TINFO_LST) +lst::lst() : basic(TINFO_lst) { debugmsg("lst default constructor",LOGLEVEL_CONSTRUCT); } @@ -88,7 +89,7 @@ void lst::destroy(bool call_parent) // public -lst::lst(exlist const & s, bool discardable) : basic(TINFO_LST) +lst::lst(exlist const & s, bool discardable) : basic(TINFO_lst) { debugmsg("lst constructor from exlist", LOGLEVEL_CONSTRUCT); @@ -99,7 +100,7 @@ lst::lst(exlist const & s, bool discardable) : basic(TINFO_LST) } } -lst::lst(exlist * vp) : basic(TINFO_LST) +lst::lst(exlist * vp) : basic(TINFO_lst) { debugmsg("lst constructor from exlist *",LOGLEVEL_CONSTRUCT); ASSERT(vp!=0); @@ -107,7 +108,7 @@ lst::lst(exlist * vp) : basic(TINFO_LST) delete vp; } -lst::lst(ex const & e1) : basic(TINFO_LST) +lst::lst(ex const & e1) : basic(TINFO_lst) { debugmsg("lst constructor from 1 ex", LOGLEVEL_CONSTRUCT); @@ -115,7 +116,7 @@ lst::lst(ex const & e1) : basic(TINFO_LST) seq.push_back(e1); } -lst::lst(ex const & e1, ex const & e2) : basic(TINFO_LST) +lst::lst(ex const & e1, ex const & e2) : basic(TINFO_lst) { debugmsg("lst constructor from 2 ex", LOGLEVEL_CONSTRUCT); @@ -125,7 +126,7 @@ lst::lst(ex const & e1, ex const & e2) : basic(TINFO_LST) } lst::lst(ex const & e1, ex const & e2, ex const & e3) - : basic(TINFO_LST) + : basic(TINFO_lst) { debugmsg("lst constructor from 3 ex", LOGLEVEL_CONSTRUCT); @@ -136,7 +137,7 @@ lst::lst(ex const & e1, ex const & e2, ex const & e3) } lst::lst(ex const & e1, ex const & e2, ex const & e3, - ex const & e4) : basic(TINFO_LST) + ex const & e4) : basic(TINFO_lst) { debugmsg("lst constructor from 4 ex", LOGLEVEL_CONSTRUCT); @@ -148,7 +149,7 @@ lst::lst(ex const & e1, ex const & e2, ex const & e3, } lst::lst(ex const & e1, ex const & e2, ex const & e3, - ex const & e4, ex const & e5) : basic(TINFO_LST) + ex const & e4, ex const & e5) : basic(TINFO_lst) { debugmsg("lst constructor from 5 ex", LOGLEVEL_CONSTRUCT); @@ -162,7 +163,7 @@ lst::lst(ex const & e1, ex const & e2, ex const & e3, lst::lst(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6) - : basic(TINFO_LST) + : basic(TINFO_lst) { debugmsg("lst constructor from 6 ex", LOGLEVEL_CONSTRUCT); @@ -177,7 +178,7 @@ lst::lst(ex const & e1, ex const & e2, ex const & e3, lst::lst(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, - ex const & e7) : basic(TINFO_LST) + ex const & e7) : basic(TINFO_lst) { debugmsg("lst constructor from 7 ex", LOGLEVEL_CONSTRUCT); @@ -193,7 +194,7 @@ lst::lst(ex const & e1, ex const & e2, ex const & e3, lst::lst(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, - ex const & e7, ex const & e8) : basic(TINFO_LST) + ex const & e7, ex const & e8) : basic(TINFO_lst) { debugmsg("lst constructor from 8 ex", LOGLEVEL_CONSTRUCT); @@ -211,7 +212,7 @@ lst::lst(ex const & e1, ex const & e2, ex const & e3, lst::lst(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, ex const & e7, ex const & e8, ex const & e9) - : basic(TINFO_LST) + : basic(TINFO_lst) { debugmsg("lst constructor from 9 ex", LOGLEVEL_CONSTRUCT); @@ -231,7 +232,7 @@ lst::lst(ex const & e1, ex const & e2, ex const & e3, ex const & e4, ex const & e5, ex const & e6, ex const & e7, ex const & e8, ex const & e9, ex const &e10) - : basic(TINFO_LST) + : basic(TINFO_lst) { debugmsg("lst constructor from 10 ex", LOGLEVEL_CONSTRUCT); diff --git a/ginac/lst.h b/ginac/lst.h index 08b75f78..e96f950e 100644 --- a/ginac/lst.h +++ b/ginac/lst.h @@ -32,7 +32,7 @@ #define __GINAC_LST_H__ #include -#include +#include typedef list exlist; diff --git a/ginac/lst_suppl.cpp b/ginac/lst_suppl.cpp index ae5910d7..5e507afd 100644 --- a/ginac/lst_suppl.cpp +++ b/ginac/lst_suppl.cpp @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ginac.h" +#include "lst.h" bool lst::info(unsigned inf) const { diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index 59863ea5..efece856 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -22,7 +22,7 @@ #include #include -#include "ginac.h" +#include "matrix.h" ////////// // default constructor, destructor, copy constructor, assignment operator @@ -33,7 +33,7 @@ /** Default ctor. Initializes to 1 x 1-dimensional zero-matrix. */ matrix::matrix() - : basic(TINFO_MATRIX), row(1), col(1) + : basic(TINFO_matrix), row(1), col(1) { debugmsg("matrix default constructor",LOGLEVEL_CONSTRUCT); m.push_back(exZERO()); @@ -86,7 +86,7 @@ void matrix::destroy(bool call_parent) * @param r number of rows * @param c number of cols */ matrix::matrix(int r, int c) - : basic(TINFO_MATRIX), row(r), col(c) + : basic(TINFO_matrix), row(r), col(c) { debugmsg("matrix constructor from int,int",LOGLEVEL_CONSTRUCT); m.resize(r*c, exZERO()); @@ -96,7 +96,7 @@ matrix::matrix(int r, int c) /** Ctor from representation, for internal use only. */ matrix::matrix(int r, int c, vector const & m2) - : basic(TINFO_MATRIX), row(r), col(c), m(m2) + : basic(TINFO_matrix), row(r), col(c), m(m2) { debugmsg("matrix constructor from int,int,vector",LOGLEVEL_CONSTRUCT); } diff --git a/ginac/matrix.h b/ginac/matrix.h index 141437bf..f30a39a2 100644 --- a/ginac/matrix.h +++ b/ginac/matrix.h @@ -23,6 +23,8 @@ #define __GINAC_MATRIX_H__ #include +#include +#include /** Symbolic matrices. */ class matrix : public basic diff --git a/ginac/mul.cpp b/ginac/mul.cpp index ef0af1b7..021433a8 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -22,7 +22,9 @@ #include #include -#include "ginac.h" +#include "mul.h" +#include "add.h" +#include "power.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -33,7 +35,7 @@ mul::mul() { debugmsg("mul default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; } mul::~mul() @@ -79,7 +81,7 @@ void mul::destroy(bool call_parent) mul::mul(ex const & lh, ex const & rh) { debugmsg("mul constructor from ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; overall_coeff=exONE(); construct_from_2_ex(lh,rh); ASSERT(is_canonical()); @@ -88,7 +90,7 @@ mul::mul(ex const & lh, ex const & rh) mul::mul(exvector const & v) { debugmsg("mul constructor from exvector",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; overall_coeff=exONE(); construct_from_exvector(v); ASSERT(is_canonical()); @@ -98,7 +100,7 @@ mul::mul(exvector const & v) mul::mul(epvector const & v, bool do_not_canonicalize) { debugmsg("mul constructor from epvector,bool",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; if (do_not_canonicalize) { seq=v; #ifdef EXPAIRSEQ_USE_HASHTAB @@ -114,7 +116,7 @@ mul::mul(epvector const & v, bool do_not_canonicalize) mul::mul(epvector const & v) { debugmsg("mul constructor from epvector",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; overall_coeff=exONE(); construct_from_epvector(v); ASSERT(is_canonical()); @@ -123,7 +125,7 @@ mul::mul(epvector const & v) mul::mul(epvector const & v, ex const & oc) { debugmsg("mul constructor from epvector,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; overall_coeff=oc; construct_from_epvector(v); ASSERT(is_canonical()); @@ -132,7 +134,7 @@ mul::mul(epvector const & v, ex const & oc) mul::mul(epvector * vp, ex const & oc) { debugmsg("mul constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; ASSERT(vp!=0); overall_coeff=oc; construct_from_epvector(*vp); @@ -143,7 +145,7 @@ mul::mul(epvector * vp, ex const & oc) mul::mul(ex const & lh, ex const & mh, ex const & rh) { debugmsg("mul constructor from ex,ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_MUL; + tinfo_key = TINFO_mul; exvector factors; factors.reserve(3); factors.push_back(lh); diff --git a/ginac/mul.h b/ginac/mul.h index ee199376..b134fc20 100644 --- a/ginac/mul.h +++ b/ginac/mul.h @@ -22,7 +22,7 @@ #ifndef __GINAC_MUL_H__ #define __GINAC_MUL_H__ -class mul; +#include /** Product of expressions. */ class mul : public expairseq @@ -115,4 +115,3 @@ extern type_info const & typeid_mul; #define ex_to_mul(X) static_cast(*(X).bp) #endif // ndef __GINAC_MUL_H__ - diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index be9d8c9d..6d87597f 100644 --- a/ginac/ncmul.cpp +++ b/ginac/ncmul.cpp @@ -23,7 +23,10 @@ #include #include -#include "ginac.h" +#include "ncmul.h" +#include "ex.h" +#include "add.h" +#include "mul.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -34,7 +37,7 @@ ncmul::ncmul() { debugmsg("ncmul default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ncmul::~ncmul() @@ -81,28 +84,28 @@ ncmul::ncmul(ex const & lh, ex const & rh) : exprseq(lh,rh) { debugmsg("ncmul constructor from ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ncmul::ncmul(ex const & f1, ex const & f2, ex const & f3) : exprseq(f1,f2,f3) { debugmsg("ncmul constructor from 3 ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ncmul::ncmul(ex const & f1, ex const & f2, ex const & f3, ex const & f4) : exprseq(f1,f2,f3,f4) { debugmsg("ncmul constructor from 4 ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ncmul::ncmul(ex const & f1, ex const & f2, ex const & f3, ex const & f4, ex const & f5) : exprseq(f1,f2,f3,f4,f5) { debugmsg("ncmul constructor from 5 ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ncmul::ncmul(ex const & f1, ex const & f2, ex const & f3, @@ -110,19 +113,19 @@ ncmul::ncmul(ex const & f1, ex const & f2, ex const & f3, exprseq(f1,f2,f3,f4,f5,f6) { debugmsg("ncmul constructor from 6 ex",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ncmul::ncmul(exvector const & v, bool discardable) : exprseq(v,discardable) { debugmsg("ncmul constructor from exvector,bool",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ncmul::ncmul(exvector * vp) : exprseq(vp) { debugmsg("ncmul constructor from exvector *",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_NCMUL; + tinfo_key = TINFO_ncmul; } ////////// diff --git a/ginac/ncmul.h b/ginac/ncmul.h index 3e7fbc58..5a8b732b 100644 --- a/ginac/ncmul.h +++ b/ginac/ncmul.h @@ -22,6 +22,8 @@ #ifndef __GINAC_NCMUL_H__ #define __GINAC_NCMUL_H__ +#include + /** Non-commutative product of expressions. */ class ncmul : public exprseq { diff --git a/ginac/normal.cpp b/ginac/normal.cpp index c0459685..fe4eb3cc 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -25,7 +25,23 @@ #include -#include "ginac.h" +#include "normal.h" +#include "basic.h" +#include "ex.h" +#include "add.h" +#include "constant.h" +#include "expairseq.h" +#include "fail.h" +#include "indexed.h" +#include "inifcns.h" +#include "lst.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" +#include "series.h" +#include "symbol.h" // If comparing expressions (ex::compare()) is fast, you can set this to 1. // Some routines like quo(), rem() and gcd() will then return a quick answer diff --git a/ginac/normal.h b/ginac/normal.h index 731ab5ae..d4d8ac16 100644 --- a/ginac/normal.h +++ b/ginac/normal.h @@ -23,6 +23,9 @@ #ifndef NORMAL_H #define NORMAL_H +class ex; +class symbol; + // Quotient q(x) of polynomials a(x) and b(x) in Q[x], so that a(x)=b(x)*q(x)+r(x) extern ex quo(const ex &a, const ex &b, const symbol &x, bool check_args = true); diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index fa17175c..886fac72 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -26,7 +26,8 @@ #include #include -#include "ginac.h" +#include "numeric.h" +#include "ex.h" #include "config.h" // CLN should not pollute the global namespace, hence we include it here @@ -48,7 +49,7 @@ // public /** default ctor. Numerically it initializes to an integer zero. */ -numeric::numeric() : basic(TINFO_NUMERIC) +numeric::numeric() : basic(TINFO_numeric) { debugmsg("numeric default constructor", LOGLEVEL_CONSTRUCT); value = new cl_N; @@ -100,7 +101,7 @@ void numeric::destroy(bool call_parent) // public -numeric::numeric(int i) : basic(TINFO_NUMERIC) +numeric::numeric(int i) : basic(TINFO_numeric) { debugmsg("numeric constructor from int",LOGLEVEL_CONSTRUCT); // Not the whole int-range is available if we don't cast to long @@ -112,7 +113,7 @@ numeric::numeric(int i) : basic(TINFO_NUMERIC) status_flags::hash_calculated); } -numeric::numeric(unsigned int i) : basic(TINFO_NUMERIC) +numeric::numeric(unsigned int i) : basic(TINFO_numeric) { debugmsg("numeric constructor from uint",LOGLEVEL_CONSTRUCT); // Not the whole uint-range is available if we don't cast to ulong @@ -124,7 +125,7 @@ numeric::numeric(unsigned int i) : basic(TINFO_NUMERIC) status_flags::hash_calculated); } -numeric::numeric(long i) : basic(TINFO_NUMERIC) +numeric::numeric(long i) : basic(TINFO_numeric) { debugmsg("numeric constructor from long",LOGLEVEL_CONSTRUCT); value = new cl_I(i); @@ -133,7 +134,7 @@ numeric::numeric(long i) : basic(TINFO_NUMERIC) status_flags::hash_calculated); } -numeric::numeric(unsigned long i) : basic(TINFO_NUMERIC) +numeric::numeric(unsigned long i) : basic(TINFO_numeric) { debugmsg("numeric constructor from ulong",LOGLEVEL_CONSTRUCT); value = new cl_I(i); @@ -145,7 +146,7 @@ numeric::numeric(unsigned long i) : basic(TINFO_NUMERIC) /** Ctor for rational numerics a/b. * * @exception overflow_error (division by zero) */ -numeric::numeric(long numer, long denom) : basic(TINFO_NUMERIC) +numeric::numeric(long numer, long denom) : basic(TINFO_numeric) { debugmsg("numeric constructor from long/long",LOGLEVEL_CONSTRUCT); if (!denom) @@ -157,7 +158,7 @@ numeric::numeric(long numer, long denom) : basic(TINFO_NUMERIC) status_flags::hash_calculated); } -numeric::numeric(double d) : basic(TINFO_NUMERIC) +numeric::numeric(double d) : basic(TINFO_numeric) { debugmsg("numeric constructor from double",LOGLEVEL_CONSTRUCT); // We really want to explicitly use the type cl_LF instead of the @@ -170,7 +171,7 @@ numeric::numeric(double d) : basic(TINFO_NUMERIC) status_flags::hash_calculated); } -numeric::numeric(char const *s) : basic(TINFO_NUMERIC) +numeric::numeric(char const *s) : basic(TINFO_numeric) { // MISSING: treatment of complex and ints and rationals. debugmsg("numeric constructor from string",LOGLEVEL_CONSTRUCT); if (strchr(s, '.')) @@ -184,7 +185,7 @@ numeric::numeric(char const *s) : basic(TINFO_NUMERIC) /** Ctor from CLN types. This is for the initiated user or internal use * only. */ -numeric::numeric(cl_N const & z) : basic(TINFO_NUMERIC) +numeric::numeric(cl_N const & z) : basic(TINFO_numeric) { debugmsg("numeric constructor from cl_N", LOGLEVEL_CONSTRUCT); value = new cl_N(z); diff --git a/ginac/numeric.h b/ginac/numeric.h index c9bd404b..b8abb189 100644 --- a/ginac/numeric.h +++ b/ginac/numeric.h @@ -23,6 +23,7 @@ #define __GINAC_NUMERIC_H__ #include +#include #define HASHVALUE_NUMERIC 0x80000001U diff --git a/ginac/operators.cpp b/ginac/operators.cpp index b589c3c4..0448f025 100644 --- a/ginac/operators.cpp +++ b/ginac/operators.cpp @@ -22,7 +22,12 @@ #include #include -#include "ginac.h" +#include "operators.h" +#include "basic.h" +#include "ex.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" // binary arithmetic operators ex with ex diff --git a/ginac/operators.h b/ginac/operators.h index 7ccd39f6..9cfb01c6 100644 --- a/ginac/operators.h +++ b/ginac/operators.h @@ -24,6 +24,10 @@ #include +class ex; +class numeric; +class relational; + // binary arithmetic operators ex with ex ex operator+(ex const & lh, ex const & rh); ex operator-(ex const & lh, ex const & rh); diff --git a/ginac/power.cpp b/ginac/power.cpp index 39ad8998..afb34e68 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -23,7 +23,13 @@ #include #include -#include "ginac.h" +#include "power.h" +#include "expairseq.h" +#include "add.h" +#include "mul.h" +#include "numeric.h" +#include "relational.h" +#include "symbol.h" typedef vector intvector; @@ -33,7 +39,7 @@ typedef vector intvector; // public -power::power() : basic(TINFO_POWER) +power::power() : basic(TINFO_power) { debugmsg("power default constructor",LOGLEVEL_CONSTRUCT); } @@ -80,13 +86,13 @@ void power::destroy(bool call_parent) // public -power::power(ex const & lh, ex const & rh) : basic(TINFO_POWER), basis(lh), exponent(rh) +power::power(ex const & lh, ex const & rh) : basic(TINFO_power), basis(lh), exponent(rh) { debugmsg("power constructor from ex,ex",LOGLEVEL_CONSTRUCT); ASSERT(basis.return_type()==return_types::commutative); } -power::power(ex const & lh, numeric const & rh) : basic(TINFO_POWER), basis(lh), exponent(rh) +power::power(ex const & lh, numeric const & rh) : basic(TINFO_power), basis(lh), exponent(rh) { debugmsg("power constructor from ex,numeric",LOGLEVEL_CONSTRUCT); ASSERT(basis.return_type()==return_types::commutative); diff --git a/ginac/power.h b/ginac/power.h index a946a82f..8533a069 100644 --- a/ginac/power.h +++ b/ginac/power.h @@ -22,7 +22,9 @@ #ifndef __GINAC_POWER_H__ #define __GINAC_POWER_H__ -class power; +#include +#include + class numeric; class add; diff --git a/ginac/print.cpp b/ginac/print.cpp index 8fc1af37..2d3a9363 100644 --- a/ginac/print.cpp +++ b/ginac/print.cpp @@ -22,7 +22,22 @@ #include -#include "ginac.h" +#include "basic.h" +#include "ex.h" +#include "add.h" +#include "constant.h" +#include "expairseq.h" +#include "fail.h" +#include "indexed.h" +#include "inifcns.h" +#include "matrix.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" +#include "series.h" +#include "symbol.h" void ex::print(ostream & os, unsigned upper_precedence) const { diff --git a/ginac/printcsrc.cpp b/ginac/printcsrc.cpp index 34056400..2a23ab80 100644 --- a/ginac/printcsrc.cpp +++ b/ginac/printcsrc.cpp @@ -22,7 +22,20 @@ #include -#include "ginac.h" +#include "basic.h" +#include "ex.h" +#include "add.h" +#include "constant.h" +#include "expairseq.h" +#include "indexed.h" +#include "inifcns.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" +#include "series.h" +#include "symbol.h" /** Print expression as a C++ statement. The output looks like * " = ;". The "type" parameter has an effect diff --git a/ginac/printraw.cpp b/ginac/printraw.cpp index a7046106..6be1fbfb 100644 --- a/ginac/printraw.cpp +++ b/ginac/printraw.cpp @@ -26,7 +26,22 @@ #include -#include "ginac.h" +#include "basic.h" +#include "ex.h" +#include "add.h" +#include "constant.h" +#include "expairseq.h" +#include "fail.h" +#include "indexed.h" +#include "inifcns.h" +#include "matrix.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" +#include "series.h" +#include "symbol.h" void ex::printraw(ostream & os) const { diff --git a/ginac/printtree.cpp b/ginac/printtree.cpp index d30f5058..89498c5e 100644 --- a/ginac/printtree.cpp +++ b/ginac/printtree.cpp @@ -23,7 +23,20 @@ #include #include -#include "ginac.h" +#include "basic.h" +#include "ex.h" +#include "add.h" +#include "constant.h" +#include "expairseq.h" +#include "indexed.h" +#include "inifcns.h" +#include "mul.h" +#include "ncmul.h" +#include "numeric.h" +#include "power.h" +#include "relational.h" +#include "series.h" +#include "symbol.h" void ex::printtree(ostream & os, unsigned indent) const { diff --git a/ginac/relational.cpp b/ginac/relational.cpp index 9dad5cc7..db6b5cf2 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -21,7 +21,8 @@ #include -#include "ginac.h" +#include "relational.h" +#include "numeric.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -29,7 +30,7 @@ // public -relational::relational() : basic(TINFO_RELATIONAL) +relational::relational() : basic(TINFO_relational) { debugmsg("relational default constructor",LOGLEVEL_CONSTRUCT); } @@ -77,7 +78,7 @@ void relational::destroy(bool call_parent) // public -relational::relational(ex const & lhs, ex const & rhs, operators oper) : basic(TINFO_RELATIONAL) +relational::relational(ex const & lhs, ex const & rhs, operators oper) : basic(TINFO_relational) { debugmsg("relational constructor ex,ex,operator",LOGLEVEL_CONSTRUCT); lh=lhs; diff --git a/ginac/relational.h b/ginac/relational.h index 97a9f666..6f5009df 100644 --- a/ginac/relational.h +++ b/ginac/relational.h @@ -22,6 +22,9 @@ #ifndef __GINAC_RELATIONAL_H__ #define __GINAC_RELATIONAL_H__ +#include +#include + /** This class holds a relation consisting of two expressions and a logical * relation between them. */ class relational : public basic diff --git a/ginac/series.cpp b/ginac/series.cpp index 668cb6ba..187a8472 100644 --- a/ginac/series.cpp +++ b/ginac/series.cpp @@ -20,14 +20,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ginac.h" +#include "series.h" +#include "add.h" +#include "inifcns.h" +#include "mul.h" +#include "power.h" +#include "relational.h" +#include "symbol.h" /* * Default constructor, destructor, copy constructor, assignment operator and helpers */ -series::series() : basic(TINFO_SERIES) +series::series() : basic(TINFO_series) { debugmsg("series default constructor", LOGLEVEL_CONSTRUCT); } @@ -84,7 +90,7 @@ void series::destroy(bool call_parent) * @param ops_ vector of {coefficient, power} pairs (coefficient must not be zero) * @return newly constructed series */ series::series(ex const &var_, ex const &point_, epvector const &ops_) - : basic(TINFO_SERIES), seq(ops_), var(var_), point(point_) + : basic(TINFO_series), seq(ops_), var(var_), point(point_) { debugmsg("series constructor from ex,ex,epvector", LOGLEVEL_CONSTRUCT); ASSERT(is_ex_exactly_of_type(var_, symbol)); @@ -104,7 +110,7 @@ basic *series::duplicate() const // Highest degree of variable int series::degree(symbol const &s) const { - if (var == s) { + if (var.is_equal(s)) { // Return last exponent if (seq.size()) return ex_to_numeric((*(seq.end() - 1)).coeff).to_int(); @@ -128,7 +134,7 @@ int series::degree(symbol const &s) const // Lowest degree of variable int series::ldegree(symbol const &s) const { - if (var == s) { + if (var.is_equal(s)) { // Return first exponent if (seq.size()) return ex_to_numeric((*(seq.begin())).coeff).to_int(); @@ -152,7 +158,7 @@ int series::ldegree(symbol const &s) const // Coefficient of variable ex series::coeff(symbol const &s, int n) const { - if (var == s) { + if (var.is_equal(s)) { epvector::const_iterator it = seq.begin(), itend = seq.end(); while (it != itend) { int pow = ex_to_numeric(it->coeff).to_int(); @@ -312,7 +318,7 @@ ex series::add_series(const series &other) const break; // Order term ends the sequence } else { ex sum = (*a).rest + (*b).rest; - if (!(sum == exZERO())) + if (!(sum.is_zero())) new_seq.push_back(expair(sum, numeric(pow_a))); a++; b++; diff --git a/ginac/series.h b/ginac/series.h index e0fe511f..8d7822db 100644 --- a/ginac/series.h +++ b/ginac/series.h @@ -22,6 +22,9 @@ #ifndef __GINAC_SERIES_H__ #define __GINAC_SERIES_H__ +#include +#include + /** This class holds a extended truncated power series (positive and negative * integer powers). It consists of expression coefficients (only non-zero * coefficients are stored), an expansion variable and an expansion point. diff --git a/ginac/simp_lor.cpp b/ginac/simp_lor.cpp index ac8aae06..5e289aa6 100644 --- a/ginac/simp_lor.cpp +++ b/ginac/simp_lor.cpp @@ -27,7 +27,10 @@ #include #include -#include "ginac.h" +#include "simp_lor.h" +#include "ex.h" +#include "mul.h" +#include "symbol.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -38,7 +41,7 @@ simp_lor::simp_lor() : type(invalid) { debugmsg("simp_lor default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_SIMP_LOR; + tinfo_key=TINFO_simp_lor; } simp_lor::~simp_lor() @@ -88,14 +91,14 @@ void simp_lor::destroy(bool call_parent) simp_lor::simp_lor(simp_lor_types const t) : type(t) { debugmsg("simp_lor constructor from simp_lor_types",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_SIMP_LOR; + tinfo_key=TINFO_simp_lor; } simp_lor::simp_lor(simp_lor_types const t, ex const & i1, ex const & i2) : indexed(i1,i2), type(t) { debugmsg("simp_lor constructor from simp_lor_types,ex,ex",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_SIMP_LOR; + tinfo_key=TINFO_simp_lor; ASSERT(all_of_type_lorentzidx()); } @@ -103,7 +106,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, ex const & i1) : indexed(i1), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_SIMP_LOR; + tinfo_key=TINFO_simp_lor; ASSERT(all_of_type_lorentzidx()); } @@ -111,7 +114,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector const & iv indexed(iv), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_SIMP_LOR; + tinfo_key=TINFO_simp_lor; ASSERT(all_of_type_lorentzidx()); } @@ -119,7 +122,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector * ivp) : indexed(ivp), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT); - tinfo_key=TINFO_SIMP_LOR; + tinfo_key=TINFO_simp_lor; ASSERT(all_of_type_lorentzidx()); } @@ -232,7 +235,7 @@ ex simp_lor::eval(int level) const int simp_lor::compare_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_SIMP_LOR); + ASSERT(other.tinfo() == TINFO_simp_lor); const simp_lor *o = static_cast(&other); if (type==o->type) { if (name==o->name) { @@ -245,7 +248,7 @@ int simp_lor::compare_same_type(basic const & other) const bool simp_lor::is_equal_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_SIMP_LOR); + ASSERT(other.tinfo() == TINFO_simp_lor); const simp_lor *o = static_cast(&other); if (type!=o->type) return false; if (name!=o->name) return false; @@ -330,7 +333,7 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) v_contracted.reserve(2*n); for (int i=0; i #include #include +#include +#include typedef pair strstrpair; typedef pair spmapkey; diff --git a/ginac/structure.cpp b/ginac/structure.cpp index b155f946..e7cb8303 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -21,7 +21,7 @@ #include -#include "ginac.h" +#include "structure.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -32,7 +32,7 @@ structure::structure() { debugmsg("structure default constructor",LOGLEVEL_CONSTRUCT); - tinfo_key = TINFO_STRUCTURE; + tinfo_key = TINFO_structure; } structure::~structure() diff --git a/ginac/structure.h b/ginac/structure.h index ead2670f..cbe44758 100644 --- a/ginac/structure.h +++ b/ginac/structure.h @@ -22,6 +22,8 @@ #ifndef __GINAC_STRUCTURE_H__ #define __GINAC_STRUCTURE_H__ +#include + struct registered_structure_info { char const * name; }; diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index f9d64929..839a105a 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -22,14 +22,15 @@ #include #include -#include "ginac.h" +#include "symbol.h" +#include "lst.h" #include "utils.h" ////////// // default constructor, destructor, copy constructor assignment operator and helpers ////////// -symbol::symbol() : basic(TINFO_SYMBOL) +symbol::symbol() : basic(TINFO_symbol) { debugmsg("symbol default constructor",LOGLEVEL_CONSTRUCT); serial=next_serial++; @@ -81,7 +82,7 @@ void symbol::destroy(bool call_parent) // public -symbol::symbol(string const & initname) : basic(TINFO_SYMBOL) +symbol::symbol(string const & initname) : basic(TINFO_symbol) { debugmsg("symbol constructor from string",LOGLEVEL_CONSTRUCT); name=initname; diff --git a/ginac/symbol.h b/ginac/symbol.h index 8b8e9a76..5bd60159 100644 --- a/ginac/symbol.h +++ b/ginac/symbol.h @@ -23,6 +23,8 @@ #define __GINAC_SYMBOL_H__ #include +#include +#include /** Basic CAS symbol. It has a name because it must know how to output itself. * It may be assigned an expression, but this feature is only intended for diff --git a/ginac/tinfos.h b/ginac/tinfos.h index 1d0f1dc3..24aeef05 100644 --- a/ginac/tinfos.h +++ b/ginac/tinfos.h @@ -22,47 +22,46 @@ #ifndef __GINAC_TINFOS_H__ #define __GINAC_TINFOS_H__ -#define TINFO_BASIC 0x00000001U +#define TINFO_basic 0x00000001U -#define TINFO_EXPAIRSEQ 0x00010001U -#define TINFO_ADD 0x00011001U -#define TINFO_MUL 0x00011002U +#define TINFO_expairseq 0x00010001U +#define TINFO_add 0x00011001U +#define TINFO_mul 0x00011002U -#define TINFO_SYMBOL 0x00020001U -#define TINFO_CONSTANT 0x00021001U +#define TINFO_symbol 0x00020001U +#define TINFO_constant 0x00021001U -#define TINFO_EXPRSEQ 0x00030001U -#define TINFO_FUNCTION 0x00031001U -#define TINFO_NCMUL 0x00031002U -// #define TINFO_NFUNCTION 0x00031003U +#define TINFO_exprseq 0x00030001U +#define TINFO_function 0x00031001U +#define TINFO_ncmul 0x00031002U -#define TINFO_LST 0x00040001U +#define TINFO_lst 0x00040001U -#define TINFO_MATRIX 0x00050001U +#define TINFO_matrix 0x00050001U -#define TINFO_POWER 0x00060001U +#define TINFO_power 0x00060001U -#define TINFO_RELATIONAL 0x00070001U +#define TINFO_relational 0x00070001U -#define TINFO_FAIL 0x00080001U +#define TINFO_fail 0x00080001U -#define TINFO_NUMERIC 0x00090001U +#define TINFO_numeric 0x00090001U -#define TINFO_SERIES 0x000a0001U +#define TINFO_series 0x000a0001U -#define TINFO_INDEXED 0x000b0001U -#define TINFO_ALGEBRA 0x000b1001U -#define TINFO_CLIFFORD 0x000b1101U -#define TINFO_COLOR 0x000b1201U -#define TINFO_ISOSPIN 0x000b1301U -#define TINFO_SIMP_LOR 0x000b1401U +#define TINFO_indexed 0x000b0001U +#define TINFO_algebra 0x000b1001U +#define TINFO_clifford 0x000b1101U +#define TINFO_color 0x000b1201U +#define TINFO_isospin 0x000b1301U +#define TINFO_simp_lor 0x000b1401U -#define TINFO_STRUCTURE 0x000c0001U +#define TINFO_structure 0x000c0001U // reserved up to 0x000cffffU // for user defined structures -#define TINFO_IDX 0x000d0001U -#define TINFO_COLORIDX 0x000d1001U -#define TINFO_LORENTZIDX 0x000d1002U +#define TINFO_idx 0x000d0001U +#define TINFO_coloridx 0x000d1001U +#define TINFO_lorentzidx 0x000d1002U #endif // ndef __GINAC_TINFOS_H__ diff --git a/ginac/utils.cpp b/ginac/utils.cpp index 69d4f461..15f4cc57 100644 --- a/ginac/utils.cpp +++ b/ginac/utils.cpp @@ -19,6 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "utils.h" + unsigned log2(unsigned n) { unsigned k;