Fix some apparent typos and misindentations 2.
authorRichard Kreckel <kreckel@ginac.de>
Sat, 10 Oct 2015 20:24:32 +0000 (22:24 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Sat, 10 Oct 2015 20:24:32 +0000 (22:24 +0200)
(Formatting should comply with http://www.cebix.net/indentation.html.)

18 files changed:
check/exam_clifford.cpp
check/exam_inifcns_nstdsums.cpp
check/time_antipode.cpp
ginac/add.cpp
ginac/basic.cpp
ginac/clifford.cpp
ginac/ex.cpp
ginac/expairseq.cpp
ginac/inifcns_trans.cpp
ginac/integral.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

index 420089f..24655e4 100644 (file)
@@ -67,7 +67,7 @@ static unsigned check_equal_simplify_term(const ex & e1, const ex & e2, idx & mu
 {
        ex e = expand_dummy_sum(normal(simplify_indexed(e1) - e2), true);
 
-       for (int j=0; j<4; j++) {
+       for (int j=0; j<4; j++) {
                ex esub = e.subs(
                                is_a<varidx>(mu)
                                        ? lst (
@@ -87,7 +87,7 @@ static unsigned check_equal_simplify_term(const ex & e1, const ex & e2, idx & mu
 
 static unsigned check_equal_simplify_term2(const ex & e1, const ex & e2)
 {
-       ex e = expand_dummy_sum(normal(simplify_indexed(e1) - e2), true);
+       ex e = expand_dummy_sum(normal(simplify_indexed(e1) - e2), true);
        if (!(canonicalize_clifford(e).is_zero())) {
                clog << "simplify_indexed(" << e1 << ") - (" << e2 << ") erroneously returned "
                         << canonicalize_clifford(e) << " instead of 0" << endl;
index c0412d9..c93d0b4 100644 (file)
@@ -313,14 +313,14 @@ static unsigned inifcns_test_legacy()
 
        ex x1 = exp(2*Pi*I/13).evalf();
        ex x2 = exp(24*Pi*I/13).evalf();
-       ex r2 = Li(lst(2),lst(x1)).hold().evalf();
+       ex r2 = Li(lst(2),lst(x1)).hold().evalf();
        ex r3 = Li(lst(2),lst(x2)).hold().evalf();
        if ( abs(r2-conjugate(r3)) > prec ) {
                clog << "Legacy test 2 seems to be wrong." << endl;
                result++;
        }
 
-       ex x3 = exp(5*Pi*I/3).evalf();
+       ex x3 = exp(5*Pi*I/3).evalf();
        ex r4 = Li(lst(3),lst(x3)).hold().evalf();
        if ( abs(r4 - numeric("0.40068563438653142847-0.95698384815740185713*I")) > prec ) {
                clog << "Legacy test 3 seems to be wrong." << endl;
index fdedddf..2358db3 100644 (file)
@@ -151,7 +151,7 @@ class Gamma : public vertex {
 public:
        Gamma(ijpair ij = ijpair(0,0)) : vertex(ij) { }
        vertex* copy() const { return new Gamma(*this); }
-       ijpair get_increment() const { return ijpair(indices.first+indices.second+1, 0); }
+       ijpair get_increment() const { return ijpair(indices.first+indices.second+1, 0); }
        const ex evaluate(const symbol &x, const unsigned grad) const;
 private:
 };
@@ -450,7 +450,7 @@ static const node tree6(unsigned cuts=0)
 static unsigned test_tree(const node tree_generator(unsigned))
 {
        const int edges = tree_generator(0).total_edges();
-       const int vertices = edges+1;
+       const int vertices = edges+1;
        
        // fill a vector of all possible 2^edges combinations of cuts...
        vector<node> counter;
index 1b487d8..9110491 100644 (file)
@@ -316,14 +316,14 @@ ex add::coeff(const ex & s, int n) const
        epvector::const_iterator i = seq.begin(), end = seq.end();
        while (i != end) {
                ex restcoeff = i->rest.coeff(s, n);
-               if (!restcoeff.is_zero()) {
-                       if (do_clifford) {
-                               if (clifford_max_label(restcoeff) == -1) {
-                                       coeffseq_cliff->push_back(combine_ex_with_coeff_to_pair(ncmul(restcoeff, dirac_ONE(rl)), i->coeff));
+               if (!restcoeff.is_zero()) {
+                       if (do_clifford) {
+                               if (clifford_max_label(restcoeff) == -1) {
+                                       coeffseq_cliff->push_back(combine_ex_with_coeff_to_pair(ncmul(restcoeff, dirac_ONE(rl)), i->coeff));
                                } else {
-                                       coeffseq_cliff->push_back(combine_ex_with_coeff_to_pair(restcoeff, i->coeff));
+                                       coeffseq_cliff->push_back(combine_ex_with_coeff_to_pair(restcoeff, i->coeff));
                                        nonscalar = true;
-                               }
+                               }
                        }
                        coeffseq->push_back(combine_ex_with_coeff_to_pair(restcoeff, i->coeff));
                }
index 74dff63..79d83b5 100644 (file)
@@ -240,7 +240,7 @@ ex basic::op(size_t i) const
        throw(std::range_error(std::string("basic::op(): ") + class_name() + std::string(" has no operands")));
 }
 
-/** Return modifyable operand/member at position i. */
+/** Return modifiable operand/member at position i. */
 ex & basic::let_op(size_t i)
 {
        ensure_if_modifiable();
index a66c835..1e93767 100644 (file)
@@ -208,7 +208,7 @@ ex & clifford::let_op(size_t i)
         GINAC_ASSERT(i<nops());
 
        static ex rl = numeric(representation_label);
-        ensure_if_modifiable();
+       ensure_if_modifiable();
        if (nops()-i == 1)
                return rl;
        else 
@@ -923,7 +923,7 @@ ex dirac_trace(const ex & e, const std::set<unsigned char> & rls, const ex & trO
                                return trONE * I * (lorentz_eps(ex_to<idx>(i1).replace_dim(_ex4), ex_to<idx>(i2).replace_dim(_ex4), ex_to<idx>(i3).replace_dim(_ex4), ex_to<idx>(i4).replace_dim(_ex4)) * b1 * b2 * b3 * b4).simplify_indexed();
                        }
 
-                       // Tr gamma5 S_2k =
+                       // Tr gamma5 S_2k =
                        //   I/4! * epsilon0123.mu1.mu2.mu3.mu4 * Tr gamma.mu1 gamma.mu2 gamma.mu3 gamma.mu4 S_2k
                        // (the epsilon is always 4-dimensional)
                        exvector ix(num-1), bv(num-1);
@@ -1195,7 +1195,7 @@ ex lst_to_clifford(const ex & v, const ex & e) {
                                                return v.op(0) * dirac_ONE(ex_to<clifford>(e).get_representation_label()) + indexed(sub_matrix(ex_to<matrix>(v), 0, 1, 1, dim), mu_toggle) * e;
                                        else 
                                                return v.op(0) * dirac_ONE(ex_to<clifford>(e).get_representation_label()) + indexed(sub_matrix(ex_to<matrix>(v), 1, dim, 0, 1), mu_toggle) * e;
-                               } else
+                               } else
                                        throw(std::invalid_argument("lst_to_clifford(): dimensions of vector and clifford unit mismatch"));
                        } else
                                throw(std::invalid_argument("lst_to_clifford(): first argument should be a vector (nx1 or 1xn matrix)"));
@@ -1211,7 +1211,7 @@ ex lst_to_clifford(const ex & v, const ex & e) {
        } else
                throw(std::invalid_argument("lst_to_clifford(): the second argument should be a Clifford unit"));
 }
+
 /** Auxiliary structure to define a function for striping one Clifford unit
  * from vectors. Used in  clifford_to_lst(). */
 static ex get_clifford_comp(const ex & e, const ex & c) 
index e6e8cd1..ee6827a 100644 (file)
@@ -203,7 +203,7 @@ void ex::traverse_postorder(visitor & v) const
        accept(v);
 }
 
-/** Return modifyable operand/member at position i. */
+/** Return modifiable operand/member at position i. */
 ex & ex::let_op(size_t i)
 {
        makewriteable();
index c7b3e9e..9ef8afa 100644 (file)
@@ -661,7 +661,7 @@ ex expairseq::expand(unsigned options) const
  *  has (at least) two possible different semantics but we want to inherit
  *  methods thus avoiding code duplication.  Sometimes a method in expairseq
  *  has to create a new one of the same semantics, which cannot be done by a
- *  ctor because the name (add, mul,...) is unknown on the expaiseq level.  In
+ *  ctor because the name (add, mul,...) is unknown on the expairseq level.  In
  *  order for this trick to work a derived class must of course override this
  *  definition. */
 ex expairseq::thisexpairseq(const epvector &v, const ex &oc, bool do_index_renaming) const
index 79d23ed..4f081f1 100644 (file)
@@ -1530,22 +1530,22 @@ static ex atanh_series(const ex &arg,
                return ((log(_ex1+arg)-log(_ex1-arg))*_ex1_2).series(rel, order, options);
        // ...and the branch cuts (the discontinuity at the cut being just I*Pi)
        if (!(options & series_options::suppress_branchcut)) {
-               // method:
-               // This is the branch cut: assemble the primitive series manually and
-               // then add the corresponding complex step function.
-               const symbol &s = ex_to<symbol>(rel.lhs());
-               const ex &point = rel.rhs();
-               const symbol foo;
-               const ex replarg = series(atanh(arg), s==foo, order).subs(foo==point, subs_options::no_pattern);
+               // method:
+               // This is the branch cut: assemble the primitive series manually and
+               // then add the corresponding complex step function.
+               const symbol &s = ex_to<symbol>(rel.lhs());
+               const ex &point = rel.rhs();
+               const symbol foo;
+               const ex replarg = series(atanh(arg), s==foo, order).subs(foo==point, subs_options::no_pattern);
                ex Order0correction = replarg.op(0)+csgn(I*arg)*Pi*I*_ex1_2;
                if (arg_pt<_ex0)
                        Order0correction += log((arg_pt+_ex_1)/(arg_pt+_ex1))*_ex1_2;
                else
                        Order0correction += log((arg_pt+_ex1)/(arg_pt+_ex_1))*_ex_1_2;
-               epvector seq;
+               epvector seq;
                seq.push_back(expair(Order0correction, _ex0));
-               seq.push_back(expair(Order(_ex1), order));
-               return series(replarg - pseries(rel, seq), rel, order);
+               seq.push_back(expair(Order(_ex1), order));
+               return series(replarg - pseries(rel, seq), rel, order);
        }
        throw do_taylor();
 }
index 7a9fcbb..016be2c 100644 (file)
@@ -159,8 +159,8 @@ ex integral::eval(int level) const
        if (ea==eb)
                return _ex0;
 
-       if (are_ex_trivially_equal(eintvar,x) && are_ex_trivially_equal(ea,a)
-                       && are_ex_trivially_equal(eb,b) && are_ex_trivially_equal(ef,f))
+       if (are_ex_trivially_equal(eintvar,x) && are_ex_trivially_equal(ea,a) &&
+           are_ex_trivially_equal(eb,b) && are_ex_trivially_equal(ef,f))
                return this->hold();
        return (new integral(eintvar, ea, eb, ef))
                ->setflag(status_flags::dynallocated | status_flags::evaluated);
@@ -186,13 +186,13 @@ ex integral::evalf(int level) const
 
        // 12.34 is just an arbitrary number used to check whether a number
        // results after substituting a number for the integration variable.
-       if (is_exactly_a<numeric>(ea) && is_exactly_a<numeric>(eb) 
-                       && is_exactly_a<numeric>(ef.subs(x==12.34).evalf())) {
+       if (is_exactly_a<numeric>(ea) && is_exactly_a<numeric>(eb) &&
+           is_exactly_a<numeric>(ef.subs(x==12.34).evalf())) {
                        return adaptivesimpson(x, ea, eb, ef);
        }
 
-       if (are_ex_trivially_equal(a, ea) && are_ex_trivially_equal(b, eb)
-                               && are_ex_trivially_equal(f, ef))
+       if (are_ex_trivially_equal(a, ea) && are_ex_trivially_equal(b, eb) &&
+           are_ex_trivially_equal(f, ef))
                        return *this;
                else
                        return (new integral(x, ea, eb, ef))
@@ -407,8 +407,8 @@ ex integral::expand(unsigned options) const
                        return (prefactor*integral(x, newa, newb, rest)).expand(options);
        }
 
-       if (are_ex_trivially_equal(a, newa) && are_ex_trivially_equal(b, newb)
-                       && are_ex_trivially_equal(f, newf)) {
+       if (are_ex_trivially_equal(a, newa) && are_ex_trivially_equal(b, newb) &&
+           are_ex_trivially_equal(f, newf)) {
                if (options==0)
                        this->setflag(status_flags::expanded);
                return *this;
@@ -444,8 +444,8 @@ ex integral::conjugate() const
        ex conjb = b.conjugate();
        ex conjf = f.conjugate().subs(x.conjugate()==x);
 
-       if (are_ex_trivially_equal(a, conja) && are_ex_trivially_equal(b, conjb)
-                       && are_ex_trivially_equal(f, conjf))
+       if (are_ex_trivially_equal(a, conja) && are_ex_trivially_equal(b, conjb) &&
+           are_ex_trivially_equal(f, conjf))
                return *this;
 
        return (new integral(x, conja, conjb, conjf))
index 0720908..2b40487 100644 (file)
@@ -805,7 +805,7 @@ bool algebraic_match_mul_with_mul(const mul &e, const ex &pat, exmap& repls,
 
 bool mul::has(const ex & pattern, unsigned options) const
 {
-       if(!(options&has_options::algebraic))
+       if(!(options & has_options::algebraic))
                return basic::has(pattern,options);
        if(is_a<mul>(pattern)) {
                exmap repls;
index 34f89aa..797ccea 100644 (file)
@@ -334,7 +334,7 @@ ex ncmul::eval(int level) const
        
        // ncmul(x) -> x
        if (assocseq.size()==1) return *(seq.begin());
+
        // ncmul() -> 1
        if (assocseq.empty()) return _ex1;
 
@@ -568,7 +568,7 @@ unsigned ncmul::return_type() const
        GINAC_ASSERT(!all_commutative); // not all factors should commutate, because this is a ncmul();
        return all_commutative ? return_types::commutative : return_types::noncommutative;
 }
-   
+
 return_type_t ncmul::return_type_tinfo() const
 {
        if (seq.empty())
index 954529e..464ecac 100644 (file)
@@ -1535,7 +1535,7 @@ ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args, unsigned optio
                if (ca)
                        *ca = ex_to<numeric>(aex)/g;
                if (cb)
-                       *cb = bex/g;
+                       *cb = bex/g;
                return g;
        }
 
index 098be81..9c70b46 100644 (file)
@@ -502,20 +502,20 @@ static void print_real_cl_N(const print_context & c, const cln::cl_R & x)
 {
        if (cln::instanceof(x, cln::cl_I_ring)) {
 
-    int dst;
-    // fixnum 
-    if (coerce(dst, cln::the<cln::cl_I>(x))) {
-      // can be converted to native int
-      if (dst < 0)
-        c.s << "(-" << dst << ")";
-      else
-        c.s << dst;
-    } else {
-      // bignum
-      c.s << "cln::cl_I(\"";
-      print_real_number(c, x);
-      c.s << "\")";
-    }
+               int dst;
+               // fixnum 
+               if (coerce(dst, cln::the<cln::cl_I>(x))) {
+                       // can be converted to native int
+                       if (dst < 0)
+                               c.s << "(-" << dst << ")";
+                       else
+                               c.s << dst;
+               } else {
+                       // bignum
+                       c.s << "cln::cl_I(\"";
+                       print_real_number(c, x);
+                       c.s << "\")";
+               }
        } else if (cln::instanceof(x, cln::cl_RA_ring)) {
 
                // Rational number
@@ -1376,7 +1376,7 @@ const numeric numeric::numer() const
                if (cln::instanceof(r, cln::cl_RA_ring) && cln::instanceof(i, cln::cl_RA_ring)) {
                        const cln::cl_I s = cln::lcm(cln::denominator(r), cln::denominator(i));
                        return numeric(cln::complex(cln::numerator(r)*(cln::exquo(s,cln::denominator(r))),
-                                                           cln::numerator(i)*(cln::exquo(s,cln::denominator(i)))));
+                                                   cln::numerator(i)*(cln::exquo(s,cln::denominator(i)))));
                }
        }
        // at least one float encountered
@@ -1531,7 +1531,7 @@ const numeric atan(const numeric &y, const numeric &x)
                return *_num0_p;
        if (x.is_real() && y.is_real())
                return numeric(cln::atan(cln::the<cln::cl_R>(x.to_cl_N()),
-                                cln::the<cln::cl_R>(y.to_cl_N())));
+                                        cln::the<cln::cl_R>(y.to_cl_N())));
 
        // Compute -I*log((x+I*y)/sqrt(x^2+y^2))
        //      == -I*log((x+I*y)/sqrt((x+I*y)*(x-I*y)))
@@ -1775,8 +1775,8 @@ cln::cl_N lanczos_coeffs::calc_lanczos_A(const cln::cl_N &x) const
 {
        cln::cl_N A = (*current_vector)[0];
        int size = current_vector->size();
-       for (int i=1; i<size; ++i)
-       A = A + (*current_vector)[i]/(x+cln::cl_I(-1+i));
+       for (int i=1; i<size; ++i)
+               A = A + (*current_vector)[i]/(x+cln::cl_I(-1+i));
        return A;
 }
 
@@ -2050,11 +2050,11 @@ const cln::cl_N lgamma(const cln::cl_N &x)
                                - lgamma(1 - x);
                cln::cl_N A = lc.calc_lanczos_A(x);
                cln::cl_N temp = x + lc.get_order() - cln::cl_N(1)/2;
-       cln::cl_N result = log(cln::cl_I(2)*pi_val)/2
-                             + (x-cln::cl_N(1)/2)*log(temp)
-                             - temp
-                             + log(A);
-       return result;
+               cln::cl_N result = log(cln::cl_I(2)*pi_val)/2
+                                + (x-cln::cl_N(1)/2)*log(temp)
+                                - temp
+                                + log(A);
+               return result;
        }
        else 
                throw dunno();
@@ -2077,10 +2077,10 @@ const cln::cl_N tgamma(const cln::cl_N &x)
                        return pi_val/(cln::sin(pi_val*x))/tgamma(1 - x);
                cln::cl_N A = lc.calc_lanczos_A(x);
                cln::cl_N temp = x + lc.get_order() - cln::cl_N(1)/2;
-       cln::cl_N result
-                       = sqrt(cln::cl_I(2)*pi_val) * expt(temp, x - cln::cl_N(1)/2)
-                         * exp(-temp) * A;
-       return result;
+               cln::cl_N result = sqrt(cln::cl_I(2)*pi_val)
+                                * expt(temp, x - cln::cl_N(1)/2)
+                                * exp(-temp) * A;
+               return result;
        }
        else
                throw dunno();
@@ -2244,7 +2244,7 @@ const numeric bernoulli(const numeric &nn)
                                c = cln::exquo((c * (p+3-2*k)) * (p/2-k+1), cln::cl_I(2*k-1)*k);
                                b = b + c*results[k-1];
                        }
-               }
+               }
                results.push_back(-b/(p+1));
        }
        next_r = n+2;
index 8ec6380..99a5a3c 100644 (file)
@@ -178,8 +178,8 @@ void power::do_print_csrc_cl_N(const print_csrc_cl_N& c, unsigned level) const
 void power::do_print_csrc(const print_csrc & c, unsigned level) const
 {
        // Integer powers of symbols are printed in a special, optimized way
-       if (exponent.info(info_flags::integer)
-        && (is_a<symbol>(basis) || is_a<constant>(basis))) {
+       if (exponent.info(info_flags::integer) &&
+           (is_a<symbol>(basis) || is_a<constant>(basis))) {
                int exp = ex_to<numeric>(exponent).to_int();
                if (exp > 0)
                        c.s << '(';
@@ -495,8 +495,8 @@ ex power::eval(int level) const
                        if (is_exactly_a<numeric>(sub_exponent)) {
                                const numeric & num_sub_exponent = ex_to<numeric>(sub_exponent);
                                GINAC_ASSERT(num_sub_exponent!=numeric(1));
-                               if (num_exponent->is_integer() || (abs(num_sub_exponent) - (*_num1_p)).is_negative() 
-                                               || (num_sub_exponent == *_num_1_p && num_exponent->is_positive())) {
+                               if (num_exponent->is_integer() || (abs(num_sub_exponent) - (*_num1_p)).is_negative() ||
+                                   (num_sub_exponent == *_num_1_p && num_exponent->is_positive())) {
                                        return power(sub_basis,num_sub_exponent.mul(*num_exponent));
                                }
                        }
@@ -622,18 +622,18 @@ bool power::has(const ex & other, unsigned options) const
                return basic::has(other, options);
        if (!is_a<power>(other))
                return basic::has(other, options);
-       if (!exponent.info(info_flags::integer)
-                       || !other.op(1).info(info_flags::integer))
+       if (!exponent.info(info_flags::integer) ||
+           !other.op(1).info(info_flags::integer))
                return basic::has(other, options);
-       if (exponent.info(info_flags::posint)
-                       && other.op(1).info(info_flags::posint)
-                       && ex_to<numeric>(exponent) > ex_to<numeric>(other.op(1))
-                       && basis.match(other.op(0)))
+       if (exponent.info(info_flags::posint) &&
+           other.op(1).info(info_flags::posint) &&
+           ex_to<numeric>(exponent) > ex_to<numeric>(other.op(1)) &&
+           basis.match(other.op(0)))
                return true;
-       if (exponent.info(info_flags::negint)
-                       && other.op(1).info(info_flags::negint)
-                       && ex_to<numeric>(exponent) < ex_to<numeric>(other.op(1))
-                       && basis.match(other.op(0)))
+       if (exponent.info(info_flags::negint) &&
+           other.op(1).info(info_flags::negint) &&
+           ex_to<numeric>(exponent) < ex_to<numeric>(other.op(1)) &&
+           basis.match(other.op(0)))
                return true;
        return basic::has(other, options);
 }
@@ -1308,12 +1308,12 @@ ex power::expand_mul(const mul & m, const numeric & n, unsigned options, bool fr
        }
 
        // do not bother to rename indices if there are no any.
-       if ((!(options & expand_options::expand_rename_idx)) 
-                       && m.info(info_flags::has_indices))
+       if (!(options & expand_options::expand_rename_idx) &&
+           m.info(info_flags::has_indices))
                options |= expand_options::expand_rename_idx;
        // Leave it to multiplication since dummy indices have to be renamed
        if ((options & expand_options::expand_rename_idx) &&
-               (get_all_dummy_indices(m).size() > 0) && n.is_positive()) {
+           (get_all_dummy_indices(m).size() > 0) && n.is_positive()) {
                ex result = m;
                exvector va = get_all_dummy_indices(m);
                sort(va.begin(), va.end(), ex_is_less());
index 99eed8a..ead7a77 100644 (file)
@@ -960,7 +960,7 @@ ex mul::series(const relational & r, int order, unsigned options) const
                                orderloop++;
                                real_ldegree = buf.series(r, orderloop, options).ldegree(sym);
                        } while ((real_ldegree == orderloop)
-                                       && ( factor*real_ldegree < degbound));
+                             && (factor*real_ldegree < degbound));
                        ldegrees[j] = factor * real_ldegree;
                        degbound -= factor * real_ldegree;
                }
index 37063e6..c5b42d3 100644 (file)
@@ -251,7 +251,7 @@ unsigned relational::return_type() const
        GINAC_ASSERT(lh.return_type()==rh.return_type());
        return lh.return_type();
 }
-   
+
 return_type_t relational::return_type_tinfo() const
 {
        GINAC_ASSERT(lh.return_type_tinfo()==rh.return_type_tinfo());
@@ -281,7 +281,7 @@ unsigned relational::calchash() const
                        break;
                case greater:
                case greater_or_equal:
-                       v ^= lhash;
+                       v ^= lhash;
                        lhash = rhash;
                        break;
        }
index 1d2e479..ee62fa0 100644 (file)
@@ -113,7 +113,7 @@ void remember_table_list::add_entry(function const & f, ex const & result)
                }
                default:
                        throw(std::logic_error("remember_table_list::add_entry(): invalid remember_strategy"));
-        }
+       }
                GINAC_ASSERT(size()==max_assoc_size-1);
        }
        push_back(remember_table_entry(f,result));