]> www.ginac.de Git - ginac.git/commitdiff
- more indentation fixes
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Fri, 11 Aug 2000 21:39:36 +0000 (21:39 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Fri, 11 Aug 2000 21:39:36 +0000 (21:39 +0000)
35 files changed:
ginac/add.cpp
ginac/archive.cpp
ginac/basic.cpp
ginac/clifford.cpp
ginac/color.cpp
ginac/coloridx.cpp
ginac/constant.cpp
ginac/container.pl
ginac/expairseq.cpp
ginac/exprseq_suppl.cpp
ginac/fail.cpp
ginac/function.pl
ginac/idx.cpp
ginac/indexed.cpp
ginac/inifcns.cpp
ginac/inifcns_gamma.cpp
ginac/inifcns_trans.cpp
ginac/inifcns_zeta.cpp
ginac/isospin.cpp
ginac/lorentzidx.cpp
ginac/lortensor.cpp
ginac/matrix.cpp
ginac/mul.cpp
ginac/ncmul.cpp
ginac/normal.cpp
ginac/numeric.cpp
ginac/power.cpp
ginac/pseries.cpp
ginac/relational.cpp
ginac/remember.cpp
ginac/simp_lor.cpp
ginac/structure.cpp
ginac/structure.pl
ginac/symbol.cpp
ginac/utils.cpp

index 40ccc23f526553cef1a3849fae2ce39eff337702..fa42153072269da7dd6cad27d134fae1e350b594 100644 (file)
@@ -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);
 }
 
 //////////
index f237231302c51b733b29f46365163d3cdc1630d0..dcfb00dc9c37e382cb0ae88550cec11adaf4fd93 100644 (file)
@@ -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);
 }
index 0ca273a9de7367c19fe4bd83f7d5f7b8615bd975..8dcf58433e54a41605dbc31b7b8f3a4a6ad5b859 100644 (file)
@@ -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;
        }
index 742fd002698463c855ce02ff99942eb8e52d8d7f..02aff19b6ea0b9a11b675470924d79b50b50ed86 100644 (file)
@@ -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;
index 82096b57d5e10d293aee9da0ff71862909b5642c..34c3a85f32166c10de8b8b65a6f0804e7d5b9ebc 100644 (file)
@@ -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_label<MAX_REPRESENTATION_LABELS);
@@ -117,7 +117,7 @@ color::color(color_types const t, const ex & i1, unsigned rl)
 }
 
 color::color(color_types const t, const ex & i1, const ex & i2, unsigned rl)
