From: Richard Kreckel Date: Sat, 10 Oct 2015 20:24:32 +0000 (+0200) Subject: Fix some apparent typos and misindentations 2. X-Git-Tag: ginac_1-6-6~13 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=e100f94d92d574ea89a817eca8c58c5eb3418821 Fix some apparent typos and misindentations 2. (Formatting should comply with http://www.cebix.net/indentation.html.) --- diff --git a/check/exam_clifford.cpp b/check/exam_clifford.cpp index 420089fd..24655e48 100644 --- a/check/exam_clifford.cpp +++ b/check/exam_clifford.cpp @@ -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(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; diff --git a/check/exam_inifcns_nstdsums.cpp b/check/exam_inifcns_nstdsums.cpp index c0412d94..c93d0b4a 100644 --- a/check/exam_inifcns_nstdsums.cpp +++ b/check/exam_inifcns_nstdsums.cpp @@ -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; diff --git a/check/time_antipode.cpp b/check/time_antipode.cpp index fdedddf8..2358db3e 100644 --- a/check/time_antipode.cpp +++ b/check/time_antipode.cpp @@ -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 counter; diff --git a/ginac/add.cpp b/ginac/add.cpp index 1b487d80..9110491e 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -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)); } diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 74dff639..79d83b55 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -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(); diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index a66c8355..1e93767d 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -208,7 +208,7 @@ ex & clifford::let_op(size_t i) GINAC_ASSERT(i & rls, const ex & trO return trONE * I * (lorentz_eps(ex_to(i1).replace_dim(_ex4), ex_to(i2).replace_dim(_ex4), ex_to(i3).replace_dim(_ex4), ex_to(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(e).get_representation_label()) + indexed(sub_matrix(ex_to(v), 0, 1, 1, dim), mu_toggle) * e; else return v.op(0) * dirac_ONE(ex_to(e).get_representation_label()) + indexed(sub_matrix(ex_to(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) diff --git a/ginac/ex.cpp b/ginac/ex.cpp index e6e8cd17..ee6827aa 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -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(); diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index c7b3e9ed..9ef8afa9 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -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 diff --git a/ginac/inifcns_trans.cpp b/ginac/inifcns_trans.cpp index 79d23ed4..4f081f17 100644 --- a/ginac/inifcns_trans.cpp +++ b/ginac/inifcns_trans.cpp @@ -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(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(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(); } diff --git a/ginac/integral.cpp b/ginac/integral.cpp index 7a9fcbb3..016be2ca 100644 --- a/ginac/integral.cpp +++ b/ginac/integral.cpp @@ -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(ea) && is_exactly_a(eb) - && is_exactly_a(ef.subs(x==12.34).evalf())) { + if (is_exactly_a(ea) && is_exactly_a(eb) && + is_exactly_a(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)) diff --git a/ginac/mul.cpp b/ginac/mul.cpp index 07209088..2b404877 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -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(pattern)) { exmap repls; diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index 34f89aa5..797ccea9 100644 --- a/ginac/ncmul.cpp +++ b/ginac/ncmul.cpp @@ -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()) diff --git a/ginac/normal.cpp b/ginac/normal.cpp index 954529e6..464ecac9 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -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(aex)/g; if (cb) - *cb = bex/g; + *cb = bex/g; return g; } diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 098be81d..9c70b46e 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -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(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(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(x.to_cl_N()), - cln::the(y.to_cl_N()))); + cln::the(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(basis) || is_a(basis))) { + if (exponent.info(info_flags::integer) && + (is_a(basis) || is_a(basis))) { int exp = ex_to(exponent).to_int(); if (exp > 0) c.s << '('; @@ -495,8 +495,8 @@ ex power::eval(int level) const if (is_exactly_a(sub_exponent)) { const numeric & num_sub_exponent = ex_to(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(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(exponent) > ex_to(other.op(1)) - && basis.match(other.op(0))) + if (exponent.info(info_flags::posint) && + other.op(1).info(info_flags::posint) && + ex_to(exponent) > ex_to(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(exponent) < ex_to(other.op(1)) - && basis.match(other.op(0))) + if (exponent.info(info_flags::negint) && + other.op(1).info(info_flags::negint) && + ex_to(exponent) < ex_to(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()); diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 99eed8a2..ead7a777 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -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; } diff --git a/ginac/relational.cpp b/ginac/relational.cpp index 37063e6a..c5b42d3c 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -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; } diff --git a/ginac/remember.cpp b/ginac/remember.cpp index 1d2e4795..ee62fa0f 100644 --- a/ginac/remember.cpp +++ b/ginac/remember.cpp @@ -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));