#include <iostream>
#include <stdexcept>
-#include "ginac.h"
+#include "add.h"
+#include "mul.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
add::add()
{
debugmsg("add default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_ADD;
+ tinfo_key = TINFO_add;
}
add::~add()
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());
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());
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
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());
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());
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);
#ifndef __GINAC_ADD_H__
#define __GINAC_ADD_H__
+#include <ginac/expairseq.h>
+
/** Sum of expressions. */
class add : public expairseq
{
#define ex_to_add(X) static_cast<add const &>(*(X).bp)
#endif // ndef __GINAC_ADD_H__
-
#include <typeinfo>
#include <stdexcept>
-#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"
//////////
#include <typeinfo>
#include <vector>
+#include <ginac/flags.h>
+#include <ginac/tinfos.h>
+#include <ginac/debugmsg.h>
+
class basic;
class ex;
class symbol;
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
extern int max_recursion_level;
-/*
-#ifndef _DEBUG
-*/
+// convenience macros
+
#define is_of_type(OBJ,TYPE) \
(dynamic_cast<TYPE *>(const_cast<basic *>(&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<TYPE *>(const_cast<basic *>(&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<TYPE *>(const_cast<basic *>((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)
#include <string>
-#include "ginac.h"
+#include "clifford.h"
+#include "ex.h"
+#include "ncmul.h"
#include "utils.h"
//////////
debugmsg("clifford default constructor",LOGLEVEL_CONSTRUCT);
serial=next_serial++;
name=autoname_prefix()+ToString(serial);
- tinfo_key=TINFO_CLIFFORD;
+ tinfo_key=TINFO_clifford;
}
clifford::~clifford()
debugmsg("clifford constructor from string",LOGLEVEL_CONSTRUCT);
name=initname;
serial=next_serial++;
- tinfo_key=TINFO_CLIFFORD;
+ tinfo_key=TINFO_clifford;
}
//////////
int clifford::compare_same_type(basic const & other) const
{
- ASSERT(other.tinfo() == TINFO_CLIFFORD);
+ ASSERT(other.tinfo() == TINFO_clifford);
const clifford *o = static_cast<const clifford *>(&other);
if (serial==o->serial) {
return indexed::compare_same_type(other);
#define __GINAC_CLIFFORD_H__
#include <string>
+#include <ginac/indexed.h>
/** Base class for clifford object */
class clifford : public indexed
#include <iostream>
#include <stdexcept>
-#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
color::color() : type(invalid), representation_label(0)
{
debugmsg("color default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key=TINFO_COLOR;
+ tinfo_key=TINFO_color;
}
color::~color()
{
debugmsg("color constructor from color_types,unsigned",LOGLEVEL_CONSTRUCT);
ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
- tinfo_key=TINFO_COLOR;
+ tinfo_key=TINFO_color;
ASSERT(all_of_type_coloridx());
}
{
debugmsg("color constructor from color_types,ex,unsigned",LOGLEVEL_CONSTRUCT);
ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
- tinfo_key=TINFO_COLOR;
+ tinfo_key=TINFO_color;
ASSERT(all_of_type_coloridx());
}
{
debugmsg("color constructor from color_types,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
- tinfo_key=TINFO_COLOR;
+ tinfo_key=TINFO_color;
ASSERT(all_of_type_coloridx());
}
{
debugmsg("color constructor from color_types,ex,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
- tinfo_key=TINFO_COLOR;
+ tinfo_key=TINFO_color;
ASSERT(all_of_type_coloridx());
}
{
debugmsg("color constructor from color_types,exvector,unsigned",LOGLEVEL_CONSTRUCT);
ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
- tinfo_key=TINFO_COLOR;
+ tinfo_key=TINFO_color;
ASSERT(all_of_type_coloridx());
}
{
debugmsg("color constructor from color_types,exvector *,unsigned",LOGLEVEL_CONSTRUCT);
ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
- tinfo_key=TINFO_COLOR;
+ tinfo_key=TINFO_color;
ASSERT(all_of_type_coloridx());
}
int color::compare_same_type(basic const & other) const
{
- ASSERT(other.tinfo() == TINFO_COLOR);
+ ASSERT(other.tinfo() == TINFO_color);
const color *o = static_cast<const color *>(&other);
if (type==o->type) {
if (representation_label==o->representation_label) {
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<const color *>(&other);
if (type!=o->type) return false;
if (representation_label!=o->representation_label) return false;
#include <string>
#include <vector>
+#include <ginac/indexed.h>
#define MAX_REPRESENTATION_LABELS 4
#define COLOR_EIGHT 8 // N*N-1
#include <stdexcept>
-#include "ginac.h"
+#include "coloridx.h"
#include "utils.h"
//////////
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()
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;
}
//////////
#include <string>
#include <vector>
+#include <ginac/idx.h>
class coloridx : public idx
{
#include <string>
#include <stdexcept>
-#include "ginac.h"
+#include "constant.h"
+#include "numeric.h"
+#include "ex.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
// 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);
#define __GINAC_CONSTANT_H__
#include <string>
+#include <ginac/basic.h>
/** This class holds constants, symbols with specific numerical value. Each
* object of this class must either provide their own function to evaluate it
#define __GINAC_${CONTAINER_UC}_H__
#include <${STLHEADER}>
-#include <ginac/ginac.h>
+#include <ginac/basic.h>
typedef ${STLHEADER}<ex> ${STLT};
#include <iostream>
#include <stdexcept>
-#include "ginac.h"
+#include "${CONTAINER}.h"
+#include "ex.h"
${RESERVE_IMPLEMENTATION}
// public
-${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER_UC})
+${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER})
{
debugmsg("${CONTAINER} default constructor",LOGLEVEL_CONSTRUCT);
}
// 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);
}
}
-${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);
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);
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);
}
${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);
}
${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);
}
${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);
${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);
${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);
${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);
${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);
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);
#include <stdexcept>
-#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 */
#include <iostream>
-#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
#define __GINAC_EX_H__
#include <iostream>
+#include <ginac/basic.h>
+#include <ginac/operators.h>
class ex;
class expand_options;
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef __GINAC_EXPAIR_H__
+#define __GINAC_EXPAIR_H__
+
+#include <ginac/ex.h>
+#include <ginac/numeric.h>
+
/** A pair of expressions.
* This similar to, but slightly extended STL's pair<> but we need to account
* for methods like .compare() */
}
};
-
-
+#endif // ndef __GINAC_EXPAIR_H__
#include <string>
#include <stdexcept>
-#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."
// 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);
/*
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) {
*/
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);
}
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);
#include <vector>
#include <list>
+#include <ginac/expair.h>
//#define EXPAIRSEQ_USE_HASHTAB
// 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
#include <iostream>
#include <stdexcept>
-#include "ginac.h"
+#include "exprseq.h"
+#include "ex.h"
#define RESERVE(s,size) (s).reserve(size)
// public
-exprseq::exprseq() : basic(TINFO_EXPRSEQ)
+exprseq::exprseq() : basic(TINFO_exprseq)
{
debugmsg("exprseq default constructor",LOGLEVEL_CONSTRUCT);
}
// 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);
}
}
-exprseq::exprseq(exvector * vp) : basic(TINFO_EXPRSEQ)
+exprseq::exprseq(exvector * vp) : basic(TINFO_exprseq)
{
debugmsg("exprseq constructor from exvector *",LOGLEVEL_CONSTRUCT);
ASSERT(vp!=0);
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);
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);
}
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);
}
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);
}
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);
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);
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);
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);
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);
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);
#define __GINAC_EXPRSEQ_H__
#include <vector>
-#include <ginac/ginac.h>
+#include <ginac/basic.h>
typedef vector<ex> exvector;
* 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
{
* 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
// public
-fail::fail() : basic(TINFO_FAIL)
+fail::fail() : basic(TINFO_fail)
{
debugmsg("fail default constructor",LOGLEVEL_CONSTRUCT);
}
#ifndef __GINAC_FAIL_H__
#define __GINAC_FAIL_H__
+#include <ginac/basic.h>
+
class fail : public basic
{
// member functions
#include <string>
#include <stdexcept>
-#include "ginac.h"
+#include "function.h"
+#include "ex.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
function::function() : serial(0)
{
debugmsg("function default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_FUNCTION;
+ tinfo_key = TINFO_function;
}
function::~function()
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
: 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
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;
}
//////////
#include <string>
#include <vector>
+#include <ginac/exprseq.h>
class function;
extern type_info const & typeid_function;
#endif // ndef __GINAC_FUNCTION_H__
-
: 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
#include <string>
#include <vector>
+#include <ginac/exprseq.h>
class function;
#include <string>
#include <stdexcept>
-#include "ginac.h"
+#include "function.h"
+#include "ex.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
function::function() : serial(0)
{
debugmsg("function default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_FUNCTION;
+ tinfo_key = TINFO_function;
}
function::~function()
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. ${maxargs} parameters
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;
}
//////////
#ifndef __GINAC_H__
#define __GINAC_H__
-#include <ginac/flags.h>
-#include <ginac/tinfos.h>
-#include <ginac/debugmsg.h>
-
#include <ginac/basic.h>
#include <ginac/ex.h>
#include <stdexcept>
-#include "ginac.h"
+#include "idx.h"
+#include "ex.h"
+#include "lst.h"
+#include "relational.h"
#include "utils.h"
//////////
// 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++;
// 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);
#include <string>
#include <vector>
+#include <ginac/basic.h>
class idx : public basic
{
#include <string>
-#include "ginac.h"
+#include "indexed.h"
+#include "ex.h"
+#include "idx.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
indexed::indexed()
{
debugmsg("indexed default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key=TINFO_INDEXED;
+ tinfo_key=TINFO_indexed;
}
indexed::~indexed()
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());
}
: 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());
}
#define __GINAC_INDEXED_H__
#include <string>
+#include <ginac/exprseq.h>
/** Base class for non-commutative indexed objects */
class indexed : public exprseq
#include <vector>
#include <stdexcept>
-#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
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)) {
}
/** non-commutative power. */
-ex ncpower(ex basis, unsigned exponent)
+ex ncpower(ex const &basis, unsigned exponent)
{
if (exponent==0) {
return exONE();
return ncmul(v,1);
}
-
#ifndef __GINAC_INIFCNS_H__
#define __GINAC_INIFCNS_H__
+#include <ginac/function.h>
+#include <ginac/ex.h>
+
/** Sine. */
DECLARE_FUNCTION_1P(sin)
/** 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)
{
#include <vector>
#include <stdexcept>
-#include "ginac.h"
+#include "inifcns.h"
+#include "ex.h"
+#include "constant.h"
+#include "numeric.h"
+#include "power.h"
+#include "symbol.h"
//////////
// gamma function
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());
}
}
}
#include <vector>
#include <stdexcept>
-#include "ginac.h"
+#include "inifcns.h"
+#include "ex.h"
+#include "constant.h"
+#include "numeric.h"
+#include "power.h"
//////////
// exponential function
#include <string>
-#include "ginac.h"
+#include "isospin.h"
+#include "ex.h"
+#include "ncmul.h"
#include "utils.h"
//////////
debugmsg("isospin default constructor",LOGLEVEL_CONSTRUCT);
serial=next_serial++;
name=autoname_prefix()+ToString(serial);
- tinfo_key=TINFO_ISOSPIN;
+ tinfo_key=TINFO_isospin;
}
isospin::~isospin()
debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT);
name=initname;
serial=next_serial++;
- tinfo_key=TINFO_ISOSPIN;
+ tinfo_key=TINFO_isospin;
}
//////////
int isospin::compare_same_type(basic const & other) const
{
- ASSERT(other.tinfo() == TINFO_ISOSPIN);
+ ASSERT(other.tinfo() == TINFO_isospin);
const isospin *o = static_cast<const isospin *>(&other);
if (serial==o->serial) {
return indexed::compare_same_type(other);
#define __GINAC_ISOSPIN_H__
#include <string>
+#include <ginac/indexed.h>
/** Base class for isospin object */
class isospin : public indexed
#include <stdexcept>
-#include "ginac.h"
+#include "lorentzidx.h"
#include "utils.h"
//////////
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()
} else {
name="mu"+ToString(serial);
}
- tinfo_key=TINFO_LORENTZIDX;
+ tinfo_key=TINFO_lorentzidx;
}
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)
{
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;
}
//////////
#include <string>
#include <vector>
+#include <ginac/idx.h>
class lorentzidx : public idx
{
#include <iostream>
#include <stdexcept>
-#include "ginac.h"
+#include "lst.h"
+#include "ex.h"
#define RESERVE(s,size) // no reserve needed for list
// public
-lst::lst() : basic(TINFO_LST)
+lst::lst() : basic(TINFO_lst)
{
debugmsg("lst default constructor",LOGLEVEL_CONSTRUCT);
}
// 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);
}
}
-lst::lst(exlist * vp) : basic(TINFO_LST)
+lst::lst(exlist * vp) : basic(TINFO_lst)
{
debugmsg("lst constructor from exlist *",LOGLEVEL_CONSTRUCT);
ASSERT(vp!=0);
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);
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);
}
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);
}
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);
}
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);
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);
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);
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);
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);
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);
#define __GINAC_LST_H__
#include <list>
-#include <ginac/ginac.h>
+#include <ginac/basic.h>
typedef list<ex> exlist;
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "ginac.h"
+#include "lst.h"
bool lst::info(unsigned inf) const
{
#include <algorithm>
#include <stdexcept>
-#include "ginac.h"
+#include "matrix.h"
//////////
// default constructor, destructor, copy constructor, assignment operator
/** 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());
* @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());
/** Ctor from representation, for internal use only. */
matrix::matrix(int r, int c, vector<ex> 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<ex>",LOGLEVEL_CONSTRUCT);
}
#define __GINAC_MATRIX_H__
#include <vector>
+#include <ginac/basic.h>
+#include <ginac/ex.h>
/** Symbolic matrices. */
class matrix : public basic
#include <vector>
#include <stdexcept>
-#include "ginac.h"
+#include "mul.h"
+#include "add.h"
+#include "power.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
mul::mul()
{
debugmsg("mul default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_MUL;
+ tinfo_key = TINFO_mul;
}
mul::~mul()
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());
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());
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
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());
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());
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);
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);
#ifndef __GINAC_MUL_H__
#define __GINAC_MUL_H__
-class mul;
+#include <ginac/expairseq.h>
/** Product of expressions. */
class mul : public expairseq
#define ex_to_mul(X) static_cast<mul const &>(*(X).bp)
#endif // ndef __GINAC_MUL_H__
-
#include <iostream>
#include <stdexcept>
-#include "ginac.h"
+#include "ncmul.h"
+#include "ex.h"
+#include "add.h"
+#include "mul.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
ncmul::ncmul()
{
debugmsg("ncmul default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_NCMUL;
+ tinfo_key = TINFO_ncmul;
}
ncmul::~ncmul()
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,
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;
}
//////////
#ifndef __GINAC_NCMUL_H__
#define __GINAC_NCMUL_H__
+#include <ginac/exprseq.h>
+
/** Non-commutative product of expressions. */
class ncmul : public exprseq
{
#include <stdexcept>
-#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
#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);
#include <vector>
#include <stdexcept>
-#include "ginac.h"
+#include "numeric.h"
+#include "ex.h"
#include "config.h"
// CLN should not pollute the global namespace, hence we include it here
// 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;
// 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
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
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);
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);
/** 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)
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
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, '.'))
/** 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);
#define __GINAC_NUMERIC_H__
#include <strstream>
+#include <ginac/basic.h>
#define HASHVALUE_NUMERIC 0x80000001U
#include <iostream>
#include <stdexcept>
-#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
#include <iostream>
+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);
#include <iostream>
#include <stdexcept>
-#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<int> intvector;
// public
-power::power() : basic(TINFO_POWER)
+power::power() : basic(TINFO_power)
{
debugmsg("power default constructor",LOGLEVEL_CONSTRUCT);
}
// 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);
#ifndef __GINAC_POWER_H__
#define __GINAC_POWER_H__
-class power;
+#include <ginac/basic.h>
+#include <ginac/ex.h>
+
class numeric;
class add;
#include <iostream>
-#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
{
#include <iostream>
-#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
* "<type> <var_name> = <expression>;". The "type" parameter has an effect
#include <iostream>
-#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
{
#include <iostream>
#include <math.h>
-#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
{
#include <stdexcept>
-#include "ginac.h"
+#include "relational.h"
+#include "numeric.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
// public
-relational::relational() : basic(TINFO_RELATIONAL)
+relational::relational() : basic(TINFO_relational)
{
debugmsg("relational default constructor",LOGLEVEL_CONSTRUCT);
}
// 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;
#ifndef __GINAC_RELATIONAL_H__
#define __GINAC_RELATIONAL_H__
+#include <ginac/basic.h>
+#include <ginac/ex.h>
+
/** This class holds a relation consisting of two expressions and a logical
* relation between them. */
class relational : public basic
* 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);
}
* @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));
// 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();
// 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();
// 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();
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++;
#ifndef __GINAC_SERIES_H__
#define __GINAC_SERIES_H__
+#include <ginac/basic.h>
+#include <ginac/expairseq.h>
+
/** 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.
#include <stdexcept>
#include <map>
-#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
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()
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());
}
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());
}
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());
}
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());
}
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<const simp_lor *>(&other);
if (type==o->type) {
if (name==o->name) {
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<const simp_lor *>(&other);
if (type!=o->type) return false;
if (name!=o->name) return false;
v_contracted.reserve(2*n);
for (int i=0; i<n; ++i) {
ex f=m.op(i);
- if (is_ex_exactly_of_type(f,power)&&f.op(1)==2) {
+ if (is_ex_exactly_of_type(f,power)&&f.op(1).is_equal(exTWO())) {
v_contracted.push_back(f.op(0));
v_contracted.push_back(f.op(0));
} else {
#include <utility>
#include <map>
#include <iostream>
+#include <ginac/indexed.h>
+#include <ginac/lorentzidx.h>
typedef pair<string,string> strstrpair;
typedef pair<strstrpair,lorentzidx> spmapkey;
#include <string>
-#include "ginac.h"
+#include "structure.h"
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
structure::structure()
{
debugmsg("structure default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_STRUCTURE;
+ tinfo_key = TINFO_structure;
}
structure::~structure()
#ifndef __GINAC_STRUCTURE_H__
#define __GINAC_STRUCTURE_H__
+#include <ginac/basic.h>
+
struct registered_structure_info {
char const * name;
};
#include <string>
#include <stdexcept>
-#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++;
// 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;
#define __GINAC_SYMBOL_H__
#include <string>
+#include <ginac/basic.h>
+#include <ginac/ex.h>
/** 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
#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__
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "utils.h"
+
unsigned log2(unsigned n)
{
unsigned k;