From b617b5cf86e6f8ac01a339d9747c535257fcf8d0 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Tue, 5 Jun 2001 15:18:29 +0000 Subject: [PATCH] - fixed typos - c*M^n with M being a matrix wasn't correctly evalm()'d for n!=1 --- ginac/basic.cpp | 11 +++++------ ginac/mul.cpp | 3 ++- ginac/wildcard.cpp | 2 +- ginac/wildcard.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 1990ebcb..16d0dfdd 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -134,7 +134,7 @@ void basic::print(const print_context & c, unsigned level) const c.s << "[" << class_name() << " object]"; } -/** Little wrapper arount print to be called within a debugger. +/** Little wrapper around print to be called within a debugger. * This is needed because you cannot call foo.print(cout) from within the * debugger because it might not know what cout is. This method can be * invoked with no argument and it will simply print to stdout. @@ -146,7 +146,7 @@ void basic::dbgprint(void) const std::cerr << std::endl; } -/** Little wrapper arount printtree to be called within a debugger. +/** Little wrapper around printtree to be called within a debugger. * * @see basic::dbgprint * @see basic::printtree */ @@ -231,7 +231,7 @@ bool basic::has(const ex & other) const } /** Construct new expression by applying the specified function to all - * sub-expressions. */ + * sub-expressions (one level only, not recursively). */ ex basic::map(map_func f) const { unsigned num = nops(); @@ -366,8 +366,7 @@ ex basic::evalf(int level) const /** Evaluate sums and products of matrices. */ ex basic::evalm(void) const { - unsigned num = nops(); - if (num == 0) + if (nops() == 0) return *this; else return map(GiNaC::evalm); @@ -433,7 +432,7 @@ bool basic::match(const ex & pattern, lst & repl_lst) const { /* Sweet sweet shapes, sweet sweet shapes, - Thats the key thing, right right. + That's the key thing, right right. Feed feed face, feed feed shapes, But who is the king tonight? Who is the king tonight? diff --git a/ginac/mul.cpp b/ginac/mul.cpp index cb679432..3dfe48eb 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -408,7 +408,8 @@ ex mul::evalf(int level) const ex mul::evalm(void) const { // numeric*matrix - if (seq.size() == 1 && is_ex_of_type(seq[0].rest, matrix)) + if (seq.size() == 1 && seq[0].coeff.is_equal(_ex1()) + && is_ex_of_type(seq[0].rest, matrix)) return ex_to_matrix(seq[0].rest).mul(ex_to_numeric(overall_coeff)); // Evaluate children first, look whether there are any matrices at all diff --git a/ginac/wildcard.cpp b/ginac/wildcard.cpp index 0d782622..528df593 100644 --- a/ginac/wildcard.cpp +++ b/ginac/wildcard.cpp @@ -116,7 +116,7 @@ unsigned wildcard::calchash(void) const bool wildcard::match(const ex & pattern, lst & repl_lst) const { // Wildcards must match exactly (this is required for subs() to work - // properly because in the final step it substitues all wildcards by + // properly because in the final step it substitutes all wildcards by // their matching expressions) return is_equal(*pattern.bp); } diff --git a/ginac/wildcard.h b/ginac/wildcard.h index e55788e7..2e76e193 100644 --- a/ginac/wildcard.h +++ b/ginac/wildcard.h @@ -28,8 +28,8 @@ namespace GiNaC { -/** This class acts as a wildcard for subs() and matches(). An integer label - * is used to identify different wildcards. */ +/** This class acts as a wildcard for subs(), match() and has(). An integer + * label is used to identify different wildcards. */ class wildcard : public basic { GINAC_DECLARE_REGISTERED_CLASS(wildcard, basic) -- 2.50.0