From: Christian Bauer Date: Fri, 11 Aug 2000 21:39:36 +0000 (+0000) Subject: - more indentation fixes X-Git-Tag: release_0-7-0~42 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=7d10a252470cc6501b2c66bf9d6774c79b093761 - more indentation fixes --- diff --git a/ginac/add.cpp b/ginac/add.cpp index 40ccc23f..fa421530 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -50,7 +50,7 @@ add::add() add::~add() { debugmsg("add destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } add::add(const add & other) @@ -63,7 +63,7 @@ const add & add::operator=(const add & other) { debugmsg("add operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -539,9 +539,7 @@ ex add::expand(unsigned options) const if (vp==0) return *this; - return (new add(vp,overall_coeff))-> - setflag(status_flags::expanded | - status_flags::dynallocated); + return (new add(vp,overall_coeff))->setflag(status_flags::expanded | status_flags::dynallocated); } ////////// diff --git a/ginac/archive.cpp b/ginac/archive.cpp index f2372313..dcfb00dc 100644 --- a/ginac/archive.cpp +++ b/ginac/archive.cpp @@ -321,7 +321,7 @@ const std::string &archive::unatomize(archive_atom id) const /** Copy constructor of archive_node. */ archive_node::archive_node(const archive_node &other) - : a(other.a), props(other.props), has_expression(other.has_expression), e(other.e) + : a(other.a), props(other.props), has_expression(other.has_expression), e(other.e) { } @@ -341,7 +341,7 @@ const archive_node &archive_node::operator=(const archive_node &other) /** Recursively construct archive node from expression. */ archive_node::archive_node(archive &ar, const ex &expr) - : a(ar), has_expression(true), e(expr) + : a(ar), has_expression(true), e(expr) { expr.bp->archive(*this); } diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 0ca273a9..8dcf5843 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -57,7 +57,7 @@ basic::basic() : flags(0), refcount(0), tinfo_key(TINFO_BASIC) basic::~basic() { debugmsg("basic destructor", LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); GINAC_ASSERT((!(flags & status_flags::dynallocated))||(refcount==0)); } @@ -72,7 +72,7 @@ const basic & basic::operator=(const basic & other) { debugmsg("basic operator=", LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -321,7 +321,7 @@ ex basic::diff(const symbol & s, unsigned nth) const ex ndiff = this->derivative(s); while (!ndiff.is_zero() && // stop differentiating zeros - nth>1) { + nth>1) { ndiff = ndiff.diff(s); --nth; } diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 742fd002..02aff19b 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -50,7 +50,7 @@ clifford::clifford() clifford::~clifford() { debugmsg("clifford destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } clifford::clifford(const clifford & other) @@ -63,7 +63,7 @@ const clifford & clifford::operator=(const clifford & other) { debugmsg("clifford operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; diff --git a/ginac/color.cpp b/ginac/color.cpp index 82096b57..34c3a85f 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -58,7 +58,7 @@ color::color() : type(invalid), representation_label(0) color::~color() { debugmsg("color destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } color::color(const color & other) @@ -71,8 +71,8 @@ const color & color::operator=(const color & other) { debugmsg("color operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); - copy(other); + destroy(true); + copy(other); } return *this; } @@ -108,7 +108,7 @@ color::color(color_types const t, unsigned rl) : type(t), representation_label(r } color::color(color_types const t, const ex & i1, unsigned rl) - : inherited(i1), type(t), representation_label(rl) + : inherited(i1), type(t), representation_label(rl) { debugmsg("color constructor from color_types,ex,unsigned",LOGLEVEL_CONSTRUCT); GINAC_ASSERT(representation_labelhold(); } - return (new expairseq(vp,overall_coeff)) - ->setflag(status_flags::dynallocated | - status_flags::evaluated ); + return (new expairseq(vp,overall_coeff))->setflag(status_flags::dynallocated | status_flags::evaluated); } ex expairseq::evalf(int level) const @@ -573,8 +571,8 @@ void expairseq::printpair(std::ostream & os, const expair & p, unsigned upper_pr } void expairseq::printseq(std::ostream & os, char delim, - unsigned this_precedence, - unsigned upper_precedence) const + unsigned this_precedence, + unsigned upper_precedence) const { if (this_precedence<=upper_precedence) os << "("; epvector::const_iterator it,it_last; @@ -597,7 +595,7 @@ expair expairseq::split_ex_to_pair(const ex & e) const } expair expairseq::combine_ex_with_coeff_to_pair(const ex & e, - const ex & c) const + const ex & c) const { GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); @@ -605,7 +603,7 @@ expair expairseq::combine_ex_with_coeff_to_pair(const ex & e, } expair expairseq::combine_pair_with_coeff_to_pair(const expair & p, - const ex & c) const + const ex & c) const { GINAC_ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); @@ -641,7 +639,7 @@ void expairseq::combine_overall_coeff(const ex & c1, const ex & c2) GINAC_ASSERT(is_ex_exactly_of_type(c1,numeric)); GINAC_ASSERT(is_ex_exactly_of_type(c2,numeric)); overall_coeff = ex_to_numeric(overall_coeff). - add_dyn(ex_to_numeric(c1).mul(ex_to_numeric(c2))); + add_dyn(ex_to_numeric(c1).mul(ex_to_numeric(c2))); } bool expairseq::can_make_flat(const expair & p) const @@ -670,33 +668,33 @@ void expairseq::construct_from_2_ex_via_exvector(const ex & lh, const ex & rh) void expairseq::construct_from_2_ex(const ex & lh, const ex & rh) { if (lh.bp->tinfo()==tinfo()) { - if (rh.bp->tinfo()==tinfo()) { + if (rh.bp->tinfo()==tinfo()) { #ifdef EXPAIRSEQ_USE_HASHTAB - unsigned totalsize=ex_to_expairseq(lh).seq.size()+ - ex_to_expairseq(rh).seq.size(); - if (calc_hashtabsize(totalsize)!=0) { - construct_from_2_ex_via_exvector(lh,rh); - } else { + unsigned totalsize = ex_to_expairseq(lh).seq.size() + + ex_to_expairseq(rh).seq.size(); + if (calc_hashtabsize(totalsize)!=0) { + construct_from_2_ex_via_exvector(lh,rh); + } else { #endif // def EXPAIRSEQ_USE_HASHTAB - construct_from_2_expairseq(ex_to_expairseq(lh), - ex_to_expairseq(rh)); + construct_from_2_expairseq(ex_to_expairseq(lh), + ex_to_expairseq(rh)); #ifdef EXPAIRSEQ_USE_HASHTAB - } + } #endif // def EXPAIRSEQ_USE_HASHTAB - return; - } else { + return; + } else { #ifdef EXPAIRSEQ_USE_HASHTAB - unsigned totalsize=ex_to_expairseq(lh).seq.size()+1; - if (calc_hashtabsize(totalsize)!=0) { - construct_from_2_ex_via_exvector(lh,rh); - } else { + unsigned totalsize=ex_to_expairseq(lh).seq.size()+1; + if (calc_hashtabsize(totalsize) != 0) { + construct_from_2_ex_via_exvector(lh, rh); + } else { #endif // def EXPAIRSEQ_USE_HASHTAB - construct_from_expairseq_ex(ex_to_expairseq(lh),rh); + construct_from_expairseq_ex(ex_to_expairseq(lh), rh); #ifdef EXPAIRSEQ_USE_HASHTAB - } + } #endif // def EXPAIRSEQ_USE_HASHTAB - return; - } + return; + } } else if (rh.bp->tinfo()==tinfo()) { #ifdef EXPAIRSEQ_USE_HASHTAB unsigned totalsize=ex_to_expairseq(rh).seq.size()+1; @@ -776,8 +774,8 @@ void expairseq::construct_from_2_expairseq(const expairseq & s1, int cmpval=(*first1).rest.compare((*first2).rest); if (cmpval==0) { // combine terms - const numeric & newcoeff=ex_to_numeric((*first1).coeff). - add(ex_to_numeric((*first2).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)); if (expair_needs_further_processing(seq.end()-1)) { @@ -835,8 +833,8 @@ void expairseq::construct_from_expairseq_ex(const expairseq & s, int cmpval=(*first).rest.compare(p.rest); if (cmpval==0) { // combine terms - const numeric & newcoeff=ex_to_numeric((*first).coeff). - add(ex_to_numeric(p.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)); if (expair_needs_further_processing(seq.end()-1)) { @@ -983,11 +981,11 @@ void expairseq::make_flat(const epvector & v) if ((cit->rest.bp->tinfo()==tinfo())&&can_make_flat(*cit)) { const expairseq & subseqref=ex_to_expairseq((*cit).rest); combine_overall_coeff(ex_to_numeric(subseqref.overall_coeff), - ex_to_numeric((*cit).coeff)); + ex_to_numeric((*cit).coeff)); epvector::const_iterator cit_s=subseqref.seq.begin(); while (cit_s!=subseqref.seq.end()) { seq.push_back(expair((*cit_s).rest, - ex_to_numeric((*cit_s).coeff).mul_dyn(ex_to_numeric((*cit).coeff)))); + ex_to_numeric((*cit_s).coeff).mul_dyn(ex_to_numeric((*cit).coeff)))); //seq.push_back(combine_pair_with_coeff_to_pair(*cit_s, // (*cit).coeff)); ++cit_s; @@ -1134,8 +1132,8 @@ void expairseq::combine_same_terms_sorted_seq(void) bool must_copy=false; while (itin2!=last) { if ((*itin1).rest.compare((*itin2).rest)==0) { - (*itin1).coeff=ex_to_numeric((*itin1).coeff). - add_dyn(ex_to_numeric((*itin2).coeff)); + (*itin1).coeff = ex_to_numeric((*itin1).coeff). + add_dyn(ex_to_numeric((*itin2).coeff)); if (expair_needs_further_processing(itin1)) { needs_further_processing = true; } @@ -1309,9 +1307,9 @@ void expairseq::sorted_insert(epplist & eppl, epp elem) } void expairseq::build_hashtab_and_combine(epvector::iterator & first_numeric, - epvector::iterator & last_non_zero, - vector & touched, - unsigned & number_of_zeroes) + epvector::iterator & last_non_zero, + vector & touched, + unsigned & number_of_zeroes) { epp current=seq.begin(); @@ -1336,8 +1334,8 @@ void expairseq::build_hashtab_and_combine(epvector::iterator & first_numeric, ++current; } else { // epplit points to a matching expair, combine it with current - (*(*epplit)).coeff=ex_to_numeric((*(*epplit)).coeff). - add_dyn(ex_to_numeric((*current).coeff)); + (*(*epplit)).coeff = ex_to_numeric((*(*epplit)).coeff). + add_dyn(ex_to_numeric((*current).coeff)); // move obsolete current expair to end by swapping with last_non_zero element // if this was a numeric, it is swapped with the expair before first_numeric @@ -1354,9 +1352,9 @@ void expairseq::build_hashtab_and_combine(epvector::iterator & first_numeric, } void expairseq::drop_coeff_0_terms(epvector::iterator & first_numeric, - epvector::iterator & last_non_zero, - vector & touched, - unsigned & number_of_zeroes) + epvector::iterator & last_non_zero, + vector & touched, + unsigned & number_of_zeroes) { // move terms with coeff 0 to end and remove them from hashtab // check only those elements which have been touched @@ -1390,7 +1388,7 @@ void expairseq::drop_coeff_0_terms(epvector::iterator & first_numeric, ++number_of_zeroes; if (first_numeric!=current) { - + // change entry in hashtab which referred to first_numeric or last_non_zero to current move_hashtab_entry(changed_entry,current); touched[current-seq.begin()]=touched[changed_entry-seq.begin()]; @@ -1563,12 +1561,12 @@ epvector * expairseq::expandchildren(unsigned options) const } // copy first changed element s->push_back(combine_ex_with_coeff_to_pair(expanded_ex, - (*cit2).coeff)); + (*cit2).coeff)); ++cit2; // copy rest while (cit2!=last) { s->push_back(combine_ex_with_coeff_to_pair((*cit2).rest.expand(options), - (*cit2).coeff)); + (*cit2).coeff)); ++cit2; } return s; @@ -1611,12 +1609,12 @@ epvector * expairseq::evalchildren(int level) const } // copy first changed element s->push_back(combine_ex_with_coeff_to_pair(evaled_ex, - (*cit2).coeff)); + (*cit2).coeff)); ++cit2; // copy rest while (cit2!=last) { s->push_back(combine_ex_with_coeff_to_pair((*cit2).rest.eval(level), - (*cit2).coeff)); + (*cit2).coeff)); ++cit2; } return s; @@ -1641,7 +1639,7 @@ epvector expairseq::evalfchildren(int level) const --level; for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) { s.push_back(combine_ex_with_coeff_to_pair((*it).rest.evalf(level), - (*it).coeff.evalf(level))); + (*it).coeff.evalf(level))); } return s; } @@ -1660,7 +1658,7 @@ epvector expairseq::normalchildren(int level) const --level; for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) { s.push_back(combine_ex_with_coeff_to_pair((*it).rest.normal(level), - (*it).coeff)); + (*it).coeff)); } return s; } @@ -1672,7 +1670,7 @@ epvector expairseq::diffchildren(const symbol & y) const for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) { s.push_back(combine_ex_with_coeff_to_pair((*it).rest.diff(y), - (*it).coeff)); + (*it).coeff)); } return s; } @@ -1702,12 +1700,12 @@ epvector * expairseq::subschildren(const lst & ls, const lst & lr) const } // copy first changed element s->push_back(combine_ex_with_coeff_to_pair(subsed_ex, - (*cit2).coeff)); + (*cit2).coeff)); ++cit2; // copy rest while (cit2!=last) { s->push_back(combine_ex_with_coeff_to_pair((*cit2).rest.subs(ls,lr), - (*cit2).coeff)); + (*cit2).coeff)); ++cit2; } return s; diff --git a/ginac/exprseq_suppl.cpp b/ginac/exprseq_suppl.cpp index 2d7e7bf9..1e4ef616 100644 --- a/ginac/exprseq_suppl.cpp +++ b/ginac/exprseq_suppl.cpp @@ -30,7 +30,8 @@ namespace GiNaC { bool exprseq::info(unsigned inf) const { - if (inf==info_flags::exprseq) return 1; + if (inf==info_flags::exprseq) + return 1; return basic::info(inf); } diff --git a/ginac/fail.cpp b/ginac/fail.cpp index 37baafba..2cea9eb1 100644 --- a/ginac/fail.cpp +++ b/ginac/fail.cpp @@ -45,7 +45,7 @@ fail::fail() : inherited(TINFO_fail) fail::~fail() { debugmsg("fail destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } fail::fail(const fail & other) @@ -58,7 +58,7 @@ const fail & fail::operator=(const fail & other) { debugmsg("fail operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; diff --git a/ginac/function.pl b/ginac/function.pl index ac2dc877..fac659f5 100755 --- a/ginac/function.pl +++ b/ginac/function.pl @@ -636,7 +636,7 @@ function::function() : serial(0) function::~function() { debugmsg("function destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } function::function(const function & other) @@ -649,7 +649,7 @@ const function & function::operator=(const function & other) { debugmsg("function operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; diff --git a/ginac/idx.cpp b/ginac/idx.cpp index 8a31ec7e..08b982c3 100644 --- a/ginac/idx.cpp +++ b/ginac/idx.cpp @@ -52,7 +52,7 @@ idx::idx() : inherited(TINFO_idx), symbolic(true), covariant(false) idx::~idx() { debugmsg("idx destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } idx::idx(const idx & other) @@ -65,7 +65,7 @@ const idx & idx::operator=(const idx & other) { debugmsg("idx operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -108,15 +108,13 @@ idx::idx(const std::string & n, bool cov) : inherited(TINFO_idx), serial = next_serial++; } -idx::idx(const char * n, bool cov) : inherited(TINFO_idx), - symbolic(true), name(n), covariant(cov) +idx::idx(const char * n, bool cov) : inherited(TINFO_idx), symbolic(true), name(n), covariant(cov) { debugmsg("idx constructor from char*,bool",LOGLEVEL_CONSTRUCT); serial = next_serial++; } -idx::idx(unsigned v, bool cov) : inherited(TINFO_idx), - symbolic(false), value(v), covariant(cov) +idx::idx(unsigned v, bool cov) : inherited(TINFO_idx), symbolic(false), value(v), covariant(cov) { debugmsg("idx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); serial = 0; @@ -273,8 +271,7 @@ ex idx::subs(const lst & ls, const lst & lr) const int idx::compare_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,idx)); - const idx & o=static_cast - (const_cast(other)); + const idx & o=static_cast(const_cast(other)); if (covariant!=o.covariant) { // different co/contravariant @@ -301,8 +298,7 @@ int idx::compare_same_type(const basic & other) const bool idx::is_equal_same_type(const basic & other) const { GINAC_ASSERT(is_of_type(other,idx)); - const idx & o=static_cast - (const_cast(other)); + const idx & o=static_cast(const_cast(other)); if (covariant!=o.covariant) return false; if (symbolic!=o.symbolic) return false; @@ -327,8 +323,7 @@ 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)); - const idx & o=static_cast - (const_cast(other)); + const idx & o=static_cast(const_cast(other)); if (covariant==o.covariant) return false; if (symbolic!=o.symbolic) return false; @@ -439,7 +434,7 @@ 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) + bool antisymmetric, int * sig) { // match (return value,iv2) to iv3 by permuting indices // iv3 is always cyclic @@ -488,7 +483,7 @@ unsigned count_index(const ex & e, const ex & i) } ex subs_indices(const ex & e, const exvector & idxv_subs, - const exvector & idxv_repl) + const exvector & idxv_repl) { GINAC_ASSERT(idxv_subs.size()==idxv_repl.size()); ex res=e; diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index 0d26bd72..8151b080 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -48,7 +48,7 @@ indexed::indexed() indexed::~indexed() { debugmsg("indexed destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } indexed::indexed(const indexed & other) @@ -61,7 +61,7 @@ const indexed & indexed::operator=(const indexed & other) { debugmsg("indexed operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -102,7 +102,7 @@ indexed::indexed(const ex & i1, const ex & i2) : inherited(i1,i2) } indexed::indexed(const ex & i1, const ex & i2, const ex & i3) - : inherited(i1,i2,i3) + : inherited(i1,i2,i3) { debugmsg("indexed constructor from ex,ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_indexed; @@ -110,7 +110,7 @@ indexed::indexed(const ex & i1, const ex & i2, const ex & i3) } indexed::indexed(const ex & i1, const ex & i2, const ex & i3, const ex & i4) - : inherited(i1,i2,i3,i4) + : inherited(i1,i2,i3,i4) { debugmsg("indexed constructor from ex,ex,ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_indexed; @@ -190,7 +190,7 @@ void indexed::print(std::ostream & os, unsigned upper_precedence) const } void indexed::printcsrc(std::ostream & os, unsigned type, - unsigned upper_precedence) const + unsigned upper_precedence) const { debugmsg("indexed print csrc",LOGLEVEL_PRINT); print(os,upper_precedence); @@ -225,7 +225,7 @@ exvector indexed::get_indices(void) const * @see ex::diff */ ex indexed::derivative(const symbol & s) const { - return _ex0(); + return _ex0(); } int indexed::compare_same_type(const basic & other) const diff --git a/ginac/inifcns.cpp b/ginac/inifcns.cpp index d5e9275b..6541af42 100644 --- a/ginac/inifcns.cpp +++ b/ginac/inifcns.cpp @@ -63,7 +63,7 @@ static ex abs_eval(const ex & arg) } REGISTER_FUNCTION(abs, eval_func(abs_eval). - evalf_func(abs_evalf)); + evalf_func(abs_evalf)); ////////// @@ -108,13 +108,13 @@ static ex csgn_eval(const ex & arg) } static ex csgn_series(const ex & arg, - const relational & rel, - int order, - unsigned options) + const relational & rel, + int order, + unsigned options) { const ex arg_pt = arg.subs(rel); - if (arg_pt.info(info_flags::numeric) && - ex_to_numeric(arg_pt).real().is_zero()) + if (arg_pt.info(info_flags::numeric) + && ex_to_numeric(arg_pt).real().is_zero()) throw (std::domain_error("csgn_series(): on imaginary axis")); epvector seq; @@ -123,8 +123,8 @@ static ex csgn_series(const ex & arg, } REGISTER_FUNCTION(csgn, eval_func(csgn_eval). - evalf_func(csgn_evalf). - series_func(csgn_series)); + evalf_func(csgn_evalf). + series_func(csgn_series)); ////////// @@ -159,10 +159,10 @@ static ex eta_eval(const ex & x, const ex & y) } static ex eta_series(const ex & arg1, - const ex & arg2, - const relational & rel, - int order, - unsigned options) + const ex & arg2, + const relational & rel, + int order, + unsigned options) { const ex arg1_pt = arg1.subs(rel); const ex arg2_pt = arg2.subs(rel); @@ -177,8 +177,8 @@ static ex eta_series(const ex & arg1, } REGISTER_FUNCTION(eta, eval_func(eta_eval). - evalf_func(eta_evalf). - series_func(eta_series)); + evalf_func(eta_evalf). + series_func(eta_series)); ////////// @@ -314,9 +314,9 @@ static ex Li2_series(const ex &x, const relational &rel, int order, unsigned opt } REGISTER_FUNCTION(Li2, eval_func(Li2_eval). - evalf_func(Li2_evalf). - derivative_func(Li2_deriv). - series_func(Li2_series)); + evalf_func(Li2_evalf). + derivative_func(Li2_deriv). + series_func(Li2_series)); ////////// // trilogarithm @@ -349,7 +349,7 @@ static ex factorial_eval(const ex & x) } REGISTER_FUNCTION(factorial, eval_func(factorial_eval). - evalf_func(factorial_evalf)); + evalf_func(factorial_evalf)); ////////// // binomial @@ -369,7 +369,7 @@ static ex binomial_eval(const ex & x, const ex &y) } REGISTER_FUNCTION(binomial, eval_func(binomial_eval). - evalf_func(binomial_evalf)); + evalf_func(binomial_evalf)); ////////// // Order term function (for truncated power series) @@ -405,7 +405,7 @@ static ex Order_series(const ex & x, const relational & r, int order, unsigned o // Differentiation is handled in function::derivative because of its special requirements REGISTER_FUNCTION(Order, eval_func(Order_eval). - series_func(Order_series)); + series_func(Order_series)); ////////// // Inert partial differentiation operator diff --git a/ginac/inifcns_gamma.cpp b/ginac/inifcns_gamma.cpp index e6ba5b11..ae12074e 100644 --- a/ginac/inifcns_gamma.cpp +++ b/ginac/inifcns_gamma.cpp @@ -85,9 +85,9 @@ static ex lgamma_deriv(const ex & x, unsigned deriv_param) static ex lgamma_series(const ex & arg, - const relational & rel, - int order, - unsigned options) + const relational & rel, + int order, + unsigned options) { // method: // Taylor series where there is no pole falls back to psi function @@ -111,9 +111,9 @@ static ex lgamma_series(const ex & arg, REGISTER_FUNCTION(lgamma, eval_func(lgamma_eval). - evalf_func(lgamma_evalf). - derivative_func(lgamma_deriv). - series_func(lgamma_series)); + evalf_func(lgamma_evalf). + derivative_func(lgamma_deriv). + series_func(lgamma_series)); ////////// @@ -182,9 +182,9 @@ static ex tgamma_deriv(const ex & x, unsigned deriv_param) static ex tgamma_series(const ex & arg, - const relational & rel, - int order, - unsigned options) + const relational & rel, + int order, + unsigned options) { // method: // Taylor series where there is no pole falls back to psi function @@ -207,9 +207,9 @@ static ex tgamma_series(const ex & arg, REGISTER_FUNCTION(tgamma, eval_func(tgamma_eval). - evalf_func(tgamma_evalf). - derivative_func(tgamma_deriv). - series_func(tgamma_series)); + evalf_func(tgamma_evalf). + derivative_func(tgamma_deriv). + series_func(tgamma_series)); ////////// @@ -280,10 +280,10 @@ static ex beta_deriv(const ex & x, const ex & y, unsigned deriv_param) static ex beta_series(const ex & arg1, - const ex & arg2, - const relational & rel, - int order, - unsigned options) + const ex & arg2, + const relational & rel, + int order, + unsigned options) { // method: // Taylor series where there is no pole of one of the tgamma functions @@ -295,7 +295,7 @@ static ex beta_series(const ex & arg1, const symbol *s = static_cast(rel.lhs().bp); ex arg1_ser, arg2_ser, arg1arg2_ser; if ((!arg1_pt.info(info_flags::integer) || arg1_pt.info(info_flags::positive)) && - (!arg2_pt.info(info_flags::integer) || arg2_pt.info(info_flags::positive))) + (!arg2_pt.info(info_flags::integer) || arg2_pt.info(info_flags::positive))) throw do_taylor(); // caught by function::series() // trap the case where arg1 is on a pole: if (arg1.info(info_flags::integer) && !arg1.info(info_flags::positive)) @@ -318,9 +318,9 @@ static ex beta_series(const ex & arg1, REGISTER_FUNCTION(beta, eval_func(beta_eval). - evalf_func(beta_evalf). - derivative_func(beta_deriv). - series_func(beta_series)); + evalf_func(beta_evalf). + derivative_func(beta_deriv). + series_func(beta_series)); ////////// @@ -390,9 +390,9 @@ static ex psi1_deriv(const ex & x, unsigned deriv_param) } static ex psi1_series(const ex & arg, - const relational & rel, - int order, - unsigned options) + const relational & rel, + int order, + unsigned options) { // method: // Taylor series where there is no pole falls back to polygamma function @@ -415,11 +415,11 @@ static ex psi1_series(const ex & arg, const unsigned function_index_psi1 = function::register_new(function_options("psi"). - eval_func(psi1_eval). - evalf_func(psi1_evalf). - derivative_func(psi1_deriv). - series_func(psi1_series). - overloaded(2)); + eval_func(psi1_eval). + evalf_func(psi1_evalf). + derivative_func(psi1_deriv). + series_func(psi1_series). + overloaded(2)); ////////// // Psi-functions (aka polygamma-functions) psi(0,x)==psi(x) @@ -513,10 +513,10 @@ static ex psi2_deriv(const ex & n, const ex & x, unsigned deriv_param) } static ex psi2_series(const ex & n, - const ex & arg, - const relational & rel, - int order, - unsigned options) + const ex & arg, + const relational & rel, + int order, + unsigned options) { // method: // Taylor series where there is no pole falls back to polygamma function @@ -541,11 +541,11 @@ static ex psi2_series(const ex & n, const unsigned function_index_psi2 = function::register_new(function_options("psi"). - eval_func(psi2_eval). - evalf_func(psi2_evalf). - derivative_func(psi2_deriv). - series_func(psi2_series). - overloaded(2)); + eval_func(psi2_eval). + evalf_func(psi2_evalf). + derivative_func(psi2_deriv). + series_func(psi2_series). + overloaded(2)); #ifndef NO_NAMESPACE_GINAC diff --git a/ginac/inifcns_trans.cpp b/ginac/inifcns_trans.cpp index ac0bc323..734c0ecb 100644 --- a/ginac/inifcns_trans.cpp +++ b/ginac/inifcns_trans.cpp @@ -90,8 +90,8 @@ static ex exp_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(exp, eval_func(exp_eval). - evalf_func(exp_evalf). - derivative_func(exp_deriv)); + evalf_func(exp_evalf). + derivative_func(exp_deriv)); ////////// // natural logarithm @@ -145,9 +145,9 @@ static ex log_deriv(const ex & x, unsigned deriv_param) } static ex log_series(const ex &arg, - const relational &rel, - int order, - unsigned options) + const relational &rel, + int order, + unsigned options) { GINAC_ASSERT(is_ex_exactly_of_type(rel.lhs(),symbol)); ex arg_pt; @@ -202,9 +202,9 @@ static ex log_series(const ex &arg, } REGISTER_FUNCTION(log, eval_func(log_eval). - evalf_func(log_evalf). - derivative_func(log_deriv). - series_func(log_series)); + evalf_func(log_evalf). + derivative_func(log_deriv). + series_func(log_series)); ////////// // sine (trigonometric function) @@ -284,8 +284,8 @@ static ex sin_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(sin, eval_func(sin_eval). - evalf_func(sin_evalf). - derivative_func(sin_deriv)); + evalf_func(sin_evalf). + derivative_func(sin_deriv)); ////////// // cosine (trigonometric function) @@ -365,8 +365,8 @@ static ex cos_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(cos, eval_func(cos_eval). - evalf_func(cos_evalf). - derivative_func(cos_deriv)); + evalf_func(cos_evalf). + derivative_func(cos_deriv)); ////////// // tangent (trigonometric function) @@ -443,9 +443,9 @@ static ex tan_deriv(const ex & x, unsigned deriv_param) } static ex tan_series(const ex &x, - const relational &rel, - int order, - unsigned options) + const relational &rel, + int order, + unsigned options) { // method: // Taylor series where there is no pole falls back to tan_deriv. @@ -458,9 +458,9 @@ static ex tan_series(const ex &x, } REGISTER_FUNCTION(tan, eval_func(tan_eval). - evalf_func(tan_evalf). - derivative_func(tan_deriv). - series_func(tan_series)); + evalf_func(tan_evalf). + derivative_func(tan_deriv). + series_func(tan_series)); ////////// // inverse sine (arc sine) @@ -510,8 +510,8 @@ static ex asin_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(asin, eval_func(asin_eval). - evalf_func(asin_evalf). - derivative_func(asin_deriv)); + evalf_func(asin_evalf). + derivative_func(asin_deriv)); ////////// // inverse cosine (arc cosine) @@ -561,8 +561,8 @@ static ex acos_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(acos, eval_func(acos_eval). - evalf_func(acos_evalf). - derivative_func(acos_deriv)); + evalf_func(acos_evalf). + derivative_func(acos_deriv)); ////////// // inverse tangent (arc tangent) @@ -600,8 +600,8 @@ static ex atan_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(atan, eval_func(atan_eval). - evalf_func(atan_evalf). - derivative_func(atan_deriv)); + evalf_func(atan_evalf). + derivative_func(atan_deriv)); ////////// // inverse tangent (atan2(y,x)) @@ -640,8 +640,8 @@ static ex atan2_deriv(const ex & y, const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(atan2, eval_func(atan2_eval). - evalf_func(atan2_evalf). - derivative_func(atan2_deriv)); + evalf_func(atan2_evalf). + derivative_func(atan2_deriv)); ////////// // hyperbolic sine (trigonometric function) @@ -694,8 +694,8 @@ static ex sinh_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(sinh, eval_func(sinh_eval). - evalf_func(sinh_evalf). - derivative_func(sinh_deriv)); + evalf_func(sinh_evalf). + derivative_func(sinh_deriv)); ////////// // hyperbolic cosine (trigonometric function) @@ -748,8 +748,8 @@ static ex cosh_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(cosh, eval_func(cosh_eval). - evalf_func(cosh_evalf). - derivative_func(cosh_deriv)); + evalf_func(cosh_evalf). + derivative_func(cosh_deriv)); ////////// @@ -803,9 +803,9 @@ static ex tanh_deriv(const ex & x, unsigned deriv_param) } static ex tanh_series(const ex &x, - const relational &rel, - int order, - unsigned options) + const relational &rel, + int order, + unsigned options) { // method: // Taylor series where there is no pole falls back to tanh_deriv. @@ -818,9 +818,9 @@ static ex tanh_series(const ex &x, } REGISTER_FUNCTION(tanh, eval_func(tanh_eval). - evalf_func(tanh_evalf). - derivative_func(tanh_deriv). - series_func(tanh_series)); + evalf_func(tanh_evalf). + derivative_func(tanh_deriv). + series_func(tanh_series)); ////////// // inverse hyperbolic sine (trigonometric function) @@ -858,8 +858,8 @@ static ex asinh_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(asinh, eval_func(asinh_eval). - evalf_func(asinh_evalf). - derivative_func(asinh_deriv)); + evalf_func(asinh_evalf). + derivative_func(asinh_deriv)); ////////// // inverse hyperbolic cosine (trigonometric function) @@ -903,8 +903,8 @@ static ex acosh_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(acosh, eval_func(acosh_eval). - evalf_func(acosh_evalf). - derivative_func(acosh_deriv)); + evalf_func(acosh_evalf). + derivative_func(acosh_deriv)); ////////// // inverse hyperbolic tangent (trigonometric function) @@ -945,8 +945,8 @@ static ex atanh_deriv(const ex & x, unsigned deriv_param) } REGISTER_FUNCTION(atanh, eval_func(atanh_eval). - evalf_func(atanh_evalf). - derivative_func(atanh_deriv)); + evalf_func(atanh_evalf). + derivative_func(atanh_deriv)); #ifndef NO_NAMESPACE_GINAC } // namespace GiNaC diff --git a/ginac/inifcns_zeta.cpp b/ginac/inifcns_zeta.cpp index a20e534f..4c6e6601 100644 --- a/ginac/inifcns_zeta.cpp +++ b/ginac/inifcns_zeta.cpp @@ -83,10 +83,10 @@ static ex zeta1_deriv(const ex & x, unsigned deriv_param) const unsigned function_index_zeta1 = function::register_new(function_options("zeta"). - eval_func(zeta1_eval). - evalf_func(zeta1_evalf). - derivative_func(zeta1_deriv). - overloaded(2)); + eval_func(zeta1_eval). + evalf_func(zeta1_evalf). + derivative_func(zeta1_deriv). + overloaded(2)); ////////// // Derivatives of Riemann's Zeta-function zeta(0,x)==zeta(x) @@ -117,9 +117,9 @@ static ex zeta2_deriv(const ex & n, const ex & x, unsigned deriv_param) const unsigned function_index_zeta2 = function::register_new(function_options("zeta"). - eval_func(zeta2_eval). - derivative_func(zeta2_deriv). - overloaded(2)); + eval_func(zeta2_eval). + derivative_func(zeta2_deriv). + overloaded(2)); #ifndef NO_NAMESPACE_GINAC } // namespace GiNaC diff --git a/ginac/isospin.cpp b/ginac/isospin.cpp index fafdaec0..b46ecb0e 100644 --- a/ginac/isospin.cpp +++ b/ginac/isospin.cpp @@ -54,7 +54,7 @@ isospin::isospin() isospin::~isospin() { debugmsg("isospin destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } isospin::isospin(const isospin & other) @@ -67,7 +67,7 @@ const isospin & isospin::operator=(const isospin & other) { debugmsg("isospin operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -207,9 +207,8 @@ ex isospin::simplify_ncmul(const exvector & v) const unsigned isospin::calchash(void) const { - hashvalue=golden_ratio_hash(golden_ratio_hash(0x55555556U ^ - golden_ratio_hash(tinfo_key) ^ - serial)); + hashvalue = golden_ratio_hash(golden_ratio_hash(0x55555556U ^ + golden_ratio_hash(tinfo_key) ^ serial)); setflag(status_flags::hash_calculated); return hashvalue; } diff --git a/ginac/lorentzidx.cpp b/ginac/lorentzidx.cpp index d03d9b7a..91fc6d9e 100644 --- a/ginac/lorentzidx.cpp +++ b/ginac/lorentzidx.cpp @@ -44,14 +44,14 @@ lorentzidx::lorentzidx() : orthogonal_only(false), dim_parallel_space(0) { debugmsg("lorentzidx default constructor",LOGLEVEL_CONSTRUCT); // serial is incremented in idx::idx() - name="mu"+ToString(serial); - tinfo_key=TINFO_lorentzidx; + name = "mu" + ToString(serial); + tinfo_key = TINFO_lorentzidx; } lorentzidx::~lorentzidx() { debugmsg("lorentzidx destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } lorentzidx::lorentzidx(const lorentzidx & other) @@ -64,7 +64,7 @@ const lorentzidx & lorentzidx::operator=(const lorentzidx & other) { debugmsg("lorentzidx operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -90,8 +90,8 @@ void lorentzidx::destroy(bool call_parent) // public -lorentzidx::lorentzidx(bool cov, bool oonly, unsigned dimp) : - idx(cov), orthogonal_only(oonly), dim_parallel_space(dimp) +lorentzidx::lorentzidx(bool cov, bool oonly, unsigned dimp) + : idx(cov), orthogonal_only(oonly), dim_parallel_space(dimp) { debugmsg("lorentzidx constructor from bool",LOGLEVEL_CONSTRUCT); // serial is incremented in idx::idx(bool) @@ -104,7 +104,7 @@ lorentzidx::lorentzidx(bool cov, bool oonly, unsigned dimp) : } lorentzidx::lorentzidx(const std::string & n, bool cov, bool oonly, unsigned dimp) - : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp) + : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp) { debugmsg("lorentzidx constructor from string,bool,bool,unsigned", LOGLEVEL_CONSTRUCT); @@ -112,15 +112,15 @@ lorentzidx::lorentzidx(const std::string & n, bool cov, bool oonly, unsigned dim } lorentzidx::lorentzidx(const char * n, bool cov, bool oonly, unsigned dimp) - : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp) + : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp) { debugmsg("lorentzidx constructor from char*,bool,bool,unsigned", LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_lorentzidx; } -lorentzidx::lorentzidx(unsigned v, bool cov) : idx(v,cov), - orthogonal_only(false), dim_parallel_space(0) +lorentzidx::lorentzidx(unsigned v, bool cov) + : idx(v,cov), orthogonal_only(false), dim_parallel_space(0) { debugmsg("lorentzidx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_lorentzidx; @@ -277,8 +277,8 @@ lorentzidx lorentzidx::create_anonymous_representative(void) const i_copy.serial=0; i_copy.name="anonymous_representative"; i_copy.covariant=false; - i_copy.clearflag(status_flags::dynallocated| - status_flags::hash_calculated); + i_copy.clearflag(status_flags::dynallocated | + status_flags::hash_calculated); return i_copy; } diff --git a/ginac/lortensor.cpp b/ginac/lortensor.cpp index f7b37391..2b797efb 100644 --- a/ginac/lortensor.cpp +++ b/ginac/lortensor.cpp @@ -63,7 +63,7 @@ lortensor::lortensor() lortensor::~lortensor() { debugmsg("lortensor destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } lortensor::lortensor(const lortensor & other) @@ -76,7 +76,7 @@ const lortensor & lortensor::operator=(const lortensor & other) { debugmsg("lortensor operator=",LOGLEVEL_ASSIGNMENT); if (this != & other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -308,14 +308,17 @@ unsigned lortensor::return_type(void) const { return return_types::commutative; } + unsigned lortensor::return_type_tinfo(void) const { return tinfo_key; } + ex lortensor::thisexprseq(const exvector & v) const { return lortensor(type,name,serial,v); } + ex lortensor::thisexprseq(exvector *vp) const { return lortensor(type,name,serial,vp); @@ -420,7 +423,7 @@ ex simplify_lortensor_mul(const ex & m) replacements=0; if (first_idx.is_symbolic()) { replacements = subs_index_in_exvector(v_contracted, - first_idx.toggle_covariant(),second_idx); + first_idx.toggle_covariant(),second_idx); if (replacements==0) { // not contracted, restore g object *it=saved_g; @@ -436,7 +439,7 @@ ex simplify_lortensor_mul(const ex & m) if ((replacements==0)&&(second_idx.is_symbolic())) { // first index not contracted, *it is again the original g object replacements = subs_index_in_exvector(v_contracted, - second_idx.toggle_covariant(),first_idx); + second_idx.toggle_covariant(),first_idx); if (replacements==0) { // not contracted except in itself, restore g object *it=saved_g; diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index 470991b7..b2d4f606 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -48,8 +48,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS(matrix, basic) // public /** Default ctor. Initializes to 1 x 1-dimensional zero-matrix. */ -matrix::matrix() - : inherited(TINFO_matrix), row(1), col(1) +matrix::matrix() : inherited(TINFO_matrix), row(1), col(1) { debugmsg("matrix default constructor",LOGLEVEL_CONSTRUCT); m.push_back(_ex0()); @@ -58,6 +57,7 @@ matrix::matrix() matrix::~matrix() { debugmsg("matrix destructor",LOGLEVEL_DESTRUCT); + destroy(false); } matrix::matrix(const matrix & other) @@ -70,7 +70,7 @@ const matrix & matrix::operator=(const matrix & other) { debugmsg("matrix operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -102,7 +102,7 @@ void matrix::destroy(bool call_parent) * @param r number of rows * @param c number of cols */ matrix::matrix(unsigned r, unsigned c) - : inherited(TINFO_matrix), row(r), col(c) + : inherited(TINFO_matrix), row(r), col(c) { debugmsg("matrix constructor from unsigned,unsigned",LOGLEVEL_CONSTRUCT); m.resize(r*c, _ex0()); @@ -112,7 +112,7 @@ matrix::matrix(unsigned r, unsigned c) /** Ctor from representation, for internal use only. */ matrix::matrix(unsigned r, unsigned c, const exvector & m2) - : inherited(TINFO_matrix), row(r), col(c), m(m2) + : inherited(TINFO_matrix), row(r), col(c), m(m2) { debugmsg("matrix constructor from unsigned,unsigned,exvector",LOGLEVEL_CONSTRUCT); } @@ -814,8 +814,8 @@ ex matrix::determinant_minor(void) const return (m[0]*m[3]-m[2]*m[1]).expand(); if (n==3) return (m[0]*m[4]*m[8]-m[0]*m[5]*m[7]- - m[1]*m[3]*m[8]+m[2]*m[3]*m[7]+ - m[1]*m[5]*m[6]-m[2]*m[4]*m[6]).expand(); + m[1]*m[3]*m[8]+m[2]*m[3]*m[7]+ + m[1]*m[5]*m[6]-m[2]*m[4]*m[6]).expand(); // This algorithm can best be understood by looking at a naive // implementation of Laplace-expansion, like this one: @@ -1099,15 +1099,15 @@ int matrix::fraction_free_elimination(const bool det) for (unsigned r2=r0+1; r2 x return recombine_pair_to_ex(*(seq.begin())); } else if ((seq_size==1) && - is_ex_exactly_of_type((*seq.begin()).rest,add) && - ex_to_numeric((*seq.begin()).coeff).is_equal(_num1())) { + 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 +()) 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) { - distrseq.push_back(addref.combine_pair_with_coeff_to_pair(*cit, - overall_coeff)); + distrseq.push_back(addref.combine_pair_with_coeff_to_pair(*cit, overall_coeff)); } return (new add(distrseq, - ex_to_numeric(addref.overall_coeff). - mul_dyn(ex_to_numeric(overall_coeff)))) - ->setflag(status_flags::dynallocated | - status_flags::evaluated); + ex_to_numeric(addref.overall_coeff). + mul_dyn(ex_to_numeric(overall_coeff)))) + ->setflag(status_flags::dynallocated | status_flags::evaluated); } return this->hold(); } @@ -445,7 +443,7 @@ ex mul::evalf(int level) const --level; for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) { s.push_back(combine_ex_with_coeff_to_pair((*it).rest.evalf(level), - (*it).coeff)); + (*it).coeff)); } return mul(s,overall_coeff.evalf(level)); } @@ -481,8 +479,8 @@ ex mul::derivative(const symbol & s) const // D(a*b*c) = D(a)*b*c + a*D(b)*c + a*b*D(c) for (unsigned i=0; i!=seq.size(); ++i) { epvector mulseq = seq; - mulseq[i] = split_ex_to_pair(power(seq[i].rest,seq[i].coeff - _ex1())* - seq[i].rest.diff(s)); + mulseq[i] = split_ex_to_pair(power(seq[i].rest,seq[i].coeff - _ex1()) * + seq[i].rest.diff(s)); addseq.push_back((new mul(mulseq,overall_coeff*seq[i].coeff))->setflag(status_flags::dynallocated)); } return (new add(addseq))->setflag(status_flags::dynallocated); @@ -567,7 +565,7 @@ expair mul::split_ex_to_pair(const ex & e) const } expair mul::combine_ex_with_coeff_to_pair(const ex & e, - const ex & c) const + const ex & c) const { // to avoid duplication of power simplification rules, // we create a temporary power object @@ -580,7 +578,7 @@ expair mul::combine_ex_with_coeff_to_pair(const ex & e, } expair mul::combine_pair_with_coeff_to_pair(const expair & p, - const ex & c) const + const ex & c) const { // to avoid duplication of power simplification rules, // we create a temporary power object @@ -640,8 +638,7 @@ 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)); GINAC_ASSERT(is_ex_exactly_of_type(c2,numeric)); - overall_coeff = ex_to_numeric(overall_coeff). - mul_dyn(ex_to_numeric(c1).power(ex_to_numeric(c2))); + overall_coeff = ex_to_numeric(overall_coeff).mul_dyn(ex_to_numeric(c1).power(ex_to_numeric(c2))); } bool mul::can_make_flat(const expair & p) const @@ -692,8 +689,7 @@ ex mul::expand(unsigned options) const return this->setflag(status_flags::expanded); else return ((new mul(expanded_seqp,overall_coeff))-> - setflag(status_flags::dynallocated | - status_flags::expanded)); + setflag(status_flags::dynallocated | status_flags::expanded)); } exvector distrseq; @@ -711,8 +707,7 @@ ex mul::expand(unsigned options) const term[positions_of_adds[l]]=split_ex_to_pair(addref.op(k[l])); } distrseq.push_back((new mul(term,overall_coeff))-> - setflag(status_flags::dynallocated | - status_flags::expanded)); + setflag(status_flags::dynallocated | status_flags::expanded)); // increment k[] int l = number_of_adds-1; diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index 1aa43633..7e8dce65 100644 --- a/ginac/ncmul.cpp +++ b/ginac/ncmul.cpp @@ -53,7 +53,7 @@ ncmul::ncmul() ncmul::~ncmul() { debugmsg("ncmul destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } ncmul::ncmul(const ncmul & other) @@ -66,7 +66,7 @@ const ncmul & ncmul::operator=(const ncmul & other) { debugmsg("ncmul operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -90,37 +90,34 @@ void ncmul::destroy(bool call_parent) // public -ncmul::ncmul(const ex & lh, const ex & rh) : - inherited(lh,rh) +ncmul::ncmul(const ex & lh, const ex & rh) : inherited(lh,rh) { debugmsg("ncmul constructor from ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_ncmul; } -ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3) : - inherited(f1,f2,f3) +ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3) : inherited(f1,f2,f3) { debugmsg("ncmul constructor from 3 ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_ncmul; } ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3, - const ex & f4) : inherited(f1,f2,f3,f4) + const ex & f4) : inherited(f1,f2,f3,f4) { debugmsg("ncmul constructor from 4 ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_ncmul; } ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3, - const ex & f4, const ex & f5) : inherited(f1,f2,f3,f4,f5) + const ex & f4, const ex & f5) : inherited(f1,f2,f3,f4,f5) { debugmsg("ncmul constructor from 5 ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_ncmul; } ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3, - const ex & f4, const ex & f5, const ex & f6) : - inherited(f1,f2,f3,f4,f5,f6) + const ex & f4, const ex & f5, const ex & f6) : inherited(f1,f2,f3,f4,f5,f6) { debugmsg("ncmul constructor from 6 ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_ncmul; @@ -366,7 +363,7 @@ ex ncmul::eval(int level) const // ncmul(...,x1,x2,...,x3,x4,...) (associativity) // ncmul(x) -> x // ncmul() -> 1 - // ncmul(...,c1,...,c2,...) -> + // ncmul(...,c1,...,c2,...) // *(c1,c2,ncmul(...)) (pull out commutative elements) // ncmul(x1,y1,x2,y2) -> *(ncmul(x1,x2),ncmul(y1,y2)) // (collect elements of same type) @@ -442,8 +439,7 @@ ex ncmul::eval(int level) const noncommutativeseq.push_back(assocseq[i]); } } - commutativeseq.push_back((new ncmul(noncommutativeseq,1))-> - setflag(status_flags::dynallocated)); + commutativeseq.push_back((new ncmul(noncommutativeseq,1))->setflag(status_flags::dynallocated)); return (new mul(commutativeseq))->setflag(status_flags::dynallocated); } @@ -496,8 +492,7 @@ ex ncmul::eval(int level) const exvector splitseq; splitseq.reserve(evv.size()); for (i=0; i - setflag(status_flags::dynallocated)); + splitseq.push_back((new ncmul(evv[i]))->setflag(status_flags::dynallocated)); } return (new mul(splitseq))->setflag(status_flags::dynallocated); @@ -570,10 +565,10 @@ unsigned ncmul::return_type(void) const all_commutative=0; } if ((rt==return_types::noncommutative)&&(!all_commutative)) { - // another nc element found, compare type_infos + // another nc element found, compare type_infos if ((*cit_noncommutative_element).return_type_tinfo()!=(*cit).return_type_tinfo()) { - // diffent types -> mul is ncc - return return_types::noncommutative_composite; + // diffent types -> mul is ncc + return return_types::noncommutative_composite; } } } @@ -657,7 +652,7 @@ ex simplified_ncmul(const exvector & v) return v[0]; } return (new ncmul(v))->setflag(status_flags::dynallocated | - status_flags::evaluated); + status_flags::evaluated); } #ifndef NO_NAMESPACE_GINAC diff --git a/ginac/normal.cpp b/ginac/normal.cpp index 851b7ba7..0e1a0bfa 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -569,7 +569,7 @@ bool divide(const ex &a, const ex &b, ex &q, bool check_args) } #endif if (check_args && (!a.info(info_flags::rational_polynomial) || - !b.info(info_flags::rational_polynomial))) + !b.info(info_flags::rational_polynomial))) throw(std::invalid_argument("divide: arguments must be polynomials over the rationals")); // Find first symbol @@ -1890,7 +1890,7 @@ static ex frac_cancel(const ex &n, const ex &d) // as defined by get_first_symbol() is made positive) const symbol *x; if (get_first_symbol(den, x)) { - GINAC_ASSERT(is_ex_exactly_of_type(den.unit(*x),numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(den.unit(*x),numeric)); if (ex_to_numeric(den.unit(*x)).is_negative()) { num *= _ex_1(); den *= _ex_1(); diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 24e33e46..af2d8eff 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -99,14 +99,14 @@ numeric::numeric() : basic(TINFO_numeric) *value = ::cl_I(0); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } numeric::~numeric() { debugmsg("numeric destructor" ,LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } numeric::numeric(const numeric & other) @@ -119,7 +119,7 @@ const numeric & numeric::operator=(const numeric & other) { debugmsg("numeric operator=", LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -154,8 +154,8 @@ numeric::numeric(int i) : basic(TINFO_numeric) value = new ::cl_I((long) i); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } @@ -168,8 +168,8 @@ numeric::numeric(unsigned int i) : basic(TINFO_numeric) value = new ::cl_I((unsigned long)i); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } @@ -179,8 +179,8 @@ numeric::numeric(long i) : basic(TINFO_numeric) value = new ::cl_I(i); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } @@ -190,8 +190,8 @@ numeric::numeric(unsigned long i) : basic(TINFO_numeric) value = new ::cl_I(i); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } /** Ctor for rational numerics a/b. @@ -206,8 +206,8 @@ numeric::numeric(long numer, long denom) : basic(TINFO_numeric) *value = *value / ::cl_I(denom); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } @@ -221,8 +221,8 @@ numeric::numeric(double d) : basic(TINFO_numeric) *value = cl_float(d, cl_default_float_format); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } @@ -246,8 +246,8 @@ numeric::numeric(const char *s) : basic(TINFO_numeric) bool imaginary = false; delim = ss.find_first_of(std::string("+-"),1); // Do we have an exponent marker like "31.415E-1"? If so, hop on! - if (delim != std::string::npos && - ss.at(delim-1) == 'E') + if (delim != std::string::npos + && ss.at(delim-1) == 'E') delim = ss.find_first_of(std::string("+-"),delim+1); term = ss.substr(0,delim); if (delim != std::string::npos) @@ -281,8 +281,8 @@ numeric::numeric(const char *s) : basic(TINFO_numeric) *value = *value + ::cl_R(cs); } while(delim != std::string::npos); calchash(); - setflag(status_flags::evaluated| - status_flags::hash_calculated); + setflag(status_flags::evaluated | + status_flags::hash_calculated); } /** Ctor from CLN types. This is for the initiated user or internal use @@ -293,8 +293,8 @@ numeric::numeric(const cl_N & z) : basic(TINFO_numeric) value = new ::cl_N(z); calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } ////////// @@ -337,8 +337,8 @@ numeric::numeric(const archive_node &n, const lst &sym_lst) : inherited(n, sym_l } calchash(); setflag(status_flags::evaluated | - status_flags::expanded | - status_flags::hash_calculated); + status_flags::expanded | + status_flags::hash_calculated); } /** Unarchive the object. */ @@ -602,13 +602,13 @@ bool numeric::has(const ex & other) const return true; if (o.imag().is_zero()) // e.g. scan for 3 in -3*I return (this->real().is_equal(o) || this->imag().is_equal(o) || - this->real().is_equal(-o) || this->imag().is_equal(-o)); + this->real().is_equal(-o) || this->imag().is_equal(-o)); else { if (o.is_equal(I)) // e.g scan for I in 42*I return !this->is_real(); if (o.real().is_zero()) // e.g. scan for 2*I in 2*I+1 return (this->real().has(o*I) || this->imag().has(o*I) || - this->real().has(-o*I) || this->imag().has(-o*I)); + this->real().has(-o*I) || this->imag().has(-o*I)); } return false; } @@ -976,7 +976,7 @@ bool numeric::is_cinteger(void) const return true; else if (!this->is_real()) { // complex case, handle n+m*I if (::instanceof(::realpart(*value), ::cl_I_ring) && - ::instanceof(::imagpart(*value), ::cl_I_ring)) + ::instanceof(::imagpart(*value), ::cl_I_ring)) return true; } return false; @@ -990,7 +990,7 @@ bool numeric::is_crational(void) const return true; else if (!this->is_real()) { // complex case, handle Q(i): if (::instanceof(::realpart(*value), ::cl_RA_ring) && - ::instanceof(::imagpart(*value), ::cl_RA_ring)) + ::instanceof(::imagpart(*value), ::cl_RA_ring)) return true; } return false; @@ -1297,8 +1297,8 @@ const numeric acos(const numeric & x) const numeric atan(const numeric & x) { if (!x.is_real() && - x.real().is_zero() && - abs(x.imag()).is_equal(_num1())) + x.real().is_zero() && + abs(x.imag()).is_equal(_num1())) throw pole_error("atan(): logarithmic pole",0); return ::atan(*x.value); // -> CLN } @@ -1373,7 +1373,7 @@ const numeric atanh(const numeric & x) /*static ::cl_N Li2_series(const ::cl_N & x, - const ::cl_float_format_t & prec) + const ::cl_float_format_t & prec) { // Note: argument must be in the unit circle // This is very inefficient unless we have fast floating point Bernoulli @@ -1401,7 +1401,7 @@ const numeric atanh(const numeric & x) /** Numeric evaluation of Dilogarithm within circle of convergence (unit * circle) using a power series. */ static ::cl_N Li2_series(const ::cl_N & x, - const ::cl_float_format_t & prec) + const ::cl_float_format_t & prec) { // Note: argument must be in the unit circle ::cl_N aug, acc; @@ -1420,23 +1420,23 @@ static ::cl_N Li2_series(const ::cl_N & x, /** Folds Li2's argument inside a small rectangle to enhance convergence. */ static ::cl_N Li2_projection(const ::cl_N & x, - const ::cl_float_format_t & prec) + const ::cl_float_format_t & prec) { const ::cl_R re = ::realpart(x); const ::cl_R im = ::imagpart(x); if (re > ::cl_F(".5")) // zeta(2) - Li2(1-x) - log(x)*log(1-x) return(::cl_zeta(2) - - Li2_series(1-x, prec) - - ::log(x)*::log(1-x)); + - Li2_series(1-x, prec) + - ::log(x)*::log(1-x)); if ((re <= 0 && ::abs(im) > ::cl_F(".75")) || (re < ::cl_F("-.5"))) // -log(1-x)^2 / 2 - Li2(x/(x-1)) - return(-::square(::log(1-x))/2 - - Li2_series(x/(x-1), prec)); + return(- ::square(::log(1-x))/2 + - Li2_series(x/(x-1), prec)); if (re > 0 && ::abs(im) > ::cl_LF(".75")) // Li2(x^2)/2 - Li2(-x) return(Li2_projection(::square(x), prec)/2 - - Li2_projection(-x, prec)); + - Li2_projection(-x, prec)); return Li2_series(x, prec); } @@ -1464,9 +1464,9 @@ const numeric Li2(const numeric & x) if (::abs(*x.value) > 1) // -log(-x)^2 / 2 - zeta(2) - Li2(1/x) - return(-::square(::log(-*x.value))/2 - - ::cl_zeta(2, prec) - - Li2_projection(::recip(*x.value), prec)); + return(- ::square(::log(-*x.value))/2 + - ::cl_zeta(2, prec) + - Li2_projection(::recip(*x.value), prec)); else return Li2_projection(*x.value, prec); } @@ -1498,15 +1498,15 @@ const numeric zeta(const numeric & x) const numeric lgamma(const numeric & x) { std::clog << "lgamma(" << x - << "): Does anybody know good way to calculate this numerically?" - << std::endl; + << "): Does anybody know good way to calculate this numerically?" + << std::endl; return numeric(0); } const numeric tgamma(const numeric & x) { std::clog << "tgamma(" << x - << "): Does anybody know good way to calculate this numerically?" - << std::endl; + << "): Does anybody know good way to calculate this numerically?" + << std::endl; return numeric(0); } @@ -1516,8 +1516,8 @@ const numeric tgamma(const numeric & x) const numeric psi(const numeric & x) { std::clog << "psi(" << x - << "): Does anybody know good way to calculate this numerically?" - << std::endl; + << "): Does anybody know good way to calculate this numerically?" + << std::endl; return numeric(0); } @@ -1527,8 +1527,8 @@ const numeric psi(const numeric & x) const numeric psi(const numeric & n, const numeric & x) { std::clog << "psi(" << n << "," << x - << "): Does anybody know good way to calculate this numerically?" - << std::endl; + << "): Does anybody know good way to calculate this numerically?" + << std::endl; return numeric(0); } @@ -1789,8 +1789,7 @@ numeric irem(const numeric & a, const numeric & b, numeric & q) cl_I_div_t rem_quo = truncate2(The(::cl_I)(*a.value), The(::cl_I)(*b.value)); q = rem_quo.quotient; return rem_quo.remainder; - } - else { + } else { q = _num0(); return _num0(); // Throw? } @@ -1906,7 +1905,7 @@ ex CatalanEvalf(void) // be 61 (<64) while cl_float_format(18)=65. We want to have a cl_LF instead // of cl_SF, cl_FF or cl_DF but everything else is basically arbitrary. _numeric_digits::_numeric_digits() - : digits(17) + : digits(17) { assert(!too_late); too_late = true; diff --git a/ginac/power.cpp b/ginac/power.cpp index 2b6049ba..0bef15c4 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -58,7 +58,7 @@ power::power() : basic(TINFO_power) power::~power() { debugmsg("power destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } power::power(const power & other) @@ -71,7 +71,7 @@ const power & power::operator=(const power & other) { debugmsg("power operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -211,9 +211,8 @@ void power::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedenc debugmsg("power print csrc", LOGLEVEL_PRINT); // Integer powers of symbols are printed in a special, optimized way - if (exponent.info(info_flags::integer) && - (is_ex_exactly_of_type(basis, symbol) || - is_ex_exactly_of_type(basis, constant))) { + if (exponent.info(info_flags::integer) + && (is_ex_exactly_of_type(basis, symbol) || is_ex_exactly_of_type(basis, constant))) { int exp = ex_to_numeric(exponent).to_int(); if (exp > 0) os << "("; @@ -450,8 +449,7 @@ ex power::eval(int level) const mulp->clearflag(status_flags::evaluated); mulp->clearflag(status_flags::hash_calculated); return (new mul(power(*mulp,exponent), - power(num_coeff,*num_exponent)))-> - setflag(status_flags::dynallocated); + power(num_coeff,*num_exponent)))->setflag(status_flags::dynallocated); } else { GINAC_ASSERT(num_coeff.compare(_num0())<0); if (num_coeff.compare(_num_1())!=0) { @@ -460,8 +458,7 @@ ex power::eval(int level) const mulp->clearflag(status_flags::evaluated); mulp->clearflag(status_flags::hash_calculated); return (new mul(power(*mulp,exponent), - power(abs(num_coeff),*num_exponent)))-> - setflag(status_flags::dynallocated); + power(abs(num_coeff),*num_exponent)))->setflag(status_flags::dynallocated); } } } @@ -533,8 +530,8 @@ ex power::derivative(const symbol & s) const } else { // D(b^e) = b^e * (D(e)*ln(b) + e*D(b)/b) return mul(power(basis, exponent), - add(mul(exponent.diff(s), log(basis)), - mul(mul(exponent, basis.diff(s)), power(basis, -1)))); + add(mul(exponent.diff(s), log(basis)), + mul(mul(exponent, basis.diff(s)), power(basis, -1)))); } } @@ -573,9 +570,7 @@ ex power::expand(unsigned options) const if (are_ex_trivially_equal(basis,expanded_basis)) { return this->hold(); } else { - return (new power(expanded_basis,exponent))-> - setflag(status_flags::dynallocated | - status_flags::expanded); + return (new power(expanded_basis,exponent))->setflag(status_flags::dynallocated | status_flags::expanded); } } @@ -595,9 +590,7 @@ ex power::expand(unsigned options) const if (are_ex_trivially_equal(basis,expanded_basis)) { return this->hold(); } else { - return (new power(expanded_basis,exponent))-> - setflag(status_flags::dynallocated | - status_flags::expanded); + return (new power(expanded_basis,exponent))->setflag(status_flags::dynallocated | status_flags::expanded); } } @@ -638,12 +631,12 @@ ex power::expand_add(const add & a, int n) const for (l=0; lsetflag(status_flags::dynallocated), - _ex1())); + _ex1())); } } else { if (is_ex_exactly_of_type(r,mul)) { sum.push_back(expair(expand_mul(ex_to_mul(r),_num2()), - ex_to_numeric(c).power_dyn(_num2()))); + ex_to_numeric(c).power_dyn(_num2()))); } else { sum.push_back(expair((new power(r,_ex2()))->setflag(status_flags::dynallocated), - ex_to_numeric(c).power_dyn(_num2()))); + ex_to_numeric(c).power_dyn(_num2()))); } } @@ -758,7 +752,7 @@ ex power::expand_add_2(const add & a) const 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)))); + _num2().mul(ex_to_numeric(c)).mul_dyn(ex_to_numeric(c1)))); } } @@ -774,8 +768,7 @@ ex power::expand_add_2(const add & a) const GINAC_ASSERT(sum.size()==(a_nops*(a_nops+1))/2); - return (new add(sum))->setflag(status_flags::dynallocated | - status_flags::expanded ); + return (new add(sum))->setflag(status_flags::dynallocated | status_flags::expanded); } /** Expand factors of m in m^n where m is a mul and n is and integer @@ -795,18 +788,16 @@ ex power::expand_mul(const mul & m, const numeric & n) const } else { // it is safe not to call mul::combine_pair_with_coeff_to_pair() // since n is an integer - distrseq.push_back(expair((*cit).rest, - ex_to_numeric((*cit).coeff).mul(n))); + distrseq.push_back(expair((*cit).rest, ex_to_numeric((*cit).coeff).mul(n))); } ++cit; } - return (new mul(distrseq,ex_to_numeric(m.overall_coeff).power_dyn(n))) - ->setflag(status_flags::dynallocated); + return (new mul(distrseq,ex_to_numeric(m.overall_coeff).power_dyn(n)))->setflag(status_flags::dynallocated); } /* ex power::expand_commutative_3(const ex & basis, const numeric & exponent, - unsigned options) const + unsigned options) const { // obsolete @@ -822,12 +813,10 @@ ex power::expand_commutative_3(const ex & basis, const numeric & exponent, int n=exponent.to_int(); for (int k=0; k<=n; k++) { - distrseq.push_back(binomial(n,k)*power(first_operands,numeric(k))* - power(last_operand,numeric(n-k))); + distrseq.push_back(binomial(n,k) * power(first_operands,numeric(k)) + * power(last_operand,numeric(n-k))); } - return ex((new add(distrseq))->setflag(status_flags::expanded | - status_flags::dynallocated )). - expand(options); + return ex((new add(distrseq))->setflag(status_flags::expanded | status_flags::dynallocated)).expand(options); } */ @@ -835,11 +824,11 @@ ex power::expand_commutative_3(const ex & basis, const numeric & exponent, ex power::expand_noncommutative(const ex & basis, const numeric & exponent, unsigned options) const { - ex rest_power=ex(power(basis,exponent.add(_num_1()))). - expand(options | expand_options::internal_do_not_expand_power_operands); + ex rest_power = ex(power(basis,exponent.add(_num_1()))). + expand(options | expand_options::internal_do_not_expand_power_operands); return ex(mul(rest_power,basis),0). - expand(options | expand_options::internal_do_not_expand_mul_operands); + expand(options | expand_options::internal_do_not_expand_mul_operands); } */ diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 419da735..94bdb558 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -100,8 +100,7 @@ void pseries::destroy(bool call_parent) * @param rel_ expansion variable and point (must hold a relational) * @param ops_ vector of {coefficient, power} pairs (coefficient must not be zero) * @return newly constructed pseries */ -pseries::pseries(const ex &rel_, const epvector &ops_) - : basic(TINFO_pseries), seq(ops_) +pseries::pseries(const ex &rel_, const epvector &ops_) : basic(TINFO_pseries), seq(ops_) { debugmsg("pseries constructor from ex,epvector", LOGLEVEL_CONSTRUCT); GINAC_ASSERT(is_ex_exactly_of_type(rel_, relational)); @@ -415,8 +414,7 @@ ex pseries::expand(unsigned options) const for (epvector::const_iterator i=seq.begin(); i!=seq.end(); ++i) newseq.push_back(expair(i->rest.expand(), i->coeff)); return (new pseries(relational(var,point), newseq)) - ->setflag(status_flags::dynallocated | - status_flags::expanded); + ->setflag(status_flags::dynallocated | status_flags::expanded); } @@ -474,7 +472,7 @@ ex pseries::convert_to_poly(bool no_order) const * false otherwise. */ bool pseries::is_terminating(void) const { - return !is_order_function((seq.end()-1)->rest); + return seq.size() == 0 || !is_order_function((seq.end()-1)->rest); } diff --git a/ginac/relational.cpp b/ginac/relational.cpp index a71a90af..5628f25c 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -48,7 +48,7 @@ relational::relational() : basic(TINFO_relational) relational::~relational() { debugmsg("relational destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } relational::relational(const relational & other) @@ -61,7 +61,7 @@ const relational & relational::operator=(const relational & other) { debugmsg("relational operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -286,9 +286,7 @@ ex relational::eval(int level) const if (level == -max_recursion_level) { throw(std::runtime_error("max recursion level reached")); } - return (new relational(lh.eval(level-1),rh.eval(level-1),o))-> - setflag(status_flags::dynallocated | - status_flags::evaluated ); + return (new relational(lh.eval(level-1),rh.eval(level-1),o))->setflag(status_flags::dynallocated | status_flags::evaluated); } ex relational::evalf(int level) const @@ -299,8 +297,7 @@ ex relational::evalf(int level) const if (level == -max_recursion_level) { throw(std::runtime_error("max recursion level reached")); } - return (new relational(lh.eval(level-1),rh.eval(level-1),o))-> - setflag(status_flags::dynallocated); + return (new relational(lh.eval(level-1),rh.eval(level-1),o))->setflag(status_flags::dynallocated); } ex relational::simplify_ncmul(const exvector & v) const diff --git a/ginac/remember.cpp b/ginac/remember.cpp index 2c442162..9b06a464 100644 --- a/ginac/remember.cpp +++ b/ginac/remember.cpp @@ -35,8 +35,8 @@ namespace GiNaC { // class remember_table_entry ////////// -remember_table_entry::remember_table_entry(function const & f, ex const & r) : - hashvalue(f.gethash()), seq(f.seq), result(r) +remember_table_entry::remember_table_entry(function const & f, ex const & r) + : hashvalue(f.gethash()), seq(f.seq), result(r) { ++last_access=access_counter; successful_hits=0; @@ -144,8 +144,8 @@ remember_table::remember_table() remember_strategy=remember_strategies::delete_never; } -remember_table::remember_table(unsigned s, unsigned as, unsigned strat) : - max_assoc_size(as), remember_strategy(strat) +remember_table::remember_table(unsigned s, unsigned as, unsigned strat) + : max_assoc_size(as), remember_strategy(strat) { // we keep max_assoc_size and remember_strategy if we need to clear // all entries diff --git a/ginac/simp_lor.cpp b/ginac/simp_lor.cpp index 3c9cb453..06eef8ee 100644 --- a/ginac/simp_lor.cpp +++ b/ginac/simp_lor.cpp @@ -54,7 +54,7 @@ simp_lor::simp_lor() : type(invalid) simp_lor::~simp_lor() { debugmsg("simp_lor destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } simp_lor::simp_lor(const simp_lor & other) @@ -67,7 +67,7 @@ const simp_lor & simp_lor::operator=(const simp_lor & other) { debugmsg("simp_lor operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; @@ -101,32 +101,32 @@ 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, const ex & i1, const ex & i2) : - indexed(i1,i2), type(t) +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); tinfo_key=TINFO_simp_lor; GINAC_ASSERT(all_of_type_lorentzidx()); } -simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const ex & i1) : - indexed(i1), type(t), name(n) +simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const ex & i1) + : indexed(i1), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_simp_lor; GINAC_ASSERT(all_of_type_lorentzidx()); } -simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv) : - indexed(iv), type(t), name(n) +simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv) + : indexed(iv), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_simp_lor; GINAC_ASSERT(all_of_type_lorentzidx()); } -simp_lor::simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp) : - indexed(ivp), type(t), name(n) +simp_lor::simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp) + : indexed(ivp), type(t), name(n) { debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_simp_lor; @@ -230,7 +230,7 @@ ex simp_lor::eval(int level) const return _ex0(); } } else if (idx1.is_symbolic() && - idx1.is_co_contra_pair(idx2)) { + idx1.is_co_contra_pair(idx2)) { return Dim()-idx1.get_dim_parallel_space(); } } @@ -367,8 +367,7 @@ ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp) // try to contract first index replacements=0; if (first_idx.is_symbolic()) { - replacements = subs_index_in_exvector(v_contracted, - first_idx.toggle_covariant(),second_idx); + replacements = subs_index_in_exvector(v_contracted, first_idx.toggle_covariant(),second_idx); if (replacements==0) { // not contracted, restore g object *it=saved_g; @@ -383,8 +382,7 @@ ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp) // try second index only if first was not contracted if ((replacements==0)&&(second_idx.is_symbolic())) { // first index not contracted, *it is again the original g object - replacements = subs_index_in_exvector(v_contracted, - second_idx.toggle_covariant(),first_idx); + replacements = subs_index_in_exvector(v_contracted, second_idx.toggle_covariant(),first_idx); if (replacements==0) { // not contracted except in itself, restore g object *it=saved_g; @@ -446,7 +444,7 @@ ex simplify_simp_lor(const ex & e, const scalar_products & sp) ex sum=_ex0(); for (unsigned i=0; i0) { reg(v2,v1,sp); @@ -501,7 +499,7 @@ void scalar_products::debugprint(void) const for (spmap::const_iterator cit=spm.begin(); cit!=spm.end(); ++cit) { const spmapkey & k=(*cit).first; std::cerr << "item key=((" << k.first.first - << "," << k.first.second << "),"; + << "," << k.first.second << "),"; k.second.printraw(cerr); cerr << ") value=" << (*cit).second << std::endl; } diff --git a/ginac/structure.cpp b/ginac/structure.cpp index 95c074ac..fe3c1c51 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -44,7 +44,7 @@ structure::structure() structure::~structure() { debugmsg("structure destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } structure::structure(const structure & other) @@ -57,7 +57,7 @@ const structure & structure::operator=(const structure & other) { debugmsg("structure operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; diff --git a/ginac/structure.pl b/ginac/structure.pl index b43661d8..7521016a 100755 --- a/ginac/structure.pl +++ b/ginac/structure.pl @@ -277,7 +277,7 @@ ${STRUCTURE}::${STRUCTURE}() ${STRUCTURE}::~${STRUCTURE}() { debugmsg("${STRUCTURE} destructor",LOGLEVEL_DESTRUCT); - destroy(0); + destroy(false); } ${STRUCTURE}::${STRUCTURE}(${STRUCTURE} const & other) @@ -290,7 +290,7 @@ ${STRUCTURE} const & ${STRUCTURE}::operator=(${STRUCTURE} const & other) { debugmsg("${STRUCTURE} operator=",LOGLEVEL_ASSIGNMENT); if (this != &other) { - destroy(1); + destroy(true); copy(other); } return *this; diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index 1e2561ab..15f1f002 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -181,11 +181,11 @@ bool symbol::info(unsigned inf) const { if (inf==info_flags::symbol) return true; if (inf==info_flags::polynomial || - inf==info_flags::integer_polynomial || - inf==info_flags::cinteger_polynomial || - inf==info_flags::rational_polynomial || - inf==info_flags::crational_polynomial || - inf==info_flags::rational_function) { + inf==info_flags::integer_polynomial || + inf==info_flags::cinteger_polynomial || + inf==info_flags::rational_polynomial || + inf==info_flags::crational_polynomial || + inf==info_flags::rational_function) { return true; } else { return inherited::info(inf); diff --git a/ginac/utils.cpp b/ginac/utils.cpp index c4e5bbc4..49edabee 100644 --- a/ginac/utils.cpp +++ b/ginac/utils.cpp @@ -31,7 +31,7 @@ namespace GiNaC { /** ctor for pole_error exception class. */ pole_error::pole_error(const std::string& what_arg, int degree) - : domain_error(what_arg) + : domain_error(what_arg) { deg = degree; }