From: Christian Bauer Date: Fri, 21 Jan 2000 18:20:26 +0000 (+0000) Subject: - changed all instances of "foo const &/*" to "const foo &/*" X-Git-Tag: release_0-5-0~49 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=2565309dd7c38635c191eacf2a4af9b23fc0d310 - changed all instances of "foo const &/*" to "const foo &/*" - changed function arguments like "int const" to a simple "int" --- diff --git a/check/main.cpp b/check/main.cpp index d500b9e3..c55794a6 100644 --- a/check/main.cpp +++ b/check/main.cpp @@ -45,7 +45,7 @@ int main() result += fcntimer(series_expansion); result += fcntimer(lortensor_check); } - } catch (exception const & e) { + } catch (const exception &e) { cout << "error: caught an exception: " << e.what() << endl; result++; } diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 53cf5969..abcb90c6 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -1316,7 +1316,7 @@ being polynomials in the remaining variables. The method @code{collect()} accomplishes this task. Here is its declaration: @example -ex ex::collect(symbol const & s); +ex ex::collect(const symbol & s); @end example Note that the original polynomial needs to be in expanded form in order @@ -1326,8 +1326,8 @@ coefficients can be checked using the two methods @cindex @code{degree()} @cindex @code{ldegree()} @example -int ex::degree(symbol const & s); -int ex::ldegree(symbol const & s); +int ex::degree(const symbol & s); +int ex::ldegree(const symbol & s); @end example where @code{degree()} returns the highest coefficient and @@ -1677,7 +1677,7 @@ function that is called when one wishes to @code{eval} it. It could look something like this: @example -static ex cos_eval_method(ex const & x) +static ex cos_eval_method(const ex & x) @{ // if (!x%(2*Pi)) return 1 // if (!x%Pi) return -1 @@ -1696,7 +1696,7 @@ lazy we sweep the problem under the rug by calling someone else's function that does so, in this case the one in class @code{numeric}: @example -static ex cos_evalf_method(ex const & x) +static ex cos_evalf_method(const ex & x) @{ return sin(ex_to_numeric(x)); @} @@ -1706,7 +1706,7 @@ Differentiation will surely turn up and so we need to tell @code{sin} how to differentiate itself: @example -static ex cos_diff_method(ex const & x, unsigned diff_param) +static ex cos_diff_method(const ex & x, unsigned diff_param) @{ return cos(x); @} diff --git a/ginac/add.cpp b/ginac/add.cpp index ab05def2..c75a31e7 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -53,13 +53,13 @@ add::~add() destroy(0); } -add::add(add const & other) +add::add(const add & other) { debugmsg("add copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -add const & add::operator=(add const & other) +const add & add::operator=(const add & other) { debugmsg("add operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -71,7 +71,7 @@ add const & add::operator=(add const & other) // protected -void add::copy(add const & other) +void add::copy(const add & other) { inherited::copy(other); } @@ -87,7 +87,7 @@ void add::destroy(bool call_parent) // public -add::add(ex const & lh, ex const & rh) +add::add(const ex & lh, const ex & rh) { debugmsg("add constructor from ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_add; @@ -96,7 +96,7 @@ add::add(ex const & lh, ex const & rh) GINAC_ASSERT(is_canonical()); } -add::add(exvector const & v) +add::add(const exvector & v) { debugmsg("add constructor from exvector",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_add; @@ -106,7 +106,7 @@ add::add(exvector const & v) } /* -add::add(epvector const & v, bool do_not_canonicalize) +add::add(const epvector & v, bool do_not_canonicalize) { debugmsg("add constructor from epvector,bool",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_add; @@ -122,7 +122,7 @@ add::add(epvector const & v, bool do_not_canonicalize) } */ -add::add(epvector const & v) +add::add(const epvector & v) { debugmsg("add constructor from epvector",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_add; @@ -131,7 +131,7 @@ add::add(epvector const & v) GINAC_ASSERT(is_canonical()); } -add::add(epvector const & v, ex const & oc) +add::add(const epvector & v, const ex & oc) { debugmsg("add constructor from epvector,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_add; @@ -140,7 +140,7 @@ add::add(epvector const & v, ex const & oc) GINAC_ASSERT(is_canonical()); } -add::add(epvector * vp, ex const & oc) +add::add(epvector * vp, const ex & oc) { debugmsg("add constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_add; @@ -346,7 +346,7 @@ bool add::info(unsigned inf) const } } -int add::degree(symbol const & s) const +int add::degree(const symbol & s) const { int deg=INT_MIN; if (!overall_coeff.is_equal(_ex0())) { @@ -360,7 +360,7 @@ int add::degree(symbol const & s) const return deg; } -int add::ldegree(symbol const & s) const +int add::ldegree(const symbol & s) const { int deg=INT_MAX; if (!overall_coeff.is_equal(_ex0())) { @@ -374,7 +374,7 @@ int add::ldegree(symbol const & s) const return deg; } -ex add::coeff(symbol const & s, int const n) const +ex add::coeff(const symbol & s, int n) const { epvector coeffseq; coeffseq.reserve(seq.size()); @@ -443,7 +443,7 @@ exvector add::get_indices(void) const return (seq.begin())->rest.get_indices(); } -ex add::simplify_ncmul(exvector const & v) const +ex add::simplify_ncmul(const exvector & v) const { if (seq.size()==0) { return inherited::simplify_ncmul(v); @@ -453,12 +453,12 @@ ex add::simplify_ncmul(exvector const & v) const // protected -int add::compare_same_type(basic const & other) const +int add::compare_same_type(const basic & other) const { return inherited::compare_same_type(other); } -bool add::is_equal_same_type(basic const & other) const +bool add::is_equal_same_type(const basic & other) const { return inherited::is_equal_same_type(other); } @@ -479,20 +479,20 @@ unsigned add::return_type_tinfo(void) const return (*seq.begin()).rest.return_type_tinfo(); } -ex add::thisexpairseq(epvector const & v, ex const & oc) const +ex add::thisexpairseq(const epvector & v, const ex & oc) const { return (new add(v,oc))->setflag(status_flags::dynallocated); } -ex add::thisexpairseq(epvector * vp, ex const & oc) const +ex add::thisexpairseq(epvector * vp, const ex & oc) const { return (new add(vp,oc))->setflag(status_flags::dynallocated); } -expair add::split_ex_to_pair(ex const & e) const +expair add::split_ex_to_pair(const ex & e) const { if (is_ex_exactly_of_type(e,mul)) { - mul const & mulref=ex_to_mul(e); + const mul & mulref=ex_to_mul(e); ex numfactor=mulref.overall_coeff; // mul * mulcopyp=static_cast(mulref.duplicate()); mul * mulcopyp=new mul(mulref); @@ -504,12 +504,12 @@ expair add::split_ex_to_pair(ex const & e) const return expair(e,_ex1()); } -expair add::combine_ex_with_coeff_to_pair(ex const & e, - ex const & c) const +expair add::combine_ex_with_coeff_to_pair(const ex & e, + const ex & c) const { GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); if (is_ex_exactly_of_type(e,mul)) { - mul const & mulref=ex_to_mul(e); + const mul & mulref=ex_to_mul(e); ex numfactor=mulref.overall_coeff; //mul * mulcopyp=static_cast(mulref.duplicate()); mul * mulcopyp=new mul(mulref); @@ -532,8 +532,8 @@ expair add::combine_ex_with_coeff_to_pair(ex const & e, return expair(e,c); } -expair add::combine_pair_with_coeff_to_pair(expair const & p, - ex const & c) const +expair add::combine_pair_with_coeff_to_pair(const expair & p, + const ex & c) const { GINAC_ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); @@ -546,7 +546,7 @@ expair add::combine_pair_with_coeff_to_pair(expair const & p, return expair(p.rest,ex_to_numeric(p.coeff).mul_dyn(ex_to_numeric(c))); } -ex add::recombine_pair_to_ex(expair const & p) const +ex add::recombine_pair_to_ex(const expair & p) const { //if (p.coeff.compare(_ex1())==0) { //if (are_ex_trivially_equal(p.coeff,_ex1())) { @@ -592,7 +592,7 @@ unsigned add::precedence=40; ////////// const add some_add; -type_info const & typeid_add=typeid(some_add); +const type_info & typeid_add=typeid(some_add); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/add.h b/ginac/add.h index d4da3bea..51cb4f10 100644 --- a/ginac/add.h +++ b/ginac/add.h @@ -44,20 +44,20 @@ class add : public expairseq public: add(); ~add(); - add(add const & other); - add const & operator=(add const & other); + add(const add & other); + const add & operator=(const add & other); protected: - void copy(add const & other); + void copy(const add & other); void destroy(bool call_parent); // other constructors public: - add(ex const & lh, ex const & rh); - add(exvector const & v); - add(epvector const & v); - //add(epvector const & v, bool do_not_canonicalize=0); - add(epvector const & v, ex const & oc); - add(epvector * vp, ex const & oc); + add(const ex & lh, const ex & rh); + add(const exvector & v); + add(const epvector & v); + //add(const epvector & v, bool do_not_canonicalize=0); + add(const epvector & v, const ex & oc); + add(epvector * vp, const ex & oc); // functions overriding virtual functions from bases classes public: @@ -66,31 +66,31 @@ public: void printraw(ostream & os) const; void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; bool info(unsigned inf) const; - int degree(symbol const & s) const; - int ldegree(symbol const & s) const; - ex coeff(symbol const & s, int const n=1) const; + int degree(const symbol & s) const; + int ldegree(const symbol & s) const; + ex coeff(const symbol & s, int n=1) const; ex eval(int level=0) const; - ex diff(symbol const & s) const; - ex series(symbol const & s, ex const & point, int order) const; + ex diff(const symbol & s) const; + ex series(const symbol & s, const ex & point, int order) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; numeric integer_content(void) const; ex smod(const numeric &xi) const; numeric max_coefficient(void) const; exvector get_indices(void) const; - ex simplify_ncmul(exvector const & v) const; + ex simplify_ncmul(const exvector & v) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; - ex thisexpairseq(epvector const & v, ex const & oc) const; - ex thisexpairseq(epvector * vp, ex const & oc) const; - expair split_ex_to_pair(ex const & e) const; - expair combine_ex_with_coeff_to_pair(ex const & e, - ex const & c) const; - expair combine_pair_with_coeff_to_pair(expair const & p, - ex const & c) const; - ex recombine_pair_to_ex(expair const & p) const; + ex thisexpairseq(const epvector & v, const ex & oc) const; + ex thisexpairseq(epvector * vp, const ex & oc) const; + expair split_ex_to_pair(const ex & e) const; + expair combine_ex_with_coeff_to_pair(const ex & e, + const ex & c) const; + expair combine_pair_with_coeff_to_pair(const expair & p, + const ex & c) const; + ex recombine_pair_to_ex(const expair & p) const; ex expand(unsigned options=0) const; // new virtual functions which can be overridden by derived classes @@ -108,7 +108,7 @@ protected: // global constants extern const add some_add; -extern type_info const & typeid_add; +extern const type_info & typeid_add; // utility functions inline const add &ex_to_add(const ex &e) diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 4f4fdbfb..0d9f989b 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -61,14 +61,14 @@ basic::~basic() GINAC_ASSERT((!(flags & status_flags::dynallocated))||(refcount==0)); } -basic::basic(basic const & other) : flags(0), refcount(0), tinfo_key(TINFO_BASIC) +basic::basic(const basic & other) : flags(0), refcount(0), tinfo_key(TINFO_BASIC) { debugmsg("basic copy constructor", LOGLEVEL_CONSTRUCT); copy(other); } #endif -basic const & basic::operator=(basic const & other) +const basic & basic::operator=(const basic & other) { debugmsg("basic operator=", LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -81,7 +81,7 @@ basic const & basic::operator=(basic const & other) // protected #if 0 -void basic::copy(basic const & other) +void basic::copy(const basic & other) { flags=other.flags & ~ status_flags::dynallocated; hashvalue=other.hashvalue; @@ -211,30 +211,30 @@ unsigned basic::nops() const return 0; } -ex basic::op(int const i) const +ex basic::op(int i) const { return (const_cast(this))->let_op(i); } -ex & basic::let_op(int const i) +ex & basic::let_op(int i) { throw(std::out_of_range("op() out of range")); } -ex basic::operator[](ex const & index) const +ex basic::operator[](const ex & index) const { if (is_exactly_of_type(*index.bp,numeric)) { - return op(static_cast(*index.bp).to_int()); + return op(static_cast(*index.bp).to_int()); } throw(std::invalid_argument("non-numeric indices not supported by this type")); } -ex basic::operator[](int const i) const +ex basic::operator[](int i) const { return op(i); } -bool basic::has(ex const & other) const +bool basic::has(const ex & other) const { GINAC_ASSERT(other.bp!=0); if (is_equal(*other.bp)) return true; @@ -246,22 +246,22 @@ bool basic::has(ex const & other) const return false; } -int basic::degree(symbol const & s) const +int basic::degree(const symbol & s) const { return 0; } -int basic::ldegree(symbol const & s) const +int basic::ldegree(const symbol & s) const { return 0; } -ex basic::coeff(symbol const & s, int const n) const +ex basic::coeff(const symbol & s, int n) const { return n==0 ? *this : _ex0(); } -ex basic::collect(symbol const & s) const +ex basic::collect(const symbol & s) const { ex x; int ldeg=ldegree(s); @@ -282,7 +282,7 @@ ex basic::evalf(int level) const return *this; } -ex basic::subs(lst const & ls, lst const & lr) const +ex basic::subs(const lst & ls, const lst & lr) const { return *this; } @@ -292,19 +292,19 @@ exvector basic::get_indices(void) const return exvector(); // return an empty exvector } -ex basic::simplify_ncmul(exvector const & v) const +ex basic::simplify_ncmul(const exvector & v) const { return simplified_ncmul(v); } // protected -int basic::compare_same_type(basic const & other) const +int basic::compare_same_type(const basic & other) const { return compare_pointers(this, &other); } -bool basic::is_equal_same_type(basic const & other) const +bool basic::is_equal_same_type(const basic & other) const { return compare_same_type(other)==0; } @@ -349,7 +349,7 @@ ex basic::expand(unsigned options) const // public -ex basic::subs(ex const & e) const +ex basic::subs(const ex & e) const { // accept 2 types of replacement expressions: // - symbol==ex @@ -382,7 +382,7 @@ ex basic::subs(ex const & e) const /** Compare objects to establish canonical order. * All compare functions return: -1 for *this less than other, 0 equal, * 1 greater. */ -int basic::compare(basic const & other) const +int basic::compare(const basic & other) const { unsigned hash_this = gethash(); unsigned hash_other = other.gethash(); @@ -432,7 +432,7 @@ int basic::compare(basic const & other) const return cmpval; } -bool basic::is_equal(basic const & other) const +bool basic::is_equal(const basic & other) const { unsigned hash_this = gethash(); unsigned hash_other = other.gethash(); @@ -451,7 +451,7 @@ bool basic::is_equal(basic const & other) const // protected -basic const & basic::hold(void) const +const basic & basic::hold(void) const { return setflag(status_flags::evaluated); } @@ -477,7 +477,7 @@ unsigned basic::delta_indent=4; ////////// const basic some_basic; -type_info const & typeid_basic=typeid(some_basic); +const type_info & typeid_basic=typeid(some_basic); ////////// // global variables diff --git a/ginac/basic.h b/ginac/basic.h index ecf120a1..e763de5d 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -82,7 +82,7 @@ public: ; #endif // def INLINE_BASIC_CONSTRUCTORS - basic(basic const & other) + basic(const basic & other) #ifdef INLINE_BASIC_CONSTRUCTORS { copy(other); @@ -91,10 +91,10 @@ public: ; #endif // def INLINE_BASIC_CONSTRUCTORS - virtual basic const & operator=(basic const & other); + virtual const basic & operator=(const basic & other); protected: - void copy(basic const & other) + void copy(const basic & other) { flags = other.flags & ~status_flags::dynallocated; hashvalue = other.hashvalue; @@ -126,29 +126,29 @@ public: // only const functions please (may break reference counting) virtual void dbgprinttree(void) const; virtual bool info(unsigned inf) const; virtual unsigned nops() const; - virtual ex op(int const i) const; - virtual ex & let_op(int const i); - virtual ex operator[](ex const & index) const; - virtual ex operator[](int const i) const; - virtual bool has(ex const & other) const; - virtual int degree(symbol const & s) const; - virtual int ldegree(symbol const & s) const; - virtual ex coeff(symbol const & s, int const n=1) const; - virtual ex collect(symbol const & s) const; + virtual ex op(int i) const; + virtual ex & let_op(int i); + virtual ex operator[](const ex & index) const; + virtual ex operator[](int i) const; + virtual bool has(const ex & other) const; + virtual int degree(const symbol & s) const; + virtual int ldegree(const symbol & s) const; + virtual ex coeff(const symbol & s, int n=1) const; + virtual ex collect(const symbol & s) const; virtual ex eval(int level=0) const; virtual ex evalf(int level=0) const; - virtual ex diff(symbol const & s) const; - virtual ex series(symbol const & s, ex const & point, int order) const; - virtual ex subs(lst const & ls, lst const & lr) const; + virtual ex diff(const symbol & s) const; + virtual ex series(const symbol & s, const ex & point, int order) const; + virtual ex subs(const lst & ls, const lst & lr) const; virtual ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; virtual numeric integer_content(void) const; virtual ex smod(const numeric &xi) const; virtual numeric max_coefficient(void) const; virtual exvector get_indices(void) const; - virtual ex simplify_ncmul(exvector const & v) const; + virtual ex simplify_ncmul(const exvector & v) const; protected: // non-const functions should be called from class ex only - virtual int compare_same_type(basic const & other) const; - virtual bool is_equal_same_type(basic const & other) const; + virtual int compare_same_type(const basic & other) const; + virtual bool is_equal_same_type(const basic & other) const; virtual unsigned return_type(void) const; virtual unsigned return_type_tinfo(void) const; virtual unsigned calchash(void) const; @@ -156,15 +156,15 @@ protected: // non-const functions should be called from class ex only // non-virtual functions in this class public: - ex subs(ex const & e) const; - int compare(basic const & other) const; - bool is_equal(basic const & other) const; - basic const & hold(void) const; + ex subs(const ex & e) const; + int compare(const basic & other) const; + bool is_equal(const basic & other) const; + const basic & hold(void) const; unsigned gethash(void) const {if (flags & status_flags::hash_calculated) return hashvalue; else return calchash();} unsigned tinfo(void) const {return tinfo_key;} protected: - basic const & setflag(unsigned f) const {flags |= f; return *this;} - basic const & clearflag(unsigned f) const {flags &= ~f; return *this;} + const basic & setflag(unsigned f) const {flags |= f; return *this;} + const basic & clearflag(unsigned f) const {flags &= ~f; return *this;} void ensure_if_modifiable(void) const; // member variables @@ -182,7 +182,7 @@ private: // global constants extern const basic some_basic; -extern type_info const & typeid_basic; +extern const type_info & typeid_basic; // global variables diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 50cee72f..8d41e92c 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -53,13 +53,13 @@ clifford::~clifford() destroy(0); } -clifford::clifford(clifford const & other) +clifford::clifford(const clifford & other) { debugmsg("clifford copy constructor",LOGLEVEL_CONSTRUCT); copy (other); } -clifford const & clifford::operator=(clifford const & other) +const clifford & clifford::operator=(const clifford & other) { debugmsg("clifford operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -71,7 +71,7 @@ clifford const & clifford::operator=(clifford const & other) // protected -void clifford::copy(clifford const & other) +void clifford::copy(const clifford & other) { indexed::copy(other); name=other.name; @@ -91,7 +91,7 @@ void clifford::destroy(bool call_parent) // public -clifford::clifford(string const & initname) +clifford::clifford(const string & initname) { debugmsg("clifford constructor from string",LOGLEVEL_CONSTRUCT); name=initname; @@ -151,7 +151,7 @@ bool clifford::info(unsigned inf) const // protected -int clifford::compare_same_type(basic const & other) const +int clifford::compare_same_type(const basic & other) const { GINAC_ASSERT(other.tinfo() == TINFO_clifford); const clifford *o = static_cast(&other); @@ -161,7 +161,7 @@ int clifford::compare_same_type(basic const & other) const return serial < o->serial ? -1 : 1; } -ex clifford::simplify_ncmul(exvector const & v) const +ex clifford::simplify_ncmul(const exvector & v) const { return simplified_ncmul(v); } @@ -185,7 +185,7 @@ unsigned clifford::calchash(void) const // non-virtual functions in this class ////////// -void clifford::setname(string const & n) +void clifford::setname(const string & n) { name=n; } @@ -211,7 +211,7 @@ unsigned clifford::next_serial=0; ////////// const clifford some_clifford; -type_info const & typeid_clifford=typeid(some_clifford); +const type_info & typeid_clifford=typeid(some_clifford); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/clifford.h b/ginac/clifford.h index b0dd7177..a2deeb52 100644 --- a/ginac/clifford.h +++ b/ginac/clifford.h @@ -40,15 +40,15 @@ class clifford : public indexed public: clifford(); ~clifford(); - clifford(clifford const & other); - clifford const & operator=(clifford const & other); + clifford(const clifford & other); + const clifford & operator=(const clifford & other); protected: - void copy(clifford const & other); + void copy(const clifford & other); void destroy(bool call_parent); // other constructors public: - explicit clifford(string const & initname); + explicit clifford(const string & initname); // functions overriding virtual functions from base classes public: @@ -59,8 +59,8 @@ public: void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; bool info(unsigned inf) const; protected: - int compare_same_type(basic const & other) const; - ex simplify_ncmul(exvector const & v) const; + int compare_same_type(const basic & other) const; + ex simplify_ncmul(const exvector & v) const; unsigned calchash(void) const; // new virtual functions which can be overridden by derived classes @@ -68,7 +68,7 @@ protected: // non-virtual functions in this class public: - void setname(string const & n); + void setname(const string & n); private: string & autoname_prefix(void); @@ -84,7 +84,7 @@ private: // global constants extern const clifford some_clifford; -extern type_info const & typeid_clifford; +extern const type_info & typeid_clifford; // utility functions inline const clifford &ex_to_clifford(const ex &e) diff --git a/ginac/color.cpp b/ginac/color.cpp index d45a1210..f9220582 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -58,13 +58,13 @@ color::~color() destroy(0); } -color::color(color const & other) +color::color(const color & other) { debugmsg("color copy constructor",LOGLEVEL_CONSTRUCT); copy (other); } -color const & color::operator=(color const & other) +const color & color::operator=(const color & other) { debugmsg("color operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -76,7 +76,7 @@ color const & color::operator=(color const & other) // protected -void color::copy(color const & other) +void color::copy(const color & other) { indexed::copy(other); type=other.type; @@ -96,7 +96,7 @@ void color::destroy(bool call_parent) // protected -color::color(color_types const t, unsigned const rl) : type(t), representation_label(rl) +color::color(color_types const t, unsigned rl) : type(t), representation_label(rl) { debugmsg("color constructor from color_types,unsigned",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(representation_label(&other); @@ -361,7 +361,7 @@ int color::compare_same_type(basic const & other) const return type < o->type ? -1 : 1; } -bool color::is_equal_same_type(basic const & other) const +bool color::is_equal_same_type(const basic & other) const { GINAC_ASSERT(other.tinfo() == TINFO_color); const color *o = static_cast(&other); @@ -372,7 +372,7 @@ bool color::is_equal_same_type(basic const & other) const #include -ex color::simplify_ncmul(exvector const & v) const +ex color::simplify_ncmul(const exvector & v) const { // simplifications: contract delta8_{a,b} where possible // sort delta8,f,d,T(rl=0),T(rl=1),...,ONE(rl=0),ONE(rl=1),... @@ -390,8 +390,8 @@ ex color::simplify_ncmul(exvector const & v) const if (is_ex_exactly_of_type(*it,color) && (ex_to_color(*it).type==color_delta8)) { color & d8=ex_to_nonconst_color(*it); GINAC_ASSERT(d8.seq.size()==2); - coloridx const & first_idx=ex_to_coloridx(d8.seq[0]); - coloridx const & second_idx=ex_to_coloridx(d8.seq[1]); + const coloridx & first_idx=ex_to_coloridx(d8.seq[0]); + const coloridx & second_idx=ex_to_coloridx(d8.seq[1]); // delta8_{a,a} should have been contracted in color::eval() GINAC_ASSERT((!first_idx.is_equal(second_idx))||(!first_idx.is_symbolic())); ex saved_delta8=*it; // save to restore it later @@ -455,8 +455,8 @@ ex color::simplify_ncmul(exvector const & v) const for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) { GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)); GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)); - color const & col1=ex_to_color(*it1); - color const & col2=ex_to_color(*it2); + const color & col1=ex_to_color(*it1); + const color & col2=ex_to_color(*it2); exvector iv_intersect=idx_intersect(col1.seq,col2.seq); if (iv_intersect.size()>=2) return _ex0(); } @@ -469,8 +469,8 @@ ex color::simplify_ncmul(exvector const & v) const for (exvector::iterator it2=it1+1; it2!=dvec.end(); ++it2) { GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)); GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)); - color const & col1=ex_to_color(*it1); - color const & col2=ex_to_color(*it2); + const color & col1=ex_to_color(*it1); + const color & col2=ex_to_color(*it2); exvector iv_intersect=idx_intersect(col1.seq,col2.seq); if (iv_intersect.size()>=2) { if (iv_intersect.size()==3) { @@ -496,8 +496,8 @@ ex color::simplify_ncmul(exvector const & v) const for (exvector::iterator it2=it1+1; it2!=fvec.end(); ++it2) { GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)); GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)); - color const & col1=ex_to_color(*it1); - color const & col2=ex_to_color(*it2); + const color & col1=ex_to_color(*it1); + const color & col2=ex_to_color(*it2); exvector iv_intersect=idx_intersect(col1.seq,col2.seq); if (iv_intersect.size()>=2) { if (iv_intersect.size()==3) { @@ -531,7 +531,7 @@ ex color::simplify_ncmul(exvector const & v) const // d_{a,b,c} T_b T_c = 5/6 T_a for (exvector::iterator it2=dvec.begin(); it2!=dvec.end(); ++it2) { GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_d); - color const & dref=ex_to_color(*it2); + const color & dref=ex_to_color(*it2); exvector iv_intersect=idx_intersect(dref.seq,iv); if (iv_intersect.size()==2) { int sig; // unimportant, since symmetric @@ -547,7 +547,7 @@ ex color::simplify_ncmul(exvector const & v) const // f_{a,b,c} T_b T_c = 3/2 I T_a for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) { GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_f); - color const & fref=ex_to_color(*it2); + const color & fref=ex_to_color(*it2); exvector iv_intersect=idx_intersect(fref.seq,iv); if (iv_intersect.size()==2) { int sig; @@ -579,7 +579,7 @@ ex color::simplify_ncmul(exvector const & v) const ONEvecs,unknownvec)); } -ex color::thisexprseq(exvector const & v) const +ex color::thisexprseq(const exvector & v) const { return color(type,v,representation_label); } @@ -619,43 +619,43 @@ bool color::all_of_type_coloridx(void) const ////////// const color some_color; -type_info const & typeid_color=typeid(some_color); +const type_info & typeid_color=typeid(some_color); ////////// // friend functions ////////// -color color_ONE(unsigned const rl) +color color_ONE(unsigned rl) { return color(color::color_ONE,rl); } -color color_T(ex const & a, unsigned const rl) +color color_T(const ex & a, unsigned rl) { return color(color::color_T,a,rl); } -color color_f(ex const & a, ex const & b, ex const & c) +color color_f(const ex & a, const ex & b, const ex & c) { return color(color::color_f,a,b,c); } -color color_d(ex const & a, ex const & b, ex const & c) +color color_d(const ex & a, const ex & b, const ex & c) { return color(color::color_d,a,b,c); } -ex color_h(ex const & a, ex const & b, ex const & c) +ex color_h(const ex & a, const ex & b, const ex & c) { return color(color::color_d,a,b,c)+I*color(color::color_f,a,b,c); } -color color_delta8(ex const & a, ex const & b) +color color_delta8(const ex & a, const ex & b) { return color(color::color_delta8,a,b); } -void split_color_string_in_parts(exvector const & v, exvector & delta8vec, +void split_color_string_in_parts(const exvector & v, exvector & delta8vec, exvector & fvec, exvector & dvec, exvectorvector & Tvecs, exvectorvector & ONEvecs, @@ -727,7 +727,7 @@ exvector recombine_color_string(exvector & delta8vec, exvector & fvec, return v; } -ex color_trace_of_one_representation_label(exvector const & v) +ex color_trace_of_one_representation_label(const exvector & v) { if (v.size()==0) { return numeric(COLOR_THREE); @@ -746,8 +746,8 @@ ex color_trace_of_one_representation_label(exvector const & v) v1.pop_back(); exvector v2=v1; - ex const & last_index=ex_to_color(last_element).seq[0]; - ex const & next_to_last_index=ex_to_color(next_to_last_element).seq[0]; + const ex & last_index=ex_to_color(last_element).seq[0]; + const ex & next_to_last_index=ex_to_color(next_to_last_element).seq[0]; ex summation_index=coloridx(); v2.push_back(color_T(summation_index)); // don't care about the representation_label @@ -768,7 +768,7 @@ ex color_trace_of_one_representation_label(exvector const & v) */ } -ex color_trace(exvector const & v, unsigned const rl) +ex color_trace(const exvector & v, unsigned rl) { GINAC_ASSERT(rl(*e.bp); } -color color_ONE(unsigned const rl=0); -color color_T(ex const & a, unsigned const rl=0); -color color_f(ex const & a, ex const & b, ex const & c); -color color_d(ex const & a, ex const & b, ex const & c); -ex color_h(ex const & a, ex const & b, ex const & c); -color color_delta8(ex const & a, ex const & b); -void split_color_string_in_parts(exvector const & v, exvector & delta8vec, +color color_ONE(unsigned rl=0); +color color_T(const ex & a, unsigned rl=0); +color color_f(const ex & a, const ex & b, const ex & c); +color color_d(const ex & a, const ex & b, const ex & c); +ex color_h(const ex & a, const ex & b, const ex & c); +color color_delta8(const ex & a, const ex & b); +void split_color_string_in_parts(const exvector & v, exvector & delta8vec, exvector & fvec, exvector & dvec, exvectorvector & Tvecs, exvectorvector & ONEvecs, @@ -157,14 +157,14 @@ void split_color_string_in_parts(exvector const & v, exvector & delta8vec, exvector recombine_color_string(exvector & delta8vec, exvector & fvec, exvector & dvec, exvectorvector & Tvecs, exvectorvector & ONEvecs, exvector & unknownvec); -ex color_trace_of_one_representation_label(exvector const & v); -ex color_trace(exvector const & v, unsigned const rl=0); -ex simplify_pure_color_string(ex const & e); -ex simplify_color(ex const & e); +ex color_trace_of_one_representation_label(const exvector & v); +ex color_trace(const exvector & v, unsigned rl=0); +ex simplify_pure_color_string(const ex & e); +ex simplify_color(const ex & e); -ex brute_force_sum_color_indices(ex const & e); +ex brute_force_sum_color_indices(const ex & e); -void append_exvector_to_exvector(exvector & dest, exvector const & source); +void append_exvector_to_exvector(exvector & dest, const exvector & source); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/coloridx.cpp b/ginac/coloridx.cpp index e0542496..60e45968 100644 --- a/ginac/coloridx.cpp +++ b/ginac/coloridx.cpp @@ -50,13 +50,13 @@ coloridx::~coloridx() destroy(0); } -coloridx::coloridx(coloridx const & other) +coloridx::coloridx(const coloridx & other) { debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -coloridx const & coloridx::operator=(coloridx const & other) +const coloridx & coloridx::operator=(const coloridx & other) { debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -68,7 +68,7 @@ coloridx const & coloridx::operator=(coloridx const & other) // protected -void coloridx::copy(coloridx const & other) +void coloridx::copy(const coloridx & other) { idx::copy(other); } @@ -92,19 +92,19 @@ coloridx::coloridx(bool cov) : idx(cov) tinfo_key=TINFO_coloridx; } -coloridx::coloridx(string const & n, bool cov) : idx(n,cov) +coloridx::coloridx(const string & n, bool cov) : idx(n,cov) { debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_coloridx; } -coloridx::coloridx(char const * n, bool cov) : idx(n,cov) +coloridx::coloridx(const char * n, bool cov) : idx(n,cov) { debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_coloridx; } -coloridx::coloridx(unsigned const v, bool cov) : idx(v,cov) +coloridx::coloridx(unsigned v, bool cov) : idx(v,cov) { debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_coloridx; @@ -213,7 +213,7 @@ bool coloridx::info(unsigned inf) const ////////// const coloridx some_coloridx; -type_info const & typeid_coloridx=typeid(some_coloridx); +const type_info & typeid_coloridx=typeid(some_coloridx); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/coloridx.h b/ginac/coloridx.h index 43b390d9..52ed82a0 100644 --- a/ginac/coloridx.h +++ b/ginac/coloridx.h @@ -42,18 +42,18 @@ class coloridx : public idx public: coloridx(); ~coloridx(); - coloridx (coloridx const & other); - coloridx const & operator=(coloridx const & other); + coloridx (const coloridx & other); + const coloridx & operator=(const coloridx & other); protected: - void copy(coloridx const & other); + void copy(const coloridx & other); void destroy(bool call_parent); // other constructors public: explicit coloridx(bool cov); - explicit coloridx(string const & n, bool cov=false); - explicit coloridx(char const * n, bool cov=false); - explicit coloridx(unsigned const v, bool cov=false); + explicit coloridx(const string & n, bool cov=false); + explicit coloridx(const char * n, bool cov=false); + explicit coloridx(unsigned v, bool cov=false); // functions overriding virtual functions from bases classes public: @@ -76,7 +76,7 @@ public: // global constants extern const coloridx some_coloridx; -extern type_info const & typeid_coloridx; +extern const type_info & typeid_coloridx; // utility functions inline const coloridx &ex_to_coloridx(const ex &e) diff --git a/ginac/constant.cpp b/ginac/constant.cpp index 1e9a4c15..c115d902 100644 --- a/ginac/constant.cpp +++ b/ginac/constant.cpp @@ -54,7 +54,7 @@ constant::~constant() destroy(0); } -constant::constant(constant const & other) +constant::constant(const constant & other) { debugmsg("constant copy constructor",LOGLEVEL_CONSTRUCT); copy(other); @@ -62,7 +62,7 @@ constant::constant(constant const & other) // protected -void constant::copy(constant const & other) +void constant::copy(const constant & other) { basic::copy(other); name=other.name; @@ -89,7 +89,7 @@ void constant::destroy(bool call_parent) // public -constant::constant(string const & initname, evalffunctype efun) : +constant::constant(const string & initname, evalffunctype efun) : basic(TINFO_constant), name(initname), ef(efun), // number(0), fct_assigned(true), serial(next_serial++) number(0), serial(next_serial++) @@ -97,7 +97,7 @@ constant::constant(string const & initname, evalffunctype efun) : debugmsg("constant constructor from string, function",LOGLEVEL_CONSTRUCT); } -constant::constant(string const & initname, numeric const & initnumber) : +constant::constant(const string & initname, const numeric & initnumber) : basic(TINFO_constant), name(initname), ef(0), number(new numeric(initnumber)), /* fct_assigned(false),*/ serial(next_serial++) { @@ -191,17 +191,17 @@ ex constant::evalf(int level) const // protected -int constant::compare_same_type(basic const & other) const +int constant::compare_same_type(const basic & other) const { GINAC_ASSERT(is_exactly_of_type(other, constant)); - // constant const & o=static_cast(const_cast(other)); + // const constant & o=static_cast(const_cast(other)); // return name.compare(o.name); const constant *o = static_cast(&other); if (serial==o->serial) return 0; return serial < o->serial ? -1 : 1; } -bool constant::is_equal_same_type(basic const & other) const +bool constant::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_exactly_of_type(other, constant)); const constant *o = static_cast(&other); @@ -231,7 +231,7 @@ unsigned constant::next_serial=0; ////////// const constant some_constant; -type_info const & typeid_constant=typeid(some_constant); +const type_info & typeid_constant=typeid(some_constant); /** Pi. (3.14159...) Diverts straight into CLN for evalf(). */ const constant Pi("Pi", PiEvalf); diff --git a/ginac/constant.h b/ginac/constant.h index 2e6ad5b0..90193714 100644 --- a/ginac/constant.h +++ b/ginac/constant.h @@ -46,16 +46,16 @@ class constant : public basic public: constant(); ~constant(); - constant(constant const & other); - // constant const & operator=(constant const & other); /* it's pervert! */ + constant(const constant & other); + // const constant & operator=(const constant & other); /* it's pervert! */ protected: - void copy(constant const & other); + void copy(const constant & other); void destroy(bool call_parent); // other constructors public: - constant(string const & initname, evalffunctype efun=0); - constant(string const & initname, numeric const & initnumber); + constant(const string & initname, evalffunctype efun=0); + constant(const string & initname, const numeric & initnumber); // functions overriding virtual functions from bases classes public: @@ -65,10 +65,10 @@ public: void printtree(ostream & os, unsigned indent) const; void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; ex evalf(int level=0) const; - ex diff(symbol const & s) const; + ex diff(const symbol & s) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; // new virtual functions which can be overridden by derived classes // none @@ -90,7 +90,7 @@ private: // global constants extern const constant some_constant; -extern type_info const & typeid_constant; +extern const type_info & typeid_constant; // extern const numeric I; extern const constant Pi; diff --git a/ginac/container.pl b/ginac/container.pl index c9ff5e4f..f04c7067 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -52,11 +52,11 @@ if ($reserve) { if ($prepend) { $PREPEND_INTERFACE=<=0); GINAC_ASSERT(ibasic::normal(sym_lst,repl_lst,level); } -ex ${CONTAINER}::diff(symbol const & s) const +ex ${CONTAINER}::diff(const symbol & s) const { return this${CONTAINER}(diffchildren(s)); } -ex ${CONTAINER}::subs(lst const & ls, lst const & lr) const +ex ${CONTAINER}::subs(const lst & ls, const lst & lr) const { ${STLT} * vp=subschildren(ls,lr); if (vp==0) { @@ -650,7 +650,7 @@ ex ${CONTAINER}::subs(lst const & ls, lst const & lr) const // protected -int ${CONTAINER}::compare_same_type(basic const & other) const +int ${CONTAINER}::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,${CONTAINER})); ${CONTAINER} const & o=static_cast<${CONTAINER} const &> @@ -671,7 +671,7 @@ int ${CONTAINER}::compare_same_type(basic const & other) const return 1; } -bool ${CONTAINER}::is_equal_same_type(basic const & other) const +bool ${CONTAINER}::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,${CONTAINER})); ${CONTAINER} const & o=static_cast<${CONTAINER} const &> @@ -699,7 +699,7 @@ unsigned ${CONTAINER}::return_type(void) const // public -${CONTAINER} & ${CONTAINER}::append(ex const & b) +${CONTAINER} & ${CONTAINER}::append(const ex & b) { ensure_if_modifiable(); seq.push_back(b); @@ -821,7 +821,7 @@ ${STLT} ${CONTAINER}::normalchildren(int level) const return s; } -${STLT} ${CONTAINER}::diffchildren(symbol const & y) const +${STLT} ${CONTAINER}::diffchildren(const symbol & y) const { ${STLT} s; RESERVE(s,seq.size()); @@ -832,7 +832,7 @@ ${STLT} ${CONTAINER}::diffchildren(symbol const & y) const } /* obsolete subschildren -${STLT} ${CONTAINER}::subschildren(lst const & ls, lst const & lr) const +${STLT} ${CONTAINER}::subschildren(const lst & ls, const lst & lr) const { ${STLT} s; RESERVE(s,seq.size()); @@ -843,7 +843,7 @@ ${STLT} ${CONTAINER}::subschildren(lst const & ls, lst const & lr) const } */ -${STLT} * ${CONTAINER}::subschildren(lst const & ls, lst const & lr) const +${STLT} * ${CONTAINER}::subschildren(const lst & ls, const lst & lr) const { // returns a NULL pointer if nothing had to be substituted // returns a pointer to a newly created epvector otherwise @@ -852,7 +852,7 @@ ${STLT} * ${CONTAINER}::subschildren(lst const & ls, lst const & lr) const ${STLT}::const_iterator last=seq.end(); ${STLT}::const_iterator cit=seq.begin(); while (cit!=last) { - ex const & subsed_ex=(*cit).subs(ls,lr); + const ex & subsed_ex=(*cit).subs(ls,lr); if (!are_ex_trivially_equal(*cit,subsed_ex)) { // something changed, copy seq, subs and return it @@ -894,7 +894,7 @@ unsigned ${CONTAINER}::precedence=10; ////////// const ${CONTAINER} some_${CONTAINER}; -type_info const & typeid_${CONTAINER}=typeid(some_${CONTAINER}); +const type_info & typeid_${CONTAINER}=typeid(some_${CONTAINER}); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/diff.cpp b/ginac/diff.cpp index c3bd2395..20849186 100644 --- a/ginac/diff.cpp +++ b/ginac/diff.cpp @@ -44,7 +44,7 @@ namespace GiNaC { /** Default implementation of ex::diff(). It prints and error message and returns a fail object. * @see ex::diff */ -ex basic::diff(symbol const & s) const +ex basic::diff(const symbol & s) const { throw(std::logic_error("differentiation not supported by this type")); } @@ -53,7 +53,7 @@ ex basic::diff(symbol const & s) const /** Implementation of ex::diff() for a numeric. It always returns 0. * * @see ex::diff */ -ex numeric::diff(symbol const & s) const +ex numeric::diff(const symbol & s) const { return _ex0(); } @@ -63,7 +63,7 @@ ex numeric::diff(symbol const & s) const * It returns 1 or 0. * * @see ex::diff */ -ex symbol::diff(symbol const & s) const +ex symbol::diff(const symbol & s) const { if (compare_same_type(s)) { return _ex0(); @@ -75,7 +75,7 @@ ex symbol::diff(symbol const & s) const /** Implementation of ex::diff() for a constant. It always returns 0. * * @see ex::diff */ -ex constant::diff(symbol const & s) const +ex constant::diff(const symbol & s) const { return _ex0(); } @@ -85,7 +85,7 @@ ex constant::diff(symbol const & s) const * * @param nth order of differentiation * @see ex::diff */ -ex symbol::diff(symbol const & s, unsigned nth) const +ex symbol::diff(const symbol & s, unsigned nth) const { if (compare_same_type(s)) { switch (nth) { @@ -106,7 +106,7 @@ ex symbol::diff(symbol const & s, unsigned nth) const /** Implementation of ex::diff() for an indexed object. It always returns 0. * @see ex::diff */ -ex indexed::diff(symbol const & s) const +ex indexed::diff(const symbol & s) const { return _ex0(); } @@ -114,7 +114,7 @@ ex indexed::diff(symbol const & s) const /** Implementation of ex::diff() for an expairseq. It differentiates all elements of the sequence. * @see ex::diff */ -ex expairseq::diff(symbol const & s) const +ex expairseq::diff(const symbol & s) const { return thisexpairseq(diffchildren(s),overall_coeff); } @@ -122,7 +122,7 @@ ex expairseq::diff(symbol const & s) const /** Implementation of ex::diff() for a sum. It differentiates each term. * @see ex::diff */ -ex add::diff(symbol const & s) const +ex add::diff(const symbol & s) const { // D(a+b+c)=D(a)+D(b)+D(c) return (new add(diffchildren(s)))->setflag(status_flags::dynallocated); @@ -131,7 +131,7 @@ ex add::diff(symbol const & s) const /** Implementation of ex::diff() for a product. It applies the product rule. * @see ex::diff */ -ex mul::diff(symbol const & s) const +ex mul::diff(const symbol & s) const { exvector new_seq; new_seq.reserve(seq.size()); @@ -150,7 +150,7 @@ ex mul::diff(symbol const & s) const /** Implementation of ex::diff() for a non-commutative product. It always returns 0. * @see ex::diff */ -ex ncmul::diff(symbol const & s) const +ex ncmul::diff(const symbol & s) const { return _ex0(); } @@ -158,7 +158,7 @@ ex ncmul::diff(symbol const & s) const /** Implementation of ex::diff() for a power. * @see ex::diff */ -ex power::diff(symbol const & s) const +ex power::diff(const symbol & s) const { if (exponent.info(info_flags::real)) { // D(b^r) = r * b^(r-1) * D(b) (faster than the formula below) @@ -175,7 +175,7 @@ ex power::diff(symbol const & s) const /** Implementation of ex::diff() for functions. It applies the chain rule, * except for the Order term function. * @see ex::diff */ -ex function::diff(symbol const & s) const +ex function::diff(const symbol & s) const { exvector new_seq; @@ -202,7 +202,7 @@ ex function::diff(symbol const & s) const /** Implementation of ex::diff() for a power series. It treats the series as a polynomial. * @see ex::diff */ -ex pseries::diff(symbol const & s) const +ex pseries::diff(const symbol & s) const { if (s == var) { epvector new_seq; @@ -232,7 +232,7 @@ ex pseries::diff(symbol const & s) const * @param nth order of derivative (default 1) * @return partial derivative as a new expression */ -ex ex::diff(symbol const & s, unsigned nth) const +ex ex::diff(const symbol & s, unsigned nth) const { GINAC_ASSERT(bp!=0); diff --git a/ginac/ex.cpp b/ginac/ex.cpp index 644e88a0..88395f98 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -62,7 +62,7 @@ ex::~ex() } } -ex::ex(ex const & other) : bp(other.bp) +ex::ex(const ex & other) : bp(other.bp) { debugmsg("ex copy constructor",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(bp!=0); @@ -70,7 +70,7 @@ ex::ex(ex const & other) : bp(other.bp) ++bp->refcount; } -ex const & ex::operator=(ex const & other) +const ex & ex::operator=(const ex & other) { debugmsg("ex operator=",LOGLEVEL_ASSIGNMENT); GINAC_ASSERT(bp!=0); @@ -95,14 +95,14 @@ ex const & ex::operator=(ex const & other) // public #ifndef INLINE_EX_CONSTRUCTORS -ex::ex(basic const & other) +ex::ex(const basic & other) { debugmsg("ex constructor from basic",LOGLEVEL_CONSTRUCT); construct_from_basic(other); } #endif -ex::ex(int const i) +ex::ex(int i) { debugmsg("ex constructor from int",LOGLEVEL_CONSTRUCT); switch (i) { // some tiny efficiency-hack (FIXME: is this ok?) @@ -123,19 +123,19 @@ ex::ex(int const i) } } -ex::ex(unsigned int const i) +ex::ex(unsigned int i) { debugmsg("ex constructor from unsigned int",LOGLEVEL_CONSTRUCT); construct_from_basic(numeric(i)); } -ex::ex(long const i) +ex::ex(long i) { debugmsg("ex constructor from long",LOGLEVEL_CONSTRUCT); construct_from_basic(numeric(i)); } -ex::ex(unsigned long const i) +ex::ex(unsigned long i) { debugmsg("ex constructor from unsigned long",LOGLEVEL_CONSTRUCT); construct_from_basic(numeric(i)); @@ -291,25 +291,25 @@ ex ex::expand(unsigned options) const return bp->expand(options); } -bool ex::has(ex const & other) const +bool ex::has(const ex & other) const { GINAC_ASSERT(bp!=0); return bp->has(other); } -int ex::degree(symbol const & s) const +int ex::degree(const symbol & s) const { GINAC_ASSERT(bp!=0); return bp->degree(s); } -int ex::ldegree(symbol const & s) const +int ex::ldegree(const symbol & s) const { GINAC_ASSERT(bp!=0); return bp->ldegree(s); } -ex ex::coeff(symbol const & s, int const n) const +ex ex::coeff(const symbol & s, int n) const { GINAC_ASSERT(bp!=0); return bp->coeff(s,n); @@ -369,7 +369,7 @@ ex ex::denom(bool normalize) const return res; } -ex ex::collect(symbol const & s) const +ex ex::collect(const symbol & s) const { GINAC_ASSERT(bp!=0); return bp->collect(s); @@ -387,13 +387,13 @@ ex ex::evalf(int level) const return bp->evalf(level); } -ex ex::subs(lst const & ls, lst const & lr) const +ex ex::subs(const lst & ls, const lst & lr) const { GINAC_ASSERT(bp!=0); return bp->subs(ls,lr); } -ex ex::subs(ex const & e) const +ex ex::subs(const ex & e) const { GINAC_ASSERT(bp!=0); return bp->subs(e); @@ -405,34 +405,34 @@ exvector ex::get_indices(void) const return bp->get_indices(); } -ex ex::simplify_ncmul(exvector const & v) const +ex ex::simplify_ncmul(const exvector & v) const { GINAC_ASSERT(bp!=0); return bp->simplify_ncmul(v); } -ex ex::operator[](ex const & index) const +ex ex::operator[](const ex & index) const { debugmsg("ex operator[ex]",LOGLEVEL_OPERATOR); GINAC_ASSERT(bp!=0); return (*bp)[index]; } -ex ex::operator[](int const i) const +ex ex::operator[](int i) const { debugmsg("ex operator[int]",LOGLEVEL_OPERATOR); GINAC_ASSERT(bp!=0); return (*bp)[i]; } -ex ex::op(int const i) const +ex ex::op(int i) const { debugmsg("ex op()",LOGLEVEL_MEMBER_FUNCTION); GINAC_ASSERT(bp!=0); return bp->op(i); } -ex & ex::let_op(int const i) +ex & ex::let_op(int i) { debugmsg("ex let_op()",LOGLEVEL_MEMBER_FUNCTION); makewriteable(); @@ -441,7 +441,7 @@ ex & ex::let_op(int const i) } #ifndef INLINE_EX_CONSTRUCTORS -int ex::compare(ex const & other) const +int ex::compare(const ex & other) const { GINAC_ASSERT(bp!=0); GINAC_ASSERT(other.bp!=0); @@ -454,7 +454,7 @@ int ex::compare(ex const & other) const #endif // ndef INLINE_EX_CONSTRUCTORS #ifndef INLINE_EX_CONSTRUCTORS -bool ex::is_equal(ex const & other) const +bool ex::is_equal(const ex & other) const { GINAC_ASSERT(bp!=0); GINAC_ASSERT(other.bp!=0); @@ -484,17 +484,17 @@ unsigned ex::gethash(void) const return bp->gethash(); } -ex ex::exadd(ex const & rh) const +ex ex::exadd(const ex & rh) const { return (new add(*this,rh))->setflag(status_flags::dynallocated); } -ex ex::exmul(ex const & rh) const +ex ex::exmul(const ex & rh) const { return (new mul(*this,rh))->setflag(status_flags::dynallocated); } -ex ex::exncmul(ex const & rh) const +ex ex::exncmul(const ex & rh) const { return (new ncmul(*this,rh))->setflag(status_flags::dynallocated); } @@ -516,11 +516,11 @@ void ex::makewriteable() GINAC_ASSERT(bp->refcount == 1); } -void ex::construct_from_basic(basic const & other) +void ex::construct_from_basic(const basic & other) { if ((other.flags & status_flags::evaluated)==0) { // cf. copy constructor - ex const & tmpex = other.eval(1); // evaluate only one (top) level + const ex & tmpex = other.eval(1); // evaluate only one (top) level bp = tmpex.bp; GINAC_ASSERT(bp!=0); GINAC_ASSERT(bp->flags & status_flags::dynallocated); diff --git a/ginac/ex.h b/ginac/ex.h index 21a4ea7c..a39fe2e7 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -38,7 +38,7 @@ class status_flags; class symbol; class lst; -extern ex const & _ex0(void); /* FIXME: should this pollute headers? */ +extern const ex & _ex0(void); /* FIXME: should this pollute headers? */ // typedef vector exvector; @@ -84,7 +84,7 @@ public: ; #endif // def INLINE_EX_CONSTRUCTORS - ex(ex const & other) + ex(const ex & other) #ifdef INLINE_EX_CONSTRUCTORS : bp(other.bp) { @@ -99,7 +99,7 @@ public: ; #endif // def INLINE_EX_CONSTRUCTORS - ex const & operator=(ex const & other) + const ex & operator=(const ex & other) #ifdef INLINE_EX_CONSTRUCTORS { GINAC_ASSERT(bp!=0); @@ -123,7 +123,7 @@ public: // other constructors public: - ex(basic const & other) + ex(const basic & other) #ifdef INLINE_EX_CONSTRUCTORS { construct_from_basic(other); @@ -135,10 +135,10 @@ public: ; #endif // def INLINE_EX_CONSTRUCTORS - ex(int const i); - ex(unsigned int const i); - ex(long const i); - ex(unsigned long const i); + ex(int i); + ex(unsigned int i); + ex(long i); + ex(unsigned long i); ex(double const d); // functions overriding virtual functions from bases classes @@ -159,12 +159,12 @@ public: bool info(unsigned inf) const; unsigned nops() const; ex expand(unsigned options=0) const; - bool has(ex const & other) const; - int degree(symbol const & s) const; - int ldegree(symbol const & s) const; - ex coeff(symbol const & s, int const n=1) const; - ex lcoeff(symbol const & s) const { return coeff(s, degree(s)); } - ex tcoeff(symbol const & s) const { return coeff(s, ldegree(s)); } + bool has(const ex & other) const; + int degree(const symbol & s) const; + int ldegree(const symbol & s) const; + ex coeff(const symbol & s, int n=1) const; + ex lcoeff(const symbol & s) const { return coeff(s, degree(s)); } + ex tcoeff(const symbol & s) const { return coeff(s, ldegree(s)); } ex numer(bool normalize = true) const; ex denom(bool normalize = true) const; ex unit(const symbol &x) const; @@ -175,20 +175,20 @@ public: ex normal(int level = 0) const; ex smod(const numeric &xi) const; numeric max_coefficient(void) const; - ex collect(symbol const & s) const; + ex collect(const symbol & s) const; ex eval(int level = 0) const; ex evalf(int level = 0) const; - ex diff(symbol const & s, unsigned nth = 1) const; - ex series(symbol const & s, ex const & point, int order = 6) const; - ex subs(lst const & ls, lst const & lr) const; - ex subs(ex const & e) const; + ex diff(const symbol & s, unsigned nth = 1) const; + ex series(const symbol & s, const ex & point, int order = 6) const; + ex subs(const lst & ls, const lst & lr) const; + ex subs(const ex & e) const; exvector get_indices(void) const; - ex simplify_ncmul(exvector const & v) const; - ex operator[](ex const & index) const; - ex operator[](int const i) const; - ex op(int const i) const; - ex & let_op(int const i); - int compare(ex const & other) const + ex simplify_ncmul(const exvector & v) const; + ex operator[](const ex & index) const; + ex operator[](int i) const; + ex op(int i) const; + ex & let_op(int i); + int compare(const ex & other) const #ifdef INLINE_EX_CONSTRUCTORS { GINAC_ASSERT(bp!=0); @@ -202,7 +202,7 @@ public: #else ; #endif // def INLINE_EX_CONSTRUCTORS - bool is_equal(ex const & other) const + bool is_equal(const ex & other) const #ifdef INLINE_EX_CONSTRUCTORS { GINAC_ASSERT(bp!=0); @@ -222,11 +222,11 @@ public: unsigned return_type_tinfo(void) const; unsigned gethash(void) const; - ex exadd(ex const & rh) const; - ex exmul(ex const & rh) const; - ex exncmul(ex const & rh) const; + ex exadd(const ex & rh) const; + ex exmul(const ex & rh) const; + ex exncmul(const ex & rh) const; private: - void construct_from_basic(basic const & other); + void construct_from_basic(const basic & other); void makewriteable(); #ifdef OBSCURE_CINT_HACK @@ -269,52 +269,52 @@ inline bool are_ex_trivially_equal(const ex &e1, const ex &e2) } // wrapper functions around member functions -inline unsigned nops(ex const & thisex) +inline unsigned nops(const ex & thisex) { return thisex.nops(); } -inline ex expand(ex const & thisex, unsigned options = 0) +inline ex expand(const ex & thisex, unsigned options = 0) { return thisex.expand(options); } -inline bool has(ex const & thisex, ex const & other) +inline bool has(const ex & thisex, const ex & other) { return thisex.has(other); } -inline int degree(ex const & thisex, symbol const & s) +inline int degree(const ex & thisex, const symbol & s) { return thisex.degree(s); } -inline int ldegree(ex const & thisex, symbol const & s) +inline int ldegree(const ex & thisex, const symbol & s) { return thisex.ldegree(s); } -inline ex coeff(ex const & thisex, symbol const & s, int const n=1) +inline ex coeff(const ex & thisex, const symbol & s, int n=1) { return thisex.coeff(s, n); } -inline ex numer(ex const & thisex, bool normalize = true) +inline ex numer(const ex & thisex, bool normalize = true) { return thisex.numer(normalize); } -inline ex denom(ex const & thisex, bool normalize = true) +inline ex denom(const ex & thisex, bool normalize = true) { return thisex.denom(normalize); } -inline ex normal(ex const & thisex, int level=0) +inline ex normal(const ex & thisex, int level=0) { return thisex.normal(level); } -inline ex collect(ex const & thisex, symbol const & s) +inline ex collect(const ex & thisex, const symbol & s) { return thisex.collect(s); } -inline ex eval(ex const & thisex, int level = 0) +inline ex eval(const ex & thisex, int level = 0) { return thisex.eval(level); } -inline ex evalf(ex const & thisex, int level = 0) +inline ex evalf(const ex & thisex, int level = 0) { return thisex.evalf(level); } -inline ex diff(ex const & thisex, symbol const & s, unsigned nth = 1) +inline ex diff(const ex & thisex, const symbol & s, unsigned nth = 1) { return thisex.diff(s, nth); } -inline ex series(ex const & thisex, symbol const & s, ex const & point, int order = 6) +inline ex series(const ex & thisex, const symbol & s, const ex & point, int order = 6) { return thisex.series(s, point, order); } -inline ex subs(ex const & thisex, ex const & e) +inline ex subs(const ex & thisex, const ex & e) { return thisex.subs(e); } -inline ex subs(ex const & thisex, lst const & ls, lst const & lr) +inline ex subs(const ex & thisex, const lst & ls, const lst & lr) { return thisex.subs(ls, lr); } inline void swap(ex & e1, ex & e2) diff --git a/ginac/expair.h b/ginac/expair.h index b9006848..25fc36f3 100644 --- a/ginac/expair.h +++ b/ginac/expair.h @@ -38,11 +38,11 @@ class expair public: expair() {} ~expair() {} - expair(expair const & other) : rest(other.rest), coeff(other.coeff) + expair(const expair & other) : rest(other.rest), coeff(other.coeff) { GINAC_ASSERT(is_ex_exactly_of_type(coeff,numeric)); } - expair const & operator=(expair const & other) + const expair & operator=(const expair & other) { if (this != &other) { rest=other.rest; @@ -50,7 +50,7 @@ public: } return *this; } - expair(ex const & r, ex const & c) : rest(r), coeff(c) + expair(const ex & r, const ex & c) : rest(r), coeff(c) { GINAC_ASSERT(is_ex_exactly_of_type(coeff,numeric)); } @@ -62,16 +62,16 @@ public: (coeff.is_equal(ex(1))); } - bool is_equal(expair const & other) const + bool is_equal(const expair & other) const { return (rest.is_equal(other.rest) && coeff.is_equal(other.coeff)); } - bool is_less(expair const & other) const + bool is_less(const expair & other) const { return (rest.compare(other.rest)<0) || (!(other.rest.compare(rest)<0) && (coeff.compare(other.coeff)<0)); } - int compare(expair const & other) const + int compare(const expair & other) const { int cmpval=rest.compare(other.rest); if (cmpval!=0) return cmpval; @@ -79,7 +79,7 @@ public: return cmpval; } - bool is_less_old2(expair const & other) const + bool is_less_old2(const expair & other) const { /* bool this_numeric_with_coeff_1=is_numeric_with_coeff_1(); @@ -118,7 +118,7 @@ public: (!(other.rest.compare(rest)<0) && (coeff.compare(other.coeff)<0)); } - int compare_old2(expair const & other) const + int compare_old2(const expair & other) const { if (is_ex_exactly_of_type(rest,numeric) && is_ex_exactly_of_type(other.rest,numeric)) { @@ -155,12 +155,12 @@ public: if (cmpval!=0) return cmpval; return coeff.compare(other.coeff); } - bool is_less_old(expair const & other) const + bool is_less_old(const expair & other) const { return (rest.compare(other.rest)<0) || (!(other.rest.compare(rest)<0) && (coeff.compare(other.coeff)<0)); } - int compare_old(expair const & other) const + int compare_old(const expair & other) const { int cmpval=rest.compare(other.rest); if (cmpval!=0) return cmpval; @@ -184,7 +184,7 @@ public: class expair_is_less { public: - bool operator()(expair const & lh, expair const & rh) const + bool operator()(const expair & lh, const expair & rh) const { return lh.is_less(rh); } @@ -193,7 +193,7 @@ public: class expair_is_less_old { public: - bool operator()(expair const & lh, expair const & rh) const + bool operator()(const expair & lh, const expair & rh) const { return lh.is_less_old(rh); } diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index 2d83b141..550b2a88 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -48,7 +48,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS(expairseq, basic) class epp_is_less { public: - bool operator()(epp const & lh, epp const & rh) const + bool operator()(const epp & lh, const epp & rh) const { return (*lh).is_less(*rh); } @@ -60,13 +60,13 @@ public: // public -expairseq::expairseq(expairseq const & other) +expairseq::expairseq(const expairseq & other) { debugmsg("expairseq copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -expairseq const & expairseq::operator=(expairseq const & other) +const expairseq & expairseq::operator=(const expairseq & other) { debugmsg("expairseq operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -78,7 +78,7 @@ expairseq const & expairseq::operator=(expairseq const & other) // protected -void expairseq::copy(expairseq const & other) +void expairseq::copy(const expairseq & other) { inherited::copy(other); seq=other.seq; @@ -107,14 +107,14 @@ void expairseq::copy(expairseq const & other) // other constructors ////////// -expairseq::expairseq(ex const & lh, ex const & rh) : inherited(TINFO_expairseq) +expairseq::expairseq(const ex & lh, const ex & rh) : inherited(TINFO_expairseq) { debugmsg("expairseq constructor from ex,ex",LOGLEVEL_CONSTRUCT); construct_from_2_ex(lh,rh); GINAC_ASSERT(is_canonical()); } -expairseq::expairseq(exvector const & v) : inherited(TINFO_expairseq) +expairseq::expairseq(const exvector & v) : inherited(TINFO_expairseq) { debugmsg("expairseq constructor from exvector",LOGLEVEL_CONSTRUCT); construct_from_exvector(v); @@ -122,7 +122,7 @@ expairseq::expairseq(exvector const & v) : inherited(TINFO_expairseq) } /* -expairseq::expairseq(epvector const & v, bool do_not_canonicalize) : +expairseq::expairseq(const epvector & v, bool do_not_canonicalize) : inherited(TINFO_expairseq) { debugmsg("expairseq constructor from epvector",LOGLEVEL_CONSTRUCT); @@ -138,7 +138,7 @@ expairseq::expairseq(epvector const & v, bool do_not_canonicalize) : } */ -expairseq::expairseq(epvector const & v, ex const & oc) : +expairseq::expairseq(const epvector & v, const ex & oc) : inherited(TINFO_expairseq), overall_coeff(oc) { debugmsg("expairseq constructor from epvector,ex",LOGLEVEL_CONSTRUCT); @@ -146,7 +146,7 @@ expairseq::expairseq(epvector const & v, ex const & oc) : GINAC_ASSERT(is_canonical()); } -expairseq::expairseq(epvector * vp, ex const & oc) : +expairseq::expairseq(epvector * vp, const ex & oc) : inherited(TINFO_expairseq), overall_coeff(oc) { debugmsg("expairseq constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); @@ -329,7 +329,7 @@ ex expairseq::op(int i) const return overall_coeff; } -ex & expairseq::let_op(int const i) +ex & expairseq::let_op(int i) { throw(std::logic_error("let_op not defined for expairseq and derived classes (add,mul,...)")); } @@ -361,7 +361,7 @@ ex expairseq::normal(lst &sym_lst, lst &repl_lst, int level) const return n.bp->basic::normal(sym_lst,repl_lst,level); } -ex expairseq::subs(lst const & ls, lst const & lr) const +ex expairseq::subs(const lst & ls, const lst & lr) const { epvector * vp=subschildren(ls,lr); if (vp==0) { @@ -372,10 +372,10 @@ ex expairseq::subs(lst const & ls, lst const & lr) const // protected -int expairseq::compare_same_type(basic const & other) const +int expairseq::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other, expairseq)); - expairseq const & o=static_cast(const_cast(other)); + const expairseq & o=static_cast(const_cast(other)); int cmpval; @@ -423,8 +423,8 @@ int expairseq::compare_same_type(basic const & other) const for (unsigned i=0; i0) { - epplist const & eppl1=hashtab[i]; - epplist const & eppl2=o.hashtab[i]; + const epplist & eppl1=hashtab[i]; + const epplist & eppl2=o.hashtab[i]; epplist::const_iterator it1=eppl1.begin(); epplist::const_iterator it2=eppl2.begin(); while (it1!=eppl1.end()) { @@ -440,9 +440,9 @@ int expairseq::compare_same_type(basic const & other) const #endif // def EXPAIRSEQ_USE_HASHTAB } -bool expairseq::is_equal_same_type(basic const & other) const +bool expairseq::is_equal_same_type(const basic & other) const { - expairseq const & o=dynamic_cast(const_cast(other)); + const expairseq & o=dynamic_cast(const_cast(other)); // compare number of elements if (seq.size() != o.seq.size()) return false; @@ -485,8 +485,8 @@ bool expairseq::is_equal_same_type(basic const & other) const for (unsigned i=0; i0) { - epplist const & eppl1=hashtab[i]; - epplist const & eppl2=o.hashtab[i]; + const epplist & eppl1=hashtab[i]; + const epplist & eppl2=o.hashtab[i]; epplist::const_iterator it1=eppl1.begin(); epplist::const_iterator it2=eppl2.begin(); while (it1!=eppl1.end()) { @@ -544,17 +544,17 @@ ex expairseq::expand(unsigned options) const // protected -ex expairseq::thisexpairseq(epvector const & v,ex const & oc) const +ex expairseq::thisexpairseq(const epvector & v,const ex & oc) const { return expairseq(v,oc); } -ex expairseq::thisexpairseq(epvector * vp, ex const & oc) const +ex expairseq::thisexpairseq(epvector * vp, const ex & oc) const { return expairseq(vp,oc); } -void expairseq::printpair(ostream & os, expair const & p, unsigned upper_precedence) const +void expairseq::printpair(ostream & os, const expair & p, unsigned upper_precedence) const { os << "[["; p.rest.bp->print(os,precedence); @@ -581,21 +581,21 @@ void expairseq::printseq(ostream & os, char delim, unsigned this_precedence, if (this_precedence<=upper_precedence) os << ")"; } -expair expairseq::split_ex_to_pair(ex const & e) const +expair expairseq::split_ex_to_pair(const ex & e) const { return expair(e,_ex1()); } -expair expairseq::combine_ex_with_coeff_to_pair(ex const & e, - ex const & c) const +expair expairseq::combine_ex_with_coeff_to_pair(const ex & e, + const ex & c) const { GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); return expair(e,c); } -expair expairseq::combine_pair_with_coeff_to_pair(expair const & p, - ex const & c) const +expair expairseq::combine_pair_with_coeff_to_pair(const expair & p, + const ex & c) const { GINAC_ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); @@ -603,7 +603,7 @@ expair expairseq::combine_pair_with_coeff_to_pair(expair const & p, return expair(p.rest,ex_to_numeric(p.coeff).mul_dyn(ex_to_numeric(c))); } -ex expairseq::recombine_pair_to_ex(expair const & p) const +ex expairseq::recombine_pair_to_ex(const expair & p) const { return lst(p.rest,p.coeff); } @@ -618,14 +618,14 @@ ex expairseq::default_overall_coeff(void) const return _ex0(); } -void expairseq::combine_overall_coeff(ex const & c) +void expairseq::combine_overall_coeff(const ex & c) { GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); overall_coeff = ex_to_numeric(overall_coeff).add_dyn(ex_to_numeric(c)); } -void expairseq::combine_overall_coeff(ex const & c1, ex const & c2) +void expairseq::combine_overall_coeff(const ex & c1, const ex & c2) { GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c1,numeric)); @@ -634,7 +634,7 @@ void expairseq::combine_overall_coeff(ex const & c1, ex const & c2) add_dyn(ex_to_numeric(c1).mul(ex_to_numeric(c2))); } -bool expairseq::can_make_flat(expair const & p) const +bool expairseq::can_make_flat(const expair & p) const { return true; } @@ -644,7 +644,7 @@ bool expairseq::can_make_flat(expair const & p) const // non-virtual functions in this class ////////// -void expairseq::construct_from_2_ex_via_exvector(ex const & lh, ex const & rh) +void expairseq::construct_from_2_ex_via_exvector(const ex & lh, const ex & rh) { exvector v; v.reserve(2); @@ -657,7 +657,7 @@ void expairseq::construct_from_2_ex_via_exvector(ex const & lh, ex const & rh) #endif // def EXPAIRSEQ_USE_HASHTAB } -void expairseq::construct_from_2_ex(ex const & lh, ex const & rh) +void expairseq::construct_from_2_ex(const ex & lh, const ex & rh) { if (lh.bp->tinfo()==tinfo()) { if (rh.bp->tinfo()==tinfo()) { @@ -747,8 +747,8 @@ void expairseq::construct_from_2_ex(ex const & lh, ex const & rh) } } -void expairseq::construct_from_2_expairseq(expairseq const & s1, - expairseq const & s2) +void expairseq::construct_from_2_expairseq(const expairseq & s1, + const expairseq & s2) { combine_overall_coeff(s1.overall_coeff); combine_overall_coeff(s2.overall_coeff); @@ -766,7 +766,7 @@ void expairseq::construct_from_2_expairseq(expairseq const & s1, int cmpval=(*first1).rest.compare((*first2).rest); if (cmpval==0) { // combine terms - numeric const & newcoeff=ex_to_numeric((*first1).coeff). + const numeric & newcoeff=ex_to_numeric((*first1).coeff). add(ex_to_numeric((*first2).coeff)); if (!newcoeff.is_zero()) { seq.push_back(expair((*first1).rest,newcoeff)); @@ -801,8 +801,8 @@ void expairseq::construct_from_2_expairseq(expairseq const & s1, } } -void expairseq::construct_from_expairseq_ex(expairseq const & s, - ex const & e) +void expairseq::construct_from_expairseq_ex(const expairseq & s, + const ex & e) { combine_overall_coeff(s.overall_coeff); if (is_ex_exactly_of_type(e,numeric)) { @@ -825,7 +825,7 @@ void expairseq::construct_from_expairseq_ex(expairseq const & s, int cmpval=(*first).rest.compare(p.rest); if (cmpval==0) { // combine terms - numeric const & newcoeff=ex_to_numeric((*first).coeff). + const numeric & newcoeff=ex_to_numeric((*first).coeff). add(ex_to_numeric(p.coeff)); if (!newcoeff.is_zero()) { seq.push_back(expair((*first).rest,newcoeff)); @@ -864,7 +864,7 @@ void expairseq::construct_from_expairseq_ex(expairseq const & s, } } -void expairseq::construct_from_exvector(exvector const & v) +void expairseq::construct_from_exvector(const exvector & v) { // simplifications: +(a,+(b,c),d) -> +(a,b,c,d) (associativity) // +(d,b,c,a) -> +(a,b,c,d) (canonicalization) @@ -880,7 +880,7 @@ void expairseq::construct_from_exvector(exvector const & v) #endif // def EXPAIRSEQ_USE_HASHTAB } -void expairseq::construct_from_epvector(epvector const & v) +void expairseq::construct_from_epvector(const epvector & v) { // simplifications: +(a,+(b,c),d) -> +(a,b,c,d) (associativity) // +(d,b,c,a) -> +(a,b,c,d) (canonicalization) @@ -898,7 +898,7 @@ void expairseq::construct_from_epvector(epvector const & v) #include -void expairseq::make_flat(exvector const & v) +void expairseq::make_flat(const exvector & v) { exvector::const_iterator cit, citend = v.end(); @@ -922,7 +922,7 @@ void expairseq::make_flat(exvector const & v) cit=v.begin(); while (cit!=citend) { if (cit->bp->tinfo()==tinfo()) { - expairseq const & subseqref=ex_to_expairseq(*cit); + const expairseq & subseqref=ex_to_expairseq(*cit); combine_overall_coeff(subseqref.overall_coeff); epvector::const_iterator cit_s=subseqref.seq.begin(); while (cit_s!=subseqref.seq.end()) { @@ -949,7 +949,7 @@ void expairseq::make_flat(exvector const & v) */ } -void expairseq::make_flat(epvector const & v) +void expairseq::make_flat(const epvector & v) { epvector::const_iterator cit, citend = v.end(); @@ -973,7 +973,7 @@ void expairseq::make_flat(epvector const & v) cit=v.begin(); while (cit!=citend) { if ((cit->rest.bp->tinfo()==tinfo())&&can_make_flat(*cit)) { - expairseq const & subseqref=ex_to_expairseq((*cit).rest); + const expairseq & subseqref=ex_to_expairseq((*cit).rest); combine_overall_coeff(ex_to_numeric(subseqref.overall_coeff), ex_to_numeric((*cit).coeff)); epvector::const_iterator cit_s=subseqref.seq.begin(); @@ -1186,7 +1186,7 @@ unsigned expairseq::calc_hashtabsize(unsigned sz) const return size; } -unsigned expairseq::calc_hashindex(ex const & e) const +unsigned expairseq::calc_hashindex(const ex & e) const { // calculate hashindex unsigned hash=e.gethash(); @@ -1540,7 +1540,7 @@ epvector * expairseq::expandchildren(unsigned options) const epvector::const_iterator last=seq.end(); epvector::const_iterator cit=seq.begin(); while (cit!=last) { - ex const & expanded_ex=(*cit).rest.expand(options); + const ex & expanded_ex=(*cit).rest.expand(options); if (!are_ex_trivially_equal((*cit).rest,expanded_ex)) { // something changed, copy seq, eval and return it @@ -1588,7 +1588,7 @@ epvector * expairseq::evalchildren(int level) const epvector::const_iterator last=seq.end(); epvector::const_iterator cit=seq.begin(); while (cit!=last) { - ex const & evaled_ex=(*cit).rest.eval(level); + const ex & evaled_ex=(*cit).rest.eval(level); if (!are_ex_trivially_equal((*cit).rest,evaled_ex)) { // something changed, copy seq, eval and return it @@ -1657,7 +1657,7 @@ epvector expairseq::normalchildren(int level) const return s; } -epvector expairseq::diffchildren(symbol const & y) const +epvector expairseq::diffchildren(const symbol & y) const { epvector s; s.reserve(seq.size()); @@ -1669,7 +1669,7 @@ epvector expairseq::diffchildren(symbol const & y) const return s; } -epvector * expairseq::subschildren(lst const & ls, lst const & lr) const +epvector * expairseq::subschildren(const lst & ls, const lst & lr) const { // returns a NULL pointer if nothing had to be substituted // returns a pointer to a newly created epvector otherwise @@ -1679,7 +1679,7 @@ epvector * expairseq::subschildren(lst const & ls, lst const & lr) const epvector::const_iterator last=seq.end(); epvector::const_iterator cit=seq.begin(); while (cit!=last) { - ex const & subsed_ex=(*cit).rest.subs(ls,lr); + const ex & subsed_ex=(*cit).rest.subs(ls,lr); if (!are_ex_trivially_equal((*cit).rest,subsed_ex)) { // something changed, copy seq, subs and return it @@ -1729,7 +1729,7 @@ unsigned expairseq::hashtabfactor=1; ////////// const expairseq some_expairseq; -type_info const & typeid_expairseq=typeid(some_expairseq); +const type_info & typeid_expairseq=typeid(some_expairseq); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/expairseq.h b/ginac/expairseq.h index d9d7bf05..8be797dc 100644 --- a/ginac/expairseq.h +++ b/ginac/expairseq.h @@ -73,10 +73,10 @@ public: { destroy(0); } - expairseq(expairseq const & other); - expairseq const & operator=(expairseq const & other); + expairseq(const expairseq & other); + const expairseq & operator=(const expairseq & other); protected: - void copy(expairseq const & other); + void copy(const expairseq & other); void destroy(bool call_parent) { if (call_parent) basic::destroy(call_parent); @@ -84,10 +84,10 @@ protected: // other constructors public: - expairseq(ex const & lh, ex const & rh); - expairseq(exvector const & v); - expairseq(epvector const & v, ex const & oc); - expairseq(epvector * vp, ex const & oc); // vp will be deleted + expairseq(const ex & lh, const ex & rh); + expairseq(const exvector & v); + expairseq(const epvector & v, const ex & oc); + expairseq(epvector * vp, const ex & oc); // vp will be deleted // functions overriding virtual functions from bases classes public: @@ -97,52 +97,52 @@ public: void printtree(ostream & os, unsigned indent) const; bool info(unsigned inf) const; unsigned nops() const; - ex op(int const i) const; - ex & let_op(int const i); + ex op(int i) const; + ex & let_op(int i); ex eval(int level=0) const; ex evalf(int level=0) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; - ex diff(symbol const & s) const; - ex subs(lst const & ls, lst const & lr) const; + ex diff(const symbol & s) const; + ex subs(const lst & ls, const lst & lr) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; unsigned calchash(void) const; ex expand(unsigned options=0) const; // new virtual functions which can be overridden by derived classes protected: - virtual ex thisexpairseq(epvector const & v, ex const & oc) const; - virtual ex thisexpairseq(epvector * vp, ex const & oc) const; + virtual ex thisexpairseq(const epvector & v, const ex & oc) const; + virtual ex thisexpairseq(epvector * vp, const ex & oc) const; virtual void printseq(ostream & os, char delim, unsigned this_precedence, unsigned upper_precedence) const; - virtual void printpair(ostream & os, expair const & p, + virtual void printpair(ostream & os, const expair & p, unsigned upper_precedence) const; - virtual expair split_ex_to_pair(ex const & e) const; - virtual expair combine_ex_with_coeff_to_pair(ex const & e, - ex const & c) const; - virtual expair combine_pair_with_coeff_to_pair(expair const & p, - ex const & c) const; - virtual ex recombine_pair_to_ex(expair const & p) const; + virtual expair split_ex_to_pair(const ex & e) const; + virtual expair combine_ex_with_coeff_to_pair(const ex & e, + const ex & c) const; + virtual expair combine_pair_with_coeff_to_pair(const expair & p, + const ex & c) const; + virtual ex recombine_pair_to_ex(const expair & p) const; virtual bool expair_needs_further_processing(epp it); virtual ex default_overall_coeff(void) const; - virtual void combine_overall_coeff(ex const & c); - virtual void combine_overall_coeff(ex const & c1, ex const & c2); - virtual bool can_make_flat(expair const & p) const; + virtual void combine_overall_coeff(const ex & c); + virtual void combine_overall_coeff(const ex & c1, const ex & c2); + virtual bool can_make_flat(const expair & p) const; // non-virtual functions in this class protected: - void construct_from_2_ex_via_exvector(ex const & lh, ex const & rh); - void construct_from_2_ex(ex const & lh, ex const & rh); - void construct_from_2_expairseq(expairseq const & s1, - expairseq const & s2); - void construct_from_expairseq_ex(expairseq const & s, - ex const & e); - void construct_from_exvector(exvector const & v); - void construct_from_epvector(epvector const & v); - void make_flat(exvector const & v); - void make_flat(epvector const & v); + void construct_from_2_ex_via_exvector(const ex & lh, const ex & rh); + void construct_from_2_ex(const ex & lh, const ex & rh); + void construct_from_2_expairseq(const expairseq & s1, + const expairseq & s2); + void construct_from_expairseq_ex(const expairseq & s, + const ex & e); + void construct_from_exvector(const exvector & v); + void construct_from_epvector(const epvector & v); + void make_flat(const exvector & v); + void make_flat(const epvector & v); epvector * bubblesort(epvector::iterator itbegin, epvector::iterator itend); epvector * mergesort(epvector::iterator itbegin, epvector::iterator itend); void canonicalize(void); @@ -150,7 +150,7 @@ protected: #ifdef EXPAIRSEQ_USE_HASHTAB void combine_same_terms(void); unsigned calc_hashtabsize(unsigned sz) const; - unsigned calc_hashindex(ex const & e) const; + unsigned calc_hashindex(const ex & e) const; void shrink_hashtab(void); void remove_hashtab_entry(epvector::const_iterator element); void move_hashtab_entry(epvector::const_iterator oldpos, @@ -172,8 +172,8 @@ protected: epvector * evalchildren(int level) const; epvector evalfchildren(int level) const; epvector normalchildren(int level) const; - epvector diffchildren(symbol const & s) const; - epvector * subschildren(lst const & ls, lst const & lr) const; + epvector diffchildren(const symbol & s) const; + epvector * subschildren(const lst & ls, const lst & lr) const; // member variables @@ -194,7 +194,7 @@ protected: // global constants extern const expairseq some_expairseq; -extern type_info const & typeid_expairseq; +extern const type_info & typeid_expairseq; // utility functions inline const expairseq &ex_to_expairseq(const ex &e) diff --git a/ginac/exprseq_suppl.cpp b/ginac/exprseq_suppl.cpp index 5b5e0ca2..62700417 100644 --- a/ginac/exprseq_suppl.cpp +++ b/ginac/exprseq_suppl.cpp @@ -34,7 +34,7 @@ bool exprseq::info(unsigned inf) const return basic::info(inf); } -ex & exprseq::let_op(int const i) +ex & exprseq::let_op(int i) { GINAC_ASSERT(i>=0); GINAC_ASSERT(i(const_cast(other)); + const function & o=static_cast(const_cast(other)); if (serial!=o.serial) { return serial < o.serial ? -1 : 1; @@ -675,10 +675,10 @@ int function::compare_same_type(basic const & other) const return exprseq::compare_same_type(o); } -bool function::is_equal_same_type(basic const & other) const +bool function::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other, function)); - function const & o=static_cast(const_cast(other)); + const function & o=static_cast(const_cast(other)); if (serial!=o.serial) return false; return exprseq::is_equal_same_type(o); @@ -750,7 +750,7 @@ $register_new_implementation ////////// const function some_function; -type_info const & typeid_function=typeid(some_function); +const type_info & typeid_function=typeid(some_function); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/idx.cpp b/ginac/idx.cpp index caaa79e7..67d23c5b 100644 --- a/ginac/idx.cpp +++ b/ginac/idx.cpp @@ -52,13 +52,13 @@ idx::~idx() destroy(0); } -idx::idx(idx const & other) +idx::idx(const idx & other) { debugmsg("idx copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -idx const & idx::operator=(idx const & other) +const idx & idx::operator=(const idx & other) { debugmsg("idx operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -70,7 +70,7 @@ idx const & idx::operator=(idx const & other) // protected -void idx::copy(idx const & other) +void idx::copy(const idx & other) { basic::copy(other); serial=other.serial; @@ -98,21 +98,21 @@ idx::idx(bool cov) : basic(TINFO_idx), symbolic(true), covariant(cov) name="index"+ToString(serial); } -idx::idx(string const & n, bool cov) : basic(TINFO_idx), +idx::idx(const string & 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(const char * 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 v, bool cov) : basic(TINFO_idx), symbolic(false), value(v), covariant(cov) { debugmsg("idx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); @@ -200,7 +200,7 @@ bool idx::info(unsigned inf) const return basic::info(inf); } -ex idx::subs(lst const & ls, lst const & lr) const +ex idx::subs(const lst & ls, const lst & lr) const { GINAC_ASSERT(ls.nops()==lr.nops()); #ifdef DO_GINAC_ASSERT @@ -220,10 +220,10 @@ ex idx::subs(lst const & ls, lst const & lr) const // protected -int idx::compare_same_type(basic const & other) const +int idx::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,idx)); - idx const & o=static_cast + const idx & o=static_cast (const_cast(other)); if (covariant!=o.covariant) { @@ -248,10 +248,10 @@ int idx::compare_same_type(basic const & other) const return o.symbolic ? -1 : 1; } -bool idx::is_equal_same_type(basic const & other) const +bool idx::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,idx)); - idx const & o=static_cast + const idx & o=static_cast (const_cast(other)); if (covariant!=o.covariant) return false; @@ -273,11 +273,11 @@ unsigned idx::calchash(void) const // public -bool idx::is_co_contra_pair(basic const & other) const +bool idx::is_co_contra_pair(const basic & other) const { // like is_equal_same_type(), but tests for different covariant status GINAC_ASSERT(is_of_type(other,idx)); - idx const & o=static_cast + const idx & o=static_cast (const_cast(other)); if (covariant==o.covariant) return false; @@ -328,7 +328,7 @@ unsigned idx::next_serial=0; ////////// const idx some_idx; -type_info const & typeid_idx=typeid(some_idx); +const type_info & typeid_idx=typeid(some_idx); ////////// // other functions @@ -362,7 +362,7 @@ int canonicalize_indices(exvector & iv, bool antisymmetric) return something_changed ? sig : INT_MAX; } -exvector idx_intersect(exvector const & iv1, exvector const & iv2) +exvector idx_intersect(const exvector & iv1, const exvector & iv2) { // build a vector of symbolic indices contained in iv1 and iv2 simultaneously // assumes (but does not test) that each index occurs at most twice @@ -388,7 +388,7 @@ exvector idx_intersect(exvector const & iv1, exvector const & iv2) return iv3[A]; \ } -ex permute_free_index_to_front(exvector const & iv3, exvector const & iv2, +ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2, bool antisymmetric, int * sig) { // match (return value,iv2) to iv3 by permuting indices @@ -408,7 +408,7 @@ ex permute_free_index_to_front(exvector const & iv3, exvector const & iv2, throw(std::logic_error("permute_free_index_to_front(): no valid permutation found")); } -unsigned subs_index_in_exvector(exvector & v, ex const & is, ex const & ir) +unsigned subs_index_in_exvector(exvector & v, const ex & is, const ex & ir) { exvector::iterator it; unsigned replacements=0; @@ -427,7 +427,7 @@ unsigned subs_index_in_exvector(exvector & v, ex const & is, ex const & ir) return replacements; } -unsigned count_index(ex const & e, ex const & i) +unsigned count_index(const ex & e, const ex & i) { exvector idxv=e.get_indices(); unsigned count=0; @@ -437,8 +437,8 @@ unsigned count_index(ex const & e, ex const & i) return count; } -ex subs_indices(ex const & e, exvector const & idxv_subs, - exvector const & idxv_repl) +ex subs_indices(const ex & e, const exvector & idxv_subs, + const exvector & idxv_repl) { GINAC_ASSERT(idxv_subs.size()==idxv_repl.size()); ex res=e; diff --git a/ginac/idx.h b/ginac/idx.h index 4f125196..67c9344e 100644 --- a/ginac/idx.h +++ b/ginac/idx.h @@ -40,18 +40,18 @@ class idx : public basic public: idx(); ~idx(); - idx (idx const & other); - idx const & operator=(idx const & other); + idx (const idx & other); + const idx & operator=(const idx & other); protected: - void copy(idx const & other); + void copy(const idx & other); void destroy(bool call_parent); // other constructors public: explicit idx(bool cov); - explicit idx(string const & n, bool cov=false); - explicit idx(char const * n, bool cov=false); - explicit idx(unsigned const v, bool cov=false); + explicit idx(const string & n, bool cov=false); + explicit idx(const char * n, bool cov=false); + explicit idx(unsigned v, bool cov=false); // functions overriding virtual functions from bases classes public: @@ -61,14 +61,14 @@ public: void print(ostream & os, unsigned upper_precedence=0) const; bool info(unsigned inf) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned calchash(void) const; - ex subs(lst const & ls, lst const & lr) const; + ex subs(const lst & ls, const lst & lr) const; // new virtual functions which can be overridden by derived classes public: - virtual bool is_co_contra_pair(basic const & other) const; + virtual bool is_co_contra_pair(const basic & other) const; virtual ex toggle_covariant(void) const; // non-virtual functions in this class @@ -76,7 +76,7 @@ public: bool is_symbolic(void) const; unsigned get_value(void) const; bool is_covariant(void) const; - void setname(string const & n) {name=n;} + void setname(const string & n) {name=n;} string getname(void) const {return name;} // member variables @@ -92,7 +92,7 @@ protected: // global constants extern const idx some_idx; -extern type_info const & typeid_idx; +extern const type_info & typeid_idx; // utility functions inline const idx &ex_to_idx(const ex &e) @@ -105,13 +105,13 @@ inline const idx &ex_to_idx(const ex &e) // typedef vector exvector; int canonicalize_indices(exvector & iv, bool antisymmetric=false); -exvector idx_intersect(exvector const & iv1, exvector const & iv2); -ex permute_free_index_to_front(exvector const & iv3, exvector const & iv2, +exvector idx_intersect(const exvector & iv1, const exvector & iv2); +ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2, bool antisymmetric, int * sig); -unsigned subs_index_in_exvector(exvector & v, ex const & is, ex const & ir); -ex subs_indices(ex const & e, exvector const & idxv_contra, - exvector const & idxv_co); -unsigned count_index(ex const & e, ex const & i); +unsigned subs_index_in_exvector(exvector & v, const ex & is, const ex & ir); +ex subs_indices(const ex & e, const exvector & idxv_contra, + const exvector & idxv_co); +unsigned count_index(const ex & e, const ex & i); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index 4eeb2db1..7fe0a7e9 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -51,13 +51,13 @@ indexed::~indexed() destroy(0); } -indexed::indexed(indexed const & other) +indexed::indexed(const indexed & other) { debugmsg("indexed copy constructor",LOGLEVEL_CONSTRUCT); copy (other); } -indexed const & indexed::operator=(indexed const & other) +const indexed & indexed::operator=(const indexed & other) { debugmsg("indexed operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -69,7 +69,7 @@ indexed const & indexed::operator=(indexed const & other) // protected -void indexed::copy(indexed const & other) +void indexed::copy(const indexed & other) { inherited::copy(other); } @@ -87,21 +87,21 @@ void indexed::destroy(bool call_parent) // public -indexed::indexed(ex const & i1) : inherited(i1) +indexed::indexed(const ex & i1) : inherited(i1) { debugmsg("indexed constructor from ex",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_indexed; GINAC_ASSERT(all_of_type_idx()); } -indexed::indexed(ex const & i1, ex const & i2) : inherited(i1,i2) +indexed::indexed(const ex & i1, const ex & i2) : inherited(i1,i2) { debugmsg("indexed constructor from ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_indexed; GINAC_ASSERT(all_of_type_idx()); } -indexed::indexed(ex const & i1, ex const & i2, ex const & i3) +indexed::indexed(const ex & i1, const ex & i2, const ex & i3) : inherited(i1,i2,i3) { debugmsg("indexed constructor from ex,ex,ex",LOGLEVEL_CONSTRUCT); @@ -109,7 +109,7 @@ indexed::indexed(ex const & i1, ex const & i2, ex const & i3) GINAC_ASSERT(all_of_type_idx()); } -indexed::indexed(ex const & i1, ex const & i2, ex const & i3, ex const & i4) +indexed::indexed(const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(i1,i2,i3,i4) { debugmsg("indexed constructor from ex,ex,ex,ex",LOGLEVEL_CONSTRUCT); @@ -117,7 +117,7 @@ indexed::indexed(ex const & i1, ex const & i2, ex const & i3, ex const & i4) GINAC_ASSERT(all_of_type_idx()); } -indexed::indexed(exvector const & iv) : inherited(iv) +indexed::indexed(const exvector & iv) : inherited(iv) { debugmsg("indexed constructor from exvector",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_indexed; @@ -220,13 +220,13 @@ exvector indexed::get_indices(void) const // protected -int indexed::compare_same_type(basic const & other) const +int indexed::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,indexed)); return inherited::compare_same_type(other); } -bool indexed::is_equal_same_type(basic const & other) const +bool indexed::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,indexed)); return inherited::is_equal_same_type(other); @@ -242,7 +242,7 @@ unsigned indexed::return_type_tinfo(void) const return tinfo_key; } -ex indexed::thisexprseq(exvector const & v) const +ex indexed::thisexprseq(const exvector & v) const { return indexed(v); } @@ -324,7 +324,7 @@ bool indexed::all_of_type_idx(void) const ////////// const indexed some_indexed; -type_info const & typeid_indexed=typeid(some_indexed); +const type_info & typeid_indexed=typeid(some_indexed); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/indexed.h b/ginac/indexed.h index ce416ff9..5b5856e5 100644 --- a/ginac/indexed.h +++ b/ginac/indexed.h @@ -41,19 +41,19 @@ class indexed : public exprseq public: indexed(); ~indexed(); - indexed(indexed const & other); - indexed const & operator=(indexed const & other); + indexed(const indexed & other); + const indexed & operator=(const indexed & other); protected: - void copy(indexed const & other); + void copy(const indexed & other); void destroy(bool call_parent); // other constructors public: - indexed(ex const & i1); - indexed(ex const & i1, ex const & i2); - indexed(ex const & i1, ex const & i2, ex const & i3); - indexed(ex const & i1, ex const & i2, ex const & i3, ex const & i4); - indexed(exvector const & iv); + indexed(const ex & i1); + indexed(const ex & i1, const ex & i2); + indexed(const ex & i1, const ex & i2, const ex & i3); + indexed(const ex & i1, const ex & i2, const ex & i3, const ex & i4); + indexed(const exvector & iv); indexed(exvector * iv); // functions overriding virtual functions from base classes @@ -64,14 +64,14 @@ public: void print(ostream & os, unsigned upper_precedence=0) const; void printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const; bool info(unsigned inf) const; - ex diff(symbol const & s) const; + ex diff(const symbol & s) const; exvector get_indices(void) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; - ex thisexprseq(exvector const & v) const; + ex thisexprseq(const exvector & v) const; ex thisexprseq(exvector * vp) const; // new virtual functions which can be overridden by derived classes @@ -91,7 +91,7 @@ protected: // global constants extern const indexed some_indexed; -extern type_info const & typeid_indexed; +extern const type_info & typeid_indexed; // utility functions inline const indexed &ex_to_indexed(const ex &e) diff --git a/ginac/inifcns.cpp b/ginac/inifcns.cpp index c99e3581..9c5019df 100644 --- a/ginac/inifcns.cpp +++ b/ginac/inifcns.cpp @@ -45,7 +45,7 @@ namespace GiNaC { // absolute value ////////// -static ex abs_evalf(ex const & x) +static ex abs_evalf(const ex & x) { BEGIN_TYPECHECK TYPECHECK(x,numeric) @@ -54,7 +54,7 @@ static ex abs_evalf(ex const & x) return abs(ex_to_numeric(x)); } -static ex abs_eval(ex const & x) +static ex abs_eval(const ex & x) { if (is_ex_exactly_of_type(x, numeric)) return abs(ex_to_numeric(x)); @@ -68,7 +68,7 @@ REGISTER_FUNCTION(abs, abs_eval, abs_evalf, NULL, NULL); // dilogarithm ////////// -static ex Li2_eval(ex const & x) +static ex Li2_eval(const ex & x) { if (x.is_zero()) return x; @@ -85,7 +85,7 @@ REGISTER_FUNCTION(Li2, Li2_eval, NULL, NULL, NULL); // trilogarithm ////////// -static ex Li3_eval(ex const & x) +static ex Li3_eval(const ex & x) { if (x.is_zero()) return x; @@ -98,12 +98,12 @@ REGISTER_FUNCTION(Li3, Li3_eval, NULL, NULL, NULL); // factorial ////////// -static ex factorial_evalf(ex const & x) +static ex factorial_evalf(const ex & x) { return factorial(x).hold(); } -static ex factorial_eval(ex const & x) +static ex factorial_eval(const ex & x) { if (is_ex_exactly_of_type(x, numeric)) return factorial(ex_to_numeric(x)); @@ -117,12 +117,12 @@ REGISTER_FUNCTION(factorial, factorial_eval, factorial_evalf, NULL, NULL); // binomial ////////// -static ex binomial_evalf(ex const & x, ex const & y) +static ex binomial_evalf(const ex & x, const ex & y) { return binomial(x, y).hold(); } -static ex binomial_eval(ex const & x, ex const &y) +static ex binomial_eval(const ex & x, const ex &y) { if (is_ex_exactly_of_type(x, numeric) && is_ex_exactly_of_type(y, numeric)) return binomial(ex_to_numeric(x), ex_to_numeric(y)); @@ -136,7 +136,7 @@ REGISTER_FUNCTION(binomial, binomial_eval, binomial_evalf, NULL, NULL); // Order term function (for truncated power series) ////////// -static ex Order_eval(ex const & x) +static ex Order_eval(const ex & x) { if (is_ex_exactly_of_type(x, numeric)) { @@ -155,7 +155,7 @@ static ex Order_eval(ex const & x) return Order(x).hold(); } -static ex Order_series(ex const & x, symbol const & s, ex const & point, int order) +static ex Order_series(const ex & x, const symbol & s, const ex & point, int order) { // Just wrap the function into a pseries object epvector new_seq; @@ -169,7 +169,7 @@ REGISTER_FUNCTION(Order, Order_eval, NULL, NULL, Order_series); // Solve linear system ////////// -ex lsolve(ex const &eqns, ex const &symbols) +ex lsolve(const ex &eqns, const ex &symbols) { // solve a system of linear equations if (eqns.info(info_flags::relation_equal)) { @@ -234,7 +234,7 @@ ex lsolve(ex const &eqns, ex const &symbols) matrix solution; try { solution=sys.fraction_free_elim(vars,rhs); - } catch (runtime_error const & e) { + } catch (const runtime_error & e) { // probably singular matrix (or other error) // return empty solution list // cerr << e.what() << endl; @@ -261,7 +261,7 @@ ex lsolve(ex const &eqns, ex const &symbols) } /** non-commutative power. */ -ex ncpower(ex const &basis, unsigned exponent) +ex ncpower(const ex &basis, unsigned exponent) { if (exponent==0) { return _ex1(); diff --git a/ginac/inifcns.h b/ginac/inifcns.h index 644492d8..dfaea514 100644 --- a/ginac/inifcns.h +++ b/ginac/inifcns.h @@ -87,12 +87,12 @@ DECLARE_FUNCTION_1P(Li3) // overloading at work: we cannot use the macros /** Riemann's Zeta-function. */ extern const unsigned function_index_zeta1; -inline function zeta(ex const & p1) { +inline function zeta(const ex & p1) { return function(function_index_zeta1, p1); } /** Derivatives of Riemann's Zeta-function. */ extern const unsigned function_index_zeta2; -inline function zeta(ex const & p1, ex const & p2) { +inline function zeta(const ex & p1, const ex & p2) { return function(function_index_zeta2, p1, p2); } @@ -105,12 +105,12 @@ DECLARE_FUNCTION_2P(beta) // overloading at work: we cannot use the macros /** Psi-function (aka digamma-function). */ extern const unsigned function_index_psi1; -inline function psi(ex const & p1) { +inline function psi(const ex & p1) { return function(function_index_psi1, p1); } /** Derivatives of Psi-function (aka polygamma-functions). */ extern const unsigned function_index_psi2; -inline function psi(ex const & p1, ex const & p2) { +inline function psi(const ex & p1, const ex & p2) { return function(function_index_psi2, p1, p2); } @@ -123,11 +123,11 @@ DECLARE_FUNCTION_2P(binomial) /** Order term function (for truncated power series). */ DECLARE_FUNCTION_1P(Order) -ex lsolve(ex const &eqns, ex const &symbols); +ex lsolve(const ex &eqns, const ex &symbols); -ex ncpower(ex const &basis, unsigned exponent); +ex ncpower(const ex &basis, unsigned exponent); -inline bool is_order_function(ex const & e) +inline bool is_order_function(const ex & e) { return is_ex_the_function(e, Order); } diff --git a/ginac/isospin.cpp b/ginac/isospin.cpp index e5ac27b3..a5b5912e 100644 --- a/ginac/isospin.cpp +++ b/ginac/isospin.cpp @@ -53,13 +53,13 @@ isospin::~isospin() destroy(0); } -isospin::isospin(isospin const & other) +isospin::isospin(const isospin & other) { debugmsg("isospin copy constructor",LOGLEVEL_CONSTRUCT); copy (other); } -isospin const & isospin::operator=(isospin const & other) +const isospin & isospin::operator=(const isospin & other) { debugmsg("isospin operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -71,7 +71,7 @@ isospin const & isospin::operator=(isospin const & other) // protected -void isospin::copy(isospin const & other) +void isospin::copy(const isospin & other) { indexed::copy(other); name=other.name; @@ -91,7 +91,7 @@ void isospin::destroy(bool call_parent) // public -isospin::isospin(string const & initname) +isospin::isospin(const string & initname) { debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT); name=initname; @@ -151,7 +151,7 @@ bool isospin::info(unsigned inf) const // protected -int isospin::compare_same_type(basic const & other) const +int isospin::compare_same_type(const basic & other) const { GINAC_ASSERT(other.tinfo() == TINFO_isospin); const isospin *o = static_cast(&other); @@ -161,7 +161,7 @@ int isospin::compare_same_type(basic const & other) const return serial < o->serial ? -1 : 1; } -ex isospin::simplify_ncmul(exvector const & v) const +ex isospin::simplify_ncmul(const exvector & v) const { return simplified_ncmul(v); } @@ -185,7 +185,7 @@ unsigned isospin::calchash(void) const // non-virtual functions in this class ////////// -void isospin::setname(string const & n) +void isospin::setname(const string & n) { name=n; } @@ -211,7 +211,7 @@ unsigned isospin::next_serial=0; ////////// const isospin some_isospin; -type_info const & typeid_isospin=typeid(some_isospin); +const type_info & typeid_isospin=typeid(some_isospin); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/isospin.h b/ginac/isospin.h index 180aa56e..0318360f 100644 --- a/ginac/isospin.h +++ b/ginac/isospin.h @@ -39,15 +39,15 @@ class isospin : public indexed public: isospin(); ~isospin(); - isospin(isospin const & other); - isospin const & operator=(isospin const & other); + isospin(const isospin & other); + const isospin & operator=(const isospin & other); protected: - void copy(isospin const & other); + void copy(const isospin & other); void destroy(bool call_parent); // other constructors public: - explicit isospin(string const & initname); + explicit isospin(const string & initname); // functions overriding virtual functions from base classes public: @@ -58,8 +58,8 @@ public: void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; bool info(unsigned inf) const; protected: - int compare_same_type(basic const & other) const; - ex simplify_ncmul(exvector const & v) const; + int compare_same_type(const basic & other) const; + ex simplify_ncmul(const exvector & v) const; unsigned calchash(void) const; // new virtual functions which can be overridden by derived classes @@ -67,7 +67,7 @@ protected: // non-virtual functions in this class public: - void setname(string const & n); + void setname(const string & n); private: string & autoname_prefix(void); @@ -83,7 +83,7 @@ private: // global constants extern const isospin some_isospin; -extern type_info const & typeid_isospin; +extern const type_info & typeid_isospin; // utility functions inline const isospin &ex_to_isospin(const ex &e) diff --git a/ginac/lorentzidx.cpp b/ginac/lorentzidx.cpp index 56b4358c..e8dacf73 100644 --- a/ginac/lorentzidx.cpp +++ b/ginac/lorentzidx.cpp @@ -50,13 +50,13 @@ lorentzidx::~lorentzidx() destroy(0); } -lorentzidx::lorentzidx(lorentzidx const & other) +lorentzidx::lorentzidx(const lorentzidx & other) { debugmsg("lorentzidx copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -lorentzidx const & lorentzidx::operator=(lorentzidx const & other) +const lorentzidx & lorentzidx::operator=(const lorentzidx & other) { debugmsg("lorentzidx operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -68,7 +68,7 @@ lorentzidx const & lorentzidx::operator=(lorentzidx const & other) // protected -void lorentzidx::copy(lorentzidx const & other) +void lorentzidx::copy(const lorentzidx & other) { idx::copy(other); orthogonal_only=other.orthogonal_only; @@ -99,7 +99,7 @@ lorentzidx::lorentzidx(bool cov, bool oonly, unsigned dimp) : tinfo_key=TINFO_lorentzidx; } -lorentzidx::lorentzidx(string const & n, bool cov, bool oonly, unsigned dimp) +lorentzidx::lorentzidx(const string & n, bool cov, bool oonly, unsigned dimp) : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp) { debugmsg("lorentzidx constructor from string,bool,bool,unsigned", @@ -107,7 +107,7 @@ lorentzidx::lorentzidx(string const & n, bool cov, bool oonly, unsigned dimp) tinfo_key=TINFO_lorentzidx; } -lorentzidx::lorentzidx(char const * n, bool cov, bool oonly, unsigned dimp) +lorentzidx::lorentzidx(const char * n, bool cov, bool oonly, unsigned dimp) : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp) { debugmsg("lorentzidx constructor from char*,bool,bool,unsigned", @@ -115,7 +115,7 @@ lorentzidx::lorentzidx(char const * n, bool cov, bool oonly, unsigned dimp) tinfo_key=TINFO_lorentzidx; } -lorentzidx::lorentzidx(unsigned const v, bool cov) : idx(v,cov), +lorentzidx::lorentzidx(unsigned v, bool cov) : idx(v,cov), orthogonal_only(false), dim_parallel_space(0) { debugmsg("lorentzidx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); @@ -251,7 +251,7 @@ lorentzidx lorentzidx::create_anonymous_representative(void) const ////////// const lorentzidx some_lorentzidx; -type_info const & typeid_lorentzidx=typeid(some_lorentzidx); +const type_info & typeid_lorentzidx=typeid(some_lorentzidx); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/lorentzidx.h b/ginac/lorentzidx.h index b2315527..c5eade73 100644 --- a/ginac/lorentzidx.h +++ b/ginac/lorentzidx.h @@ -42,20 +42,20 @@ class lorentzidx : public idx public: lorentzidx(); ~lorentzidx(); - lorentzidx (lorentzidx const & other); - lorentzidx const & operator=(lorentzidx const & other); + lorentzidx (const lorentzidx & other); + const lorentzidx & operator=(const lorentzidx & other); protected: - void copy(lorentzidx const & other); + void copy(const lorentzidx & other); void destroy(bool call_parent); // other constructors public: explicit lorentzidx(bool cov, bool oonly=false, unsigned dimp=0); - explicit lorentzidx(string const & n, bool cov=false, + explicit lorentzidx(const string & n, bool cov=false, bool oonly=false, unsigned dimp=0); - explicit lorentzidx(char const * n, bool cov=false, + explicit lorentzidx(const char * n, bool cov=false, bool oonly=false, unsigned dimp=0); - explicit lorentzidx(unsigned const v, bool cov=false); + explicit lorentzidx(unsigned v, bool cov=false); // functions overriding virtual functions from bases classes public: @@ -83,7 +83,7 @@ protected: // global constants extern const lorentzidx some_lorentzidx; -extern type_info const & typeid_lorentzidx; +extern const type_info & typeid_lorentzidx; // utility functions inline const lorentzidx &ex_to_lorentzidx(const ex &e) diff --git a/ginac/lortensor.cpp b/ginac/lortensor.cpp index 1cbbf917..657d10b6 100644 --- a/ginac/lortensor.cpp +++ b/ginac/lortensor.cpp @@ -65,13 +65,13 @@ lortensor::~lortensor() destroy(0); } -lortensor::lortensor(lortensor const & other) +lortensor::lortensor(const lortensor & other) { debugmsg("lortensor copy constructor",LOGLEVEL_CONSTRUCT); copy (other); } -lortensor const & lortensor::operator=(lortensor const & other) +const lortensor & lortensor::operator=(const lortensor & other) { debugmsg("lortensor operator=",LOGLEVEL_ASSIGNMENT); if (this != & other) { @@ -83,7 +83,7 @@ lortensor const & lortensor::operator=(lortensor const & other) //protected -void lortensor::copy(lortensor const & other) +void lortensor::copy(const lortensor & other) { indexed::copy(other); type=other.type; @@ -104,14 +104,14 @@ void lortensor::destroy(bool call_parent) // protected -lortensor::lortensor(lortensor_types const lt, string const & n) : type(lt), name(n) +lortensor::lortensor(lortensor_types const lt, const string & n) : type(lt), name(n) { debugmsg("lortensor constructor from lortensor_types,string",LOGLEVEL_CONSTRUCT); serial=next_serial++; tinfo_key=TINFO_lortensor; } -lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu) : indexed(mu), type(lt), name(n) +lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu) : indexed(mu), type(lt), name(n) { debugmsg("lortensor constructor from lortensor_types,string,ex",LOGLEVEL_CONSTRUCT); serial=next_serial++; @@ -119,7 +119,7 @@ lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu) tinfo_key=TINFO_lortensor; } -lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu, ex const & nu) : indexed(mu,nu), type(lt), name(n) +lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu) : indexed(mu,nu), type(lt), name(n) { debugmsg("lortensor constructor from lortensor_types,string,ex,ex",LOGLEVEL_CONSTRUCT); serial=next_serial++; @@ -127,7 +127,7 @@ lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu, tinfo_key=TINFO_lortensor; } -lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu, ex const & nu, ex const & rho) : indexed(mu,nu,rho), type(lt), name(n) +lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu, const ex & rho) : indexed(mu,nu,rho), type(lt), name(n) { debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex",LOGLEVEL_CONSTRUCT); serial=next_serial++; @@ -135,7 +135,7 @@ lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu, tinfo_key=TINFO_lortensor; } -lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu, ex const & nu, ex const & rho, ex const & sigma) : indexed(mu,nu,rho,sigma), type(lt), name(n) +lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma) : indexed(mu,nu,rho,sigma), type(lt), name(n) { debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex,ex",LOGLEVEL_CONSTRUCT); serial=next_serial++; @@ -143,7 +143,7 @@ lortensor::lortensor(lortensor_types const lt, string const & n, ex const & mu, tinfo_key=TINFO_lortensor; } -lortensor::lortensor(lortensor_types const lt, string const & n, exvector const & iv) : indexed(iv), type(lt), name(n) +lortensor::lortensor(lortensor_types const lt, const string & n, const exvector & iv) : indexed(iv), type(lt), name(n) { debugmsg("lortensor constructor from lortensor_types,string,exvector",LOGLEVEL_CONSTRUCT); serial=next_serial++; @@ -151,14 +151,14 @@ lortensor::lortensor(lortensor_types const lt, string const & n, exvector const tinfo_key=TINFO_lortensor; } -lortensor::lortensor(lortensor_types const lt, string const & n, unsigned s, exvector const & iv) : indexed(iv), type(lt), name(n), serial(s) +lortensor::lortensor(lortensor_types const lt, const string & n, unsigned s, const exvector & iv) : indexed(iv), type(lt), name(n), serial(s) { debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(all_of_type_lorentzidx()); tinfo_key=TINFO_lortensor; } -lortensor::lortensor(lortensor_types const lt, string const & n, unsigned s, exvector *ivp) : indexed(ivp), type(lt), name(n), serial(s) +lortensor::lortensor(lortensor_types const lt, const string & n, unsigned s, exvector *ivp) : indexed(ivp), type(lt), name(n), serial(s) { debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(all_of_type_lorentzidx()); @@ -246,8 +246,8 @@ ex lortensor::eval(int level) const //something has changed while sorting indices, more evaluations later return ex(sig) *lortensor(type,name,iv); } - lorentzidx const & idx1=ex_to_lorentzidx(seq[0]); - lorentzidx const & idx2=ex_to_lorentzidx(seq[1]); + const lorentzidx & idx1=ex_to_lorentzidx(seq[0]); + const lorentzidx & idx2=ex_to_lorentzidx(seq[1]); if ((!idx1.is_symbolic()) && (!idx2.is_symbolic())) { //both indices are numeric if ((idx1.get_value()==idx2.get_value())) { @@ -277,7 +277,7 @@ ex lortensor::eval(int level) const //protected -int lortensor::compare_same_type(basic const & other) const +int lortensor::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,lortensor)); const lortensor *o = static_cast (&other); @@ -292,7 +292,7 @@ int lortensor::compare_same_type(basic const & other) const return type < o->type ? -1 : 1; } -bool lortensor::is_equal_same_type(basic const & other) const +bool lortensor::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,lortensor)); const lortensor *o=static_cast (&other); @@ -311,7 +311,7 @@ unsigned lortensor::return_type_tinfo(void) const { return tinfo_key; } -ex lortensor::thisexprseq(exvector const & v) const +ex lortensor::thisexprseq(const exvector & v) const { return lortensor(type,name,serial,v); } @@ -326,7 +326,7 @@ ex lortensor::thisexprseq(exvector *vp) const // protected -void lortensor::setname(string const & n) +void lortensor::setname(const string & n) { name=n; } @@ -361,27 +361,27 @@ unsigned lortensor::next_serial=0; // friend functions ////////// -lortensor lortensor_g(ex const & mu, ex const & nu) +lortensor lortensor_g(const ex & mu, const ex & nu) { return lortensor(lortensor::lortensor_g,"",mu,nu); } -lortensor lortensor_epsilon(ex const & mu, ex const & nu, ex const & rho, ex const & sigma) +lortensor lortensor_epsilon(const ex & mu, const ex & nu, const ex & rho, const ex & sigma) { return lortensor(lortensor::lortensor_epsilon,"",mu,nu,rho,sigma); } -lortensor lortensor_rank1(string const & n, ex const & mu) +lortensor lortensor_rank1(const string & n, const ex & mu) { return lortensor(lortensor::lortensor_rank1,n,mu); } -lortensor lortensor_rank2(string const & n, ex const & mu, ex const & nu) +lortensor lortensor_rank2(const string & n, const ex & mu, const ex & nu) { return lortensor(lortensor::lortensor_rank2,n,mu,nu); } -ex simplify_lortensor_mul(ex const & m) +ex simplify_lortensor_mul(const ex & m) { GINAC_ASSERT(is_ex_exactly_of_type(m,mul)); exvector v_contracted; @@ -407,10 +407,10 @@ ex simplify_lortensor_mul(ex const & m) // process only lor_g objects if (is_ex_exactly_of_type(*it,lortensor) && (ex_to_lortensor(*it).type==lortensor::lortensor_g)) { - lortensor const & g=ex_to_lortensor(*it); + const lortensor & g=ex_to_lortensor(*it); GINAC_ASSERT(g.seq.size()==2); - idx const & first_idx=ex_to_lorentzidx(g.seq[0]); - idx const & second_idx=ex_to_lorentzidx(g.seq[1]); + const idx & first_idx=ex_to_lorentzidx(g.seq[0]); + const idx & second_idx=ex_to_lorentzidx(g.seq[1]); // g_{mu,mu} should have been contracted in lortensor::eval() GINAC_ASSERT(!first_idx.is_equal(second_idx)); ex saved_g=*it; // save to restore it later @@ -455,7 +455,7 @@ ex simplify_lortensor_mul(ex const & m) return m; } -ex simplify_lortensor(ex const & e) +ex simplify_lortensor(const ex & e) { // all simplification is done on expanded objects ex e_expanded=e.expand(); diff --git a/ginac/lortensor.h b/ginac/lortensor.h index 617770c0..e3cb75d0 100644 --- a/ginac/lortensor.h +++ b/ginac/lortensor.h @@ -38,15 +38,15 @@ namespace GiNaC { class lortensor : public indexed { // friends - friend lortensor lortensor_g(ex const & mu, ex const & nu); - // friend lortensor lortensor_delta(ex const & mu, ex const & nu); - friend lortensor lortensor_epsilon(ex const & mu, ex const & nu, - ex const & rho, ex const & sigma); - friend lortensor lortensor_rankn(string const & n, exvector const & iv); - friend lortensor lortensor_rank1(string const & n, ex const & mu); - friend lortensor lortensor_rank2(string const & n, ex const & mu, ex const & nu); - friend ex simplify_lortensor_mul(ex const & m); - friend ex simplify_lortensor(ex const & e); + friend lortensor lortensor_g(const ex & mu, const ex & nu); + // friend lortensor lortensor_delta(const ex & mu, const ex & nu); + friend lortensor lortensor_epsilon(const ex & mu, const ex & nu, + const ex & rho, const ex & sigma); + friend lortensor lortensor_rankn(const string & n, const exvector & iv); + friend lortensor lortensor_rank1(const string & n, const ex & mu); + friend lortensor lortensor_rank2(const string & n, const ex & mu, const ex & nu); + friend ex simplify_lortensor_mul(const ex & m); + friend ex simplify_lortensor(const ex & e); // types @@ -66,23 +66,23 @@ public: public: lortensor(); ~lortensor(); - lortensor(lortensor const & other); - lortensor const & operator=(lortensor const & other); + lortensor(const lortensor & other); + const lortensor & operator=(const lortensor & other); protected: - void copy(lortensor const & other); + void copy(const lortensor & other); void destroy(bool call_parent); // other constructors protected: - lortensor(lortensor_types const lt, string const & n); - lortensor(lortensor_types const lt, string const & n, ex const & mu); - lortensor(lortensor_types const lt, string const & n, ex const & mu, ex const & nu); - lortensor(lortensor_types const lt, string const & n, ex const & mu, ex const & nu, - ex const & rho); - lortensor(lortensor_types const lt, string const & n, ex const & mu, ex const & nu, ex const & rho, ex const & sigma); - lortensor(lortensor_types const lt, string const & n, exvector const & iv); - lortensor(lortensor_types const lt, string const & n, unsigned s, exvector const & iv); - lortensor(lortensor_types const lt, string const & n, unsigned s, exvector * ivp); + lortensor(lortensor_types const lt, const string & n); + lortensor(lortensor_types const lt, const string & n, const ex & mu); + lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu); + lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu, + const ex & rho); + lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma); + lortensor(lortensor_types const lt, const string & n, const exvector & iv); + lortensor(lortensor_types const lt, const string & n, unsigned s, const exvector & iv); + lortensor(lortensor_types const lt, const string & n, unsigned s, exvector * ivp); //functions overriding virtual functions from base classes public: @@ -94,11 +94,11 @@ public: bool info(unsigned inf) const; ex eval(int level=0) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; - ex thisexprseq(exvector const & v) const; + ex thisexprseq(const exvector & v) const; ex thisexprseq(exvector * vp) const; // new virtual functions which can be overridden by derived classes @@ -106,7 +106,7 @@ protected: //non virtual functions in this class public: - void setname(string const & n); + void setname(const string & n); string getname(void) const {return name;} protected: bool all_of_type_lorentzidx(void) const; @@ -126,7 +126,7 @@ private: // global constants extern const lortensor some_lortensor; - extern type_info const & typeid_lortensor; + extern const type_info & typeid_lortensor; // utility functions @@ -140,9 +140,9 @@ inline lortensor &ex_to_nonconst_lortensor(const ex &e) return static_cast(*e.bp); } -lortensor lortensor_g(ex const & mu, ex const & nu); -ex simplify_lortensor_mul(ex const & m); -ex simplify_lortensor(ex const & e); +lortensor lortensor_g(const ex & mu, const ex & nu); +ex simplify_lortensor_mul(const ex & m); +ex simplify_lortensor(const ex & e); ex Dim(void); #ifndef NO_GINAC_NAMESPACE diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index 0ed64ef6..4a55ef1f 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -54,13 +54,13 @@ matrix::~matrix() debugmsg("matrix destructor",LOGLEVEL_DESTRUCT); } -matrix::matrix(matrix const & other) +matrix::matrix(const matrix & other) { debugmsg("matrix copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -matrix const & matrix::operator=(matrix const & other) +const matrix & matrix::operator=(const matrix & other) { debugmsg("matrix operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -72,7 +72,7 @@ matrix const & matrix::operator=(matrix const & other) // protected -void matrix::copy(matrix const & other) +void matrix::copy(const matrix & other) { inherited::copy(other); row=other.row; @@ -105,7 +105,7 @@ matrix::matrix(unsigned r, unsigned c) // protected /** Ctor from representation, for internal use only. */ -matrix::matrix(unsigned r, unsigned c, exvector const & m2) +matrix::matrix(unsigned r, unsigned c, const exvector & m2) : inherited(TINFO_matrix), row(r), col(c), m(m2) { debugmsg("matrix constructor from unsigned,unsigned,exvector",LOGLEVEL_CONSTRUCT); @@ -205,7 +205,7 @@ unsigned matrix::nops() const } /** returns matrix entry at position (i/col, i%col). */ -ex & matrix::let_op(int const i) +ex & matrix::let_op(int i) { return m[i]; } @@ -222,7 +222,7 @@ ex matrix::expand(unsigned options) const /** Search ocurrences. A matrix 'has' an expression if it is the expression * itself or one of the elements 'has' it. */ -bool matrix::has(ex const & other) const +bool matrix::has(const ex & other) const { GINAC_ASSERT(other.bp!=0); @@ -292,10 +292,10 @@ ex matrix::evalf(int level) const // protected -int matrix::compare_same_type(basic const & other) const +int matrix::compare_same_type(const basic & other) const { GINAC_ASSERT(is_exactly_of_type(other, matrix)); - matrix const & o=static_cast(const_cast(other)); + const matrix & o=static_cast(const_cast(other)); // compare number of rows if (row != o.rows()) { @@ -328,7 +328,7 @@ int matrix::compare_same_type(basic const & other) const /** Sum of matrices. * * @exception logic_error (incompatible matrices) */ -matrix matrix::add(matrix const & other) const +matrix matrix::add(const matrix & other) const { if (col != other.col || row != other.row) { throw (std::logic_error("matrix::add(): incompatible matrices")); @@ -348,7 +348,7 @@ matrix matrix::add(matrix const & other) const /** Difference of matrices. * * @exception logic_error (incompatible matrices) */ -matrix matrix::sub(matrix const & other) const +matrix matrix::sub(const matrix & other) const { if (col != other.col || row != other.row) { throw (std::logic_error("matrix::sub(): incompatible matrices")); @@ -368,7 +368,7 @@ matrix matrix::sub(matrix const & other) const /** Product of matrices. * * @exception logic_error (incompatible matrices) */ -matrix matrix::mul(matrix const & other) const +matrix matrix::mul(const matrix & other) const { if (col != other.row) { throw (std::logic_error("matrix::mul(): incompatible matrices")); @@ -390,7 +390,7 @@ matrix matrix::mul(matrix const & other) const * @param ro row of element * @param co column of element * @exception range_error (index out of range) */ -ex const & matrix::operator() (unsigned ro, unsigned co) const +const ex & matrix::operator() (unsigned ro, unsigned co) const { if (ro<0 || ro>=row || co<0 || co>=col) { throw (std::range_error("matrix::operator(): index out of range")); @@ -625,7 +625,7 @@ ex matrix::trace(void) const * @return characteristic polynomial as new expression * @exception logic_error (matrix not square) * @see matrix::determinant() */ -ex matrix::charpoly(ex const & lambda) const +ex matrix::charpoly(const ex & lambda) const { if (row != col) { throw (std::logic_error("matrix::charpoly(): matrix not square")); @@ -711,8 +711,8 @@ ex matrix::ffe_get(unsigned r, unsigned c) const * @param rhs m x p matrix * @exception logic_error (incompatible matrices) * @exception runtime_error (singular matrix) */ -matrix matrix::fraction_free_elim(matrix const & vars, - matrix const & rhs) const +matrix matrix::fraction_free_elim(const matrix & vars, + const matrix & rhs) const { if ((row != rhs.row) || (col != vars.row) || (rhs.col != vars.col)) { throw (std::logic_error("matrix::solve(): incompatible matrices")); @@ -871,7 +871,7 @@ matrix matrix::fraction_free_elim(matrix const & vars, } /** Solve simultaneous set of equations. */ -matrix matrix::solve(matrix const & v) const +matrix matrix::solve(const matrix & v) const { if (!(row == col && col == v.row)) { throw (std::logic_error("matrix::solve(): incompatible matrices")); @@ -951,7 +951,7 @@ int matrix::pivot(unsigned ro) ////////// const matrix some_matrix; -type_info const & typeid_matrix=typeid(some_matrix); +const type_info & typeid_matrix=typeid(some_matrix); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/matrix.h b/ginac/matrix.h index 3780122f..1b454a78 100644 --- a/ginac/matrix.h +++ b/ginac/matrix.h @@ -48,16 +48,16 @@ class matrix : public basic public: matrix(); ~matrix(); - matrix(matrix const & other); - matrix const & operator=(matrix const & other); + matrix(const matrix & other); + const matrix & operator=(const matrix & other); protected: - void copy(matrix const & other); + void copy(const matrix & other); void destroy(bool call_parent); // other constructors public: matrix(unsigned r, unsigned c); - matrix(unsigned r, unsigned c, exvector const & m2); + matrix(unsigned r, unsigned c, const exvector & m2); // functions overriding virtual functions from bases classes public: @@ -65,14 +65,14 @@ public: void print(ostream & os, unsigned upper_precedence=0) const; void printraw(ostream & os) const; unsigned nops() const; - ex & let_op(int const i); + ex & let_op(int i); ex expand(unsigned options=0) const; - bool has(ex const & other) const; + bool has(const ex & other) const; ex eval(int level=0) const; ex evalf(int level=0) const; - // ex subs(lst const & ls, lst const & lr) const; + // ex subs(const lst & ls, const lst & lr) const; protected: - int compare_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; unsigned return_type(void) const { return return_types::noncommutative; }; // new virtual functions which can be overridden by derived classes // (none) @@ -83,18 +83,18 @@ public: { return row; } unsigned cols() const //! get number of columns. { return col; } - matrix add(matrix const & other) const; - matrix sub(matrix const & other) const; - matrix mul(matrix const & other) const; - ex const & operator() (unsigned ro, unsigned co) const; + matrix add(const matrix & other) const; + matrix sub(const matrix & other) const; + matrix mul(const matrix & other) const; + const ex & operator() (unsigned ro, unsigned co) const; matrix & set(unsigned ro, unsigned co, ex value); matrix transpose(void) const; ex determinant(bool normalized=true) const; ex trace(void) const; - ex charpoly(ex const & lambda) const; + ex charpoly(const ex & lambda) const; matrix inverse(void) const; - matrix fraction_free_elim(matrix const & vars, matrix const & v) const; - matrix solve(matrix const & v) const; + matrix fraction_free_elim(const matrix & vars, const matrix & v) const; + matrix solve(const matrix & v) const; protected: int pivot(unsigned ro); void ffe_swap(unsigned r1, unsigned c1, unsigned r2 ,unsigned c2); @@ -111,44 +111,44 @@ protected: // global constants extern const matrix some_matrix; -extern type_info const & typeid_matrix; +extern const type_info & typeid_matrix; // wrapper functions around member functions -inline unsigned nops(matrix const & m) +inline unsigned nops(const matrix & m) { return m.nops(); } -inline ex expand(matrix const & m, unsigned options=0) +inline ex expand(const matrix & m, unsigned options=0) { return m.expand(options); } -inline bool has(matrix const & m, ex const & other) +inline bool has(const matrix & m, const ex & other) { return m.has(other); } -inline ex eval(matrix const & m, int level=0) +inline ex eval(const matrix & m, int level=0) { return m.eval(level); } -inline ex evalf(matrix const & m, int level=0) +inline ex evalf(const matrix & m, int level=0) { return m.evalf(level); } -inline unsigned rows(matrix const & m) +inline unsigned rows(const matrix & m) { return m.rows(); } -inline unsigned cols(matrix const & m) +inline unsigned cols(const matrix & m) { return m.cols(); } -inline matrix transpose(matrix const & m) +inline matrix transpose(const matrix & m) { return m.transpose(); } -inline ex determinant(matrix const & m, bool normalized=true) +inline ex determinant(const matrix & m, bool normalized=true) { return m.determinant(normalized); } -inline ex trace(matrix const & m) +inline ex trace(const matrix & m) { return m.trace(); } -inline ex charpoly(matrix const & m, ex const & lambda) +inline ex charpoly(const matrix & m, const ex & lambda) { return m.charpoly(lambda); } -inline matrix inverse(matrix const & m) +inline matrix inverse(const matrix & m) { return m.inverse(); } // utility functions diff --git a/ginac/mul.cpp b/ginac/mul.cpp index b269836a..35be3920 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -54,13 +54,13 @@ mul::~mul() destroy(0); } -mul::mul(mul const & other) +mul::mul(const mul & other) { debugmsg("mul copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -mul const & mul::operator=(mul const & other) +const mul & mul::operator=(const mul & other) { debugmsg("mul operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -72,7 +72,7 @@ mul const & mul::operator=(mul const & other) // protected -void mul::copy(mul const & other) +void mul::copy(const mul & other) { inherited::copy(other); } @@ -88,7 +88,7 @@ void mul::destroy(bool call_parent) // public -mul::mul(ex const & lh, ex const & rh) +mul::mul(const ex & lh, const ex & rh) { debugmsg("mul constructor from ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; @@ -97,7 +97,7 @@ mul::mul(ex const & lh, ex const & rh) GINAC_ASSERT(is_canonical()); } -mul::mul(exvector const & v) +mul::mul(const exvector & v) { debugmsg("mul constructor from exvector",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; @@ -107,7 +107,7 @@ mul::mul(exvector const & v) } /* -mul::mul(epvector const & v, bool do_not_canonicalize) +mul::mul(const epvector & v, bool do_not_canonicalize) { debugmsg("mul constructor from epvector,bool",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; @@ -123,7 +123,7 @@ mul::mul(epvector const & v, bool do_not_canonicalize) } */ -mul::mul(epvector const & v) +mul::mul(const epvector & v) { debugmsg("mul constructor from epvector",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; @@ -132,7 +132,7 @@ mul::mul(epvector const & v) GINAC_ASSERT(is_canonical()); } -mul::mul(epvector const & v, ex const & oc) +mul::mul(const epvector & v, const ex & oc) { debugmsg("mul constructor from epvector,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; @@ -141,7 +141,7 @@ mul::mul(epvector const & v, ex const & oc) GINAC_ASSERT(is_canonical()); } -mul::mul(epvector * vp, ex const & oc) +mul::mul(epvector * vp, const ex & oc) { debugmsg("mul constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; @@ -152,7 +152,7 @@ mul::mul(epvector * vp, ex const & oc) GINAC_ASSERT(is_canonical()); } -mul::mul(ex const & lh, ex const & mh, ex const & rh) +mul::mul(const ex & lh, const ex & mh, const ex & rh) { debugmsg("mul constructor from ex,ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; @@ -316,7 +316,7 @@ bool mul::info(unsigned inf) const typedef vector intvector; -int mul::degree(symbol const & s) const +int mul::degree(const symbol & s) const { int deg_sum=0; for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -325,7 +325,7 @@ int mul::degree(symbol const & s) const return deg_sum; } -int mul::ldegree(symbol const & s) const +int mul::ldegree(const symbol & s) const { int deg_sum=0; for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -334,7 +334,7 @@ int mul::ldegree(symbol const & s) const return deg_sum; } -ex mul::coeff(symbol const & s, int const n) const +ex mul::coeff(const symbol & s, int n) const { exvector coeffseq; coeffseq.reserve(seq.size()+1); @@ -425,7 +425,7 @@ ex mul::eval(int level) const is_ex_exactly_of_type((*seq.begin()).rest,add) && ex_to_numeric((*seq.begin()).coeff).is_equal(_num1())) { // *(+(x,y,...);c) -> +(*(x,c),*(y,c),...) (c numeric(), no powers of +()) - add const & addref=ex_to_add((*seq.begin()).rest); + const add & addref=ex_to_add((*seq.begin()).rest); epvector distrseq; distrseq.reserve(addref.seq.size()); for (epvector::const_iterator cit=addref.seq.begin(); cit!=addref.seq.end(); ++cit) { @@ -455,19 +455,19 @@ exvector mul::get_indices(void) const return iv; } -ex mul::simplify_ncmul(exvector const & v) const +ex mul::simplify_ncmul(const exvector & v) const { throw(std::logic_error("mul::simplify_ncmul() should never have been called!")); } // protected -int mul::compare_same_type(basic const & other) const +int mul::compare_same_type(const basic & other) const { return inherited::compare_same_type(other); } -bool mul::is_equal_same_type(basic const & other) const +bool mul::is_equal_same_type(const basic & other) const { return inherited::is_equal_same_type(other); } @@ -519,20 +519,20 @@ unsigned mul::return_type_tinfo(void) const return tinfo_key; } -ex mul::thisexpairseq(epvector const & v, ex const & oc) const +ex mul::thisexpairseq(const epvector & v, const ex & oc) const { return (new mul(v,oc))->setflag(status_flags::dynallocated); } -ex mul::thisexpairseq(epvector * vp, ex const & oc) const +ex mul::thisexpairseq(epvector * vp, const ex & oc) const { return (new mul(vp,oc))->setflag(status_flags::dynallocated); } -expair mul::split_ex_to_pair(ex const & e) const +expair mul::split_ex_to_pair(const ex & e) const { if (is_ex_exactly_of_type(e,power)) { - power const & powerref=ex_to_power(e); + const power & powerref=ex_to_power(e); if (is_ex_exactly_of_type(powerref.exponent,numeric)) { return expair(powerref.basis,powerref.exponent); } @@ -540,8 +540,8 @@ expair mul::split_ex_to_pair(ex const & e) const return expair(e,_ex1()); } -expair mul::combine_ex_with_coeff_to_pair(ex const & e, - ex const & c) const +expair mul::combine_ex_with_coeff_to_pair(const ex & e, + const ex & c) const { // to avoid duplication of power simplification rules, // we create a temporary power object @@ -553,8 +553,8 @@ expair mul::combine_ex_with_coeff_to_pair(ex const & e, return split_ex_to_pair(power(e,c)); } -expair mul::combine_pair_with_coeff_to_pair(expair const & p, - ex const & c) const +expair mul::combine_pair_with_coeff_to_pair(const expair & p, + const ex & c) const { // to avoid duplication of power simplification rules, // we create a temporary power object @@ -566,7 +566,7 @@ expair mul::combine_pair_with_coeff_to_pair(expair const & p, return split_ex_to_pair(power(recombine_pair_to_ex(p),c)); } -ex mul::recombine_pair_to_ex(expair const & p) const +ex mul::recombine_pair_to_ex(const expair & p) const { // if (p.coeff.compare(_ex1())==0) { // if (are_ex_trivially_equal(p.coeff,_ex1())) { @@ -605,14 +605,14 @@ ex mul::default_overall_coeff(void) const return _ex1(); } -void mul::combine_overall_coeff(ex const & c) +void mul::combine_overall_coeff(const ex & c) { GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); overall_coeff = ex_to_numeric(overall_coeff).mul_dyn(ex_to_numeric(c)); } -void mul::combine_overall_coeff(ex const & c1, ex const & c2) +void mul::combine_overall_coeff(const ex & c1, const ex & c2) { GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c1,numeric)); @@ -621,7 +621,7 @@ void mul::combine_overall_coeff(ex const & c1, ex const & c2) mul_dyn(ex_to_numeric(c1).power(ex_to_numeric(c2))); } -bool mul::can_make_flat(expair const & p) const +bool mul::can_make_flat(const expair & p) const { GINAC_ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); // this assertion will probably fail somewhere @@ -638,7 +638,7 @@ ex mul::expand(unsigned options) const epvector * expanded_seqp=expandchildren(options); - epvector const & expanded_seq = expanded_seqp==0 ? seq : *expanded_seqp; + const epvector & expanded_seq = expanded_seqp==0 ? seq : *expanded_seqp; positions_of_adds.resize(expanded_seq.size()); number_of_add_operands.resize(expanded_seq.size()); @@ -652,7 +652,7 @@ ex mul::expand(unsigned options) const if (is_ex_exactly_of_type((*cit).rest,add)&& (ex_to_numeric((*cit).coeff).is_equal(_num1()))) { positions_of_adds[number_of_adds]=current_position; - add const & expanded_addref=ex_to_add((*cit).rest); + const add & expanded_addref=ex_to_add((*cit).rest); unsigned addref_nops=expanded_addref.nops(); number_of_add_operands[number_of_adds]=addref_nops; number_of_expanded_terms *= addref_nops; @@ -685,7 +685,7 @@ ex mul::expand(unsigned options) const epvector term; term=expanded_seq; for (l=0; lsetflag(status_flags::dynallocated | @@ -280,7 +280,7 @@ ex ncmul::expand(unsigned options) const status_flags::expanded); } -int ncmul::degree(symbol const & s) const +int ncmul::degree(const symbol & s) const { int deg_sum=0; for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -289,7 +289,7 @@ int ncmul::degree(symbol const & s) const return deg_sum; } -int ncmul::ldegree(symbol const & s) const +int ncmul::ldegree(const symbol & s) const { int deg_sum=0; for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -298,7 +298,7 @@ int ncmul::ldegree(symbol const & s) const return deg_sum; } -ex ncmul::coeff(symbol const & s, int const n) const +ex ncmul::coeff(const symbol & s, int n) const { exvector coeffseq; coeffseq.reserve(seq.size()); @@ -332,7 +332,7 @@ ex ncmul::coeff(symbol const & s, int const n) const return _ex0(); } -unsigned ncmul::count_factors(ex const & e) const +unsigned ncmul::count_factors(const ex & e) const { if ((is_ex_exactly_of_type(e,mul)&&(e.return_type()!=return_types::commutative))|| (is_ex_exactly_of_type(e,ncmul))) { @@ -345,7 +345,7 @@ unsigned ncmul::count_factors(ex const & e) const return 1; } -void ncmul::append_factors(exvector & v, ex const & e) const +void ncmul::append_factors(exvector & v, const ex & e) const { if ((is_ex_exactly_of_type(e,mul)&&(e.return_type()!=return_types::commutative))|| (is_ex_exactly_of_type(e,ncmul))) { @@ -521,12 +521,12 @@ exvector ncmul::get_indices(void) const return iv; } -ex ncmul::subs(lst const & ls, lst const & lr) const +ex ncmul::subs(const lst & ls, const lst & lr) const { return ncmul(subschildren(ls, lr)); } -ex ncmul::thisexprseq(exvector const & v) const +ex ncmul::thisexprseq(const exvector & v) const { return (new ncmul(v))->setflag(status_flags::dynallocated); } @@ -538,7 +538,7 @@ ex ncmul::thisexprseq(exvector * vp) const // protected -int ncmul::compare_same_type(basic const & other) const +int ncmul::compare_same_type(const basic & other) const { return inherited::compare_same_type(other); } @@ -612,7 +612,7 @@ exvector ncmul::expandchildren(unsigned options) const return s; } -exvector const & ncmul::get_factors(void) const +const exvector & ncmul::get_factors(void) const { return seq; } @@ -631,18 +631,18 @@ unsigned ncmul::precedence=50; ////////// const ncmul some_ncmul; -type_info const & typeid_ncmul=typeid(some_ncmul); +const type_info & typeid_ncmul=typeid(some_ncmul); ////////// // friend functions ////////// -ex nonsimplified_ncmul(exvector const & v) +ex nonsimplified_ncmul(const exvector & v) { return (new ncmul(v))->setflag(status_flags::dynallocated); } -ex simplified_ncmul(exvector const & v) +ex simplified_ncmul(const exvector & v) { if (v.size()==0) { return _ex1(); diff --git a/ginac/ncmul.h b/ginac/ncmul.h index 10477938..d04af7f5 100644 --- a/ginac/ncmul.h +++ b/ginac/ncmul.h @@ -35,8 +35,8 @@ class ncmul : public exprseq GINAC_DECLARE_REGISTERED_CLASS(ncmul, exprseq) friend class power; - friend ex nonsimplified_ncmul(exvector const & v); - friend ex simplified_ncmul(exvector const & v); + friend ex nonsimplified_ncmul(const exvector & v); + friend ex simplified_ncmul(const exvector & v); // member functions @@ -44,23 +44,23 @@ class ncmul : public exprseq public: ncmul(); ~ncmul(); - ncmul(ncmul const & other); - ncmul const & operator=(ncmul const & other); + ncmul(const ncmul & other); + const ncmul & operator=(const ncmul & other); protected: - void copy(ncmul const & other); + void copy(const ncmul & other); void destroy(bool call_parent); // other constructors public: - ncmul(ex const & lh, ex const & rh); - ncmul(ex const & f1, ex const & f2, ex const & f3); - ncmul(ex const & f1, ex const & f2, ex const & f3, - ex const & f4); - ncmul(ex const & f1, ex const & f2, ex const & f3, - ex const & f4, ex const & f5); - ncmul(ex const & f1, ex const & f2, ex const & f3, - ex const & f4, ex const & f5, ex const & f6); - ncmul(exvector const & v, bool discardable=false); + ncmul(const ex & lh, const ex & rh); + ncmul(const ex & f1, const ex & f2, const ex & f3); + ncmul(const ex & f1, const ex & f2, const ex & f3, + const ex & f4); + ncmul(const ex & f1, const ex & f2, const ex & f3, + const ex & f4, const ex & f5); + ncmul(const ex & f1, const ex & f2, const ex & f3, + const ex & f4, const ex & f5, const ex & f6); + ncmul(const exvector & v, bool discardable=false); ncmul(exvector * vp); // vp will be deleted // functions overriding virtual functions from bases classes @@ -70,18 +70,18 @@ public: void printraw(ostream & os) const; void printcsrc(ostream & os, unsigned upper_precedence) const; bool info(unsigned inf) const; - int degree(symbol const & s) const; - int ldegree(symbol const & s) const; + int degree(const symbol & s) const; + int ldegree(const symbol & s) const; ex expand(unsigned options=0) const; - ex coeff(symbol const & s, int const n=1) const; + ex coeff(const symbol & s, int n=1) const; ex eval(int level=0) const; - ex diff(symbol const & s) const; - ex subs(lst const & ls, lst const & lr) const; + ex diff(const symbol & s) const; + ex subs(const lst & ls, const lst & lr) const; exvector get_indices(void) const; - ex thisexprseq(exvector const & v) const; + ex thisexprseq(const exvector & v) const; ex thisexprseq(exvector * vp) const; protected: - int compare_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; @@ -90,11 +90,11 @@ protected: // non-virtual functions in this class protected: - unsigned count_factors(ex const & e) const; - void append_factors(exvector & v, ex const & e) const; + unsigned count_factors(const ex & e) const; + void append_factors(exvector & v, const ex & e) const; exvector expandchildren(unsigned options) const; public: - exvector const & get_factors(void) const; + const exvector & get_factors(void) const; // member variables @@ -105,12 +105,12 @@ protected: // global constants extern const ncmul some_ncmul; -extern type_info const & typeid_ncmul; +extern const type_info & typeid_ncmul; // friend funtions -ex nonsimplified_ncmul(exvector const & v); -ex simplified_ncmul(exvector const & v); +ex nonsimplified_ncmul(const exvector & v); +ex simplified_ncmul(const exvector & v); // utility functions inline const ncmul &ex_to_ncmul(const ex &e) diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index c23d46a2..99dcc8e4 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -204,7 +204,7 @@ numeric::numeric(double d) : basic(TINFO_numeric) status_flags::hash_calculated); } -numeric::numeric(char const *s) : basic(TINFO_numeric) +numeric::numeric(const char *s) : basic(TINFO_numeric) { // MISSING: treatment of complex and ints and rationals. debugmsg("numeric constructor from string",LOGLEVEL_CONSTRUCT); if (strchr(s, '.')) @@ -456,7 +456,7 @@ ex numeric::evalf(int level) const // protected -int numeric::compare_same_type(basic const & other) const +int numeric::compare_same_type(const basic & other) const { GINAC_ASSERT(is_exactly_of_type(other, numeric)); const numeric & o = static_cast(const_cast(other)); @@ -468,7 +468,7 @@ int numeric::compare_same_type(basic const & other) const return compare(o); } -bool numeric::is_equal_same_type(basic const & other) const +bool numeric::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_exactly_of_type(other,numeric)); const numeric *o = static_cast(&other); @@ -624,7 +624,7 @@ const numeric & numeric::operator=(double d) return operator=(numeric(d)); } -const numeric & numeric::operator=(char const * s) +const numeric & numeric::operator=(const char * s) { return operator=(numeric(s)); } @@ -1000,7 +1000,7 @@ unsigned numeric::precedence = 30; ////////// const numeric some_numeric; -type_info const & typeid_numeric=typeid(some_numeric); +const type_info & typeid_numeric=typeid(some_numeric); /** Imaginary unit. This is not a constant but a numeric since we are * natively handing complex numbers anyways. */ const numeric I = numeric(complex(cl_I(0),cl_I(1))); @@ -1471,7 +1471,7 @@ void _numeric_digits::print(ostream & os) const os << digits; } -ostream& operator<<(ostream& os, _numeric_digits const & e) +ostream& operator<<(ostream& os, const _numeric_digits & e) { e.print(os); return os; diff --git a/ginac/numeric.h b/ginac/numeric.h index 71cccb26..e138117f 100644 --- a/ginac/numeric.h +++ b/ginac/numeric.h @@ -116,7 +116,7 @@ public: explicit numeric(unsigned long i); explicit numeric(long numer, long denom); explicit numeric(double d); - explicit numeric(char const *); + explicit numeric(const char *); numeric(cl_N const & z); // functions overriding virtual functions from bases classes @@ -128,14 +128,14 @@ public: void printcsrc(ostream & os, unsigned type, unsigned precedence=0) const; bool info(unsigned inf) const; ex evalf(int level=0) const; - ex diff(symbol const & s) const; + ex diff(const symbol & s) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; numeric integer_content(void) const; ex smod(const numeric &xi) const; numeric max_coefficient(void) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned calchash(void) const { hashvalue=HASHVALUE_NUMERIC; return HASHVALUE_NUMERIC; @@ -161,7 +161,7 @@ public: const numeric & operator=(long i); const numeric & operator=(unsigned long i); const numeric & operator=(double d); - const numeric & operator=(char const * s); + const numeric & operator=(const char * s); numeric inverse(void) const; int csgn(void) const; int compare(const numeric & other) const; @@ -204,7 +204,7 @@ protected: extern const numeric some_numeric; extern const numeric I; -extern type_info const & typeid_numeric; +extern const type_info & typeid_numeric; extern _numeric_digits Digits; #define is_a_numeric_hash(x) ((x)==HASHVALUE_NUMERIC) diff --git a/ginac/operators.cpp b/ginac/operators.cpp index 9e1f2b1d..10a45165 100644 --- a/ginac/operators.cpp +++ b/ginac/operators.cpp @@ -38,31 +38,31 @@ namespace GiNaC { // binary arithmetic operators ex with ex -ex operator+(ex const & lh, ex const & rh) +ex operator+(const ex & lh, const ex & rh) { debugmsg("operator+(ex,ex)",LOGLEVEL_OPERATOR); return lh.exadd(rh); } -ex operator-(ex const & lh, ex const & rh) +ex operator-(const ex & lh, const ex & rh) { debugmsg("operator-(ex,ex)",LOGLEVEL_OPERATOR); return lh.exadd(rh.exmul(_ex_1())); } -ex operator*(ex const & lh, ex const & rh) +ex operator*(const ex & lh, const ex & rh) { debugmsg("operator*(ex,ex)",LOGLEVEL_OPERATOR); return lh.exmul(rh); } -ex operator/(ex const & lh, ex const & rh) +ex operator/(const ex & lh, const ex & rh) { debugmsg("operator*(ex,ex)",LOGLEVEL_OPERATOR); return lh.exmul(power(rh,_ex_1())); } -ex operator%(ex const & lh, ex const & rh) +ex operator%(const ex & lh, const ex & rh) { debugmsg("operator%(ex,ex)",LOGLEVEL_OPERATOR); return lh.exncmul(rh); @@ -71,25 +71,25 @@ ex operator%(ex const & lh, ex const & rh) // binary arithmetic operators numeric with numeric -numeric operator+(numeric const & lh, numeric const & rh) +numeric operator+(const numeric & lh, const numeric & rh) { debugmsg("operator+(numeric,numeric)",LOGLEVEL_OPERATOR); return lh.add(rh); } -numeric operator-(numeric const & lh, numeric const & rh) +numeric operator-(const numeric & lh, const numeric & rh) { debugmsg("operator-(numeric,numeric)",LOGLEVEL_OPERATOR); return lh.sub(rh); } -numeric operator*(numeric const & lh, numeric const & rh) +numeric operator*(const numeric & lh, const numeric & rh) { debugmsg("operator*(numeric,numeric)",LOGLEVEL_OPERATOR); return lh.mul(rh); } -numeric operator/(numeric const & lh, numeric const & rh) +numeric operator/(const numeric & lh, const numeric & rh) { debugmsg("operator/(numeric,ex)",LOGLEVEL_OPERATOR); return lh.div(rh); @@ -98,31 +98,31 @@ numeric operator/(numeric const & lh, numeric const & rh) // binary arithmetic assignment operators with ex -ex const & operator+=(ex & lh, ex const & rh) +const ex & operator+=(ex & lh, const ex & rh) { debugmsg("operator+=(ex,ex)",LOGLEVEL_OPERATOR); return (lh=lh+rh); } -ex const & operator-=(ex & lh, ex const & rh) +const ex & operator-=(ex & lh, const ex & rh) { debugmsg("operator-=(ex,ex)",LOGLEVEL_OPERATOR); return (lh=lh-rh); } -ex const & operator*=(ex & lh, ex const & rh) +const ex & operator*=(ex & lh, const ex & rh) { debugmsg("operator*=(ex,ex)",LOGLEVEL_OPERATOR); return (lh=lh*rh); } -ex const & operator/=(ex & lh, ex const & rh) +const ex & operator/=(ex & lh, const ex & rh) { debugmsg("operator/=(ex,ex)",LOGLEVEL_OPERATOR); return (lh=lh/rh); } -ex const & operator%=(ex & lh, ex const & rh) +const ex & operator%=(ex & lh, const ex & rh) { debugmsg("operator%=(ex,ex)",LOGLEVEL_OPERATOR); return (lh=lh%rh); @@ -131,25 +131,25 @@ ex const & operator%=(ex & lh, ex const & rh) // binary arithmetic assignment operators with numeric -numeric const & operator+=(numeric & lh, numeric const & rh) +const numeric & operator+=(numeric & lh, const numeric & rh) { debugmsg("operator+=(numeric,numeric)",LOGLEVEL_OPERATOR); return (lh=lh.add(rh)); } -numeric const & operator-=(numeric & lh, numeric const & rh) +const numeric & operator-=(numeric & lh, const numeric & rh) { debugmsg("operator-=(numeric,numeric)",LOGLEVEL_OPERATOR); return (lh=lh.sub(rh)); } -numeric const & operator*=(numeric & lh, numeric const & rh) +const numeric & operator*=(numeric & lh, const numeric & rh) { debugmsg("operator*=(numeric,numeric)",LOGLEVEL_OPERATOR); return (lh=lh.mul(rh)); } -numeric const & operator/=(numeric & lh, numeric const & rh) +const numeric & operator/=(numeric & lh, const numeric & rh) { debugmsg("operator/=(numeric,numeric)",LOGLEVEL_OPERATOR); return (lh=lh.div(rh)); @@ -157,22 +157,22 @@ numeric const & operator/=(numeric & lh, numeric const & rh) // unary operators -ex operator+(ex const & lh) +ex operator+(const ex & lh) { return lh; } -ex operator-(ex const & lh) +ex operator-(const ex & lh) { return lh.exmul(_ex_1()); } -numeric operator+(numeric const & lh) +numeric operator+(const numeric & lh) { return lh; } -numeric operator-(numeric const & lh) +numeric operator-(const numeric & lh) { return _num_1()*lh; } @@ -211,37 +211,37 @@ numeric operator--(numeric & lh, int) // binary relational operators ex with ex -relational operator==(ex const & lh, ex const & rh) +relational operator==(const ex & lh, const ex & rh) { debugmsg("operator==(ex,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::equal); } -relational operator!=(ex const & lh, ex const & rh) +relational operator!=(const ex & lh, const ex & rh) { debugmsg("operator!=(ex,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::not_equal); } -relational operator<(ex const & lh, ex const & rh) +relational operator<(const ex & lh, const ex & rh) { debugmsg("operator<(ex,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::less); } -relational operator<=(ex const & lh, ex const & rh) +relational operator<=(const ex & lh, const ex & rh) { debugmsg("operator<=(ex,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::less_or_equal); } -relational operator>(ex const & lh, ex const & rh) +relational operator>(const ex & lh, const ex & rh) { debugmsg("operator>(ex,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::greater); } -relational operator>=(ex const & lh, ex const & rh) +relational operator>=(const ex & lh, const ex & rh) { debugmsg("operator>=(ex,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::greater_or_equal); @@ -251,37 +251,37 @@ relational operator>=(ex const & lh, ex const & rh) // binary relational operators ex with numeric -relational operator==(ex const & lh, numeric const & rh) +relational operator==(const ex & lh, const numeric & rh) { debugmsg("operator==(ex,numeric)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::equal); } -relational operator!=(ex const & lh, numeric const & rh) +relational operator!=(const ex & lh, const numeric & rh) { debugmsg("operator!=(ex,numeric)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::not_equal); } -relational operator<(ex const & lh, numeric const & rh) +relational operator<(const ex & lh, const numeric & rh) { debugmsg("operator<(ex,numeric)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::less); } -relational operator<=(ex const & lh, numeric const & rh) +relational operator<=(const ex & lh, const numeric & rh) { debugmsg("operator<=(ex,numeric)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::less_or_equal); } -relational operator>(ex const & lh, numeric const & rh) +relational operator>(const ex & lh, const numeric & rh) { debugmsg("operator>(ex,numeric)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::greater); } -relational operator>=(ex const & lh, numeric const & rh) +relational operator>=(const ex & lh, const numeric & rh) { debugmsg("operator>=(ex,numeric)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::greater_or_equal); @@ -289,37 +289,37 @@ relational operator>=(ex const & lh, numeric const & rh) // binary relational operators numeric with ex -relational operator==(numeric const & lh, ex const & rh) +relational operator==(const numeric & lh, const ex & rh) { debugmsg("operator==(numeric,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::equal); } -relational operator!=(numeric const & lh, ex const & rh) +relational operator!=(const numeric & lh, const ex & rh) { debugmsg("operator!=(numeric,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::not_equal); } -relational operator<(numeric const & lh, ex const & rh) +relational operator<(const numeric & lh, const ex & rh) { debugmsg("operator<(numeric,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::less); } -relational operator<=(numeric const & lh, ex const & rh) +relational operator<=(const numeric & lh, const ex & rh) { debugmsg("operator<=(numeric,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::less_or_equal); } -relational operator>(numeric const & lh, ex const & rh) +relational operator>(const numeric & lh, const ex & rh) { debugmsg("operator>(numeric,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::greater); } -relational operator>=(numeric const & lh, ex const & rh) +relational operator>=(const numeric & lh, const ex & rh) { debugmsg("operator>=(numeric,ex)",LOGLEVEL_OPERATOR); return relational(lh,rh,relational::greater_or_equal); @@ -329,7 +329,7 @@ relational operator>=(numeric const & lh, ex const & rh) // input/output stream operators -ostream & operator<<(ostream & os, ex const & e) +ostream & operator<<(ostream & os, const ex & e) { e.print(os); return os; diff --git a/ginac/operators.h b/ginac/operators.h index f163ec55..33acabae 100644 --- a/ginac/operators.h +++ b/ginac/operators.h @@ -34,11 +34,11 @@ 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); -ex operator*(ex const & lh, ex const & rh); -ex operator/(ex const & lh, ex const & rh); -ex operator%(ex const & lh, ex const & rh); // non-commutative multiplication +ex operator+(const ex & lh, const ex & rh); +ex operator-(const ex & lh, const ex & rh); +ex operator*(const ex & lh, const ex & rh); +ex operator/(const ex & lh, const ex & rh); +ex operator%(const ex & lh, const ex & rh); // non-commutative multiplication // binary arithmetic operators numeric with numeric numeric operator+(const numeric & lh, const numeric & rh); @@ -47,11 +47,11 @@ numeric operator*(const numeric & lh, const numeric & rh); numeric operator/(const numeric & lh, const numeric & rh); // binary arithmetic assignment operators with ex -ex const & operator+=(ex & lh, ex const & rh); -ex const & operator-=(ex & lh, ex const & rh); -ex const & operator*=(ex & lh, ex const & rh); -ex const & operator/=(ex & lh, ex const & rh); -ex const & operator%=(ex & lh, ex const & rh); // non-commutative multiplication +const ex & operator+=(ex & lh, const ex & rh); +const ex & operator-=(ex & lh, const ex & rh); +const ex & operator*=(ex & lh, const ex & rh); +const ex & operator/=(ex & lh, const ex & rh); +const ex & operator%=(ex & lh, const ex & rh); // non-commutative multiplication // binary arithmetic assignment operators with numeric const numeric & operator+=(numeric & lh, const numeric & rh); @@ -60,8 +60,8 @@ const numeric & operator*=(numeric & lh, const numeric & rh); const numeric & operator/=(numeric & lh, const numeric & rh); // unary operators -ex operator+(ex const & lh); -ex operator-(ex const & lh); +ex operator+(const ex & lh); +ex operator-(const ex & lh); numeric operator+(const numeric & lh); numeric operator-(const numeric & lh); @@ -71,15 +71,15 @@ numeric operator++(numeric & lh, int); numeric operator--(numeric & lh, int); // binary relational operators ex with ex -relational operator==(ex const & lh, ex const & rh); -relational operator!=(ex const & lh, ex const & rh); -relational operator<(ex const & lh, ex const & rh); -relational operator<=(ex const & lh, ex const & rh); -relational operator>(ex const & lh, ex const & rh); -relational operator>=(ex const & lh, ex const & rh); +relational operator==(const ex & lh, const ex & rh); +relational operator!=(const ex & lh, const ex & rh); +relational operator<(const ex & lh, const ex & rh); +relational operator<=(const ex & lh, const ex & rh); +relational operator>(const ex & lh, const ex & rh); +relational operator>=(const ex & lh, const ex & rh); // input/output stream operators -ostream & operator<<(ostream & os, ex const & e); +ostream & operator<<(ostream & os, const ex & e); istream & operator>>(istream & is, ex & e); #ifndef NO_GINAC_NAMESPACE diff --git a/ginac/power.cpp b/ginac/power.cpp index ccbf5281..cbe0c65b 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -60,13 +60,13 @@ power::~power() destroy(0); } -power::power(power const & other) +power::power(const power & other) { debugmsg("power copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -power const & power::operator=(power const & other) +const power & power::operator=(const power & other) { debugmsg("power operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -78,7 +78,7 @@ power const & power::operator=(power const & other) // protected -void power::copy(power const & other) +void power::copy(const power & other) { inherited::copy(other); basis=other.basis; @@ -96,13 +96,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(const ex & lh, const ex & rh) : basic(TINFO_power), basis(lh), exponent(rh) { debugmsg("power constructor from ex,ex",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(basis.return_type()==return_types::commutative); } -power::power(ex const & lh, numeric const & rh) : basic(TINFO_power), basis(lh), exponent(rh) +power::power(const ex & lh, const numeric & rh) : basic(TINFO_power), basis(lh), exponent(rh) { debugmsg("power constructor from ex,numeric",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(basis.return_type()==return_types::commutative); @@ -267,7 +267,7 @@ unsigned power::nops() const return 2; } -ex & power::let_op(int const i) +ex & power::let_op(int i) { GINAC_ASSERT(i>=0); GINAC_ASSERT(i<2); @@ -275,7 +275,7 @@ ex & power::let_op(int const i) return i==0 ? basis : exponent; } -int power::degree(symbol const & s) const +int power::degree(const symbol & s) const { if (is_exactly_of_type(*exponent.bp,numeric)) { if ((*basis.bp).compare(s)==0) @@ -286,7 +286,7 @@ int power::degree(symbol const & s) const return 0; } -int power::ldegree(symbol const & s) const +int power::ldegree(const symbol & s) const { if (is_exactly_of_type(*exponent.bp,numeric)) { if ((*basis.bp).compare(s)==0) @@ -297,7 +297,7 @@ int power::ldegree(symbol const & s) const return 0; } -ex power::coeff(symbol const & s, int const n) const +ex power::coeff(const symbol & s, int n) const { if ((*basis.bp).compare(s)!=0) { // basis not equal to s @@ -307,7 +307,7 @@ ex power::coeff(symbol const & s, int const n) const return _ex0(); } } else if (is_exactly_of_type(*exponent.bp,numeric)&& - (static_cast(*exponent.bp).compare(numeric(n))==0)) { + (static_cast(*exponent.bp).compare(numeric(n))==0)) { return _ex1(); } @@ -334,8 +334,8 @@ ex power::eval(int level) const throw(std::runtime_error("max recursion level reached")); } - ex const & ebasis = level==1 ? basis : basis.eval(level-1); - ex const & eexponent = level==1 ? exponent : exponent.eval(level-1); + const ex & ebasis = level==1 ? basis : basis.eval(level-1); + const ex & eexponent = level==1 ? exponent : exponent.eval(level-1); bool basis_is_numerical=0; bool exponent_is_numerical=0; @@ -416,11 +416,11 @@ ex power::eval(int level) const // (c1, c2 numeric(), c2 integer or -1 < c1 <= 1, // case c1=1 should not happen, see below!) if (exponent_is_numerical && is_ex_exactly_of_type(ebasis,power)) { - power const & sub_power=ex_to_power(ebasis); - ex const & sub_basis=sub_power.basis; - ex const & sub_exponent=sub_power.exponent; + const power & sub_power=ex_to_power(ebasis); + const ex & sub_basis=sub_power.basis; + const ex & sub_exponent=sub_power.exponent; if (is_ex_exactly_of_type(sub_exponent,numeric)) { - numeric const & num_sub_exponent=ex_to_numeric(sub_exponent); + const numeric & num_sub_exponent=ex_to_numeric(sub_exponent); GINAC_ASSERT(num_sub_exponent!=numeric(1)); if (num_exponent->is_integer() || abs(num_sub_exponent)<1) { return power(sub_basis,num_sub_exponent.mul(*num_exponent)); @@ -438,9 +438,9 @@ ex power::eval(int level) const // ^(*(...,x,c1),c2) -> ^(*(...,x;-1),c2)*(-c1)^c2 (c1, c2 numeric(), c1<0) if (exponent_is_numerical && is_ex_exactly_of_type(ebasis,mul)) { GINAC_ASSERT(!num_exponent->is_integer()); // should have been handled above - mul const & mulref=ex_to_mul(ebasis); + const mul & mulref=ex_to_mul(ebasis); if (!mulref.overall_coeff.is_equal(_ex1())) { - numeric const & num_coeff=ex_to_numeric(mulref.overall_coeff); + const numeric & num_coeff=ex_to_numeric(mulref.overall_coeff); if (num_coeff.is_real()) { if (num_coeff.is_positive()>0) { mul * mulp=new mul(mulref); @@ -494,10 +494,10 @@ ex power::evalf(int level) const return power(ebasis,eexponent); } -ex power::subs(lst const & ls, lst const & lr) const +ex power::subs(const lst & ls, const lst & lr) const { - ex const & subsed_basis=basis.subs(ls,lr); - ex const & subsed_exponent=exponent.subs(ls,lr); + const ex & subsed_basis=basis.subs(ls,lr); + const ex & subsed_exponent=exponent.subs(ls,lr); if (are_ex_trivially_equal(basis,subsed_basis)&& are_ex_trivially_equal(exponent,subsed_exponent)) { @@ -507,17 +507,17 @@ ex power::subs(lst const & ls, lst const & lr) const return power(subsed_basis, subsed_exponent); } -ex power::simplify_ncmul(exvector const & v) const +ex power::simplify_ncmul(const exvector & v) const { return inherited::simplify_ncmul(v); } // protected -int power::compare_same_type(basic const & other) const +int power::compare_same_type(const basic & other) const { GINAC_ASSERT(is_exactly_of_type(other, power)); - power const & o=static_cast(const_cast(other)); + const power & o=static_cast(const_cast(other)); int cmpval; cmpval=basis.compare(o.basis); @@ -552,7 +552,7 @@ ex power::expand(unsigned options) const } // integer numeric exponent - numeric const & num_exponent=ex_to_numeric(exponent); + const numeric & num_exponent=ex_to_numeric(exponent); int int_exponent = num_exponent.to_int(); if (int_exponent > 0 && is_ex_exactly_of_type(expanded_basis,add)) { @@ -582,7 +582,7 @@ ex power::expand(unsigned options) const // non-virtual functions in this class ////////// -ex power::expand_add(add const & a, int const n) const +ex power::expand_add(const add & a, int n) const { // expand a^n where a is an add and n is an integer @@ -608,7 +608,7 @@ ex power::expand_add(add const & a, int const n) const exvector term; term.reserve(m+1); for (l=0; lsetflag(status_flags::dynallocated); } -ex power::expand_add_2(add const & a) const +ex power::expand_add_2(const add & a) const { // special case: expand a^2 where a is an add @@ -690,8 +690,8 @@ ex power::expand_add_2(add const & a) const // power(+(x,...,z;c),2)=power(+(x,...,z;0),2)+2*c*+(x,...,z;0)+c*c // first part: ignore overall_coeff and expand other terms for (epvector::const_iterator cit0=a.seq.begin(); cit0!=last; ++cit0) { - ex const & r=(*cit0).rest; - ex const & c=(*cit0).coeff; + const ex & r=(*cit0).rest; + const ex & c=(*cit0).coeff; GINAC_ASSERT(!is_ex_exactly_of_type(r,add)); GINAC_ASSERT(!is_ex_exactly_of_type(r,power)|| @@ -719,8 +719,8 @@ ex power::expand_add_2(add const & a) const } for (epvector::const_iterator cit1=cit0+1; cit1!=last; ++cit1) { - ex const & r1=(*cit1).rest; - ex const & c1=(*cit1).coeff; + const ex & r1=(*cit1).rest; + const ex & c1=(*cit1).coeff; sum.push_back(a.combine_ex_with_coeff_to_pair((new mul(r,r1))->setflag(status_flags::dynallocated), _num2().mul(ex_to_numeric(c)).mul_dyn(ex_to_numeric(c1)))); } @@ -741,7 +741,7 @@ ex power::expand_add_2(add const & a) const return (new add(sum))->setflag(status_flags::dynallocated); } -ex power::expand_mul(mul const & m, numeric const & n) const +ex power::expand_mul(const mul & m, const numeric & n) const { // expand m^n where m is a mul and n is and integer @@ -769,7 +769,7 @@ ex power::expand_mul(mul const & m, numeric const & n) const } /* -ex power::expand_commutative_3(ex const & basis, numeric const & exponent, +ex power::expand_commutative_3(const ex & basis, const numeric & exponent, unsigned options) const { // obsolete @@ -777,7 +777,7 @@ ex power::expand_commutative_3(ex const & basis, numeric const & exponent, exvector distrseq; epvector splitseq; - add const & addref=static_cast(*basis.bp); + const add & addref=static_cast(*basis.bp); splitseq=addref.seq; splitseq.pop_back(); @@ -797,7 +797,7 @@ ex power::expand_commutative_3(ex const & basis, numeric const & exponent, */ /* -ex power::expand_noncommutative(ex const & basis, numeric const & exponent, +ex power::expand_noncommutative(const ex & basis, const numeric & exponent, unsigned options) const { ex rest_power=ex(power(basis,exponent.add(_num_1()))). @@ -821,11 +821,11 @@ unsigned power::precedence=60; ////////// const power some_power; -type_info const & typeid_power=typeid(some_power); +const type_info & typeid_power=typeid(some_power); // helper function -ex sqrt(ex const & a) +ex sqrt(const ex & a) { return power(a,_ex1_2()); } diff --git a/ginac/power.h b/ginac/power.h index 4224c199..7be32619 100644 --- a/ginac/power.h +++ b/ginac/power.h @@ -47,16 +47,16 @@ class power : public basic public: power(); ~power(); - power(power const & other); - power const & operator=(power const & other); + power(const power & other); + const power & operator=(const power & other); protected: - void copy(power const & other); + void copy(const power & other); void destroy(bool call_parent); // other constructors public: - power(ex const & lh, ex const & rh); - power(ex const & lh, numeric const & rh); + power(const ex & lh, const ex & rh); + power(const ex & lh, const numeric & rh); // functions overriding virtual functions from bases classes public: @@ -67,19 +67,19 @@ public: void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; bool info(unsigned inf) const; unsigned nops() const; - ex & let_op(int const i); - int degree(symbol const & s) const; - int ldegree(symbol const & s) const; - ex coeff(symbol const & s, int const n=1) const; + ex & let_op(int i); + int degree(const symbol & s) const; + int ldegree(const symbol & s) const; + ex coeff(const symbol & s, int n=1) const; ex eval(int level=0) const; ex evalf(int level=0) const; - ex diff(symbol const & s) const; - ex series(symbol const & s, ex const & point, int order) const; - ex subs(lst const & ls, lst const & lr) const; + ex diff(const symbol & s) const; + ex series(const symbol & s, const ex & point, int order) const; + ex subs(const lst & ls, const lst & lr) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; - ex simplify_ncmul(exvector const & v) const; + ex simplify_ncmul(const exvector & v) const; protected: - int compare_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; ex expand(unsigned options=0) const; @@ -89,12 +89,12 @@ protected: // non-virtual functions in this class protected: - ex expand_add(add const & a, int const n) const; - ex expand_add_2(add const & a) const; - ex expand_mul(mul const & m, numeric const & n) const; - //ex expand_commutative_3(ex const & basis, numeric const & exponent, + ex expand_add(const add & a, int n) const; + ex expand_add_2(const add & a) const; + ex expand_mul(const mul & m, const numeric & n) const; + //ex expand_commutative_3(const ex & basis, const numeric & exponent, // unsigned options) const; - // ex expand_noncommutative(ex const & basis, numeric const & exponent, unsigned options) const; + // ex expand_noncommutative(const ex & basis, const numeric & exponent, unsigned options) const; // member variables @@ -107,7 +107,7 @@ protected: // global constants extern const power some_power; -extern type_info const & typeid_power; +extern const type_info & typeid_power; // utility functions inline const power &ex_to_power(const ex &e) @@ -121,12 +121,12 @@ inline const power &ex_to_power(const ex &e) * * @param b the basis expression * @param e the exponent expression */ -inline ex pow(ex const & b, ex const & e) +inline ex pow(const ex & b, const ex & e) { return power(b,e); } /** Square root expression. Returns a power-object with exponent 1/2 as a new * expression. */ -ex sqrt(ex const & a); +ex sqrt(const ex & a); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index b12c8297..d674148d 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -56,13 +56,13 @@ pseries::~pseries() destroy(false); } -pseries::pseries(pseries const &other) +pseries::pseries(const pseries &other) { debugmsg("pseries copy constructor", LOGLEVEL_CONSTRUCT); copy(other); } -pseries const &pseries::operator=(pseries const & other) +const pseries &pseries::operator=(const pseries & other) { debugmsg("pseries operator=", LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -72,7 +72,7 @@ pseries const &pseries::operator=(pseries const & other) return *this; } -void pseries::copy(pseries const &other) +void pseries::copy(const pseries &other) { inherited::copy(other); seq = other.seq; @@ -101,7 +101,7 @@ void pseries::destroy(bool call_parent) * @param point_ expansion point * @param ops_ vector of {coefficient, power} pairs (coefficient must not be zero) * @return newly constructed pseries */ -pseries::pseries(ex const &var_, ex const &point_, epvector const &ops_) +pseries::pseries(const ex &var_, const ex &point_, const epvector &ops_) : basic(TINFO_pseries), seq(ops_), var(var_), point(point_) { debugmsg("pseries constructor from ex,ex,epvector", LOGLEVEL_CONSTRUCT); @@ -193,7 +193,7 @@ ex &pseries::let_op(int i) throw (std::logic_error("let_op not defined for pseries")); } -int pseries::degree(symbol const &s) const +int pseries::degree(const symbol &s) const { if (var.is_equal(s)) { // Return last exponent @@ -216,7 +216,7 @@ int pseries::degree(symbol const &s) const } } -int pseries::ldegree(symbol const &s) const +int pseries::ldegree(const symbol &s) const { if (var.is_equal(s)) { // Return first exponent @@ -239,7 +239,7 @@ int pseries::ldegree(symbol const &s) const } } -ex pseries::coeff(symbol const &s, int const n) const +ex pseries::coeff(const symbol &s, int n) const { if (var.is_equal(s)) { epvector::const_iterator it = seq.begin(), itend = seq.end(); @@ -278,7 +278,7 @@ ex pseries::evalf(int level) const return convert_to_poly().evalf(level); } -ex pseries::subs(lst const & ls, lst const & lr) const +ex pseries::subs(const lst & ls, const lst & lr) const { // If expansion variable is being substituted, convert the series to a // polynomial and do the substitution there because the result might @@ -329,7 +329,7 @@ ex pseries::convert_to_poly(bool no_order) const /** Default implementation of ex::series(). This performs Taylor expansion. * @see ex::series */ -ex basic::series(symbol const & s, ex const & point, int order) const +ex basic::series(const symbol & s, const ex & point, int order) const { epvector seq; numeric fac(1); @@ -361,7 +361,7 @@ ex basic::series(symbol const & s, ex const & point, int order) const /** Implementation of ex::series() for symbols. * @see ex::series */ -ex symbol::series(symbol const & s, ex const & point, int order) const +ex symbol::series(const symbol & s, const ex & point, int order) const { epvector seq; if (is_equal(s)) { @@ -454,7 +454,7 @@ ex pseries::add_series(const pseries &other) const /** Implementation of ex::series() for sums. This performs series addition when * adding pseries objects. * @see ex::series */ -ex add::series(symbol const & s, ex const & point, int order) const +ex add::series(const symbol & s, const ex & point, int order) const { ex acc; // Series accumulator @@ -559,7 +559,7 @@ ex pseries::mul_series(const pseries &other) const /** Implementation of ex::series() for product. This performs series * multiplication when multiplying series. * @see ex::series */ -ex mul::series(symbol const & s, ex const & point, int order) const +ex mul::series(const symbol & s, const ex & point, int order) const { ex acc; // Series accumulator @@ -639,7 +639,7 @@ ex pseries::power_const(const numeric &p, int deg) const /** Implementation of ex::series() for powers. This performs Laurent expansion * of reciprocals of series at singularities. * @see ex::series */ -ex power::series(symbol const & s, ex const & point, int order) const +ex power::series(const symbol & s, const ex & point, int order) const { ex e; if (!is_ex_exactly_of_type(basis, pseries)) { @@ -672,7 +672,7 @@ ex power::series(symbol const & s, ex const & point, int order) const * @param point expansion point * @param order truncation order of series calculations * @return an expression holding a pseries object */ -ex ex::series(symbol const &s, ex const &point, int order) const +ex ex::series(const symbol &s, const ex &point, int order) const { GINAC_ASSERT(bp!=0); return bp->series(s, point, order); @@ -681,7 +681,7 @@ ex ex::series(symbol const &s, ex const &point, int order) const // Global constants const pseries some_pseries; -type_info const & typeid_pseries = typeid(some_pseries); +const type_info & typeid_pseries = typeid(some_pseries); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/pseries.h b/ginac/pseries.h index 6e261d72..0fd99890 100644 --- a/ginac/pseries.h +++ b/ginac/pseries.h @@ -42,15 +42,15 @@ class pseries : public basic public: pseries(); ~pseries(); - pseries(pseries const &other); - pseries const &operator=(pseries const &other); + pseries(const pseries &other); + const pseries &operator=(const pseries &other); protected: - void copy(pseries const &other); + void copy(const pseries &other); void destroy(bool call_parent); // other constructors public: - pseries(ex const &var_, ex const &point_, epvector const &ops_); + pseries(const ex &var_, const ex &point_, const epvector &ops_); // functions overriding virtual functions from base classes public: @@ -60,14 +60,14 @@ public: unsigned nops(void) const; ex op(int i) const; ex &let_op(int i); - int degree(symbol const &s) const; - int ldegree(symbol const &s) const; - ex coeff(symbol const &s, int const n=1) const; + int degree(const symbol &s) const; + int ldegree(const symbol &s) const; + ex coeff(const symbol &s, int n=1) const; ex eval(int level=0) const; ex evalf(int level=0) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; - ex diff(symbol const & s) const; - ex subs(lst const & ls, lst const & lr) const; + ex diff(const symbol & s) const; + ex subs(const lst & ls, const lst & lr) const; // non-virtual functions in this class public: @@ -92,7 +92,7 @@ protected: // global constants extern const pseries some_pseries; -extern type_info const & typeid_pseries; +extern const type_info & typeid_pseries; /** Return a reference to the pseries object embedded in an expression. * The result is undefined if the expression does not contain a pseries diff --git a/ginac/relational.cpp b/ginac/relational.cpp index d854e47d..22890646 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -51,13 +51,13 @@ relational::~relational() destroy(0); } -relational::relational(relational const & other) +relational::relational(const relational & other) { debugmsg("relational copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -relational const & relational::operator=(relational const & other) +const relational & relational::operator=(const relational & other) { debugmsg("relational operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -69,7 +69,7 @@ relational const & relational::operator=(relational const & other) // protected -void relational::copy(relational const & other) +void relational::copy(const relational & other) { basic::copy(other); lh=other.lh; @@ -88,7 +88,7 @@ void relational::destroy(bool call_parent) // public -relational::relational(ex const & lhs, ex const & rhs, operators oper) : basic(TINFO_relational) +relational::relational(const ex & lhs, const ex & rhs, operators oper) : basic(TINFO_relational) { debugmsg("relational constructor ex,ex,operator",LOGLEVEL_CONSTRUCT); lh=lhs; @@ -270,7 +270,7 @@ unsigned relational::nops() const return 2; } -ex & relational::let_op(int const i) +ex & relational::let_op(int i) { GINAC_ASSERT(i>=0); GINAC_ASSERT(i<2); @@ -303,17 +303,17 @@ ex relational::evalf(int level) const setflag(status_flags::dynallocated); } -ex relational::simplify_ncmul(exvector const & v) const +ex relational::simplify_ncmul(const exvector & v) const { return lh.simplify_ncmul(v); } // protected -int relational::compare_same_type(basic const & other) const +int relational::compare_same_type(const basic & other) const { GINAC_ASSERT(is_exactly_of_type(other, relational)); - relational const & oth=static_cast(const_cast(other)); + const relational & oth=static_cast(const_cast(other)); int cmpval; @@ -404,7 +404,7 @@ unsigned relational::precedence=20; ////////// const relational some_relational; -type_info const & typeid_relational=typeid(some_relational); +const type_info & typeid_relational=typeid(some_relational); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/relational.h b/ginac/relational.h index 80d255e5..39b44fb8 100644 --- a/ginac/relational.h +++ b/ginac/relational.h @@ -52,15 +52,15 @@ public: public: relational(); ~relational(); - relational(relational const & other); - relational const & operator=(relational const & other); + relational(const relational & other); + const relational & operator=(const relational & other); protected: - void copy(relational const & other); + void copy(const relational & other); void destroy(bool call_parent); // other constructors public: - relational(ex const & lhs, ex const & rhs, operators oper=equal); + relational(const ex & lhs, const ex & rhs, operators oper=equal); // functions overriding virtual functions from bases classes public: @@ -70,12 +70,12 @@ public: void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; bool info(unsigned inf) const; unsigned nops() const; - ex & let_op(int const i); + ex & let_op(int i); ex eval(int level=0) const; ex evalf(int level=0) const; - ex simplify_ncmul(exvector const & v) const; + ex simplify_ncmul(const exvector & v) const; protected: - int compare_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; @@ -98,7 +98,7 @@ protected: // global constants extern const relational some_relational; -extern type_info const & typeid_relational; +extern const type_info & typeid_relational; // utility functions inline const relational &ex_to_relational(const ex &e) diff --git a/ginac/simp_lor.cpp b/ginac/simp_lor.cpp index c9e0e2de..36b61408 100644 --- a/ginac/simp_lor.cpp +++ b/ginac/simp_lor.cpp @@ -57,13 +57,13 @@ simp_lor::~simp_lor() destroy(0); } -simp_lor::simp_lor(simp_lor const & other) +simp_lor::simp_lor(const simp_lor & other) { debugmsg("simp_lor copy constructor",LOGLEVEL_CONSTRUCT); copy (other); } -simp_lor const & simp_lor::operator=(simp_lor const & other) +const simp_lor & simp_lor::operator=(const simp_lor & other) { debugmsg("simp_lor operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -75,7 +75,7 @@ simp_lor const & simp_lor::operator=(simp_lor const & other) // protected -void simp_lor::copy(simp_lor const & other) +void simp_lor::copy(const simp_lor & other) { indexed::copy(other); type=other.type; @@ -101,7 +101,7 @@ simp_lor::simp_lor(simp_lor_types const t) : type(t) tinfo_key=TINFO_simp_lor; } -simp_lor::simp_lor(simp_lor_types const t, ex const & i1, ex const & i2) : +simp_lor::simp_lor(simp_lor_types const t, const ex & i1, const ex & i2) : indexed(i1,i2), type(t) { debugmsg("simp_lor constructor from simp_lor_types,ex,ex",LOGLEVEL_CONSTRUCT); @@ -109,7 +109,7 @@ simp_lor::simp_lor(simp_lor_types const t, ex const & i1, ex const & i2) : GINAC_ASSERT(all_of_type_lorentzidx()); } -simp_lor::simp_lor(simp_lor_types const t, string const & n, ex const & i1) : +simp_lor::simp_lor(simp_lor_types const t, const string & n, const ex & i1) : indexed(i1), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT); @@ -117,7 +117,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, ex const & i1) : GINAC_ASSERT(all_of_type_lorentzidx()); } -simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector const & iv) : +simp_lor::simp_lor(simp_lor_types const t, const string & n, const exvector & iv) : indexed(iv), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT); @@ -125,7 +125,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector const & iv GINAC_ASSERT(all_of_type_lorentzidx()); } -simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector * ivp) : +simp_lor::simp_lor(simp_lor_types const t, const string & n, exvector * ivp) : indexed(ivp), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT); @@ -207,8 +207,8 @@ ex simp_lor::eval(int level) const if (sig==0) return _ex0(); return ex(sig)*simp_lor(type,name,iv); } - lorentzidx const & idx1=ex_to_lorentzidx(seq[0]); - lorentzidx const & idx2=ex_to_lorentzidx(seq[1]); + const lorentzidx & idx1=ex_to_lorentzidx(seq[0]); + const lorentzidx & idx2=ex_to_lorentzidx(seq[1]); if ((!idx1.is_symbolic())&&(!idx2.is_symbolic())) { // both indices are numeric if ((idx1.get_value()==idx2.get_value())) { @@ -240,7 +240,7 @@ ex simp_lor::eval(int level) const // protected -int simp_lor::compare_same_type(basic const & other) const +int simp_lor::compare_same_type(const basic & other) const { GINAC_ASSERT(other.tinfo() == TINFO_simp_lor); const simp_lor *o = static_cast(&other); @@ -253,7 +253,7 @@ int simp_lor::compare_same_type(basic const & other) const return type < o->type ? -1 : 1; } -bool simp_lor::is_equal_same_type(basic const & other) const +bool simp_lor::is_equal_same_type(const basic & other) const { GINAC_ASSERT(other.tinfo() == TINFO_simp_lor); const simp_lor *o = static_cast(&other); @@ -272,7 +272,7 @@ unsigned simp_lor::return_type_tinfo(void) const return tinfo_key; } -ex simp_lor::thisexprseq(exvector const & v) const +ex simp_lor::thisexprseq(const exvector & v) const { return simp_lor(type,name,v); } @@ -314,23 +314,23 @@ bool simp_lor::all_of_type_lorentzidx(void) const ////////// const simp_lor some_simp_lor; -type_info const & typeid_simp_lor=typeid(some_simp_lor); +const type_info & typeid_simp_lor=typeid(some_simp_lor); ////////// // friend functions ////////// -simp_lor lor_g(ex const & mu, ex const & nu) +simp_lor lor_g(const ex & mu, const ex & nu) { return simp_lor(simp_lor::simp_lor_g,mu,nu); } -simp_lor lor_vec(string const & n, ex const & mu) +simp_lor lor_vec(const string & n, const ex & mu) { return simp_lor(simp_lor::simp_lor_vec,n,mu); } -ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) +ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp) { GINAC_ASSERT(is_ex_exactly_of_type(m,mul)); exvector v_contracted; @@ -356,10 +356,10 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) // process only lor_g objects if (is_ex_exactly_of_type(*it,simp_lor) && (ex_to_simp_lor(*it).type==simp_lor::simp_lor_g)) { - simp_lor const & g=ex_to_simp_lor(*it); + const simp_lor & g=ex_to_simp_lor(*it); GINAC_ASSERT(g.seq.size()==2); - idx const & first_idx=ex_to_lorentzidx(g.seq[0]); - idx const & second_idx=ex_to_lorentzidx(g.seq[1]); + const idx & first_idx=ex_to_lorentzidx(g.seq[0]); + const idx & second_idx=ex_to_lorentzidx(g.seq[1]); // g_{mu,mu} should have been contracted in simp_lor::eval() GINAC_ASSERT(!first_idx.is_equal(second_idx)); ex saved_g=*it; // save to restore it later @@ -409,12 +409,12 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) while ((it2!=v_contracted.end())&&!jump_to_next) { if (is_ex_exactly_of_type(*it2,simp_lor) && (ex_to_simp_lor(*it2).type==simp_lor::simp_lor_vec)) { - simp_lor const & vec1=ex_to_simp_lor(*it1); - simp_lor const & vec2=ex_to_simp_lor(*it2); + const simp_lor & vec1=ex_to_simp_lor(*it1); + const simp_lor & vec2=ex_to_simp_lor(*it2); GINAC_ASSERT(vec1.seq.size()==1); GINAC_ASSERT(vec2.seq.size()==1); - lorentzidx const & idx1=ex_to_lorentzidx(vec1.seq[0]); - lorentzidx const & idx2=ex_to_lorentzidx(vec2.seq[0]); + const lorentzidx & idx1=ex_to_lorentzidx(vec1.seq[0]); + const lorentzidx & idx2=ex_to_lorentzidx(vec2.seq[0]); if (idx1.is_symbolic() && idx1.is_co_contra_pair(idx2) && sp.is_defined(vec1,vec2)) { @@ -436,7 +436,7 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) return m; } -ex simplify_simp_lor(ex const & e, scalar_products const & sp) +ex simplify_simp_lor(const ex & e, const scalar_products & sp) { // all simplification is done on expanded objects ex e_expanded=e.expand(); @@ -469,8 +469,8 @@ ex simplify_simp_lor(ex const & e, scalar_products const & sp) // helper classes ////////// -void scalar_products::reg(simp_lor const & v1, simp_lor const & v2, - ex const & sp) +void scalar_products::reg(const simp_lor & v1, const simp_lor & v2, + const ex & sp) { if (v1.compare_same_type(v2)>0) { reg(v2,v1,sp); @@ -479,7 +479,7 @@ void scalar_products::reg(simp_lor const & v1, simp_lor const & v2, spm[make_key(v1,v2)]=sp; } -bool scalar_products::is_defined(simp_lor const & v1, simp_lor const & v2) const +bool scalar_products::is_defined(const simp_lor & v1, const simp_lor & v2) const { if (v1.compare_same_type(v2)>0) { return is_defined(v2,v1); @@ -487,7 +487,7 @@ bool scalar_products::is_defined(simp_lor const & v1, simp_lor const & v2) const return spm.find(make_key(v1,v2))!=spm.end(); } -ex scalar_products::evaluate(simp_lor const & v1, simp_lor const & v2) const +ex scalar_products::evaluate(const simp_lor & v1, const simp_lor & v2) const { if (v1.compare_same_type(v2)>0) { return evaluate(v2,v1); @@ -499,7 +499,7 @@ void scalar_products::debugprint(void) const { cerr << "map size=" << spm.size() << endl; for (spmap::const_iterator cit=spm.begin(); cit!=spm.end(); ++cit) { - spmapkey const & k=(*cit).first; + const spmapkey & k=(*cit).first; cerr << "item key=((" << k.first.first << "," << k.first.second << "),"; k.second.printraw(cerr); @@ -507,7 +507,7 @@ void scalar_products::debugprint(void) const } } -spmapkey scalar_products::make_key(simp_lor const & v1, simp_lor const & v2) +spmapkey scalar_products::make_key(const simp_lor & v1, const simp_lor & v2) { GINAC_ASSERT(v1.type==simp_lor::simp_lor_vec); GINAC_ASSERT(v2.type==simp_lor::simp_lor_vec); diff --git a/ginac/simp_lor.h b/ginac/simp_lor.h index 2f12668d..5fa9446a 100644 --- a/ginac/simp_lor.h +++ b/ginac/simp_lor.h @@ -41,7 +41,7 @@ typedef pair spmapkey; class spmapkey_is_less { public: - bool operator()(spmapkey const & lh, spmapkey const & rh) const + bool operator()(const spmapkey & lh, const spmapkey & rh) const { /* cerr << "spmapkey_is_less" << endl; @@ -70,12 +70,12 @@ class simp_lor; class scalar_products { public: - void reg(simp_lor const & v1, simp_lor const & v2, ex const & sp); - bool is_defined(simp_lor const & v1, simp_lor const & v2) const; - ex evaluate(simp_lor const & v1, simp_lor const & v2) const; + void reg(const simp_lor & v1, const simp_lor & v2, const ex & sp); + bool is_defined(const simp_lor & v1, const simp_lor & v2) const; + ex evaluate(const simp_lor & v1, const simp_lor & v2) const; void debugprint(void) const; protected: - static spmapkey make_key(simp_lor const & v1, simp_lor const & v2); + static spmapkey make_key(const simp_lor & v1, const simp_lor & v2); protected: spmap spm; }; @@ -86,10 +86,10 @@ class simp_lor : public indexed // friends friend class scalar_products; - friend simp_lor lor_g(ex const & mu, ex const & nu); - friend simp_lor lor_vec(string const & n, ex const & mu); - friend ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp); - friend ex simplify_simp_lor(ex const & e, scalar_products const & sp); + friend simp_lor lor_g(const ex & mu, const ex & nu); + friend simp_lor lor_vec(const string & n, const ex & mu); + friend ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp); + friend ex simplify_simp_lor(const ex & e, const scalar_products & sp); // types @@ -105,19 +105,19 @@ public: public: simp_lor(); ~simp_lor(); - simp_lor(simp_lor const & other); - simp_lor const & operator=(simp_lor const & other); + simp_lor(const simp_lor & other); + const simp_lor & operator=(const simp_lor & other); protected: - void copy(simp_lor const & other); + void copy(const simp_lor & other); void destroy(bool call_parent); // other constructors protected: simp_lor(simp_lor_types const t); - simp_lor(simp_lor_types const t, ex const & i1, ex const & i2); - simp_lor(simp_lor_types const t, string const & n, ex const & i1); - simp_lor(simp_lor_types const t, string const & n, exvector const & iv); - simp_lor(simp_lor_types const t, string const & n, exvector * ivp); + simp_lor(simp_lor_types const t, const ex & i1, const ex & i2); + simp_lor(simp_lor_types const t, const string & n, const ex & i1); + simp_lor(simp_lor_types const t, const string & n, const exvector & iv); + simp_lor(simp_lor_types const t, const string & n, exvector * ivp); // functions overriding virtual functions from base classes public: @@ -129,11 +129,11 @@ public: bool info(unsigned inf) const; ex eval(int level=0) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; - ex thisexprseq(exvector const & v) const; + ex thisexprseq(const exvector & v) const; ex thisexprseq(exvector * vp) const; // new virtual functions which can be overridden by derived classes @@ -153,7 +153,7 @@ protected: // global constants extern const simp_lor some_simp_lor; -extern type_info const & typeid_simp_lor; +extern const type_info & typeid_simp_lor; // utility functions inline const simp_lor &ex_to_simp_lor(const ex &e) @@ -166,10 +166,10 @@ inline simp_lor &ex_to_nonconst_simp_lor(const ex &e) return static_cast(*e.bp); } -simp_lor lor_g(ex const & mu, ex const & nu); -simp_lor lor_vec(string const & n, ex const & mu); -ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp); -ex simplify_simp_lor(ex const & e, scalar_products const & sp); +simp_lor lor_g(const ex & mu, const ex & nu); +simp_lor lor_vec(const string & n, const ex & mu); +ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp); +ex simplify_simp_lor(const ex & e, const scalar_products & sp); ex Dim(void); #ifndef NO_GINAC_NAMESPACE diff --git a/ginac/structure.cpp b/ginac/structure.cpp index 5082a284..d829ba24 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -47,13 +47,13 @@ structure::~structure() destroy(0); } -structure::structure(structure const & other) +structure::structure(const structure & other) { debugmsg("structure copy constructor",LOGLEVEL_CONSTRUCT); copy(other); } -structure const & structure::operator=(structure const & other) +const structure & structure::operator=(const structure & other) { debugmsg("structure operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { @@ -65,7 +65,7 @@ structure const & structure::operator=(structure const & other) // protected -void structure::copy(structure const & other) +void structure::copy(const structure & other) { basic::copy(other); } @@ -125,13 +125,13 @@ void structure::printcsrc(ostream & os, unsigned type, unsigned upper_precedence // protected -int structure::compare_same_type(basic const & other) const +int structure::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other, structure)); return 0; // all structures are the same } -bool structure::is_equal_same_type(basic const & other) const +bool structure::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other, structure)); return true; // all structures are the same @@ -157,7 +157,7 @@ vector & structure::registered_structures(void) // public -unsigned structure::register_new(char const * nm) +unsigned structure::register_new(const char * nm) { registered_structure_info rsi={nm}; registered_structures().push_back(rsi); @@ -175,7 +175,7 @@ unsigned structure::register_new(char const * nm) ////////// const structure some_structure; -type_info const & typeid_structure=typeid(some_structure); +const type_info & typeid_structure=typeid(some_structure); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/structure.h b/ginac/structure.h index a0fe9b7d..6eae9135 100644 --- a/ginac/structure.h +++ b/ginac/structure.h @@ -30,7 +30,7 @@ namespace GiNaC { #endif // ndef NO_GINAC_NAMESPACE struct registered_structure_info { - char const * name; + const char * name; }; /** The class structure is used to implement user defined classes @@ -47,10 +47,10 @@ class structure : public basic public: structure(); ~structure(); - structure(structure const & other); - structure const & operator=(structure const & other); + structure(const structure & other); + const structure & operator=(const structure & other); protected: - void copy(structure const & other); + void copy(const structure & other); void destroy(bool call_parent); // other constructors @@ -64,8 +64,8 @@ public: void printtree(ostream & os, unsigned indent) const; void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; // new virtual functions which can be overridden by derived classes // none @@ -74,7 +74,7 @@ protected: protected: static vector & registered_structures(void); public: - static unsigned register_new(char const * nm); + static unsigned register_new(const char * nm); // member variables // none @@ -84,7 +84,7 @@ public: // global constants extern const structure some_structure; -extern type_info const & typeid_structure; +extern const type_info & typeid_structure; #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC diff --git a/ginac/structure.pl b/ginac/structure.pl index fdd7ddf9..206a24cc 100755 --- a/ginac/structure.pl +++ b/ginac/structure.pl @@ -71,7 +71,7 @@ sub generate { $number_of_members=$#MEMBERS+1; $constructor_arglist=generate('ex tmp_${MEMBER}',', '); -$member_access_functions=generate(' ex const & ${MEMBER}(void) { return m_${MEMBER}; }',"\n"); +$member_access_functions=generate(' const ex & ${MEMBER}(void) { return m_${MEMBER}; }',"\n"); $op_access_indices_decl=generate(' static unsigned op_${MEMBER};',"\n"); $op_access_indices_def=generate('unsigned ${STRUCTURE}::op_${MEMBER}=${N}-1;',"\n"); $members=generate(' ex m_${MEMBER}; ${COMMENT}',"\n"); @@ -179,17 +179,17 @@ public: void print(ostream & os, unsigned upper_precedence=0) const; void printtree(ostream & os, unsigned indent) const; int nops() const; - ex & let_op(int const i); + ex & let_op(int i); ex expand(unsigned options=0) const; - bool has(ex const & other) const; + bool has(const ex & other) const; ex eval(int level=0) const; ex evalf(int level=0) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; - ex diff(symbol const & s) const; - ex subs(lst const & ls, lst const & lr) const; + ex diff(const symbol & s) const; + ex subs(const lst & ls, const lst & lr) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; // new virtual functions which can be overridden by derived classes @@ -210,7 +210,7 @@ ${op_access_indices_decl} // global constants extern const ${STRUCTURE} some_${STRUCTURE}; -extern type_info const & typeid_${STRUCTURE}; +extern const type_info & typeid_${STRUCTURE}; extern const unsigned tinfo_${STRUCTURE}; // macros @@ -358,7 +358,7 @@ int ${STRUCTURE}::nops() const return ${number_of_members}; } -ex & ${STRUCTURE}::let_op(int const i) +ex & ${STRUCTURE}::let_op(int i) { GINAC_ASSERT(i>=0); GINAC_ASSERT(i @@ -464,7 +464,7 @@ ${compare_statements} return 0; } -bool ${STRUCTURE}::is_equal_same_type(basic const & other) const +bool ${STRUCTURE}::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,${STRUCTURE})); ${STRUCTURE} const & o=static_cast<${STRUCTURE} const &> @@ -511,7 +511,7 @@ ${op_access_indices_def} ////////// const ${STRUCTURE} some_${STRUCTURE}; -type_info const & typeid_${STRUCTURE}=typeid(some_${STRUCTURE}); +const type_info & typeid_${STRUCTURE}=typeid(some_${STRUCTURE}); const unsigned tinfo_${STRUCTURE}=structure::register_new("${STRUCTURE}"); #ifndef NO_GINAC_NAMESPACE diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index bf73ccfb..eb8e2546 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -55,13 +55,13 @@ symbol::~symbol() destroy(0); } -symbol::symbol(symbol const & other) +symbol::symbol(const symbol & other) { debugmsg("symbol copy constructor", LOGLEVEL_CONSTRUCT); copy(other); } -void symbol::copy(symbol const & other) +void symbol::copy(const symbol & other) { inherited::copy(other); name=other.name; @@ -92,7 +92,7 @@ void symbol::destroy(bool call_parent) // public -symbol::symbol(string const & initname) : inherited(TINFO_symbol) +symbol::symbol(const string & initname) : inherited(TINFO_symbol) { debugmsg("symbol constructor from string", LOGLEVEL_CONSTRUCT); name=initname; @@ -196,23 +196,23 @@ ex symbol::expand(unsigned options) const return this->hold(); } -bool symbol::has(ex const & other) const +bool symbol::has(const ex & other) const { if (is_equal(*other.bp)) return true; return false; } -int symbol::degree(symbol const & s) const +int symbol::degree(const symbol & s) const { return compare_same_type(s)==0 ? 1 : 0; } -int symbol::ldegree(symbol const & s) const +int symbol::ldegree(const symbol & s) const { return compare_same_type(s)==0 ? 1 : 0; } -ex symbol::coeff(symbol const & s, int const n) const +ex symbol::coeff(const symbol & s, int n) const { if (compare_same_type(s)==0) { return n==1 ? _ex1() : _ex0(); @@ -239,7 +239,7 @@ ex symbol::eval(int level) const } } -ex symbol::subs(lst const & ls, lst const & lr) const +ex symbol::subs(const lst & ls, const lst & lr) const { GINAC_ASSERT(ls.nops()==lr.nops()); #ifdef DO_GINAC_ASSERT @@ -259,7 +259,7 @@ ex symbol::subs(lst const & ls, lst const & lr) const // protected -int symbol::compare_same_type(basic const & other) const +int symbol::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,symbol)); const symbol *o = static_cast(&other); @@ -267,7 +267,7 @@ int symbol::compare_same_type(basic const & other) const return serial < o->serial ? -1 : 1; } -bool symbol::is_equal_same_type(basic const & other) const +bool symbol::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,symbol)); const symbol *o = static_cast(&other); @@ -304,7 +304,7 @@ unsigned symbol::calchash(void) const // public -void symbol::assign(ex const & value) +void symbol::assign(const ex & value) { asexinfop->is_assigned=1; asexinfop->assigned_expression=value; @@ -343,7 +343,7 @@ unsigned symbol::next_serial=0; ////////// const symbol some_symbol; -type_info const & typeid_symbol=typeid(some_symbol); +const type_info & typeid_symbol=typeid(some_symbol); ////////// // subclass assigned_ex_info diff --git a/ginac/symbol.h b/ginac/symbol.h index d633a473..1329054d 100644 --- a/ginac/symbol.h +++ b/ginac/symbol.h @@ -58,14 +58,14 @@ class symbol : public basic public: symbol(); ~symbol(); - symbol(symbol const & other); + symbol(const symbol & other); protected: - void copy(symbol const & other); + void copy(const symbol & other); void destroy(bool call_parent); // other constructors public: - explicit symbol(string const & initname); + explicit symbol(const string & initname); // functions overriding virtual functions from base classes public: @@ -76,28 +76,28 @@ public: void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; bool info(unsigned inf) const; ex expand(unsigned options=0) const; - bool has(ex const & other) const; - int degree(symbol const & s) const; - int ldegree(symbol const & s) const; - ex coeff(symbol const & s, int const n = 1) const; + bool has(const ex & other) const; + int degree(const symbol & s) const; + int ldegree(const symbol & s) const; + ex coeff(const symbol & s, int n = 1) const; ex eval(int level = 0) const; - ex diff(symbol const & s) const; - ex series(symbol const & s, ex const & point, int order) const; + ex diff(const symbol & s) const; + ex series(const symbol & s, const ex & point, int order) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; - ex subs(lst const & ls, lst const & lr) const; + ex subs(const lst & ls, const lst & lr) const; protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; + int compare_same_type(const basic & other) const; + bool is_equal_same_type(const basic & other) const; unsigned return_type(void) const; unsigned return_type_tinfo(void) const; unsigned calchash(void) const; // non-virtual functions in this class public: - void assign(ex const & value); + void assign(const ex & value); void unassign(void); - ex diff(symbol const & s, unsigned nth) const; - void setname(string const & n) {name=n;} + ex diff(const symbol & s, unsigned nth) const; + void setname(const string & n) {name=n;} string getname(void) const {return name;} private: string & autoname_prefix(void); @@ -115,7 +115,7 @@ private: // global constants extern const symbol some_symbol; -extern type_info const & typeid_symbol; +extern const type_info & typeid_symbol; // utility functions inline const symbol &ex_to_symbol(const ex &e) @@ -127,10 +127,10 @@ inline const symbol &ex_to_symbol(const ex &e) inline void unassign(symbol & symarg) { return symarg.unassign(); } -inline int degree(symbol const & a, symbol const & s) +inline int degree(const symbol & a, const symbol & s) { return a.degree(s); } -inline int ldegree(symbol const & a, symbol const & s) +inline int ldegree(const symbol & a, const symbol & s) { return a.ldegree(s); } #ifndef NO_GINAC_NAMESPACE diff --git a/ginac/utils.cpp b/ginac/utils.cpp index a7809879..d54c046a 100644 --- a/ginac/utils.cpp +++ b/ginac/utils.cpp @@ -39,7 +39,7 @@ unsigned log2(unsigned n) /** Compare two pointers (just to establish some sort of canonical order). * @return -1, 0, or 1 */ -int compare_pointers(void const * a, void const * b) +int compare_pointers(const void * a, const void * b) { if (a(e.bp); return *n; } -ex const & _ex_60(void) +const ex & _ex_60(void) { static ex * e = new ex(_num_60()); return *e; } // numeric -120 -numeric const & _num_120(void) +const numeric & _num_120(void) { const static ex e = ex(numeric(-120)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_120(void) +const ex & _ex_120(void) { static ex * e = new ex(_num_120()); return *e; } // numeric -30 -numeric const & _num_30(void) +const numeric & _num_30(void) { const static ex e = ex(numeric(-30)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_30(void) +const ex & _ex_30(void) { static ex * e = new ex(_num_30()); return *e; } // numeric -25 -numeric const & _num_25(void) +const numeric & _num_25(void) { const static ex e = ex(numeric(-25)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_25(void) +const ex & _ex_25(void) { static ex * e = new ex(_num_25()); return *e; } // numeric -24 -numeric const & _num_24(void) +const numeric & _num_24(void) { const static ex e = ex(numeric(-24)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_24(void) +const ex & _ex_24(void) { static ex * e = new ex(_num_24()); return *e; } // numeric -20 -numeric const & _num_20(void) +const numeric & _num_20(void) { const static ex e = ex(numeric(-20)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_20(void) +const ex & _ex_20(void) { static ex * e = new ex(_num_20()); return *e; } // numeric -18 -numeric const & _num_18(void) +const numeric & _num_18(void) { const static ex e = ex(numeric(-18)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_18(void) +const ex & _ex_18(void) { static ex * e = new ex(_num_18()); return *e; } // numeric -15 -numeric const & _num_15(void) +const numeric & _num_15(void) { const static ex e = ex(numeric(-15)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_15(void) +const ex & _ex_15(void) { static ex * e = new ex(_num_15()); return *e; } // numeric -12 -numeric const & _num_12(void) +const numeric & _num_12(void) { const static ex e = ex(numeric(-12)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_12(void) +const ex & _ex_12(void) { static ex * e = new ex(_num_12()); return *e; } // numeric -11 -numeric const & _num_11(void) +const numeric & _num_11(void) { const static ex e = ex(numeric(-11)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_11(void) +const ex & _ex_11(void) { static ex * e = new ex(_num_11()); return *e; } // numeric -10 -numeric const & _num_10(void) +const numeric & _num_10(void) { const static ex e = ex(numeric(-10)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_10(void) +const ex & _ex_10(void) { static ex * e = new ex(_num_10()); return *e; } // numeric -9 -numeric const & _num_9(void) +const numeric & _num_9(void) { const static ex e = ex(numeric(-9)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_9(void) +const ex & _ex_9(void) { static ex * e = new ex(_num_9()); return *e; } // numeric -8 -numeric const & _num_8(void) +const numeric & _num_8(void) { const static ex e = ex(numeric(-8)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_8(void) +const ex & _ex_8(void) { static ex * e = new ex(_num_8()); return *e; } // numeric -7 -numeric const & _num_7(void) +const numeric & _num_7(void) { const static ex e = ex(numeric(-7)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_7(void) +const ex & _ex_7(void) { static ex * e = new ex(_num_7()); return *e; } // numeric -6 -numeric const & _num_6(void) +const numeric & _num_6(void) { const static ex e = ex(numeric(-6)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_6(void) +const ex & _ex_6(void) { static ex * e = new ex(_num_6()); return *e; } // numeric -5 -numeric const & _num_5(void) +const numeric & _num_5(void) { const static ex e = ex(numeric(-5)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_5(void) +const ex & _ex_5(void) { static ex * e = new ex(_num_5()); return *e; } // numeric -4 -numeric const & _num_4(void) +const numeric & _num_4(void) { const static ex e = ex(numeric(-4)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_4(void) +const ex & _ex_4(void) { static ex * e = new ex(_num_4()); return *e; } // numeric -3 -numeric const & _num_3(void) +const numeric & _num_3(void) { const static ex e = ex(numeric(-3)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_3(void) +const ex & _ex_3(void) { static ex * e = new ex(_num_3()); return *e; } // numeric -2 -numeric const & _num_2(void) +const numeric & _num_2(void) { const static ex e = ex(numeric(-2)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_2(void) +const ex & _ex_2(void) { static ex * e = new ex(_num_2()); return *e; } // numeric -1 -numeric const & _num_1(void) +const numeric & _num_1(void) { const static ex e = ex(numeric(-1)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_1(void) +const ex & _ex_1(void) { static ex * e = new ex(_num_1()); return *e; } // numeric -1/2 -numeric const & _num_1_2(void) +const numeric & _num_1_2(void) { const static ex e = ex(numeric(-1,2)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_1_2(void) +const ex & _ex_1_2(void) { static ex * e = new ex(_num_1_2()); return *e; } // numeric -1/3 -numeric const & _num_1_3(void) +const numeric & _num_1_3(void) { const static ex e = ex(numeric(-1,3)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_1_3(void) +const ex & _ex_1_3(void) { static ex * e = new ex(_num_1_3()); return *e; } // numeric -1/4 -numeric const & _num_1_4(void) +const numeric & _num_1_4(void) { const static ex e = ex(numeric(-1,4)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex_1_4(void) +const ex & _ex_1_4(void) { static ex * e = new ex(_num_1_4()); return *e; } // numeric 0 -numeric const & _num0(void) +const numeric & _num0(void) { const static ex e = ex(numeric(0)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex0(void) +const ex & _ex0(void) { static ex * e = new ex(_num0()); return *e; } // numeric 1/4 -numeric const & _num1_4(void) +const numeric & _num1_4(void) { const static ex e = ex(numeric(1,4)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex1_4(void) +const ex & _ex1_4(void) { static ex * e = new ex(_num1_4()); return *e; } // numeric 1/3 -numeric const & _num1_3(void) +const numeric & _num1_3(void) { const static ex e = ex(numeric(1,3)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex1_3(void) +const ex & _ex1_3(void) { static ex * e = new ex(_num1_3()); return *e; } // numeric 1/2 -numeric const & _num1_2(void) +const numeric & _num1_2(void) { const static ex e = ex(numeric(1,2)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex1_2(void) +const ex & _ex1_2(void) { static ex * e = new ex(_num1_2()); return *e; } // numeric 1 -numeric const & _num1(void) +const numeric & _num1(void) { const static ex e = ex(numeric(1)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex1(void) +const ex & _ex1(void) { static ex * e = new ex(_num1()); return *e; } // numeric 2 -numeric const & _num2(void) +const numeric & _num2(void) { const static ex e = ex(numeric(2)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex2(void) +const ex & _ex2(void) { static ex * e = new ex(_num2()); return *e; } // numeric 3 -numeric const & _num3(void) +const numeric & _num3(void) { const static ex e = ex(numeric(3)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex3(void) +const ex & _ex3(void) { static ex * e = new ex(_num3()); return *e; } // numeric 4 -numeric const & _num4(void) +const numeric & _num4(void) { const static ex e = ex(numeric(4)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex4(void) +const ex & _ex4(void) { static ex * e = new ex(_num4()); return *e; } // numeric 5 -numeric const & _num5(void) +const numeric & _num5(void) { const static ex e = ex(numeric(5)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex5(void) +const ex & _ex5(void) { static ex * e = new ex(_num5()); return *e; } // numeric 6 -numeric const & _num6(void) +const numeric & _num6(void) { const static ex e = ex(numeric(6)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex6(void) +const ex & _ex6(void) { static ex * e = new ex(_num6()); return *e; } // numeric 7 -numeric const & _num7(void) +const numeric & _num7(void) { const static ex e = ex(numeric(7)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex7(void) +const ex & _ex7(void) { static ex * e = new ex(_num7()); return *e; } // numeric 8 -numeric const & _num8(void) +const numeric & _num8(void) { const static ex e = ex(numeric(8)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex8(void) +const ex & _ex8(void) { static ex * e = new ex(_num8()); return *e; } // numeric 9 -numeric const & _num9(void) +const numeric & _num9(void) { const static ex e = ex(numeric(9)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex9(void) +const ex & _ex9(void) { static ex * e = new ex(_num9()); return *e; } // numeric 10 -numeric const & _num10(void) +const numeric & _num10(void) { const static ex e = ex(numeric(10)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex10(void) +const ex & _ex10(void) { static ex * e = new ex(_num10()); return *e; } // numeric 11 -numeric const & _num11(void) +const numeric & _num11(void) { const static ex e = ex(numeric(11)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex11(void) +const ex & _ex11(void) { static ex * e = new ex(_num11()); return *e; } // numeric 12 -numeric const & _num12(void) +const numeric & _num12(void) { const static ex e = ex(numeric(12)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex12(void) +const ex & _ex12(void) { static ex * e = new ex(_num12()); return *e; } // numeric 15 -numeric const & _num15(void) +const numeric & _num15(void) { const static ex e = ex(numeric(15)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex15(void) +const ex & _ex15(void) { static ex * e = new ex(_num15()); return *e; } // numeric 18 -numeric const & _num18(void) +const numeric & _num18(void) { const static ex e = ex(numeric(18)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex18(void) +const ex & _ex18(void) { static ex * e = new ex(_num18()); return *e; } // numeric 20 -numeric const & _num20(void) +const numeric & _num20(void) { const static ex e = ex(numeric(20)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex20(void) +const ex & _ex20(void) { static ex * e = new ex(_num20()); return *e; } // numeric 24 -numeric const & _num24(void) +const numeric & _num24(void) { const static ex e = ex(numeric(24)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex24(void) +const ex & _ex24(void) { static ex * e = new ex(_num24()); return *e; } // numeric 25 -numeric const & _num25(void) +const numeric & _num25(void) { const static ex e = ex(numeric(25)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex25(void) +const ex & _ex25(void) { static ex * e = new ex(_num25()); return *e; } // numeric 30 -numeric const & _num30(void) +const numeric & _num30(void) { const static ex e = ex(numeric(30)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex30(void) +const ex & _ex30(void) { static ex * e = new ex(_num30()); return *e; } // numeric 60 -numeric const & _num60(void) +const numeric & _num60(void) { const static ex e = ex(numeric(60)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex60(void) +const ex & _ex60(void) { static ex * e = new ex(_num60()); return *e; } // numeric 120 -numeric const & _num120(void) +const numeric & _num120(void) { const static ex e = ex(numeric(120)); const static numeric * n = static_cast(e.bp); return *n; } -ex const & _ex120(void) +const ex & _ex120(void) { static ex * e = new ex(_num120()); return *e; diff --git a/ginac/utils.h b/ginac/utils.h index e0b03087..4af88eba 100644 --- a/ginac/utils.h +++ b/ginac/utils.h @@ -47,7 +47,7 @@ class do_taylor {}; unsigned log2(unsigned n); -int compare_pointers(void const * a, void const * b); +int compare_pointers(const void * a, const void * b); /** Rotate lower 31 bits of unsigned value by one bit to the left * (upper bits get cleared). */ @@ -147,100 +147,100 @@ OutputIterator mymerge3(InputIterator1 first1, InputIterator1 last1, class numeric; class ex; -numeric const & _num_120(void); // -120 -ex const & _ex_120(void); -numeric const & _num_60(void); // -60 -ex const & _ex_60(void); -numeric const & _num_30(void); // -30 -ex const & _ex_30(void); -numeric const & _num_25(void); // -25 -ex const & _ex_25(void); -numeric const & _num_24(void); // -24 -ex const & _ex_24(void); -numeric const & _num_20(void); // -20 -ex const & _ex_20(void); -numeric const & _num_18(void); // -18 -ex const & _ex_18(void); -numeric const & _num_15(void); // -15 -ex const & _ex_15(void); -numeric const & _num_12(void); // -12 -ex const & _ex_12(void); -numeric const & _num_11(void); // -11 -ex const & _ex_11(void); -numeric const & _num_10(void); // -10 -ex const & _ex_10(void); -numeric const & _num_9(void); // -9 -ex const & _ex_9(void); -numeric const & _num_8(void); // -8 -ex const & _ex_8(void); -numeric const & _num_7(void); // -7 -ex const & _ex_7(void); -numeric const & _num_6(void); // -6 -ex const & _ex_6(void); -numeric const & _num_5(void); // -5 -ex const & _ex_5(void); -numeric const & _num_4(void); // -4 -ex const & _ex_4(void); -numeric const & _num_3(void); // -3 -ex const & _ex_3(void); -numeric const & _num_2(void); // -2 -ex const & _ex_2(void); -numeric const & _num_1(void); // -1 -ex const & _ex_1(void); -numeric const & _num_1_2(void); // -1/2 -ex const & _ex_1_2(void); -numeric const & _num_1_3(void); // -1/3 -ex const & _ex_1_3(void); -numeric const & _num_1_4(void); // -1/4 -ex const & _ex_1_4(void); -numeric const & _num0(void); // 0 -ex const & _ex0(void); -numeric const & _num1_4(void); // 1/4 -ex const & _ex1_4(void); -numeric const & _num1_3(void); // 1/3 -ex const & _ex1_3(void); -numeric const & _num1_2(void); // 1/2 -ex const & _ex1_2(void); -numeric const & _num1(void); // 1 -ex const & _ex1(void); -numeric const & _num2(void); // 2 -ex const & _ex2(void); -numeric const & _num3(void); // 3 -ex const & _ex3(void); -numeric const & _num4(void); // 4 -ex const & _ex4(void); -numeric const & _num5(void); // 5 -ex const & _ex5(void); -numeric const & _num6(void); // 6 -ex const & _ex6(void); -numeric const & _num7(void); // 7 -ex const & _ex7(void); -numeric const & _num8(void); // 8 -ex const & _ex8(void); -numeric const & _num9(void); // 9 -ex const & _ex9(void); -numeric const & _num10(void); // 10 -ex const & _ex10(void); -numeric const & _num11(void); // 11 -ex const & _ex11(void); -numeric const & _num12(void); // 12 -ex const & _ex12(void); -numeric const & _num15(void); // 15 -ex const & _ex15(void); -numeric const & _num18(void); // 18 -ex const & _ex18(void); -numeric const & _num20(void); // 20 -ex const & _ex20(void); -numeric const & _num24(void); // 24 -ex const & _ex24(void); -numeric const & _num25(void); // 25 -ex const & _ex25(void); -numeric const & _num30(void); // 30 -ex const & _ex30(void); -numeric const & _num60(void); // 60 -ex const & _ex60(void); -numeric const & _num120(void); // 120 -ex const & _ex120(void); +const numeric & _num_120(void); // -120 +const ex & _ex_120(void); +const numeric & _num_60(void); // -60 +const ex & _ex_60(void); +const numeric & _num_30(void); // -30 +const ex & _ex_30(void); +const numeric & _num_25(void); // -25 +const ex & _ex_25(void); +const numeric & _num_24(void); // -24 +const ex & _ex_24(void); +const numeric & _num_20(void); // -20 +const ex & _ex_20(void); +const numeric & _num_18(void); // -18 +const ex & _ex_18(void); +const numeric & _num_15(void); // -15 +const ex & _ex_15(void); +const numeric & _num_12(void); // -12 +const ex & _ex_12(void); +const numeric & _num_11(void); // -11 +const ex & _ex_11(void); +const numeric & _num_10(void); // -10 +const ex & _ex_10(void); +const numeric & _num_9(void); // -9 +const ex & _ex_9(void); +const numeric & _num_8(void); // -8 +const ex & _ex_8(void); +const numeric & _num_7(void); // -7 +const ex & _ex_7(void); +const numeric & _num_6(void); // -6 +const ex & _ex_6(void); +const numeric & _num_5(void); // -5 +const ex & _ex_5(void); +const numeric & _num_4(void); // -4 +const ex & _ex_4(void); +const numeric & _num_3(void); // -3 +const ex & _ex_3(void); +const numeric & _num_2(void); // -2 +const ex & _ex_2(void); +const numeric & _num_1(void); // -1 +const ex & _ex_1(void); +const numeric & _num_1_2(void); // -1/2 +const ex & _ex_1_2(void); +const numeric & _num_1_3(void); // -1/3 +const ex & _ex_1_3(void); +const numeric & _num_1_4(void); // -1/4 +const ex & _ex_1_4(void); +const numeric & _num0(void); // 0 +const ex & _ex0(void); +const numeric & _num1_4(void); // 1/4 +const ex & _ex1_4(void); +const numeric & _num1_3(void); // 1/3 +const ex & _ex1_3(void); +const numeric & _num1_2(void); // 1/2 +const ex & _ex1_2(void); +const numeric & _num1(void); // 1 +const ex & _ex1(void); +const numeric & _num2(void); // 2 +const ex & _ex2(void); +const numeric & _num3(void); // 3 +const ex & _ex3(void); +const numeric & _num4(void); // 4 +const ex & _ex4(void); +const numeric & _num5(void); // 5 +const ex & _ex5(void); +const numeric & _num6(void); // 6 +const ex & _ex6(void); +const numeric & _num7(void); // 7 +const ex & _ex7(void); +const numeric & _num8(void); // 8 +const ex & _ex8(void); +const numeric & _num9(void); // 9 +const ex & _ex9(void); +const numeric & _num10(void); // 10 +const ex & _ex10(void); +const numeric & _num11(void); // 11 +const ex & _ex11(void); +const numeric & _num12(void); // 12 +const ex & _ex12(void); +const numeric & _num15(void); // 15 +const ex & _ex15(void); +const numeric & _num18(void); // 18 +const ex & _ex18(void); +const numeric & _num20(void); // 20 +const ex & _ex20(void); +const numeric & _num24(void); // 24 +const ex & _ex24(void); +const numeric & _num25(void); // 25 +const ex & _ex25(void); +const numeric & _num30(void); // 30 +const ex & _ex30(void); +const numeric & _num60(void); // 60 +const ex & _ex60(void); +const numeric & _num120(void); // 120 +const ex & _ex120(void); #ifndef NO_GINAC_NAMESPACE } // namespace GiNaC