]> www.ginac.de Git - ginac.git/blobdiff - ginac/mul.cpp
* Added output-support for Python bindings and LaTeX printing for
[ginac.git] / ginac / mul.cpp
index 83bebb2638f3d8f3264fa4f3ba2100fd8329271d..47f74f6f4c1b920050adf85a66154029bb42808c 100644 (file)
@@ -20,6 +20,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <iostream>
 #include <vector>
 #include <stdexcept>
 
@@ -168,6 +169,16 @@ void mul::print(const print_context & c, unsigned level) const
                if (precedence() <= level)
                        c.s << ")";
 
+       } else if (is_a<print_python_repr>(c)) {
+               c.s << class_name() << '(';
+               unsigned end = nops();
+               if (end)
+                       op(0).print(c);
+               for (unsigned i=1; i<end; ++i) {
+                       c.s << ',';
+                       op(i).print(c);
+               }
+               c.s << ')';
        } else {
 
                if (precedence() <= level) {
@@ -744,7 +755,7 @@ ex mul::expand(unsigned options) const
  *  pointer, if sequence is unchanged. */
 epvector * mul::expandchildren(unsigned options) const
 {
-       epvector::const_iterator last = seq.end();
+       const epvector::const_iterator last = seq.end();
        epvector::const_iterator cit = seq.begin();
        while (cit!=last) {
                const ex & factor = recombine_pair_to_ex(*cit);