From: Richard Kreckel Date: Thu, 24 May 2001 19:07:47 +0000 (+0000) Subject: - fix LaTeX-output bug reported by Stefan, remove obsolete has(matrix,ex). X-Git-Tag: release_0-9-0~40 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=71e787d41185b5def2c4dde6809c8420843fca9f - fix LaTeX-output bug reported by Stefan, remove obsolete has(matrix,ex). --- diff --git a/ginac/matrix.h b/ginac/matrix.h index 56428871..0e7660b9 100644 --- a/ginac/matrix.h +++ b/ginac/matrix.h @@ -101,9 +101,6 @@ inline unsigned nops(const matrix & m) inline ex expand(const matrix & m, unsigned options = 0) { return m.expand(options); } -inline bool has(const matrix & m, const ex & other) -{ return m.has(other); } - inline ex eval(const matrix & m, int level = 0) { return m.eval(level); } diff --git a/ginac/power.cpp b/ginac/power.cpp index d4c12c17..15fed248 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -144,7 +144,7 @@ void power::print(const print_context & c, unsigned level) const && (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) - c.s << "("; + c.s << '('; else { exp = -exp; if (is_of_type(c, print_csrc_cl_N)) @@ -153,7 +153,7 @@ void power::print(const print_context & c, unsigned level) const c.s << "1.0/("; } print_sym_pow(c, ex_to_symbol(basis), exp); - c.s << ")"; + c.s << ')'; // ^-1 is printed as "1.0/" or with the recip() function of CLN } else if (exponent.compare(_num_1()) == 0) { @@ -162,7 +162,7 @@ void power::print(const print_context & c, unsigned level) const else c.s << "1.0/("; basis.print(c); - c.s << ")"; + c.s << ')'; // Otherwise, use the pow() or expt() (CLN) functions } else { @@ -171,9 +171,9 @@ void power::print(const print_context & c, unsigned level) const else c.s << "pow("; basis.print(c); - c.s << ","; + c.s << ','; exponent.print(c); - c.s << ")"; + c.s << ')'; } } else { @@ -185,9 +185,9 @@ void power::print(const print_context & c, unsigned level) const c.s << "sqrt("; basis.print(c); if (is_of_type(c, print_latex)) - c.s << "}"; + c.s << '}'; else - c.s << ")"; + c.s << ')'; } else { if (precedence() <= level) { if (is_of_type(c, print_latex)) @@ -196,13 +196,17 @@ void power::print(const print_context & c, unsigned level) const c.s << "("; } basis.print(c, precedence()); - c.s << "^"; + c.s << '^'; + if (is_of_type(c, print_latex)) + c.s << '{'; exponent.print(c, precedence()); + if (is_of_type(c, print_latex)) + c.s << '}'; if (precedence() <= level) { if (is_of_type(c, print_latex)) c.s << ")}"; else - c.s << ")"; + c.s << ')'; } } }