-       : inherited(i1,i2), type(t), representation_label(rl)
+  : inherited(i1,i2), type(t), representation_label(rl)
 {
        debugmsg("color constructor from color_types,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
        GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
@@ -126,7 +126,7 @@ color::color(color_types const t, const ex & i1, const ex & i2, unsigned rl)
 }
 
 color::color(color_types const t, const ex & i1, const ex & i2, const ex & i3,
-                        unsigned rl) : inherited(i1,i2,i3), type(t), representation_label(rl)
+             unsigned rl) : inherited(i1,i2,i3), type(t), representation_label(rl)
 {
        debugmsg("color constructor from color_types,ex,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
        GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
@@ -135,7 +135,7 @@ color::color(color_types const t, const ex & i1, const ex & i2, const ex & i3,
 }
 
 color::color(color_types const t, const exvector & iv, unsigned rl)
-       : inherited(iv), type(t), representation_label(rl)
+  : inherited(iv), type(t), representation_label(rl)
 {
        debugmsg("color constructor from color_types,exvector,unsigned",LOGLEVEL_CONSTRUCT);
        GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
@@ -144,7 +144,7 @@ color::color(color_types const t, const exvector & iv, unsigned rl)
 }
 
 color::color(color_types const t, exvector * ivp, unsigned rl)
-       : inherited(ivp), type(t), representation_label(rl)
+  : inherited(ivp), type(t), representation_label(rl)
 {
        debugmsg("color constructor from color_types,exvector *,unsigned",LOGLEVEL_CONSTRUCT);
        GINAC_ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
@@ -356,7 +356,7 @@ ex color::eval(int level) const
                                if (CMPINDICES(1,2,3)) {
                                        return _ex1();
                                } else if (CMPINDICES(1,4,7)||CMPINDICES(2,4,6)||
-                                                  CMPINDICES(2,5,7)||CMPINDICES(3,4,5)) {
+                                          CMPINDICES(2,5,7)||CMPINDICES(3,4,5)) {
                                        return _ex1_2();
                                } else if (CMPINDICES(1,5,6)||CMPINDICES(3,6,7)) {
                                        return -_ex1_2();
@@ -689,10 +689,10 @@ 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,
-                                                                exvector & unknownvec)
+                                 exvector & fvec, exvector & dvec,
+                                 exvectorvector & Tvecs,
+                                 exvectorvector & ONEvecs,
+                                 exvector & unknownvec)
 {
        // if not all elements are of type color, put all Ts in unknownvec to
        // retain the ordering
@@ -738,8 +738,8 @@ void split_color_string_in_parts(const exvector & v, exvector & delta8vec,
 }    
 
 exvector recombine_color_string(exvector & delta8vec, exvector & fvec,
-                                                               exvector & dvec, exvectorvector & Tvecs,
-                                                               exvectorvector & ONEvecs, exvector & unknownvec)
+                                exvector & dvec, exvectorvector & Tvecs,
+                                exvectorvector & ONEvecs, exvector & unknownvec)
 {
        unsigned sz=delta8vec.size()+fvec.size()+dvec.size()+unknownvec.size();
        for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
@@ -787,9 +787,9 @@ ex color_trace_of_one_representation_label(const exvector & v)
        
        // FIXME: check this formula for SU(N) with N!=3
        return numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
-                  % color_trace_of_one_representation_label(v1)
-                 +numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
-                  % color_trace_of_one_representation_label(v2);
+              % color_trace_of_one_representation_label(v1)
+              +numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
+              % color_trace_of_one_representation_label(v2);
        /*
        ex term1=numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
                   % color_trace_of_one_representation_label(v1);
@@ -882,14 +882,12 @@ ex simplify_pure_color_string(const ex & e)
                                                }
                                                t1=_ex1();
                                                t2=_ex1();
-                                               ex term1=numeric(-1)/numeric(6)*nonsimplified_ncmul(recombine_color_string(
-                                                                delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+                                               ex term1=numeric(-1)/numeric(6)*nonsimplified_ncmul(recombine_color_string(delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
                                                for (unsigned k=i+1; k<j; ++k) {
                                                        S.push_back(_ex1());
                                                }
                                                t1=color_trace_of_one_representation_label(S);
-                                               ex term2=numeric(1)/numeric(2)*nonsimplified_ncmul(recombine_color_string(
-                                                                delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+                                               ex term2=numeric(1)/numeric(2)*nonsimplified_ncmul(recombine_color_string(delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
                                                return simplify_color(term1+term2);
                                        }
                                }
index 261365c7751e72f1daaaf0e499e441502df14a70..b3a409a29068baa1ed9900d2293acaf2da431a80 100644 (file)
@@ -50,7 +50,7 @@ coloridx::coloridx()
 coloridx::~coloridx() 
 {
        debugmsg("coloridx destructor",LOGLEVEL_DESTRUCT);
-       destroy(0);
+       destroy(false);
 }
 
 coloridx::coloridx(const coloridx & other)
@@ -63,7 +63,7 @@ const coloridx & coloridx::operator=(const coloridx & other)
 {
        debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT);
        if (this != &other) {
-               destroy(1);
+               destroy(true);
                copy(other);
        }
        return *this;
index 688d2288b45769087fef264178f33b213b3ae804..25efe77300bfd41dcb77293ffab95d75f2c20ea9 100644 (file)
@@ -41,9 +41,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS(constant, basic)
 
 // public
 
-constant::constant() :
-       basic(TINFO_constant), name(""), ef(0),
-       number(0), serial(next_serial++)
+constant::constant() : basic(TINFO_constant), name(""), ef(0), number(0), serial(next_serial++)
 {
        debugmsg("constant default constructor",LOGLEVEL_CONSTRUCT);
 }
@@ -89,17 +87,14 @@ void constant::destroy(bool call_parent)
 
 // public
 
-constant::constant(const std::string & initname, evalffunctype efun) :
-       basic(TINFO_constant), name(initname), ef(efun),
-       // number(0), fct_assigned(true), serial(next_serial++)
-       number(0), serial(next_serial++)
+constant::constant(const std::string & initname, evalffunctype efun)
+  : basic(TINFO_constant), name(initname), ef(efun), number(0), serial(next_serial++)
 {
        debugmsg("constant constructor from string, function",LOGLEVEL_CONSTRUCT);
 }
 
-constant::constant(const std::string & initname, const numeric & initnumber) :
-       basic(TINFO_constant), name(initname), ef(0),
-       number(new numeric(initnumber)), /* fct_assigned(false),*/ serial(next_serial++)
+constant::constant(const std::string & initname, const numeric & initnumber)
+  : basic(TINFO_constant), name(initname), ef(0), number(new numeric(initnumber)), serial(next_serial++)
 {
        debugmsg("constant constructor from string, numeric",LOGLEVEL_CONSTRUCT);
 }
index 7f06cfebe3e947ecf614dcd62e59ff4d72dfb818..f642e4114c33f13b217dd2340a0cf4193f4f9c28 100755 (executable)
@@ -125,11 +125,11 @@ sub generate {
 }
 
 $constructors_interface=generate(
-'    explicit ${CONTAINER}(${SEQ1});'."\n",
+'      explicit ${CONTAINER}(${SEQ1});'."\n",
 'const ex & param${N}',', ','','');
 
 $constructors_implementation=generate(
-       <<'END_OF_CONSTRUCTORS_IMPLEMENTATION','const ex & param${N}',', ','    seq.push_back(param${N});',"\n");
+       <<'END_OF_CONSTRUCTORS_IMPLEMENTATION','const ex & param${N}',', ','    seq.push_back(param${N});',"\n");
 ${CONTAINER}::${CONTAINER}(${SEQ1}) : basic(TINFO_${CONTAINER})
 {
        debugmsg(\"${CONTAINER} constructor from ${N}*ex\",LOGLEVEL_CONSTRUCT);
@@ -340,7 +340,7 @@ ${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER})
 ${CONTAINER}::~${CONTAINER}()
 {
        debugmsg("${CONTAINER} destructor",LOGLEVEL_DESTRUCT);
-       destroy(0);
+       destroy(false);
 }
 
 ${CONTAINER}::${CONTAINER}(${CONTAINER} const & other)
@@ -353,7 +353,7 @@ ${CONTAINER} const & ${CONTAINER}::operator=(${CONTAINER} const & other)
 {
        debugmsg("${CONTAINER} operator=",LOGLEVEL_ASSIGNMENT);
        if (this != &other) {
-               destroy(1);
+               destroy(true);
                copy(other);
        }
        return *this;
index 798d1bb9455b19ad43e0328869071dbae909ed82..1f7fcf4184cd76c41206d9be52bc4d12f541c0c9 100644 (file)
@@ -70,7 +70,7 @@ const expairseq & expairseq::operator=(const expairseq & other)
 {
        debugmsg("expairseq operator=",LOGLEVEL_ASSIGNMENT);
        if (this != &other) {
-               destroy(1);
+               destroy(true);
                copy(other);
        }
        return *this;
@@ -93,7 +93,7 @@ void expairseq::copy(const expairseq & other)
                for (unsigned i=0; i<hashtabsize; ++i) {
                        hashtab[i].clear();
                        for (epplist::const_iterator cit=other.hashtab[i].begin();
-                                cit!=other.hashtab[i].end(); ++cit) {
+                            cit!=other.hashtab[i].end(); ++cit) {
                                hashtab[i].push_back(seq.begin()+((*cit)-osb));
                        }
                }
@@ -122,8 +122,8 @@ expairseq::expairseq(const exvector & v) : inherited(TINFO_expairseq)
 }
 
 /*
-expairseq::expairseq(const epvector & v, bool do_not_canonicalize) :
-       inherited(TINFO_expairseq)
+expairseq::expairseq(const epvector & v, bool do_not_canonicalize)
+  : inherited(TINFO_expairseq)
 {
        debugmsg("expairseq constructor from epvector",LOGLEVEL_CONSTRUCT);
        if (do_not_canonicalize) {
@@ -138,16 +138,16 @@ expairseq::expairseq(const epvector & v, bool do_not_canonicalize) :
 }
 */
 
-expairseq::expairseq(const epvector & v, const ex & oc) :
-       inherited(TINFO_expairseq), overall_coeff(oc)
+expairseq::expairseq(const epvector & v, const ex & oc)
+  : inherited(TINFO_expairseq), overall_coeff(oc)
 {
        debugmsg("expairseq constructor from epvector,ex",LOGLEVEL_CONSTRUCT);
        construct_from_epvector(v);
        GINAC_ASSERT(is_canonical());
 }
 
-expairseq::expairseq(epvector * vp, const ex & oc) :
-       inherited(TINFO_expairseq), overall_coeff(oc)
+expairseq::expairseq(epvector * vp, const ex & oc)
+  : inherited(TINFO_expairseq), overall_coeff(oc)
 {
        debugmsg("expairseq constructor from epvector *,ex",LOGLEVEL_CONSTRUCT);
        GINAC_ASSERT(vp!=0);
@@ -346,9 +346,7 @@ ex expairseq::eval(int level) const
                return this->hold();
        }
 
-       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<bool> & touched,
-                                                                                 unsigned & number_of_zeroes)
+                                          epvector::iterator & last_non_zero,
+                                          vector<bool> & 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<bool> & touched,
-                                                                  unsigned & number_of_zeroes)
+                                   epvector::iterator & last_non_zero,
+                                   vector<bool> & 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;
index 2d7e7bf9acd817729bb54d82e54e497ec7c61016..1e4ef616b7a89353954af4a4246eec809bccae4a 100644 (file)
@@ -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);
 }
 
