/** @file check_numeric.cpp
*
- * These exams creates some numbers and check the result of several boolean
+ * These exams creates some numbers and check the result of several Boolean
* tests on these numbers like is_integer() etc... */
/*
e = dirac_gamma(mu, 0) * dirac_gamma(mu.toggle_variance(), 1) * dirac_gamma(nu, 0) * dirac_gamma(nu.toggle_variance(), 1);
result += check_equal_simplify(dirac_trace(e, 0), 4 * dim * dirac_ONE(1));
result += check_equal_simplify(dirac_trace(e, 1), 4 * dim * dirac_ONE(0));
- // Fails with new tinfo mechanism because the order of gamme matrices with different rl depends on luck.
+ // Fails with new tinfo mechanism because the order of gamma matrices with different rl depends on luck.
// TODO: better check.
//result += check_equal_simplify(dirac_trace(e, 2), canonicalize_clifford(e)); // e will be canonicalized by the calculation of the trace
result += check_equal_simplify(dirac_trace(e, lst(0, 1)), 16 * dim);
result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-1, 1, s, t))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 1, s, t))));; cout << '.' << flush;
matrix A(4, 4);
- A = 1, 0, 0, 0, // anticommuting, not symmetric, Tr=0
- 0, -1, 0, 0,
- 0, 0, 0, -1,
- 0, 0, 1, 0;
+ A = 1, 0, 0, 0, // anticommuting, not symmetric, Tr=0
+ 0, -1, 0, 0,
+ 0, 0, 0, -1,
+ 0, 0, 1, 0;
result += clifford_check6<varidx>(A)+clifford_check6<idx>(A);; cout << '.' << flush;
- A = 1, 0, 0, 0, // anticommuting, not symmetric, Tr=2
- 0, 1, 0, 0,
- 0, 0, 0, -1,
- 0, 0, 1, 0;
+ A = 1, 0, 0, 0, // anticommuting, not symmetric, Tr=2
+ 0, 1, 0, 0,
+ 0, 0, 0, -1,
+ 0, 0, 1, 0;
result += clifford_check6<varidx>(A)+clifford_check6<idx>(A);; cout << '.' << flush;
- A = 1, 0, 0, 0, // not anticommuting, symmetric, Tr=0
- 0, -1, 0, 0,
- 0, 0, 0, -1,
- 0, 0, -1, 0;
+ A = 1, 0, 0, 0, // not anticommuting, symmetric, Tr=0
+ 0, -1, 0, 0,
+ 0, 0, 0, -1,
+ 0, 0, -1, 0;
result += clifford_check6<varidx>(A)+clifford_check6<idx>(A);; cout << '.' << flush;
- A = 1, 0, 0, 0, // not anticommuting, symmetric, Tr=2
- 0, 1, 0, 0,
- 0, 0, 0, -1,
- 0, 0, -1, 0;
+ A = 1, 0, 0, 0, // not anticommuting, symmetric, Tr=2
+ 0, 1, 0, 0,
+ 0, 0, 0, -1,
+ 0, 0, -1, 0;
result += clifford_check6<varidx>(A)+clifford_check6<idx>(A);; cout << '.' << flush;
- A = 1, 1, 0, 0, // not anticommuting, not symmetric, Tr=4
- 0, 1, 1, 0,
- 0, 0, 1, 1,
- 0, 0, 0, 1;
+ A = 1, 1, 0, 0, // not anticommuting, not symmetric, Tr=4
+ 0, 1, 1, 0,
+ 0, 0, 1, 1,
+ 0, 0, 0, 1;
result += clifford_check6<varidx>(A)+clifford_check6<idx>(A);; cout << '.' << flush;
symbol dim("D");
return result;
}
-/* Several tests for derivetives */
+/* Several tests for derivatives */
static unsigned inifcns_consist_derivatives()
{
unsigned result = 0;
ex det = m.determinant();
if ((normal(m_i(0,0)*det) != d) ||
- (normal(m_i(0,1)*det) != -b) ||
- (normal(m_i(1,0)*det) != -c) ||
- (normal(m_i(1,1)*det) != a)) {
+ (normal(m_i(0,1)*det) != -b) ||
+ (normal(m_i(1,0)*det) != -c) ||
+ (normal(m_i(1,1)*det) != a)) {
clog << "inversion of 2x2 matrix " << m
<< " erroneously returned " << m_i << endl;
++result;
}
// And this used to fail in GiNaC 1.5.8 because it first substituted
- // exp(x) -> exp(log(x)) -> x, and then substitued again x -> log(x)
+ // exp(x) -> exp(log(x)) -> x, and then substituted again x -> log(x)
e1 = exp(x);
e2 = e1.subs(x == log(x));
if (!e2.is_equal(x)) {
/** @file exam_numeric.cpp
*
- * These exams creates some numbers and check the result of several boolean
+ * These exams creates some numbers and check the result of several Boolean
* tests on these numbers like is_integer() etc... */
/*
return bipoly;
}
-/* Chose a randum symbol or number from the argument list. */
+/* Chose a random symbol or number from the argument list. */
const ex
random_symbol(const symbol & x,
- const symbol & y,
- const symbol & z,
- bool rational = true,
- bool complex = false)
+ const symbol & y,
+ const symbol & z,
+ bool rational = true,
+ bool complex = false)
{
ex e;
switch (abs(rand()) % 4) {
/* Create a sparse random tree in three symbols. */
const ex
sparse_tree(const symbol & x,
- const symbol & y,
- const symbol & z,
- int level,
- bool trig = false, // true includes trigonomatric functions
- bool rational = true, // false excludes coefficients in Q
- bool complex = false) // true includes complex numbers
+ const symbol & y,
+ const symbol & z,
+ int level,
+ bool trig = false, // true includes trigonometric functions
+ bool rational = true, // false excludes coefficients in Q
+ bool complex = false) // true includes complex numbers
{
if (level == 0)
return random_symbol(x,y,z,rational,complex);
/*
* basic::match(lst&) used to have an obscure side effect: repl_lst
* could be modified even if the match failed! Although this "feature"
- * was documented it happend to be very confusing *even for GiNaC
+ * was documented it happened to be very confusing *even for GiNaC
* developers*, see
* http://www.ginac.de/pipermail/ginac-devel/2006-April/000942.html
*
/** @file randomize_serials.cpp
*
- * Utilitiy function used by the benchmarks.
+ * Utility function used by the benchmarks.
*/
/*
#include <ctime>
using namespace std;
-/** Generate a random amount of symbols and destroy them again immediatly.
+/** Generate a random amount of symbols and destroy them again immediately.
* This operation effectively makes the serial numbers of all subsequent
* symbols unpredictable. If the serials are unpredictable, then so are
* their hash values. If the hash values are unpredictable, then so are
int main(int argc, char** argv)
{
- std::cout << "timing univarite GCD" << std::endl << std::flush;
+ std::cout << "timing univariate GCD" << std::endl << std::flush;
run_with_random_intputs(100, 50);
// run PRS gcd tests, both with upoly and ex
run_test(p1_srep, p2_srep, true, true);
const std::string &archive::unatomize(archive_atom id) const
{
if (id >= atoms.size())
- throw (std::range_error("archive::unatomizee(): atom ID out of range"));
+ throw (std::range_error("archive::unatomize(): atom ID out of range"));
return atoms[id];
}
if (is_a<clifford>(*other)) {
- // Contraction only makes sense if the represenation labels are equal
+ // Contraction only makes sense if the representation labels are equal
if (ex_to<clifford>(*other).get_representation_label() != rl)
return false;
unsigned char rl = unit.get_representation_label();
if (is_a<clifford>(*other)) {
- // Contraction only makes sense if the represenation labels are equal
+ // Contraction only makes sense if the representation labels are equal
// and the metrics are the same
if ((ex_to<clifford>(*other).get_representation_label() != rl)
&& unit.same_metric(*other))
*
* @param iv3 Vector of 3 indices
* @param iv2 Vector of 2 indices, must be a subset of iv3
- * @param sig Returs sign introduced by index permutation
+ * @param sig Returns sign introduced by index permutation
* @return the free index (the one that is in iv3 but not in iv2) */
static ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2, int & sig)
{
if (is_exactly_a<su3t>(other->op(0))) {
- // Contraction only makes sense if the represenation labels are equal
+ // Contraction only makes sense if the representation labels are equal
GINAC_ASSERT(is_a<color>(*other));
if (ex_to<color>(*other).get_representation_label() != rl)
return false;
std::vector<filedesc> filelist; /**< List of all opened modules */
public:
/**
- * Complete clean-up of opend modules is done on destruction.
+ * Complete clean-up of opened modules is done on destruction.
*/
~excompiler()
{
};
/**
- * This static object manages the modules opened by the complile_ex and link_ex
+ * This static object manages the modules opened by the compile_ex and link_ex
* functions. On program termination its dtor is called and all open modules
* are closed. The associated source and so-files are eventually deleted then
* as well.
return 1;
#if EXPAIRSEQ_USE_HASHTAB
- if (hashtabsize > 0) return 1; // not canoncalized
+ if (hashtabsize > 0) return 1; // not canonicalized
#endif // EXPAIRSEQ_USE_HASHTAB
epvector::const_iterator it = seq.begin(), itend = seq.end();
};
/** Class to handle the renaming of dummy indices. It holds a vector of
- * indices that are being used in the expression so-far. If the same
+ * indices that are being used in the expression so far. If the same
* index occurs again as a dummy index in a factor, it is to be renamed.
- * Unless dummy index renaming was swichted of, of course ;-) . */
+ * Unless dummy index renaming was switched off, of course ;-) . */
class make_flat_inserter
{
public:
expand_indexed = 0x0001, ///< expands (a+b).i to a.i+b.i
expand_function_args = 0x0002, ///< expands the arguments of functions
expand_rename_idx = 0x0004, ///< used internally by mul::expand()
- expand_transcendental = 0x0008 ///< expands trancendental functions like log and exp
+ expand_transcendental = 0x0008 ///< expands transcendental functions like log and exp
};
};
pattern_is_product = 0x0004, ///< used internally by expairseq::subschildren()
pattern_is_not_product = 0x0008, ///< used internally by expairseq::subschildren()
no_index_renaming = 0x0010,
- // To indicate that we want to substitue an index by something that is
+ // To indicate that we want to substitute an index by something that
// is not an index. Without this flag the index value would be
// substituted in that case.
really_subs_idx = 0x0020
}
// In the case where a dummy symbol occurs twice in the same indexed object
- // we try all posibilities of raising/lowering and keep the least one in
+ // we try all possibilities of raising/lowering and keep the least one in
// the sense of ex_is_less.
ex optimal_e = e;
size_t numpossibs = 1 << local_var_dummies.size();
terminfo(const ex & orig_, const ex & symm_) : orig(orig_), symm(symm_) {}
ex orig; /**< original term */
- ex symm; /**< symmtrized term */
+ ex symm; /**< symmetrized term */
};
class terminfo_is_less {
exvector get_all_dummy_indices(const ex & e);
/** More reliable version of the form. The former assumes that e is an
- * expanded epxression. */
+ * expanded expression. */
exvector get_all_dummy_indices_safely(const ex & e);
/** Returns b with all dummy indices, which are listed in va, renamed
* indices with the corresponding numeric values without variance.
*
* @param e the given expression
- * @param subs_idx indicates if variance of dummy indixes should be neglected
+ * @param subs_idx indicates if variance of dummy indices should be neglected
*/
ex expand_dummy_sum(const ex & e, bool subs_idx = false);
return binomial(x, y).hold();
}
-// At the moment the numeric evaluation of a binomail function always
+// At the moment the numeric evaluation of a binomial function always
// gives a real number, but if this would be implemented using the gamma
// function, also complex conjugation should be changed (or rather, deleted).
static ex binomial_conjugate(const ex & x, const ex & y)
* 0, 1 and -1 --- or in compactified --- a string with zeros in front of 1 or -1 is written as a single
* number --- notation.
*
- * - All functions can be nummerically evaluated with arguments in the whole complex plane. The parameters
+ * - All functions can be numerically evaluated with arguments in the whole complex plane. The parameters
* for Li, zeta and S must be positive integers. If you want to have an alternating Euler sum, you have
* to give the signs of the parameters as a second argument s to zeta(m,s) containing 1 and -1.
*
}
// 12.34 is just an arbitrary number used to check whether a number
- // results after subsituting a number for the integration variable.
+ // 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())) {
return adaptivesimpson(x, ea, eb, ef);
/** Characteristic Polynomial. Following mathematica notation the
- * characteristic polynomial of a matrix M is defined as the determiant of
+ * characteristic polynomial of a matrix M is defined as the determinant of
* (M - lambda * 1) where 1 stands for the unit matrix of the same dimension
* as M. Note that some CASs define it with a sign inside the determinant
* which gives rise to an overall sign if the dimension is odd. This method
* more than once. According to W.M.Gentleman and S.C.Johnson this algorithm
* is better than elimination schemes for matrices of sparse multivariate
* polynomials and also for matrices of dense univariate polynomials if the
- * matrix' dimesion is larger than 7.
+ * matrix' dimension is larger than 7.
*
* @return the determinant as a new expression (in expanded form)
* @see matrix::determinant() */
* @param co is the column to be inspected
* @param symbolic signal if we want the first non-zero element to be pivoted
* (true) or the one with the largest absolute value (false).
- * @return 0 if no interchange occured, -1 if all are zero (usually signaling
+ * @return 0 if no interchange occurred, -1 if all are zero (usually signaling
* a degeneracy) and positive integer k means that rows ro and k were swapped.
*/
int matrix::pivot(unsigned ro, unsigned co, bool symbolic)
matrix(unsigned r, unsigned c, const exvector & m2);
matrix(unsigned r, unsigned c, const lst & l);
- // First step of initialization of matrix with a comma-separated seqeuence
+ // First step of initialization of matrix with a comma-separated sequence
// of expressions. Subsequent steps are handled by matrix_init<>::operator,().
matrix_init<ex, exvector::iterator> operator=(const ex & x)
{
return true;
}
-/** Checks wheter e matches to the pattern pat and the (possibly to be updated)
+/** Checks whether e matches to the pattern pat and the (possibly to be updated)
* list of replacements repls. This matching is in the sense of algebraic
* substitutions. Matching starts with pat.op(factor) of the pattern because
* the factors before this one have already been matched. The (possibly
/** Member-wise expand the expairs representing this sequence. This must be
* overridden from expairseq::expandchildren() and done iteratively in order
- * to allow for early cancallations and thus safe memory.
+ * to allow for early cancellations and thus safe memory.
*
* @see mul::expand()
* @return pointer to epvector containing expanded representation or zero
else
result *= quo(tmp, result, x);
- // Put in the reational overall factor again and return
+ // Put in the rational overall factor again and return
return result * lcm.inverse();
}
num_it++; den_it++;
}
- // Additiion of two fractions, taking advantage of the fact that
+ // Addition of two fractions, taking advantage of the fact that
// the heuristic GCD algorithm computes the cofactors at no extra cost
ex co_den1, co_den2;
ex g = gcd(den, next_den, &co_den1, &co_den2, false);
return e.op(1).subs(repl, subs_options::no_pattern);
}
-/** Get numerator and denominator of an expression. If the expresison is not
+/** Get numerator and denominator of an expression. If the expression is not
* of the normal form "numerator/denominator", it is first converted to this
* form and then a list [numerator, denominator] is returned.
*
* than a dumber basic type since as a side-effect we let it change
* cl_default_float_format when it gets changed. The only other
* meaningful thing to do with it is converting it to an unsigned,
- * for temprary storing its value e.g. The user must not create an
+ * for temporarily storing its value e.g. The user must not create an
* own working object of this class! Since C++ forces us to make the
* class definition visible in order to use an object we put in a
* flag which prevents other objects of that class to be created. */
namespace { // anonymous namespace for power::expand_add() helpers
/** Helper class to generate all bounded combinatorial partitions of an integer
- * n with exactly m parts (including zero parts) in non-decreaing order.
+ * n with exactly m parts (including zero parts) in non-decreasing order.
*/
class partition_generator {
private:
if (x.subs(r) != x)
throw std::logic_error("Cannot series expand wrt dummy variable");
- // Expanding integrant with r substituted taken in boundaries.
+ // Expanding integrand with r substituted taken in boundaries.
ex fseries = f.series(r, order, options);
epvector fexpansion;
fexpansion.reserve(fseries.nops());
/// to distinguish between non-commutative objects of different type.
std::type_info const* tinfo;
/// to distinguish between non-commutative objects of the same type.
- /// Think of gamma matrices with different represenation labels.
+ /// Think of gamma matrices with different representation labels.
unsigned rl;
/// Strict weak ordering (so one can put return_type_t's into
return cond? &safe_bool_helper::nonnull : 0;
}
-/** Cast the relational into a boolean, mainly for evaluation within an
+/** Cast the relational into a Boolean, mainly for evaluation within an
* if-statement. Note that (a<b) == false does not imply (a>=b) == true in
* the general symbolic case. A false result means the comparison is either
* false or undecidable (except of course for !=, where true means either
// non-virtual functions in this class
private:
- // For conversions to boolean, as would be used in an if conditional,
+ // For conversions to Boolean, as would be used in an if conditional,
// implicit conversions from bool to int have a large number of
// undesirable side effects. The following safe_bool type enables
// use of relational objects in conditionals without those side effects
return antisymmetrize(e, v.begin(), v.end());
}
-/** Symmetrize expression by cyclic permuation over a set of objects
+/** Symmetrize expression by cyclic permutation over a set of objects
* (symbols, indices). */
ex symmetrize_cyclic(const ex & e, exvector::const_iterator first, exvector::const_iterator last);
unsigned log2(unsigned n);
/** Rotate bits of unsigned value by one bit to the left.
- * This can be necesary if the user wants to define its own hashes. */
+ * This can be necessary if the user wants to define its own hashes. */
inline unsigned rotate_left(unsigned n)
{
return (n & 0x80000000U) ? (n << 1 | 0x00000001U) : (n << 1);