- fix LaTeX-output bug reported by Stefan, remove obsolete has(matrix,ex).
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Thu, 24 May 2001 19:07:47 +0000 (19:07 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Thu, 24 May 2001 19:07:47 +0000 (19:07 +0000)
ginac/matrix.h
ginac/power.cpp

index 5642887150b05b45cea96385f4df8ebb8e93de53..0e7660b969fcc28d0d905725ac99bf55fad4162a 100644 (file)
@@ -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); }
 
index d4c12c17d8da76dfc2b599148fc9ecc585d5f286..15fed248b889d73b24fd3954ed01c6f659152c3e 100644 (file)
@@ -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 << ')';
 
                // <expr>^-1 is printed as "1.0/<expr>" 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 << ')';
                        }
                }
        }