index 37baafba9b593d1ac6669bd2b747d8d4281a2da1..2cea9eb1a49e9f32b5b027cd9d4b4995be3b3fe3 100644 (file)
@@ -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;
index ac2dc877dfa4322f7d63f64b7b707e4dc567755f..fac659f50a329ee383c9e263c7068d271d582203 100755 (executable)
@@ -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;
index 8a31ec7ebd8cc7d436b4f4a2c97299c0dc3dea92..08b982c32146a7e9262a7b9963a86a536f739bc5 100644 (file)
@@ -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 idx &>
-                                                        (const_cast<basic &>(other));
+       const idx & o=static_cast<const idx &>(const_cast<basic &>(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 idx &>
-                                                        (const_cast<basic &>(other));
+       const idx & o=static_cast<const idx &>(const_cast<basic &>(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 idx &>
-                                                        (const_cast<basic &>(other));
+       const idx & o=static_cast<const idx &>(const_cast<basic &>(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;
index 0d26bd7256cccf84df9f6909f9d418ba34d3e034..8151b080a4b2f685a96e2769495e393a1773d7a4 100644 (file)
@@ -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
index d5e9275b54ee1f482745fdfc1d8f06e9656d0995..6541af420574cc4cf8b1dd30c87b5c2878911121 100644 (file)
@@ -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
index e6ba5b1155f569e60073d8c50550f01c5e186fa0..ae12074e9a0ac6fc7ccecf18570d4a586498ceec 100644 (file)
@@ -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<symbol *>(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
index ac0bc323c9a6968b2e9e12df665e31aed6b0c938..734c0ecb945fa1aecb0e19fbfb8d0527bc787610 100644 (file)
@@ -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
index a20e534f21a5c2ddfae4026273a55bb7f133c6b2..4c6e66011e752f810086897dd0de83c54e9475dc 100644 (file)
@@ -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
index fafdaec02af0ae8a4ad8a33bf7d1c41f0c39fc69..b46ecb0e72142764a76b05f0ab6bdc48eaecc68f 100644 (file)
@@ -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;
 }
index d03d9b7a0c991ce1420eb7f518ce170ba471a4ad..91fc6d9e183e9d15d41f9c0a679bb4d5d2f771e7 100644 (file)
@@ -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;
 }
 
index f7b3739148677ae28153b1335495e54cbb51aa95..2b797efbfa04827fdcfb6bbe3d2c73ec9b1a30c1 100644 (file)
@@ -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;
index 470991b7bf12d4354afab97ac3226e37514fac92..b2d4f606bd772ea7be1e1969a43f9cd44b872683 100644 (file)
@@ -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<m; ++r2) {
                                for (unsigned c=r1+1; c<n; ++c) {
                                        dividend_n = (tmp_n.m[r0*n+r1]*tmp_n.m[r2*n+c]*
-                                                                 tmp_d.m[r2*n+r1]*tmp_d.m[r0*n+c]
-                                                                -tmp_n.m[r2*n+r1]*tmp_n.m[r0*n+c]*
-                                                                 tmp_d.m[r0*n+r1]*tmp_d.m[r2*n+c]).expand();
+                                                     tmp_d.m[r2*n+r1]*tmp_d.m[r0*n+c]
+                                                    -tmp_n.m[r2*n+r1]*tmp_n.m[r0*n+c]*
+                                                     tmp_d.m[r0*n+r1]*tmp_d.m[r2*n+c]).expand();
                                        dividend_d = (tmp_d.m[r2*n+r1]*tmp_d.m[r0*n+c]*
-                                                                 tmp_d.m[r0*n+r1]*tmp_d.m[r2*n+c]).expand();
+                                                     tmp_d.m[r0*n+r1]*tmp_d.m[r2*n+c]).expand();
                                        bool check = divide(dividend_n, divisor_n,
-                                                                               tmp_n.m[r2*n+c], true);
+                                                           tmp_n.m[r2*n+c], true);
                                        check &= divide(dividend_d, divisor_d,
-                                                                       tmp_d.m[r2*n+c], true);
+                                                       tmp_d.m[r2*n+c], true);
                                        GINAC_ASSERT(check);
                                }
                                // fill up left hand side with zeros
index b9bae4456a638c0c8f165ba772c7dcd789e4317c..3e257e6288e4153e2e0f028c23ac333bbd641e21 100644 (file)
@@ -412,21 +412,19 @@ ex mul::eval(int level) const
                // *(x;1) -> 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;
index 1aa436339294ffcbe3214062800e2d2e73e90d5f..7e8dce6596a728679ec397c99cbe7192fce531fd 100644 (file)
@@ -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<evv.size(); ++i) {
-                       splitseq.push_back((new ncmul(evv[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
index 851b7ba7f035ac9f595e0ee37e11c266e2060d01..0e1a0bfa4f39b2e8f5911cb4813e969c5e3ac52d 100644 (file)
@@ -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();
index 24e33e4675db584d6bbf5e3f94973f48a986cba7..af2d8effe25226ce2c7d5d33d4d6ec703ee9925c 100644 (file)
@@ -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;
index 2b6049ba4f3eb90dbf787ddcb6818c6d889de7c1..0bef15c42ac46ceab7d291444c5b9917723aecb0 100644 (file)
@@ -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; l<m-1; l++) {
                        const ex & b = a.op(l);
                        GINAC_ASSERT(!is_ex_exactly_of_type(b,add));
-                       GINAC_ASSERT(!is_ex_exactly_of_type(b,power)||
-                                                !is_ex_exactly_of_type(ex_to_power(b).exponent,numeric)||
-                                                !ex_to_numeric(ex_to_power(b).exponent).is_pos_integer()||
-                                                !is_ex_exactly_of_type(ex_to_power(b).basis,add)||
-                                                !is_ex_exactly_of_type(ex_to_power(b).basis,mul)||
-                                                !is_ex_exactly_of_type(ex_to_power(b).basis,power));
+                       GINAC_ASSERT(!is_ex_exactly_of_type(b,power) ||
+                                    !is_ex_exactly_of_type(ex_to_power(b).exponent,numeric) ||
+                                    !ex_to_numeric(ex_to_power(b).exponent).is_pos_integer() ||
+                                    !is_ex_exactly_of_type(ex_to_power(b).basis,add) ||
+                                    !is_ex_exactly_of_type(ex_to_power(b).basis,mul) ||
+                                    !is_ex_exactly_of_type(ex_to_power(b).basis,power));
                        if (is_ex_exactly_of_type(b,mul)) {
                                term.push_back(expand_mul(ex_to_mul(b),numeric(k[l])));
                        } else {
@@ -653,12 +646,12 @@ ex power::expand_add(const add & a, int n) const
                
                const ex & b = a.op(l);
                GINAC_ASSERT(!is_ex_exactly_of_type(b,add));
-               GINAC_ASSERT(!is_ex_exactly_of_type(b,power)||
-                                        !is_ex_exactly_of_type(ex_to_power(b).exponent,numeric)||
-                                        !ex_to_numeric(ex_to_power(b).exponent).is_pos_integer()||
-                                        !is_ex_exactly_of_type(ex_to_power(b).basis,add)||
-                                        !is_ex_exactly_of_type(ex_to_power(b).basis,mul)||
-                                        !is_ex_exactly_of_type(ex_to_power(b).basis,power));
+               GINAC_ASSERT(!is_ex_exactly_of_type(b,power) ||
+                            !is_ex_exactly_of_type(ex_to_power(b).exponent,numeric) ||
+                            !ex_to_numeric(ex_to_power(b).exponent).is_pos_integer() ||
+                            !is_ex_exactly_of_type(ex_to_power(b).basis,add) ||
+                            !is_ex_exactly_of_type(ex_to_power(b).basis,mul) ||
+                            !is_ex_exactly_of_type(ex_to_power(b).basis,power));
                if (is_ex_exactly_of_type(b,mul)) {
                        term.push_back(expand_mul(ex_to_mul(b),numeric(n-k_cum[m-2])));
                } else {
@@ -730,27 +723,28 @@ ex power::expand_add_2(const add & a) const
                const ex & c=(*cit0).coeff;
                
                GINAC_ASSERT(!is_ex_exactly_of_type(r,add));
-               GINAC_ASSERT(!is_ex_exactly_of_type(r,power)||
-                          !is_ex_exactly_of_type(ex_to_power(r).exponent,numeric)||
-                          !ex_to_numeric(ex_to_power(r).exponent).is_pos_integer()||
-                          !is_ex_exactly_of_type(ex_to_power(r).basis,add)||
-                          !is_ex_exactly_of_type(ex_to_power(r).basis,mul)||
-                          !is_ex_exactly_of_type(ex_to_power(r).basis,power));
+               GINAC_ASSERT(!is_ex_exactly_of_type(r,power) ||
+                            !is_ex_exactly_of_type(ex_to_power(r).exponent,numeric) ||
+                            !ex_to_numeric(ex_to_power(r).exponent).is_pos_integer() ||
+                            !is_ex_exactly_of_type(ex_to_power(r).basis,add) ||
+                            !is_ex_exactly_of_type(ex_to_power(r).basis,mul) ||
+                            !is_ex_exactly_of_type(ex_to_power(r).basis,power));
 
                if (are_ex_trivially_equal(c,_ex1())) {
                        if (is_ex_exactly_of_type(r,mul)) {
-                               sum.push_back(expair(expand_mul(ex_to_mul(r),_num2()),_ex1()));
+                               sum.push_back(expair(expand_mul(ex_to_mul(r),_num2()),
+                                                    _ex1()));
                        } else {
                                sum.push_back(expair((new power(r,_ex2()))->setflag(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);
 }
 */
 
index 419da735985c14815b77871ab7aa45a0c78ee777..94bdb55899b3e5ac75269e7ad3493d20d51e5585 100644 (file)
@@ -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);
 }
 
 
index a71a90af1859d1eec591d7f022815f7b0e02ceb7..5628f25ca67d04d06ec66cc039171ec09edfb28c 100644 (file)
@@ -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
index 2c442162ebb5bbf3aaf262564341b70ac5defb07..9b06a464d8d9e33e8b5672fe6705d9d1637a73f1 100644 (file)
@@ -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
index 3c9cb453e04c04e6e2313311d5cbb7275ffe506e..06eef8ee6b03b5058784291c62565ac66abfc78f 100644 (file)
@@ -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; i<e_expanded.nops(); ++i)
                        sum += simplify_simp_lor(e_expanded.op(i),sp);
-               
+
                return sum;
        }
 
@@ -470,7 +468,7 @@ ex simplify_simp_lor(const ex & e, const scalar_products & sp)
 //////////
 
 void scalar_products::reg(const simp_lor & v1, const simp_lor & v2,
-                                                 const ex & sp)
+                          const ex & sp)
 {
        if (v1.compare_same_type(v2)>0) {
                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;
        }
index 95c074ac621716a785c4062a5259f56c9b59b952..fe3c1c5197aa3c502ed1e02de82e17405ae34e5b 100644 (file)
@@ -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;
index b43661d847bdb9e3464acc53811077bd452c669b..7521016a377e2013188261c485d0dd5ca74ac205 100755 (executable)
@@ -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;
index 1e2561ab7eff7550b3e9303bacc3b31df09368fe..15f1f0029ca8998b475da393ec5d2f40bb52a701 100644 (file)
@@ -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);
index c4e5bbc4321e4de55e140668630e4ff863cde143..49edabee177ae8a6a05aae870f5e20ce267a4062 100644 (file)
@@ -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;
 }