]> www.ginac.de Git - ginac.git/commitdiff
- Derivatives are now assembled in a slightly different manner (i.e. they
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 21 Jul 2000 01:12:25 +0000 (01:12 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 21 Jul 2000 01:12:25 +0000 (01:12 +0000)
  'look' different on first sight).  Under certain circumstances this can
  result in a dramatic speedup because it gives hashing a better chance,
  especially when computing higher derivatives.
- Series expansion accepts an additional bool argument now, telling it
  whether branch cuts are to be honored (as Maple does it) or not (as
  Mathematica does it).  It defaults to true (i.e. the Maple way).
- Many series expansions of built-in functions have been reengineered.
- The Dilogarithm (Li2) now has floating point evaluation, derivative and a
  proper series expansion.
- Namespace 'std' cleanly disentangled, as demanded by ISO/EIC 14882-1998(E).
- Some helpers updated from upstream.

92 files changed:
Makefile.in
NEWS
aclocal.m4
check/Makefile.in
check/check_inifcns.cpp
check/exam_differentiation.cpp
check/exam_pseries.cpp
cint/Makefile.in
cint/ginaccint.bin.cpp
cint/ginaccint.cpp
cint/run_exams.cpp
config.sub
configure
configure.in
doc/Makefile.in
doc/reference/Makefile.in
doc/tutorial/Makefile.in
doc/tutorial/ginac.texi
ginac/Makefile.in
ginac/add.cpp
ginac/add.h
ginac/archive.cpp
ginac/archive.h
ginac/basic.cpp
ginac/basic.h
ginac/clifford.cpp
ginac/clifford.h
ginac/color.cpp
ginac/color.h
ginac/coloridx.cpp
ginac/coloridx.h
ginac/constant.cpp
ginac/constant.h
ginac/container.pl
ginac/debugmsg.h
ginac/ex.cpp
ginac/ex.h
ginac/expair.h
ginac/expairseq.cpp
ginac/expairseq.h
ginac/fail.cpp
ginac/fail.h
ginac/function.pl
ginac/idx.cpp
ginac/idx.h
ginac/indexed.cpp
ginac/indexed.h
ginac/inifcns.cpp
ginac/inifcns_gamma.cpp
ginac/inifcns_trans.cpp
ginac/input_lexer.h
ginac/input_lexer.ll
ginac/isospin.cpp
ginac/isospin.h
ginac/lorentzidx.cpp
ginac/lorentzidx.h
ginac/lortensor.cpp
ginac/lortensor.h
ginac/matrix.cpp
ginac/matrix.h
ginac/mul.cpp
ginac/mul.h
ginac/ncmul.cpp
ginac/ncmul.h
ginac/normal.cpp
ginac/numeric.cpp
ginac/numeric.h
ginac/operators.cpp
ginac/operators.h
ginac/power.cpp
ginac/power.h
ginac/pseries.cpp
ginac/pseries.h
ginac/registrar.cpp
ginac/registrar.h
ginac/relational.cpp
ginac/relational.h
ginac/remember.cpp
ginac/remember.h
ginac/simp_lor.cpp
ginac/simp_lor.h
ginac/structure.cpp
ginac/structure.h
ginac/symbol.cpp
ginac/symbol.h
ginac/utils.cpp
ginac/utils.h
ginac/version.h
ginsh/Makefile.in
ginsh/ginsh_parser.yy
tools/Makefile.in
tools/viewgar.cpp

index 605257fc447b1a3f3e9756761c1913e75fb646d4..2cbb87ae12f1472abd2556dd15b6c9802249a942 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -94,6 +95,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
diff --git a/NEWS b/NEWS
index d40d12b856122889de5cb25fc5e7713357ccc40f..406a6e81b003c0b7e9c19c0f4a4ee0a514c637d7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,15 @@
 This file records noteworthy changes.
 
 This file records noteworthy changes.
 
+0.6.3 (xx July 2000)
+* Derivatives are now assembled in a slightly different manner (i.e. they 
+  'look' different on first sight).  Under certain circumstances this can 
+  result in a dramatic speedup because it gives hashing a better chance, 
+  especially when computing higher derivatives.
+* Many series expansions of built-in functions have been reengineered.
+* The Dilogarithm (Li2) now has floating point evaluation, derivative and a
+  proper series expansion.
+* Namespace 'std' cleanly disentangled, as demanded by ISO/EIC 14882-1998(E).
+
 0.6.2 (21 June 2000)
 * ginaccint.bin is now launched by a binary program instead of by a scripts.
   This allows us to write #!-scripts.  A small test suite for GiNaC-cint was
 0.6.2 (21 June 2000)
 * ginaccint.bin is now launched by a binary program instead of by a scripts.
   This allows us to write #!-scripts.  A small test suite for GiNaC-cint was
index 12c39ff7a1658ff498e2869c0883838e3f8b9f32..fe627fdbb27983075d709448bd603ba23ce74306 100644 (file)
@@ -297,7 +297,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
 || AC_MSG_ERROR([libtool configure failed])
 
 # Reload cache, that may have been modified by ltconfig
 || AC_MSG_ERROR([libtool configure failed])
 
 # Reload cache, that may have been modified by ltconfig
@@ -329,11 +329,6 @@ AC_REQUIRE([AC_PROG_NM])dnl
 AC_REQUIRE([AC_PROG_LN_S])dnl
 dnl
 
 AC_REQUIRE([AC_PROG_LN_S])dnl
 dnl
 
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
-esac
-
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
@@ -352,7 +347,7 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
-case "$lt_target" in
+case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -377,7 +372,10 @@ case "$lt_target" in
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+    [AC_LANG_SAVE
+     AC_LANG_C
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_RESTORE])
   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
     CFLAGS="$SAVE_CFLAGS"
   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
     CFLAGS="$SAVE_CFLAGS"
@@ -568,6 +566,7 @@ else
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_SUBST(LD)
 AC_PROG_LD_GNU
 ])
 
 AC_PROG_LD_GNU
 ])
 
@@ -613,13 +612,14 @@ else
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
+AC_SUBST(NM)
 ])
 
 # AC_CHECK_LIBM - check for math library
 AC_DEFUN(AC_CHECK_LIBM,
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 ])
 
 # AC_CHECK_LIBM - check for math library
 AC_DEFUN(AC_CHECK_LIBM,
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
-case "$lt_target" in
+case "$host" in
 *-*-beos* | *-*-cygwin*)
   # These system don't have libm
   ;;
 *-*-beos* | *-*-cygwin*)
   # These system don't have libm
   ;;
index a834eef25d6d9f5ca62f4cb38e344794465f4794..b984a80c3eafc074ea64788a1881cceea5c11b94 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -94,6 +95,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index b9e1f9f8a4f8eb1fa8ccc57e4790963359509c8a..9cebceeb050ef73d76f1f65a8e1f8edb959a1efc 100644 (file)
@@ -72,9 +72,8 @@ static unsigned inifcns_check_sin(void)
             errorflag = true;
         }
     }
             errorflag = true;
         }
     }
-    if (errorflag) {
+    if (errorflag)
         ++result;
         ++result;
-    }
     
     return result;
 }
     
     return result;
 }
@@ -127,9 +126,8 @@ static unsigned inifcns_check_cos(void)
             errorflag = true;
         }
     }
             errorflag = true;
         }
     }
-    if (errorflag) {
+    if (errorflag)
         ++result;
         ++result;
-    }
     
     return result;
 }
     
     return result;
 }
@@ -157,10 +155,38 @@ static unsigned inifcns_check_tan(void)
             errorflag = true;
         }
     }
             errorflag = true;
         }
     }
-    if (errorflag) {
+    if (errorflag)
         ++result;
         ++result;
+    
+    return result;
+}
+
+/* Simple tests on the dilogarithm function. */
+static unsigned inifcns_check_Li2(void)
+{
+    // NOTE: this can safely be removed once CLN supports dilogarithms and
+    // checks them itself.
+    unsigned result = 0;
+    bool errorflag;
+    
+    // check the relation Li2(z^2) == 2 * (Li2(z) + Li2(-z)) numerically, which
+    // should hold in the entire complex plane:
+    errorflag = false;
+    ex argument;
+    numeric epsilon(double(1e-16));
+    for (int n=0; n<200; ++n) {
+        argument = numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)
+                 + numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)*I;
+        if (abs(Li2(pow(argument,2))-2*Li2(argument)-2*Li2(-argument)) > epsilon) {
+            cout << "Li2(z) at z==" << argument
+                 << " failed to satisfy Li2(z^2)==2*(Li2(z)+Li2(-z))" << endl;
+            errorflag = true;
+        }
     }
     
     }
     
+    if (errorflag)
+        ++result;
+    
     return result;
 }
 
     return result;
 }
 
@@ -174,6 +200,7 @@ unsigned check_inifcns(void)
     result += inifcns_check_sin();  cout << '.' << flush;
     result += inifcns_check_cos();  cout << '.' << flush;
     result += inifcns_check_tan();  cout << '.' << flush;
     result += inifcns_check_sin();  cout << '.' << flush;
     result += inifcns_check_cos();  cout << '.' << flush;
     result += inifcns_check_tan();  cout << '.' << flush;
+    result += inifcns_check_Li2();  cout << '.' << flush;
     
     if (!result) {
         cout << " passed " << endl;
     
     if (!result) {
         cout << " passed " << endl;
index 49eddd66b5dc57040e86810ffbf8a7551892dd60..085ff45120a16c5bdd00a9aa4db3bbd2f1ac0596 100644 (file)
@@ -268,6 +268,30 @@ static unsigned exam_differentiation6(void)
     return 0;
 }
 
     return 0;
 }
 
+// Hashing can help a lot, if differentiation is done cleverly
+static unsigned exam_differentiation7(void)
+{
+    symbol x("x");
+    ex P = x + pow(x,3);
+    ex e = (P.diff(x) / P).diff(x, 2);
+    ex d = 6/P - 18*x/pow(P,2) - 54*pow(x,3)/pow(P,2) + 2/pow(P,3)
+        +18*pow(x,2)/pow(P,3) + 54*pow(x,4)/pow(P,3) + 54*pow(x,6)/pow(P,3);
+    
+    if (!(e-d).expand().is_zero()) {
+        clog << "expanded second derivative of " << (P.diff(x) / P) << " by " << x
+             << " returned " << e.expand() << " instead of " << d << endl;
+        return 1;
+    }
+    if (e.nops() > 3) {
+        clog << "second derivative of " << (P.diff(x) / P) << " by " << x
+             << " has " << e.nops() << " operands.  "
+             << "The result is still correct but not optimal: 3 are enough!  "
+             << "(Hint: maybe the product rule for objects of class mul should be more careful about assembling the result?)" << endl;
+        return 1;
+    }
+    return 0;
+}
+
 unsigned exam_differentiation(void)
 {
     unsigned result = 0;
 unsigned exam_differentiation(void)
 {
     unsigned result = 0;
@@ -281,6 +305,7 @@ unsigned exam_differentiation(void)
     result += exam_differentiation4();  cout << '.' << flush;
     result += exam_differentiation5();  cout << '.' << flush;
     result += exam_differentiation6();  cout << '.' << flush;
     result += exam_differentiation4();  cout << '.' << flush;
     result += exam_differentiation5();  cout << '.' << flush;
     result += exam_differentiation6();  cout << '.' << flush;
+    result += exam_differentiation7();  cout << '.' << flush;
     
     if (!result) {
         cout << " passed " << endl;
     
     if (!result) {
         cout << " passed " << endl;
index da860108f7c096c629464aca1e6fac8d6e5c1894..a6ff704742a6c6a8ea5da812979c7a0ff1946738 100644 (file)
@@ -89,7 +89,7 @@ static unsigned exam_series1(void)
     result += check_series(e, 0, d);
     
     e = pow(numeric(2), x);
     result += check_series(e, 0, d);
     
     e = pow(numeric(2), x);
-    ex t = log(ex(2)) * x;
+    ex t = log(2) * x;
     d = 1 + t + pow(t, 2) / 2 + pow(t, 3) / 6 + pow(t, 4) / 24 + pow(t, 5) / 120 + pow(t, 6) / 720 + pow(t, 7) / 5040 + Order(pow(x, 8));
     result += check_series(e, 0, d.expand());
     
     d = 1 + t + pow(t, 2) / 2 + pow(t, 3) / 6 + pow(t, 4) / 24 + pow(t, 5) / 120 + pow(t, 6) / 720 + pow(t, 7) / 5040 + Order(pow(x, 8));
     result += check_series(e, 0, d.expand());
     
@@ -179,30 +179,47 @@ static unsigned exam_series5(void)
     return check_series(e, -1, d, 4);
 }
     
     return check_series(e, -1, d, 4);
 }
     
-// Series expansion of tan(Pi/2)
+// Series expansion of tan(x==Pi/2)
 static unsigned exam_series6(void)
 {
     ex e = tan(x*Pi/2);
 static unsigned exam_series6(void)
 {
     ex e = tan(x*Pi/2);
-    ex d = pow(x-1,-1)/Pi*(-2) +
-           pow(x-1,1)*Pi/6 +
-           pow(x-1,3)*pow(Pi,3)/360 +
-           pow(x-1,5)*pow(Pi,5)/15120 +
-           pow(x-1,7)*pow(Pi,7)/604800 +
-           Order(pow(x-1,8));
+    ex d = pow(x-1,-1)/Pi*(-2) + pow(x-1,1)*Pi/6 + pow(x-1,3)*pow(Pi,3)/360
+          +pow(x-1,5)*pow(Pi,5)/15120 + pow(x-1,7)*pow(Pi,7)/604800
+          +Order(pow(x-1,8));
     return check_series(e,1,d,8);
 }
 
     return check_series(e,1,d,8);
 }
 
-// Series expansion of Li2(sin(0))
+// Series expansion of log(sin(x==0))
 static unsigned exam_series7(void)
 static unsigned exam_series7(void)
+{
+    ex e = log(sin(x));
+    ex d = log(x) - pow(x,2)/6 - pow(x,4)/180 - pow(x,6)/2835
+          +Order(pow(x,8));
+    return check_series(e,0,d,8);
+}
+
+// Series expansion of Li2(sin(x==0))
+static unsigned exam_series8(void)
 {
     ex e = Li2(sin(x));
 {
     ex e = Li2(sin(x));
-    ex d = x + numeric(1,4)*pow(x,2) - numeric(1,18)*pow(x,3)
-           - numeric(1,48)*pow(x,4) - numeric(13,1800)*pow(x,5)
-           - numeric(1,360)*pow(x,6) - numeric(23,21168)*pow(x,7)
+    ex d = x + pow(x,2)/4 - pow(x,3)/18 - pow(x,4)/48
+           - 13*pow(x,5)/1800 - pow(x,6)/360 - 23*pow(x,7)/21168
            + Order(pow(x,8));
     return check_series(e,0,d,8);
 }
 
            + Order(pow(x,8));
     return check_series(e,0,d,8);
 }
 
+// Series expansion of Li2((x==2)^2), caring about branch-cut
+static unsigned exam_series9(void)
+{
+    ex e = Li2(pow(x,2));
+    ex d = Li2(4) + (-log(3) + I*Pi*csgn(I-I*pow(x,2))) * (x-2)
+           + (numeric(-2,3) + log(3)/4 - I*Pi/4*csgn(I-I*pow(x,2))) * pow(x-2,2)
+           + (numeric(11,27) - log(3)/12 + I*Pi/12*csgn(I-I*pow(x,2))) * pow(x-2,3)
+           + (numeric(-155,648) + log(3)/32 - I*Pi/32*csgn(I-I*pow(x,2))) * pow(x-2,4)
+           + Order(pow(x-2,5));
+    return check_series(e,2,d,5);
+}
+
 unsigned exam_pseries(void)
 {
     unsigned result = 0;
 unsigned exam_pseries(void)
 {
     unsigned result = 0;
@@ -217,6 +234,8 @@ unsigned exam_pseries(void)
     result += exam_series5();  cout << '.' << flush;
     result += exam_series6();  cout << '.' << flush;
     result += exam_series7();  cout << '.' << flush;
     result += exam_series5();  cout << '.' << flush;
     result += exam_series6();  cout << '.' << flush;
     result += exam_series7();  cout << '.' << flush;
+    result += exam_series8();  cout << '.' << flush;
+    result += exam_series9();  cout << '.' << flush;
     
     if (!result) {
         cout << " passed " << endl;
     
     if (!result) {
         cout << " passed " << endl;
index 89fcfce9b8f90869ac7363195766223b13e43275..42d1ce27c6325878d85c8352687112d09b81472f 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -94,6 +95,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index de396e60ecdb14454a1ddf37ee7be947a1b7742b..dca000f3ac05bc0ed9017fc415a8a8d89e0fe246 100644 (file)
@@ -31,7 +31,7 @@ extern "C" void G__store_undo_position(void);
 #include <strstream>
 
 template<class T>
 #include <strstream>
 
 template<class T>
-string ToString(const T & t)
+std::string ToString(const T & t)
 {
     char buf[256];
     ostrstream(buf,sizeof(buf)) << t << ends;
 {
     char buf[256];
     ostrstream(buf,sizeof(buf)) << t << ends;
@@ -44,36 +44,36 @@ long ex::last_created_or_assigned_exp = 0;
 
 #endif // def OBSCURE_CINT_HACK
 
 
 #endif // def OBSCURE_CINT_HACK
 
-G__value exec_tempfile(string const & command);
-char * process_permanentfile(string const & command);
-void process_tempfile(string const & command);
+G__value exec_tempfile(std::string const & command);
+char * process_permanentfile(std::string const & command);
+void process_tempfile(std::string const & command);
 void greeting(void);
 void helpmessage(void);
 void greeting(void);
 void helpmessage(void);
-string preprocess(char const * const line, bool & comment, bool & single_quote,
-                  bool & double_quote, unsigned & open_braces);
+std::string preprocess(char const * const line, bool & comment, bool & single_quote,
+                       bool & double_quote, unsigned & open_braces);
 void cleanup(void);
 void sigterm_handler(int n);
 void initialize(void);
 void initialize_cint(void);
 void restart(void);
 void cleanup(void);
 void sigterm_handler(int n);
 void initialize(void);
 void initialize_cint(void);
 void restart(void);
-bool is_command(string const & command, string & preprocessed,
-                string const & comparevalue, bool substr=false);
-bool readlines(istream * is, string & allcommands);
-bool readfile(string const & filename, string & allcommands, bool shutup=false);
-void savefile(string const & filename, string const & allcommands);
+bool is_command(std::string const & command, std::string & preprocessed,
+                std::string const & comparevalue, bool substr=false);
+bool readlines(istream * is, std::string & allcommands);
+bool readfile(std::string const & filename, std::string & allcommands, bool shutup=false);
+void savefile(std::string const & filename, std::string const & allcommands);
 
 typedef list<char *> cplist;
 cplist filenames;
 bool redirect_output = false;
 bool silent = false;
 
 
 typedef list<char *> cplist;
 cplist filenames;
 bool redirect_output = false;
 bool silent = false;
 
-G__value exec_tempfile(string const & command)
+G__value exec_tempfile(std::string const & command)
 {
     G__value retval;
     char *tmpfilename = tempnam(NULL,"ginac");
 {
     G__value retval;
     char *tmpfilename = tempnam(NULL,"ginac");
-    ofstream fout;
+    std::ofstream fout;
     fout.open(tmpfilename);
     fout.open(tmpfilename);
-    fout << "{" << endl << command << endl << "}" << endl;
+    fout << "{" << std::endl << command << std::endl << "}" << std::endl;
     fout.close();
     G__store_undo_position();
     retval = G__exec_tempfile(tmpfilename);
     fout.close();
     G__store_undo_position();
     retval = G__exec_tempfile(tmpfilename);
@@ -83,14 +83,14 @@ G__value exec_tempfile(string const & command)
     return retval;
 }
 
     return retval;
 }
 
-char * process_permanentfile(string const & command)
+char * process_permanentfile(std::string const & command)
 {
     char *tmpfilename = tempnam(NULL,"ginac");
     if (!silent)
 {
     char *tmpfilename = tempnam(NULL,"ginac");
     if (!silent)
-        cout << "creating file " << tmpfilename << endl;
-    ofstream fout;
+        std::cout << "creating file " << tmpfilename << std::endl;
+    std::ofstream fout;
     fout.open(tmpfilename);
     fout.open(tmpfilename);
-    fout << command << endl;
+    fout << command << std::endl;
     fout.close();
     G__store_undo_position();
     G__loadfile(tmpfilename);
     fout.close();
     G__store_undo_position();
     G__loadfile(tmpfilename);
@@ -98,7 +98,7 @@ char * process_permanentfile(string const & command)
     return tmpfilename;
 }
 
     return tmpfilename;
 }
 
-void process_tempfile(string const & command)
+void process_tempfile(std::string const & command)
 {
 #ifdef OBSCURE_CINT_HACK
     static G__value ref_symbol = exec_tempfile("symbol ginac_cint_internal_symbol; ginac_cint_internal_symbol;");
 {
 #ifdef OBSCURE_CINT_HACK
     static G__value ref_symbol = exec_tempfile("symbol ginac_cint_internal_symbol; ginac_cint_internal_symbol;");
@@ -118,27 +118,27 @@ void process_tempfile(string const & command)
     
     static unsigned out_count = 0;
     if (TYPES_EQUAL(retval,ref_ex)) {
     
     static unsigned out_count = 0;
     if (TYPES_EQUAL(retval,ref_ex)) {
-        string varname = "Out"+ToString(++out_count);
+        std::string varname = "Out"+ToString(++out_count);
         if (retval.obj.i!=ex::last_created_or_assigned_exp) {
             // an ex was returned, but this is not the ex which was created last
             // => this is not a temporary ex, but one that resides safely in memory
             
         if (retval.obj.i!=ex::last_created_or_assigned_exp) {
             // an ex was returned, but this is not the ex which was created last
             // => this is not a temporary ex, but one that resides safely in memory
             
-            // cout << "warning: using ex from retval (experimental)" << endl;
+            // std::cout << "warning: using ex from retval (experimental)" << std::endl;
             ex::dummy_bp = ((ex *)(void *)(retval.obj.i))->bp;
             exec_tempfile("ex "+varname+"(*ex::dummy_bp);");
         } else if (ex::last_created_or_assigned_bp_can_be_converted_to_ex()) {
             exec_tempfile("ex "+varname+"(*ex::last_created_or_assigned_bp);");
         } else {
             ex::dummy_bp = ((ex *)(void *)(retval.obj.i))->bp;
             exec_tempfile("ex "+varname+"(*ex::dummy_bp);");
         } else if (ex::last_created_or_assigned_bp_can_be_converted_to_ex()) {
             exec_tempfile("ex "+varname+"(*ex::last_created_or_assigned_bp);");
         } else {
-            cout << "warning: last_created_or_assigned_bp modified 0 or not evaluated or not dynallocated" << endl;
+            std::cout << "warning: last_created_or_assigned_bp modified 0 or not evaluated or not dynallocated" << std::endl;
         }
         }
-        exec_tempfile(string()+"LLLAST=LLAST;\n"
+        exec_tempfile(std::string()+"LLLAST=LLAST;\n"
                       +"LLAST=LAST;\n"
                       +"LAST="+varname+";\n"
                       +"if (ginac_cint_internal_redirect_output&&"
                       +"    ginac_cint_internal_fout.good()) {" 
                       +"    ginac_cint_internal_fout << \""+varname+" = \" << "+varname+" << endl << endl;"
                       +"} else {"
                       +"LLAST=LAST;\n"
                       +"LAST="+varname+";\n"
                       +"if (ginac_cint_internal_redirect_output&&"
                       +"    ginac_cint_internal_fout.good()) {" 
                       +"    ginac_cint_internal_fout << \""+varname+" = \" << "+varname+" << endl << endl;"
                       +"} else {"
-                      +"    cout << \""+varname+" = \" << "+varname+" << endl << endl;"
+                      +"    std::cout << \""+varname+" = \" << "+varname+" << endl << endl;"
                       +"}");
     } else if (TYPES_EQUAL(retval,ref_symbol)||
                TYPES_EQUAL(retval,ref_constant)||
                       +"}");
     } else if (TYPES_EQUAL(retval,ref_symbol)||
                TYPES_EQUAL(retval,ref_constant)||
@@ -146,16 +146,16 @@ void process_tempfile(string const & command)
                TYPES_EQUAL(retval,ref_power)||
                TYPES_EQUAL(retval,ref_numeric)) {
         if (!basic_type_warning_already_displayed) {
                TYPES_EQUAL(retval,ref_power)||
                TYPES_EQUAL(retval,ref_numeric)) {
         if (!basic_type_warning_already_displayed) {
-            cout << endl
-                 <<"WARNING: The return value of the last expression you entered was a symbol," << endl
-                 << "constant, function, power or numeric, which cannot be safely displayed." << endl
-                 << "To force the output, cast it explicitly to type 'ex' or use 'cout'," << endl
-                 << "for example (assume 'x' is a symbol):" << endl
-                 << PROMPT1 "ex(x);" << endl
-                 << "OutX = x" << endl << endl
-                 << PROMPT1 "cout << x << endl;" << endl
-                 << "x" << endl << endl
-                 << "This warning will not be shown again." << endl;
+            std::cout << std::endl
+                      <<"WARNING: The return value of the last expression you entered was a symbol," << std::endl
+                      << "constant, function, power or numeric, which cannot be safely displayed." << std::endl
+                      << "To force the output, cast it explicitly to type 'ex' or use 'cout'," << std::endl
+                      << "for example (assume 'x' is a symbol):" << std::endl
+                      << PROMPT1 "ex(x);" << std::endl
+                      << "OutX = x" << std::endl << std::endl
+                      << PROMPT1 "cout << x << endl;" << std::endl
+                      << "x" << std::endl << std::endl
+                      << "This warning will not be shown again." << std::endl;
             basic_type_warning_already_displayed = true;
         }
     }
             basic_type_warning_already_displayed = true;
         }
     }
@@ -165,64 +165,64 @@ void process_tempfile(string const & command)
 
 void greeting(void)
 {
 
 void greeting(void)
 {
-    cout << "Welcome to GiNaC-cint (" << PACKAGE << " V" << VERSION
-         << ", Cint V" << G__CINTVERSION << ")\n";
-    cout << "  __,  _______  GiNaC: (C) 1999-2000 Johannes Gutenberg University Mainz,\n"
-         << " (__) *       | Germany.  Cint C/C++ interpreter: (C) 1995-2000 Masaharu\n"
-         << "  ._) i N a C | Goto and Agilent Technologies, Japan.  This is free software\n"
-         << "<-------------' with ABSOLUTELY NO WARRANTY.  For details, type `.warranty'\n"
-         << "Type `.help' for help.\n\n";
+    std::cout << "Welcome to GiNaC-cint (" << PACKAGE << " V" << VERSION
+              << ", Cint V" << G__CINTVERSION << ")\n";
+    std::cout << "  __,  _______  GiNaC: (C) 1999-2000 Johannes Gutenberg University Mainz,\n"
+              << " (__) *       | Germany.  Cint C/C++ interpreter: (C) 1995-2000 Masaharu\n"
+              << "  ._) i N a C | Goto and Agilent Technologies, Japan.  This is free software\n"
+              << "<-------------' with ABSOLUTELY NO WARRANTY.  For details, type `.warranty'\n"
+              << "Type `.help' for help.\n\n";
     return;
 }
 
 void helpmessage(void)
 {
     return;
 }
 
 void helpmessage(void)
 {
-    cout << "GiNaC-cint recognizes some special commands which start with a dot:\n\n"
-         << "  .cint                    switch to cint interactive mode (see cint\n"
-         << "                           documentation for further details)\n"
-         << "  .function                define the body of a function (necessary due to a\n"
-         << "                           cint limitation)\n"
-         << "  .help                    the text you are currently reading\n"
-         << "  .q, .quit, .exit, .bye   quit GiNaC-cint\n"
-         << "  .read filename           read a file from disk and execute it in GiNaC-cint\n"
-         << "                           (recursive call is possible)\n"
-         << "  .redirect [filename]     redirect 'OutXY = ...' output to a file\n"
-         << "                           (.redirect alone redirects output back to console)\n"
-         << "  .restart                 restart GiNaC-cint (does not re-read command line\n"
-         << "                           files)\n"
-         << "  .save filename           save the commands you have entered so far in a file\n"
-         << "  .silent                  suppress 'OutXY = ...' output (variables are still\n"
-         << "                           accessible)\n"
-         << "  .warranty                information on redistribution and warranty\n"
-         << "  .> [filename]            same as .redirect [filename]\n\n"
-         << "Instead of '.cmd' you can also write '//GiNaC-cint.cmd' to be compatible with\n"
-         << "programs that will be compiled later.\n"
-         << "Additionally you can exit GiNaC-cint with quit; exit; or bye;\n\n";
+    std::cout << "GiNaC-cint recognizes some special commands which start with a dot:\n\n"
+              << "  .cint                    switch to cint interactive mode (see cint\n"
+              << "                           documentation for further details)\n"
+              << "  .function                define the body of a function (necessary due to a\n"
+              << "                           cint limitation)\n"
+              << "  .help                    the text you are currently reading\n"
+              << "  .q, .quit, .exit, .bye   quit GiNaC-cint\n"
+              << "  .read filename           read a file from disk and execute it in GiNaC-cint\n"
+              << "                           (recursive call is possible)\n"
+              << "  .redirect [filename]     redirect 'OutXY = ...' output to a file\n"
+              << "                           (.redirect alone redirects output back to console)\n"
+              << "  .restart                 restart GiNaC-cint (does not re-read command line\n"
+              << "                           files)\n"
+              << "  .save filename           save the commands you have entered so far in a file\n"
+              << "  .silent                  suppress 'OutXY = ...' output (variables are still\n"
+              << "                           accessible)\n"
+              << "  .warranty                information on redistribution and warranty\n"
+              << "  .> [filename]            same as .redirect [filename]\n\n"
+              << "Instead of '.cmd' you can also write '//GiNaC-cint.cmd' to be compatible with\n"
+              << "programs that will be compiled later.\n"
+              << "Additionally you can exit GiNaC-cint with quit; exit; or bye;\n\n";
     return;
 }
 
 void warrantymessage(void)
 {
     return;
 }
 
 void warrantymessage(void)
 {
-    cout << "GiNaC is free software; you can redistribute it and/or modify it under the\n"
-         << "the terms of the GNU General Public License as published by the Free Software\n"
-         << "Foundation; either version 2 of the License, or (at your option) any later\n"
-         << "version.\n"
-         << "This program is distributed in the hope that it will be useful, but WITHOUT\n"
-         << "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
-         << "FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n"
-         << "details.\n"
-         << "You should have received a copy of the GNU General Public License along with\n"
-         << "this program. If not, write to the Free Software Foundation, 675 Mass Ave,\n"
-         << "Cambridge, MA 02139, USA.\n\n";
-    cout << "Cint and associated tools are copyright by Agilent Technologies Japan Company\n"
-         << "and Masaharu Goto <MXJ02154@niftyserve.or.jp>.\n"
-         << "Source code, binary executable or library of Cint and associated tools can be\n"
-         << "used, modified and distributed with no royalty for any purpose provided that\n"
-         << "the copyright notice appear in all copies and that both that copyright notice\n"
-         << "and this permission notice appear in supporting documentation.\n"
-         << "Agilent Technologies Japan and the author make no representations about the\n"
-         << "suitability of this software for any purpose.  It is provided \"AS IS\"\n"
-         << "without express or implied warranty.\n";
+    std::cout << "GiNaC is free software; you can redistribute it and/or modify it under the\n"
+              << "the terms of the GNU General Public License as published by the Free Software\n"
+              << "Foundation; either version 2 of the License, or (at your option) any later\n"
+              << "version.\n"
+              << "This program is distributed in the hope that it will be useful, but WITHOUT\n"
+              << "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
+              << "FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n"
+              << "details.\n"
+              << "You should have received a copy of the GNU General Public License along with\n"
+              << "this program. If not, write to the Free Software Foundation, 675 Mass Ave,\n"
+              << "Cambridge, MA 02139, USA.\n\n";
+    std::cout << "Cint and associated tools are copyright by Agilent Technologies Japan Company\n"
+              << "and Masaharu Goto <MXJ02154@niftyserve.or.jp>.\n"
+              << "Source code, binary executable or library of Cint and associated tools can be\n"
+              << "used, modified and distributed with no royalty for any purpose provided that\n"
+              << "the copyright notice appear in all copies and that both that copyright notice\n"
+              << "and this permission notice appear in supporting documentation.\n"
+              << "Agilent Technologies Japan and the author make no representations about the\n"
+              << "suitability of this software for any purpose.  It is provided \"AS IS\"\n"
+              << "without express or implied warranty.\n";
     return;
 }
 
     return;
 }
 
@@ -230,10 +230,10 @@ void warrantymessage(void)
  *  executed directly or more input is needed or this is a special command.
  *  All whitespace will be removed.  All comments will be removed.  Open and
  *  close braces ( { and } ) outside strings will be counted. */
  *  executed directly or more input is needed or this is a special command.
  *  All whitespace will be removed.  All comments will be removed.  Open and
  *  close braces ( { and } ) outside strings will be counted. */
-string preprocess(char const * const line, bool & comment, bool & single_quote,
-                  bool & double_quote, unsigned & open_braces)
+std::string preprocess(char const * const line, bool & comment, bool & single_quote,
+                       bool & double_quote, unsigned & open_braces)
 {
 {
-    string preprocessed;
+    std::string preprocessed;
     int pos = 0;
     bool end = false;
     bool escape = false;
     int pos = 0;
     bool end = false;
     bool escape = false;
@@ -315,7 +315,7 @@ void cleanup(void)
 {
     for (cplist::iterator it=filenames.begin(); it!=filenames.end(); ++it) {
         if (!silent)
 {
     for (cplist::iterator it=filenames.begin(); it!=filenames.end(); ++it) {
         if (!silent)
-            cout << "removing file " << *it << endl;
+            std::cout << "removing file " << *it << std::endl;
         remove(*it);
         free(*it);
     }
         remove(*it);
         free(*it);
     }
@@ -348,24 +348,24 @@ void initialize_cint(void)
 
 void restart(void)
 {
 
 void restart(void)
 {
-    cout << "Restarting GiNaC-cint." << endl;
+    std::cout << "Restarting GiNaC-cint." << std::endl;
     G__scratch_all();
     initialize_cint();
 }
 
     G__scratch_all();
     initialize_cint();
 }
 
-void redirect(string const & filename,
+void redirect(std::string const & filename,
               bool shutup=false)
 {
     if (filename=="") {
         if (!shutup)
               bool shutup=false)
 {
     if (filename=="") {
         if (!shutup)
-            cout << "Redirecting output back to console..." << endl;
-        exec_tempfile( string()
+            std::cout << "Redirecting output back to console..." << std::endl;
+        exec_tempfile( std::string()
                       +"ginac_cint_internal_redirect_output=false;\n"
                       +"ginac_cint_internal_fout.close();");
     } else {
         if (!shutup)
                       +"ginac_cint_internal_redirect_output=false;\n"
                       +"ginac_cint_internal_fout.close();");
     } else {
         if (!shutup)
-            cout << "Redirecting output to " << filename << "..." << endl;
-        exec_tempfile( string()
+            std::cout << "Redirecting output to " << filename << "..." << std::endl;
+        exec_tempfile( std::string()
                       +"ginac_cint_internal_redirect_output=true;\n"
                       +"ginac_cint_internal_fout.open(\""+filename+"\");\n");
     }
                       +"ginac_cint_internal_redirect_output=true;\n"
                       +"ginac_cint_internal_fout.open(\""+filename+"\");\n");
     }
@@ -373,20 +373,20 @@ void redirect(string const & filename,
 
 /** Sort out command line options and evaluate them.  Returns true if it
  *  succeeds and false otherwise. */
 
 /** Sort out command line options and evaluate them.  Returns true if it
  *  succeeds and false otherwise. */
-bool evaloption(const string & option)
+bool evaloption(const std::string & option)
 {
     if (option=="--version") {
 {
     if (option=="--version") {
-        cout << "GiNaC-cint (" << PACKAGE << " V" << VERSION
+        std::cout << "GiNaC-cint (" << PACKAGE << " V" << VERSION
              << ", Cint V" << G__CINTVERSION << ")\n";
         exit(0);
     }
     if (option=="--help") {
              << ", Cint V" << G__CINTVERSION << ")\n";
         exit(0);
     }
     if (option=="--help") {
-        cout << "GiNaC-cint (" << PACKAGE << " V" << VERSION
-             << ", Cint V" << G__CINTVERSION << ")\n";
-        cout << "usage: ginaccint [option] [file ...]\n";
-        cout << " --help           print this help message and exit\n"
-             << " --silent         invoke ginaccint in silent mode\n"
-             << " --version        print GiNaC version and Cint version and exit\n";
+        std::cout << "GiNaC-cint (" << PACKAGE << " V" << VERSION
+                  << ", Cint V" << G__CINTVERSION << ")\n";
+        std::cout << "usage: ginaccint [option] [file ...]\n";
+        std::cout << " --help           print this help message and exit\n"
+                  << " --silent         invoke ginaccint in silent mode\n"
+                  << " --version        print GiNaC version and Cint version and exit\n";
         exit(0);
     }
     if (option=="--silent") {
         exit(0);
     }
     if (option=="--silent") {
@@ -397,9 +397,9 @@ bool evaloption(const string & option)
     return false;
 }
 
     return false;
 }
 
-bool is_command(string const & command,
-                string & preprocessed,
-                string const & comparevalue,
+bool is_command(std::string const & command,
+                std::string & preprocessed,
+                std::string const & comparevalue,
                 bool substr)
 {
     bool single_quote = false;
                 bool substr)
 {
     bool single_quote = false;
@@ -422,11 +422,11 @@ bool is_command(string const & command,
 }       
 
 bool readlines(istream * is,
 }       
 
 bool readlines(istream * is,
-               string & allcommands)
+               std::string & allcommands)
 {
     char const * line;
     char prompt[G__ONELINE];
 {
     char const * line;
     char prompt[G__ONELINE];
-    string linebuffer;
+    std::string linebuffer;
     
     bool quit = false;
     bool eof = false;
     
     bool quit = false;
     bool eof = false;
@@ -439,8 +439,8 @@ bool readlines(istream * is,
     while ((!quit)&&(!eof)) {
         strcpy(prompt,PROMPT1);
         bool end_of_command = false;
     while ((!quit)&&(!eof)) {
         strcpy(prompt,PROMPT1);
         bool end_of_command = false;
-        string command;
-        string preprocessed;
+        std::string command;
+        std::string preprocessed;
         while (!end_of_command) {
             if (is==NULL) {
                 line = G__input(prompt);
         while (!end_of_command) {
             if (is==NULL) {
                 line = G__input(prompt);
@@ -473,13 +473,13 @@ bool readlines(istream * is,
             quit = true;
         } else if (is_command(command,preprocessed,"function")) {
             if (!silent)
             quit = true;
         } else if (is_command(command,preprocessed,"function")) {
             if (!silent)
-                cout << "next expression can be a function definition" << endl;
+                std::cout << "next expression can be a function definition" << std::endl;
             next_command_is_function = true;
         } else if (is_command(command,preprocessed,"cint")) {
             next_command_is_function = true;
         } else if (is_command(command,preprocessed,"cint")) {
-            cout << endl << "switching to cint interactive mode" << endl;
-            cout << "'h' for help, 'q' to quit, '{ statements }' or 'p [expression]' to evaluate" << endl;
+            std::cout << std::endl << "switching to cint interactive mode" << std::endl;
+            std::cout << "'h' for help, 'q' to quit, '{ statements }' or 'p [expression]' to evaluate" << std::endl;
             G__pause();
             G__pause();
-            cout << "back from cint" << endl;
+            std::cout << "back from cint" << std::endl;
         } else if (is_command(command,preprocessed,"help")) {
             helpmessage();
         } else if (is_command(command,preprocessed,"read",true)) {
         } else if (is_command(command,preprocessed,"help")) {
             helpmessage();
         } else if (is_command(command,preprocessed,"read",true)) {
@@ -505,12 +505,12 @@ bool readlines(istream * is,
             warrantymessage();
         /* test for more special commands
         } else if (preprocessed==".xyz") {
             warrantymessage();
         /* test for more special commands
         } else if (preprocessed==".xyz") {
-            cout << "special command (TBD): " << command << endl;
+            std::cout << "special command (TBD): " << command << std::endl;
         */
         } else if (command.substr(0,2)=="#!") {
             // ignore lines which indicate that this file is executed as a script
         } else {
         */
         } else if (command.substr(0,2)=="#!") {
             // ignore lines which indicate that this file is executed as a script
         } else {
-            // cout << "now processing: " << command << endl;
+            // std::cout << "now processing: " << command << std::endl;
             if (next_command_is_function) {
                 next_command_is_function = false;
                 filenames.push_back(process_permanentfile(command));
             if (next_command_is_function) {
                 next_command_is_function = false;
                 filenames.push_back(process_permanentfile(command));
@@ -530,42 +530,42 @@ bool readlines(istream * is,
     return quit;
 }    
 
     return quit;
 }    
 
-bool readfile(string const & filename,
-              string & allcommands,
-              bool shutup=false)
+bool readfile(std::string const & filename,
+              std::string & allcommands,
+              bool shutup = false)
 {
     if (!shutup)
 {
     if (!shutup)
-        cout << "Reading commands from file " << filename << "." << endl;
+        std::cout << "Reading commands from file " << filename << "." << std::endl;
     bool quit = false;
     bool quit = false;
-    ifstream fin;
+    std::ifstream fin;
     fin.open(filename.c_str());
     if (fin.good())
         quit = readlines(&fin,allcommands);
     else
     fin.open(filename.c_str());
     if (fin.good())
         quit = readlines(&fin,allcommands);
     else
-        cout << "Cannot open " << filename << " for reading." << endl;
+        std::cout << "Cannot open " << filename << " for reading." << std::endl;
     fin.close();
     return quit;
 }
 
     fin.close();
     return quit;
 }
 
-void savefile(string const & filename, string const & allcommands)
+void savefile(std::string const & filename, std::string const & allcommands)
 {
 {
-    cout << "Saving commands to file " << filename << "." << endl;
-    ofstream fout;
+    std::cout << "Saving commands to file " << filename << "." << std::endl;
+    std::ofstream fout;
     fout.open(filename.c_str());
     if (fout.good()) {
         fout << allcommands;
         if (!fout.good()) {
     fout.open(filename.c_str());
     if (fout.good()) {
         fout << allcommands;
         if (!fout.good()) {
-            cout << "Cannot save commands to " << filename << "." << endl;
+            std::cout << "Cannot save commands to " << filename << "." << std::endl;
         }
     } else {
         }
     } else {
-        cout << "Cannot open " << filename << " for writing." << endl;
+        std::cout << "Cannot open " << filename << " for writing." << std::endl;
     }
     fout.close();
 }
 
 int main(int argc, char * *argv) 
 {
     }
     fout.close();
 }
 
 int main(int argc, char * *argv) 
 {
-    string allcommands;
+    std::string allcommands;
     initialize();
     
     bool quit = false;
     initialize();
     
     bool quit = false;
@@ -587,7 +587,7 @@ int main(int argc, char * *argv)
         allcommands = "/* Files given as command line arguments:\n";
         --argc;
         while (argc && !quit) {
         allcommands = "/* Files given as command line arguments:\n";
         --argc;
         while (argc && !quit) {
-            allcommands += string(argv[argc])+'\n';
+            allcommands += std::string(argv[argc])+'\n';
             quit = readfile(argv[argc], allcommands, silent);
             --argc;
         }
             quit = readfile(argv[argc], allcommands, silent);
             --argc;
         }
index 4d25c445c32bef374272ff6cd6fc8e85df6493bd..0c6e1c1ed5cd30f68b97d9bce49f71a4528590a7 100644 (file)
@@ -22,14 +22,14 @@ int main(int argc, char * *argv)
     if (libdir=="${exec_prefix}/lib")
         libdir = exec_prefix + "/lib";
     // now we can guess what to start
     if (libdir=="${exec_prefix}/lib")
         libdir = exec_prefix + "/lib";
     // now we can guess what to start
-    string binprog = bindir + "/ginaccint.bin";
+    std::string binprog = bindir + "/ginaccint.bin";
     
     // extend LD_LIBRARY_PATH by libdir, so ginaccint.bin really finds libginac
     const char * LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
     if (LD_LIBRARY_PATH == NULL)
         setenv("LD_LIBRARY_PATH", libdir.c_str(), 1);
     else
     
     // extend LD_LIBRARY_PATH by libdir, so ginaccint.bin really finds libginac
     const char * LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
     if (LD_LIBRARY_PATH == NULL)
         setenv("LD_LIBRARY_PATH", libdir.c_str(), 1);
     else
-        setenv("LD_LIBRARY_PATH", (string(LD_LIBRARY_PATH)+':'+libdir).c_str(), 1);
+        setenv("LD_LIBRARY_PATH", (std::string(LD_LIBRARY_PATH)+':'+libdir).c_str(), 1);
     
     // hard-wire CINTSYSDIR, inherited from configure, if it is not set
     setenv("CINTSYSDIR", CINTSYSDIR.c_str(), 0);
     
     // hard-wire CINTSYSDIR, inherited from configure, if it is not set
     setenv("CINTSYSDIR", CINTSYSDIR.c_str(), 0);
@@ -38,6 +38,6 @@ int main(int argc, char * *argv)
     int error = execve(binprog.c_str(), argv, environ);
     
     // only gets here on error
     int error = execve(binprog.c_str(), argv, environ);
     
     // only gets here on error
-    cerr << argv[0] << ": cannot exec " << binprog << endl;
+    std::cerr << argv[0] << ": cannot exec " << binprog << std::endl;
     return error;
 }
     return error;
 }
index dabf467bd1a48f8f8606f7a4356f58ec122825b3..6225d73b057ace968ae2381a8be43367aded297b 100644 (file)
@@ -15,14 +15,14 @@ extern char **environ;
 int main(int argc, char * *argv)
 {
     // what to start
 int main(int argc, char * *argv)
 {
     // what to start
-    string binprog = "./ginaccint.bin";
+    std::string binprog = "./ginaccint.bin";
     
     // extend LD_LIBRARY_PATH by ../ginac/.libs, so ginaccint.bin really finds libginac
     const char * LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
     if (LD_LIBRARY_PATH == NULL)
         setenv("LD_LIBRARY_PATH", "../ginac/.libs", 1);
     else
     
     // extend LD_LIBRARY_PATH by ../ginac/.libs, so ginaccint.bin really finds libginac
     const char * LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
     if (LD_LIBRARY_PATH == NULL)
         setenv("LD_LIBRARY_PATH", "../ginac/.libs", 1);
     else
-        setenv("LD_LIBRARY_PATH", (string(LD_LIBRARY_PATH)+':'+"../ginac/.libs").c_str(), 1);
+        setenv("LD_LIBRARY_PATH", (std::string(LD_LIBRARY_PATH)+':'+"../ginac/.libs").c_str(), 1);
     
     // hard-wire CINTSYSDIR, inherited from configure
     setenv("CINTSYSDIR", CINTSYSDIR.c_str(), 1);
     
     // hard-wire CINTSYSDIR, inherited from configure
     setenv("CINTSYSDIR", CINTSYSDIR.c_str(), 1);
@@ -31,6 +31,6 @@ int main(int argc, char * *argv)
     int error = execve(binprog.c_str(), argv, environ);
     
     // only gets here on error
     int error = execve(binprog.c_str(), argv, environ);
     
     // only gets here on error
-    cerr << argv[0] << ": cannot exec " << binprog << endl;
+    std::cerr << argv[0] << ": cannot exec " << binprog << std::endl;
     return error;
 }
     return error;
 }
index 8fa14be27e16d4a8d8df2f1c4c0abc2ee1a71a47..2b4fad13ff0b2901e72a13d6a02793ecd0888152 100755 (executable)
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
 #   Free Software Foundation, Inc.
 
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
 #   Free Software Foundation, Inc.
 
-version='2000-06-13'
+version='2000-07-06'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -218,9 +218,14 @@ case $basic_machine in
                | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
                | mips64vr5000 | miprs64vr5000el | mcore \
                | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
                | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
                | mips64vr5000 | miprs64vr5000el | mcore \
                | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
-               | thumb | d10v | fr30 | avr)
+               | thumb | d10v | d30v | fr30 | avr)
                basic_machine=$basic_machine-unknown
                ;;
                basic_machine=$basic_machine-unknown
                ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
                ;;
 
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
                ;;
 
@@ -257,7 +262,7 @@ case $basic_machine in
              | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
              | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
              | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
              | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
              | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
              | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
-             | bs2000-*)
+             | bs2000-* | tic54x-* | c54x-*)
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
@@ -793,6 +798,10 @@ case $basic_machine in
                basic_machine=t3e-cray
                os=-unicos
                ;;
                basic_machine=t3e-cray
                os=-unicos
                ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
        tx39)
                basic_machine=mipstx39-unknown
                ;;
        tx39)
                basic_machine=mipstx39-unknown
                ;;
index efc04bd6c9ed1cb4c1dae890fa888a4816ebeda8..1b903bebab1584864a1ff6175a4c97e3c5c999d1 100755 (executable)
--- a/configure
+++ b/configure
@@ -545,9 +545,9 @@ fi
 
 GINACLIB_MAJOR_VERSION=0
 GINACLIB_MINOR_VERSION=6
 
 GINACLIB_MAJOR_VERSION=0
 GINACLIB_MINOR_VERSION=6
-GINACLIB_MICRO_VERSION=2
-GINACLIB_INTERFACE_AGE=2
-GINACLIB_BINARY_AGE=2
+GINACLIB_MICRO_VERSION=3
+GINACLIB_INTERFACE_AGE=0
+GINACLIB_BINARY_AGE=0
 GINACLIB_VERSION=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION.$GINACLIB_MICRO_VERSION
 
 
 GINACLIB_VERSION=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION.$GINACLIB_MICRO_VERSION
 
 
@@ -1550,8 +1550,9 @@ else
   echo "$ac_t""no" 1>&6
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
   echo "$ac_t""no" 1>&6
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1555: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1556: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1567,7 +1568,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1571: checking for BSD-compatible nm" >&5
+echo "configure:1572: checking for BSD-compatible nm" >&5
 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1602,8 +1603,9 @@ fi
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
+
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1607: checking whether ln -s works" >&5
+echo "configure:1609: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1624,11 +1626,6 @@ else
 fi
 
 
 fi
 
 
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
-esac
-
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
@@ -1649,11 +1646,11 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
-case "$lt_target" in
+case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1656 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1653 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1674,19 +1671,27 @@ case "$lt_target" in
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1678: checking whether the C compiler needs -belf" >&5
+echo "configure:1675: checking whether the C compiler needs -belf" >&5
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1683 "configure"
+  
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+     cat > conftest.$ac_ext <<EOF
+#line 1688 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -1696,6 +1701,13 @@ else
   lt_cv_cc_needs_belf=no
 fi
 rm -f conftest*
   lt_cv_cc_needs_belf=no
 fi
 rm -f conftest*
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
 fi
 
 echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
 fi
 
 echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
@@ -1764,7 +1776,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
@@ -1788,7 +1800,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 exec 5>>./config.log
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
 exec 5>>./config.log
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1792: checking how to run the C preprocessor" >&5
+echo "configure:1804: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1803,13 +1815,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1807 "configure"
+#line 1819 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1820,13 +1832,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1824 "configure"
+#line 1836 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1837,13 +1849,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1841 "configure"
+#line 1853 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1873,7 +1885,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1877: checking for $ac_word" >&5
+echo "configure:1889: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1906,7 +1918,7 @@ test -n "$LEX" || LEX=""$missing_dir/missing flex""
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1910: checking for $ac_word" >&5
+echo "configure:1922: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1940,7 +1952,7 @@ then
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:1944: checking for yywrap in -l$ac_lib" >&5
+echo "configure:1956: checking for yywrap in -l$ac_lib" >&5
 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1948,7 +1960,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1952 "configure"
+#line 1964 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1959,7 +1971,7 @@ int main() {
 yywrap()
 ; return 0; }
 EOF
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:1963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1982,7 +1994,7 @@ fi
 fi
 
 echo $ac_n "checking lex output file root""... $ac_c" 1>&6
 fi
 
 echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:1986: checking lex output file root" >&5
+echo "configure:1998: checking lex output file root" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2003,7 +2015,7 @@ echo "$ac_t""$ac_cv_prog_lex_root" 1>&6
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:2007: checking whether yytext is a pointer" >&5
+echo "configure:2019: checking whether yytext is a pointer" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2015,14 +2027,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 cat > conftest.$ac_ext <<EOF
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 cat > conftest.$ac_ext <<EOF
-#line 2019 "configure"
+#line 2031 "configure"
 #include "confdefs.h"
 `cat $LEX_OUTPUT_ROOT.c`
 int main() {
 
 ; return 0; }
 EOF
 #include "confdefs.h"
 `cat $LEX_OUTPUT_ROOT.c`
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_prog_lex_yytext_pointer=yes
 else
   rm -rf conftest*
   ac_cv_prog_lex_yytext_pointer=yes
 else
@@ -2048,7 +2060,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2052: checking for $ac_word" >&5
+echo "configure:2064: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2105,7 +2117,7 @@ fi
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:2109: checking size of long" >&5
+echo "configure:2121: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2113,7 +2125,7 @@ else
   ac_cv_sizeof_long=4
 else
   cat > conftest.$ac_ext <<EOF
   ac_cv_sizeof_long=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 2117 "configure"
+#line 2129 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -2124,7 +2136,7 @@ main()
   exit(0);
 }
 EOF
   exit(0);
 }
 EOF
-if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -2144,7 +2156,7 @@ EOF
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:2148: checking size of long long" >&5
+echo "configure:2160: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2152,7 +2164,7 @@ else
   ac_cv_sizeof_long_long=8
 else
   cat > conftest.$ac_ext <<EOF
   ac_cv_sizeof_long_long=8
 else
   cat > conftest.$ac_ext <<EOF
-#line 2156 "configure"
+#line 2168 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -2163,7 +2175,7 @@ main()
   exit(0);
 }
 EOF
   exit(0);
 }
 EOF
-if { (eval echo configure:2167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
@@ -2183,7 +2195,7 @@ EOF
 
 
 echo $ac_n "checking size of long double""... $ac_c" 1>&6
 
 
 echo $ac_n "checking size of long double""... $ac_c" 1>&6
-echo "configure:2187: checking size of long double" >&5
+echo "configure:2199: checking size of long double" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2191,7 +2203,7 @@ else
   ac_cv_sizeof_long_double=12
 else
   cat > conftest.$ac_ext <<EOF
   ac_cv_sizeof_long_double=12
 else
   cat > conftest.$ac_ext <<EOF
-#line 2195 "configure"
+#line 2207 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -2202,7 +2214,7 @@ main()
   exit(0);
 }
 EOF
   exit(0);
 }
 EOF
-if { (eval echo configure:2206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_double=`cat conftestval`
 else
 then
   ac_cv_sizeof_long_double=`cat conftestval`
 else
@@ -2234,17 +2246,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2238: checking for $ac_hdr" >&5
+echo "configure:2250: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2243 "configure"
+#line 2255 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2274,17 +2286,17 @@ for ac_hdr in readline/readline.h readline/history.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2278: checking for $ac_hdr" >&5
+echo "configure:2290: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2283 "configure"
+#line 2295 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2321,12 +2333,12 @@ LIBTERMCAP=
 for ac_func in tgetent
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 for ac_func in tgetent
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2325: checking for $ac_func" >&5
+echo "configure:2337: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2330 "configure"
+#line 2342 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2352,7 +2364,7 @@ $ac_func();
 
 ; return 0; }
 EOF
 
 ; return 0; }
 EOF
-if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2380,7 +2392,7 @@ if test "x$ac_cv_func_tgetent" = "xyes"; then
     :
 else
     echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
     :
 else
     echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:2384: checking for tgetent in -lncurses" >&5
+echo "configure:2396: checking for tgetent in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2388,7 +2400,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2392 "configure"
+#line 2404 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -2402,7 +2414,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:2406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2424,7 +2436,7 @@ fi
 
     if test -z "$LIBTERMCAP"; then
         echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
 
     if test -z "$LIBTERMCAP"; then
         echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:2428: checking for tgetent in -ltermcap" >&5
+echo "configure:2440: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2432,7 +2444,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2436 "configure"
+#line 2448 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -2446,7 +2458,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2473,7 +2485,7 @@ fi
 save_LIBS=$LIBS
 LIBS="$LIBTERMCAP $LIBS"
 echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
 save_LIBS=$LIBS
 LIBS="$LIBTERMCAP $LIBS"
 echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:2477: checking for readline in -lreadline" >&5
+echo "configure:2489: checking for readline in -lreadline" >&5
 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2481,7 +2493,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lreadline  $LIBS"
 cat > conftest.$ac_ext <<EOF
   ac_save_LIBS="$LIBS"
 LIBS="-lreadline  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2485 "configure"
+#line 2497 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -2495,7 +2507,7 @@ int main() {
 readline()
 ; return 0; }
 EOF
 readline()
 ; return 0; }
 EOF
-if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2537,17 +2549,17 @@ for ac_hdr in iostream vector map string list typeinfo iterator stdexcept algori
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2541: checking for $ac_hdr" >&5
+echo "configure:2553: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2546 "configure"
+#line 2558 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2578,17 +2590,17 @@ for ac_hdr in sstream strstream
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2582: checking for $ac_hdr" >&5
+echo "configure:2594: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2587 "configure"
+#line 2599 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2620,17 +2632,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2624: checking for $ac_hdr" >&5
+echo "configure:2636: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2629 "configure"
+#line 2641 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2634: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2657,17 +2669,17 @@ for ac_hdr in cln.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2661: checking for $ac_hdr" >&5
+echo "configure:2673: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2666 "configure"
+#line 2678 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2683: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2702,7 +2714,7 @@ done
 
 
     echo $ac_n "checking for doublefactorial in -lcln""... $ac_c" 1>&6
 
 
     echo $ac_n "checking for doublefactorial in -lcln""... $ac_c" 1>&6
-echo "configure:2706: checking for doublefactorial in -lcln" >&5
+echo "configure:2718: checking for doublefactorial in -lcln" >&5
     saved_LIBS="${LIBS}"
     if eval "test \"`echo '$''{'ginac_cv_lib_cln_link'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
     saved_LIBS="${LIBS}"
     if eval "test \"`echo '$''{'ginac_cv_lib_cln_link'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2711,14 +2723,14 @@ else
         case "${ac_cv_header_cln_cln_h}" in
         "yes")
             cat > conftest.$ac_ext <<EOF
         case "${ac_cv_header_cln_cln_h}" in
         "yes")
             cat > conftest.$ac_ext <<EOF
-#line 2715 "configure"
+#line 2727 "configure"
 #include "confdefs.h"
 #include <cln/cl_integer.h>
 int main() {
 doublefactorial(2);
 ; return 0; }
 EOF
 #include "confdefs.h"
 #include <cln/cl_integer.h>
 int main() {
 doublefactorial(2);
 ; return 0; }
 EOF
-if { (eval echo configure:2722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ginac_cv_lib_cln_link="-lcln"
 else
   rm -rf conftest*
   ginac_cv_lib_cln_link="-lcln"
 else
@@ -2731,14 +2743,14 @@ rm -f conftest*
             ;;
         *)
             cat > conftest.$ac_ext <<EOF
             ;;
         *)
             cat > conftest.$ac_ext <<EOF
-#line 2735 "configure"
+#line 2747 "configure"
 #include "confdefs.h"
 #include <cl_integer.h>
 int main() {
 doublefactorial(2);
 ; return 0; }
 EOF
 #include "confdefs.h"
 #include <cl_integer.h>
 int main() {
 doublefactorial(2);
 ; return 0; }
 EOF
-if { (eval echo configure:2742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ginac_cv_lib_cln_link="-lcln"
 else
   rm -rf conftest*
   ginac_cv_lib_cln_link="-lcln"
 else
@@ -2779,7 +2791,7 @@ GINACLIB_LIBS=$LIBS
 # Extract the first word of "doxygen", so it can be a program name with args.
 set dummy doxygen; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "doxygen", so it can be a program name with args.
 set dummy doxygen; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2783: checking for $ac_word" >&5
+echo "configure:2795: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_DOXYGEN'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_DOXYGEN'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2815,7 +2827,7 @@ fi
 # Extract the first word of "latex", so it can be a program name with args.
 set dummy latex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "latex", so it can be a program name with args.
 set dummy latex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2819: checking for $ac_word" >&5
+echo "configure:2831: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_LATEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_LATEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2851,7 +2863,7 @@ fi
 # Extract the first word of "makeindex", so it can be a program name with args.
 set dummy makeindex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "makeindex", so it can be a program name with args.
 set dummy makeindex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2855: checking for $ac_word" >&5
+echo "configure:2867: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MAKEINDEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_MAKEINDEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2887,7 +2899,7 @@ fi
 # Extract the first word of "dvips", so it can be a program name with args.
 set dummy dvips; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "dvips", so it can be a program name with args.
 set dummy dvips; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2891: checking for $ac_word" >&5
+echo "configure:2903: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_DVIPS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_DVIPS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2923,7 +2935,7 @@ fi
 # Extract the first word of "fig2dev", so it can be a program name with args.
 set dummy fig2dev; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "fig2dev", so it can be a program name with args.
 set dummy fig2dev; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2927: checking for $ac_word" >&5
+echo "configure:2939: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_FIG2DEV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_FIG2DEV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2987,7 +2999,7 @@ if test "x$with_cint" != "xno"; then
   # Extract the first word of "cint", so it can be a program name with args.
 set dummy cint; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
   # Extract the first word of "cint", so it can be a program name with args.
 set dummy cint; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2991: checking for $ac_word" >&5
+echo "configure:3003: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_CINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3023,7 +3035,7 @@ fi
   # Extract the first word of "makecint", so it can be a program name with args.
 set dummy makecint; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
   # Extract the first word of "makecint", so it can be a program name with args.
 set dummy makecint; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3027: checking for $ac_word" >&5
+echo "configure:3039: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MAKECINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_path_MAKECINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3261,6 +3273,8 @@ s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
 s%@RANLIB@%$RANLIB%g
 s%@CC@%$CC%g
 s%@build_os@%$build_os%g
 s%@RANLIB@%$RANLIB%g
 s%@CC@%$CC%g
+s%@LD@%$LD%g
+s%@NM@%$NM%g
 s%@LN_S@%$LN_S%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@LEX@%$LEX%g
 s%@LN_S@%$LN_S%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@LEX@%$LEX%g
index f10abf961e35195c27f98bf0dad2cd81feafe9ab..1f17c6a9a334f6fcc42348ec183be4a87f9f8c88 100644 (file)
@@ -19,9 +19,9 @@ dnl (don't we all *love* M4?)...
 
 GINACLIB_MAJOR_VERSION=0
 GINACLIB_MINOR_VERSION=6
 
 GINACLIB_MAJOR_VERSION=0
 GINACLIB_MINOR_VERSION=6
-GINACLIB_MICRO_VERSION=2
-GINACLIB_INTERFACE_AGE=2
-GINACLIB_BINARY_AGE=2
+GINACLIB_MICRO_VERSION=3
+GINACLIB_INTERFACE_AGE=0
+GINACLIB_BINARY_AGE=0
 GINACLIB_VERSION=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION.$GINACLIB_MICRO_VERSION
 
 AC_SUBST(GINACLIB_MAJOR_VERSION)
 GINACLIB_VERSION=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION.$GINACLIB_MICRO_VERSION
 
 AC_SUBST(GINACLIB_MAJOR_VERSION)
index 5e9d536f6ae63d663e6dd60d0bb66c730c66643d..79c771fde83fbdedf8a9e6c2632b715c397bc965 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -94,6 +95,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index 7d610ec7a686603811940a65587afbfa94ef8bb1..bb18600025e771167471f4943c626980c9219957 100644 (file)
@@ -85,6 +85,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -97,6 +98,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index 2bad576a3261f7e006795111d99fcf58ea99a437..027e555a514f10661d6a957837feda5412eac498 100644 (file)
@@ -84,6 +84,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -96,6 +97,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index ad044074eb19bed8933314c00d0b0d622ed49812..536bf897a439267d05d4cc7f84001ffa382cd8f2 100644 (file)
@@ -2068,10 +2068,17 @@ GiNaC contains the following predefined mathematical functions:
 
 @cindex branch cut
 For functions that have a branch cut in the complex plane GiNaC follows
 
 @cindex branch cut
 For functions that have a branch cut in the complex plane GiNaC follows
-the conventions for C++ as defined in the ANSI standard.  In particular:
-the natural logarithm (@code{log}) and the square root (@code{sqrt})
-both have their branch cuts running along the negative real axis where
-the points on the axis itself belong to the upper part.
+the conventions for C++ as defined in the ANSI standard as far as
+possible.  In particular: the natural logarithm (@code{log}) and the
+square root (@code{sqrt}) both have their branch cuts running along the
+negative real axis where the points on the axis itself belong to the
+upper part (i.e. continuous with quadrant II).  The inverse
+trigonometric and hyperbolic functions are not defined for complex
+arguments by the C++ standard, however.  Here, we follow the conventions
+used by CLN, which in turn follow the carefully structured definitions
+in the Common Lisp standard.  Hopefully, future revisions of the C++
+standard incorporate these functions in the complex domain in a manner
+compatible with Common Lisp.
 
 
 @node Input/Output, Extending GiNaC, Built-in Functions, Methods and Functions
 
 
 @node Input/Output, Extending GiNaC, Built-in Functions, Methods and Functions
index 4677e72658dcc89b404a722ab7b96b838e070d25..da902e49bacbdf3acd77778ce6d3b8ac08e2e0c5 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -94,6 +95,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index 8a7e9041fff631cfdb78d29bb833cad64e97d950..f85617c6dab88ae01b91d6d6e8ff3ec405995115 100644 (file)
@@ -185,7 +185,7 @@ basic * add::duplicate() const
     return new add(*this);
 }
 
     return new add(*this);
 }
 
-void add::print(ostream & os, unsigned upper_precedence) const
+void add::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("add print",LOGLEVEL_PRINT);
     if (precedence<=upper_precedence) os << "(";
 {
     debugmsg("add print",LOGLEVEL_PRINT);
     if (precedence<=upper_precedence) os << "(";
@@ -225,7 +225,7 @@ void add::print(ostream & os, unsigned upper_precedence) const
     if (precedence<=upper_precedence) os << ")";
 }
 
     if (precedence<=upper_precedence) os << ")";
 }
 
-void add::printraw(ostream & os) const
+void add::printraw(std::ostream & os) const
 {
     debugmsg("add printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("add printraw",LOGLEVEL_PRINT);
 
@@ -241,7 +241,7 @@ void add::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void add::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void add::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("add print csrc", LOGLEVEL_PRINT);
     if (precedence <= upper_precedence)
 {
     debugmsg("add print csrc", LOGLEVEL_PRINT);
     if (precedence <= upper_precedence)
@@ -539,9 +539,9 @@ ex add::expand(unsigned options) const
         return *this;
     
     epvector * vp = expandchildren(options);
         return *this;
     
     epvector * vp = expandchildren(options);
-    if (vp==0) {
+    if (vp==0)
         return *this;
         return *this;
-    }
+    
     return (new add(vp,overall_coeff))->
         setflag(status_flags::expanded |
                 status_flags::dynallocated);
     return (new add(vp,overall_coeff))->
         setflag(status_flags::expanded |
                 status_flags::dynallocated);
index a3c34e9ccd592fa436a13e8144ef7bb4f9177101..7db48695fd8e3db5aee68e0480c6e23e263e19a0 100644 (file)
@@ -62,15 +62,15 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
     ex coeff(const symbol & s, int n=1) const;
     ex eval(int level=0) const;
     bool info(unsigned inf) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
     ex coeff(const symbol & s, int n=1) const;
     ex eval(int level=0) const;
-    ex series(const relational & r, int order) const;
+    ex series(const relational & r, int order, bool branchcut = true) const;
     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
     numeric integer_content(void) const;
     ex smod(const numeric &xi) const;
     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
     numeric integer_content(void) const;
     ex smod(const numeric &xi) const;
index 058264d9150a82ac4b78b050748b632b26005bf5..73df064a4c9cdfd8889d6c65ba0df62b0412c23c 100644 (file)
@@ -55,7 +55,7 @@ void archive::archive_ex(const ex &e, const char *name)
 archive_node_id archive::add_node(const archive_node &n)
 {
        // Search for node in nodes vector
 archive_node_id archive::add_node(const archive_node &n)
 {
        // Search for node in nodes vector
-       vector<archive_node>::const_iterator i = nodes.begin(), iend = nodes.end();
+       std::vector<archive_node>::const_iterator i = nodes.begin(), iend = nodes.end();
        archive_node_id id = 0;
        while (i != iend) {
                if (i->has_same_ex_as(n))
        archive_node_id id = 0;
        while (i != iend) {
                if (i->has_same_ex_as(n))
@@ -84,9 +84,9 @@ archive_node &archive::get_node(archive_node_id id)
 ex archive::unarchive_ex(const lst &sym_lst, const char *name) const
 {
        // Find root node
 ex archive::unarchive_ex(const lst &sym_lst, const char *name) const
 {
        // Find root node
-       string name_string = name;
+       std::string name_string = name;
        archive_atom id = atomize(name_string);
        archive_atom id = atomize(name_string);
-       vector<archived_ex>::const_iterator i = exprs.begin(), iend = exprs.end();
+       std::vector<archived_ex>::const_iterator i = exprs.begin(), iend = exprs.end();
        while (i != iend) {
                if (i->name == id)
                        goto found;
        while (i != iend) {
                if (i->name == id)
                        goto found;
@@ -112,7 +112,7 @@ ex archive::unarchive_ex(const lst &sym_lst, unsigned int index) const
 
 /** Retrieve expression and its name from archive by index.
  *  @param sym_lst  list of pre-defined symbols */
 
 /** Retrieve expression and its name from archive by index.
  *  @param sym_lst  list of pre-defined symbols */
-ex archive::unarchive_ex(const lst &sym_lst, string &name, unsigned int index) const
+ex archive::unarchive_ex(const lst &sym_lst, std::string &name, unsigned int index) const
 {
        if (index >= exprs.size())
                throw (std::range_error("index of archived expression out of range"));
 {
        if (index >= exprs.size())
                throw (std::range_error("index of archived expression out of range"));
@@ -172,7 +172,7 @@ unsigned int archive::num_expressions(void) const
  */
 
 /** Write unsigned integer quantity to stream. */
  */
 
 /** Write unsigned integer quantity to stream. */
-static void write_unsigned(ostream &os, unsigned int val)
+static void write_unsigned(std::ostream &os, unsigned int val)
 {
        while (val > 0x80) {
                os.put((val & 0x7f) | 0x80);
 {
        while (val > 0x80) {
                os.put((val & 0x7f) | 0x80);
@@ -182,7 +182,7 @@ static void write_unsigned(ostream &os, unsigned int val)
 }
 
 /** Read unsigned integer quantity from stream. */
 }
 
 /** Read unsigned integer quantity from stream. */
-static unsigned int read_unsigned(istream &is)
+static unsigned int read_unsigned(std::istream &is)
 {
        unsigned char b;
        unsigned int ret = 0;
 {
        unsigned char b;
        unsigned int ret = 0;
@@ -196,7 +196,7 @@ static unsigned int read_unsigned(istream &is)
 }
 
 /** Write archive_node to binary data stream. */
 }
 
 /** Write archive_node to binary data stream. */
-ostream &operator<<(ostream &os, const archive_node &n)
+std::ostream &operator<<(std::ostream &os, const archive_node &n)
 {
        // Write properties
        unsigned int num_props = n.props.size();
 {
        // Write properties
        unsigned int num_props = n.props.size();
@@ -209,7 +209,7 @@ ostream &operator<<(ostream &os, const archive_node &n)
 }
 
 /** Write archive to binary data stream. */
 }
 
 /** Write archive to binary data stream. */
-ostream &operator<<(ostream &os, const archive &ar)
+std::ostream &operator<<(std::ostream &os, const archive &ar)
 {
        // Write header
        os.put('G');    // Signature
 {
        // Write header
        os.put('G');    // Signature
@@ -241,7 +241,7 @@ ostream &operator<<(ostream &os, const archive &ar)
 }
 
 /** Read archive_node from binary data stream. */
 }
 
 /** Read archive_node from binary data stream. */
-istream &operator>>(istream &is, archive_node &n)
+std::istream &operator>>(std::istream &is, archive_node &n)
 {
        // Read properties
        unsigned int num_props = read_unsigned(is);
 {
        // Read properties
        unsigned int num_props = read_unsigned(is);
@@ -256,7 +256,7 @@ istream &operator>>(istream &is, archive_node &n)
 }
 
 /** Read archive from binary data stream. */
 }
 
 /** Read archive from binary data stream. */
-istream &operator>>(istream &is, archive &ar)
+std::istream &operator>>(std::istream &is, archive &ar)
 {
        // Read header
        char c1, c2, c3, c4;
 {
        // Read header
        char c1, c2, c3, c4;
@@ -293,10 +293,10 @@ istream &operator>>(istream &is, archive &ar)
 
 /** Atomize a string (i.e. convert it into an ID number that uniquely
  *  represents the string). */
 
 /** Atomize a string (i.e. convert it into an ID number that uniquely
  *  represents the string). */
-archive_atom archive::atomize(const string &s) const
+archive_atom archive::atomize(const std::string &s) const
 {
        // Search for string in atoms vector
 {
        // Search for string in atoms vector
-       vector<string>::const_iterator i = atoms.begin(), iend = atoms.end();
+       std::vector<std::string>::const_iterator i = atoms.begin(), iend = atoms.end();
        archive_atom id = 0;
        while (i != iend) {
                if (*i == s)
        archive_atom id = 0;
        while (i != iend) {
                if (*i == s)
@@ -310,7 +310,7 @@ archive_atom archive::atomize(const string &s) const
 }
 
 /** Unatomize a string (i.e. convert the ID number back to the string). */
 }
 
 /** Unatomize a string (i.e. convert the ID number back to the string). */
-const string &archive::unatomize(archive_atom id) const
+const std::string &archive::unatomize(archive_atom id) const
 {
        if (id >= atoms.size())
                throw (std::range_error("archive::unatomizee(): atom ID out of range"));
 {
        if (id >= atoms.size())
                throw (std::range_error("archive::unatomizee(): atom ID out of range"));
@@ -359,25 +359,25 @@ bool archive_node::has_same_ex_as(const archive_node &other) const
 
 
 /** Add property of type "bool" to node. */
 
 
 /** Add property of type "bool" to node. */
-void archive_node::add_bool(const string &name, bool value)
+void archive_node::add_bool(const std::string &name, bool value)
 {
        props.push_back(property(a.atomize(name), PTYPE_BOOL, value));
 }
 
 /** Add property of type "unsigned int" to node. */
 {
        props.push_back(property(a.atomize(name), PTYPE_BOOL, value));
 }
 
 /** Add property of type "unsigned int" to node. */
-void archive_node::add_unsigned(const string &name, unsigned int value)
+void archive_node::add_unsigned(const std::string &name, unsigned int value)
 {
        props.push_back(property(a.atomize(name), PTYPE_UNSIGNED, value));
 }
 
 /** Add property of type "string" to node. */
 {
        props.push_back(property(a.atomize(name), PTYPE_UNSIGNED, value));
 }
 
 /** Add property of type "string" to node. */
-void archive_node::add_string(const string &name, const string &value)
+void archive_node::add_string(const std::string &name, const std::string &value)
 {
        props.push_back(property(a.atomize(name), PTYPE_STRING, a.atomize(value)));
 }
 
 /** Add property of type "ex" to node. */
 {
        props.push_back(property(a.atomize(name), PTYPE_STRING, a.atomize(value)));
 }
 
 /** Add property of type "ex" to node. */
-void archive_node::add_ex(const string &name, const ex &value)
+void archive_node::add_ex(const std::string &name, const ex &value)
 {
        // Recursively create an archive_node and add its ID to the properties of this node
        archive_node_id id = a.add_node(archive_node(a, value));
 {
        // Recursively create an archive_node and add its ID to the properties of this node
        archive_node_id id = a.add_node(archive_node(a, value));
@@ -387,10 +387,10 @@ void archive_node::add_ex(const string &name, const ex &value)
 
 /** Retrieve property of type "bool" from node.
  *  @return "true" if property was found, "false" otherwise */
 
 /** Retrieve property of type "bool" from node.
  *  @return "true" if property was found, "false" otherwise */
-bool archive_node::find_bool(const string &name, bool &ret) const
+bool archive_node::find_bool(const std::string &name, bool &ret) const
 {
        archive_atom name_atom = a.atomize(name);
 {
        archive_atom name_atom = a.atomize(name);
-       vector<property>::const_iterator i = props.begin(), iend = props.end();
+       std::vector<property>::const_iterator i = props.begin(), iend = props.end();
        while (i != iend) {
                if (i->type == PTYPE_BOOL && i->name == name_atom) {
                        ret = i->value;
        while (i != iend) {
                if (i->type == PTYPE_BOOL && i->name == name_atom) {
                        ret = i->value;
@@ -403,10 +403,10 @@ bool archive_node::find_bool(const string &name, bool &ret) const
 
 /** Retrieve property of type "unsigned" from node.
  *  @return "true" if property was found, "false" otherwise */
 
 /** Retrieve property of type "unsigned" from node.
  *  @return "true" if property was found, "false" otherwise */
-bool archive_node::find_unsigned(const string &name, unsigned int &ret) const
+bool archive_node::find_unsigned(const std::string &name, unsigned int &ret) const
 {
        archive_atom name_atom = a.atomize(name);
 {
        archive_atom name_atom = a.atomize(name);
-       vector<property>::const_iterator i = props.begin(), iend = props.end();
+       std::vector<property>::const_iterator i = props.begin(), iend = props.end();
        while (i != iend) {
                if (i->type == PTYPE_UNSIGNED && i->name == name_atom) {
                        ret = i->value;
        while (i != iend) {
                if (i->type == PTYPE_UNSIGNED && i->name == name_atom) {
                        ret = i->value;
@@ -419,10 +419,10 @@ bool archive_node::find_unsigned(const string &name, unsigned int &ret) const
 
 /** Retrieve property of type "string" from node.
  *  @return "true" if property was found, "false" otherwise */
 
 /** Retrieve property of type "string" from node.
  *  @return "true" if property was found, "false" otherwise */
-bool archive_node::find_string(const string &name, string &ret) const
+bool archive_node::find_string(const std::string &name, std::string &ret) const
 {
        archive_atom name_atom = a.atomize(name);
 {
        archive_atom name_atom = a.atomize(name);
-       vector<property>::const_iterator i = props.begin(), iend = props.end();
+       std::vector<property>::const_iterator i = props.begin(), iend = props.end();
        while (i != iend) {
                if (i->type == PTYPE_STRING && i->name == name_atom) {
                        ret = a.unatomize(i->value);
        while (i != iend) {
                if (i->type == PTYPE_STRING && i->name == name_atom) {
                        ret = a.unatomize(i->value);
@@ -435,10 +435,10 @@ bool archive_node::find_string(const string &name, string &ret) const
 
 /** Retrieve property of type "ex" from node.
  *  @return "true" if property was found, "false" otherwise */
 
 /** Retrieve property of type "ex" from node.
  *  @return "true" if property was found, "false" otherwise */
-bool archive_node::find_ex(const string &name, ex &ret, const lst &sym_lst, unsigned int index) const
+bool archive_node::find_ex(const std::string &name, ex &ret, const lst &sym_lst, unsigned int index) const
 {
        archive_atom name_atom = a.atomize(name);
 {
        archive_atom name_atom = a.atomize(name);
-       vector<property>::const_iterator i = props.begin(), iend = props.end();
+       std::vector<property>::const_iterator i = props.begin(), iend = props.end();
        unsigned int found_index = 0;
        while (i != iend) {
                if (i->type == PTYPE_NODE && i->name == name_atom) {
        unsigned int found_index = 0;
        while (i != iend) {
                if (i->type == PTYPE_NODE && i->name == name_atom) {
@@ -464,7 +464,7 @@ ex archive_node::unarchive(const lst &sym_lst) const
                return e;
 
        // Find instantiation function for class specified in node
                return e;
 
        // Find instantiation function for class specified in node
-       string class_name;
+       std::string class_name;
        if (!find_string("class", class_name))
                throw (std::runtime_error("archive node contains no class name"));
        unarch_func f = find_unarch_func(class_name);
        if (!find_string("class", class_name))
                throw (std::runtime_error("archive node contains no class name"));
        unarch_func f = find_unarch_func(class_name);
@@ -500,7 +500,7 @@ void archive::clear(void)
 /** Delete cached unarchived expressions in all archive_nodes (mainly for debugging). */
 void archive::forget(void)
 {
 /** Delete cached unarchived expressions in all archive_nodes (mainly for debugging). */
 void archive::forget(void)
 {
-       vector<archive_node>::iterator i = nodes.begin(), iend = nodes.end();
+       std::vector<archive_node>::iterator i = nodes.begin(), iend = nodes.end();
        while (i != iend) {
                i->forget();
                i++;
        while (i != iend) {
                i->forget();
                i++;
@@ -516,12 +516,12 @@ void archive_node::forget(void)
 
 
 /** Print archive to stream in ugly raw format (for debugging). */
 
 
 /** Print archive to stream in ugly raw format (for debugging). */
-void archive::printraw(ostream &os) const
+void archive::printraw(std::ostream &os) const
 {
        // Dump atoms
        os << "Atoms:\n";
        {
 {
        // Dump atoms
        os << "Atoms:\n";
        {
-               vector<string>::const_iterator i = atoms.begin(), iend = atoms.end();
+               std::vector<std::string>::const_iterator i = atoms.begin(), iend = atoms.end();
                archive_atom id = 0;
                while (i != iend) {
                        os << " " << id << " " << *i << endl;
                archive_atom id = 0;
                while (i != iend) {
                        os << " " << id << " " << *i << endl;
@@ -533,7 +533,7 @@ void archive::printraw(ostream &os) const
        // Dump expressions
        os << "Expressions:\n";
        {
        // Dump expressions
        os << "Expressions:\n";
        {
-               vector<archived_ex>::const_iterator i = exprs.begin(), iend = exprs.end();
+               std::vector<archived_ex>::const_iterator i = exprs.begin(), iend = exprs.end();
                unsigned int index = 0;
                while (i != iend) {
                        os << " " << index << " \"" << unatomize(i->name) << "\" root node " << i->root << endl;
                unsigned int index = 0;
                while (i != iend) {
                        os << " " << index << " \"" << unatomize(i->name) << "\" root node " << i->root << endl;
@@ -545,7 +545,7 @@ void archive::printraw(ostream &os) const
        // Dump nodes
        os << "Nodes:\n";
        {
        // Dump nodes
        os << "Nodes:\n";
        {
-               vector<archive_node>::const_iterator i = nodes.begin(), iend = nodes.end();
+               std::vector<archive_node>::const_iterator i = nodes.begin(), iend = nodes.end();
                archive_node_id id = 0;
                while (i != iend) {
                        os << " " << id << " ";
                archive_node_id id = 0;
                while (i != iend) {
                        os << " " << id << " ";
@@ -556,7 +556,7 @@ void archive::printraw(ostream &os) const
 }
 
 /** Output archive_node to stream in ugly raw format (for debugging). */
 }
 
 /** Output archive_node to stream in ugly raw format (for debugging). */
-void archive_node::printraw(ostream &os) const
+void archive_node::printraw(std::ostream &os) const
 {
        // Dump cached unarchived expression
        if (has_expression)
 {
        // Dump cached unarchived expression
        if (has_expression)
@@ -565,7 +565,7 @@ void archive_node::printraw(ostream &os) const
                os << "\n";
 
        // Dump properties
                os << "\n";
 
        // Dump properties
-       vector<property>::const_iterator i = props.begin(), iend = props.end();
+       std::vector<property>::const_iterator i = props.begin(), iend = props.end();
        while (i != iend) {
                os << "  ";
                switch (i->type) {
        while (i != iend) {
                os << "  ";
                switch (i->type) {
index 396820b392a7fc58f4ee4b77432b059c14cab0ad..082a32680b6a7aa7ec43b59bbd35d7ee5ab80fa0 100644 (file)
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
 
-class ostream;
-class istream;
+namespace std {
+    class ostream;
+    class istream;
+}
 
 #ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
 
 #ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
@@ -51,8 +53,8 @@ typedef unsigned int archive_atom;
  *  addressed by its name and data type. */
 class archive_node
 {
  *  addressed by its name and data type. */
 class archive_node
 {
-       friend ostream &operator<<(ostream &os, const archive_node &ar);
-       friend istream &operator>>(istream &is, archive_node &ar);
+       friend std::ostream &operator<<(std::ostream &os, const archive_node &ar);
+       friend std::istream &operator>>(std::istream &is, archive_node &ar);
 
 public:
        archive_node() : a(*dummy_ar_creator()), has_expression(false) {} // hack for cint which always requires a default constructor
 
 public:
        archive_node() : a(*dummy_ar_creator()), has_expression(false) {} // hack for cint which always requires a default constructor
@@ -65,20 +67,20 @@ public:
 
        bool has_same_ex_as(const archive_node &other) const;
 
 
        bool has_same_ex_as(const archive_node &other) const;
 
-       void add_bool(const string &name, bool value);
-       void add_unsigned(const string &name, unsigned int value);
-       void add_string(const string &name, const string &value);
-       void add_ex(const string &name, const ex &value);
+       void add_bool(const std::string &name, bool value);
+       void add_unsigned(const std::string &name, unsigned int value);
+       void add_string(const std::string &name, const std::string &value);
+       void add_ex(const std::string &name, const ex &value);
 
 
-       bool find_bool(const string &name, bool &ret) const;
-       bool find_unsigned(const string &name, unsigned int &ret) const;
-       bool find_string(const string &name, string &ret) const;
-       bool find_ex(const string &name, ex &ret, const lst &sym_lst, unsigned int index = 0) const;
+       bool find_bool(const std::string &name, bool &ret) const;
+       bool find_unsigned(const std::string &name, unsigned int &ret) const;
+       bool find_string(const std::string &name, std::string &ret) const;
+       bool find_ex(const std::string &name, ex &ret, const lst &sym_lst, unsigned int index = 0) const;
 
        ex unarchive(const lst &sym_lst) const;
 
        void forget(void);
 
        ex unarchive(const lst &sym_lst) const;
 
        void forget(void);
-       void printraw(ostream &os) const;
+       void printraw(std::ostream &os) const;
 
 private:
        static archive* dummy_ar_creator(void);
 
 private:
        static archive* dummy_ar_creator(void);
@@ -109,7 +111,7 @@ private:
        archive &a;
 
        /** Vector of stored properties. */
        archive &a;
 
        /** Vector of stored properties. */
-       vector<property> props;
+       std::vector<property> props;
 
        /** Flag indicating whether a cached unarchived representation of this node exists. */
        mutable bool has_expression;
 
        /** Flag indicating whether a cached unarchived representation of this node exists. */
        mutable bool has_expression;
@@ -128,8 +130,8 @@ private:
  *  of class basic (or a derived class). */
 class archive
 {
  *  of class basic (or a derived class). */
 class archive
 {
-       friend ostream &operator<<(ostream &os, const archive &ar);
-       friend istream &operator>>(istream &is, archive &ar);
+       friend std::ostream &operator<<(std::ostream &os, const archive &ar);
+       friend std::istream &operator>>(std::istream &is, archive &ar);
 
 public:
        archive() {}
 
 public:
        archive() {}
@@ -147,17 +149,17 @@ public:
        void archive_ex(const ex &e, const char *name);
        ex unarchive_ex(const lst &sym_lst, const char *name) const;
        ex unarchive_ex(const lst &sym_lst, unsigned int index = 0) const;
        void archive_ex(const ex &e, const char *name);
        ex unarchive_ex(const lst &sym_lst, const char *name) const;
        ex unarchive_ex(const lst &sym_lst, unsigned int index = 0) const;
-       ex unarchive_ex(const lst &sym_lst, string &name, unsigned int index = 0) const;
+       ex unarchive_ex(const lst &sym_lst, std::string &name, unsigned int index = 0) const;
        unsigned int num_expressions(void) const;
 
        void clear(void);
 
        void forget(void);
        unsigned int num_expressions(void) const;
 
        void clear(void);
 
        void forget(void);
-       void printraw(ostream &os) const;
+       void printraw(std::ostream &os) const;
 
 private:
        /** Vector of archived nodes. */
 
 private:
        /** Vector of archived nodes. */
-       vector<archive_node> nodes;
+       std::vector<archive_node> nodes;
 
        /** Archived expression descriptor. */
        struct archived_ex {
 
        /** Archived expression descriptor. */
        struct archived_ex {
@@ -169,20 +171,20 @@ private:
        };
 
        /** Vector of archived expression descriptors. */
        };
 
        /** Vector of archived expression descriptors. */
-       vector<archived_ex> exprs;
+       std::vector<archived_ex> exprs;
 
 public:
 
 public:
-       archive_atom atomize(const string &s) const;
-       const string &unatomize(archive_atom id) const;
+       archive_atom atomize(const std::string &s) const;
+       const std::string &unatomize(archive_atom id) const;
 
 private:
        /** Vector of atomized strings (using a vector allows faster unarchiving). */
 
 private:
        /** Vector of atomized strings (using a vector allows faster unarchiving). */
-       mutable vector<string> atoms;
+       mutable std::vector<std::string> atoms;
 };
 
 
 };
 
 
-ostream &operator<<(ostream &os, const archive &ar);
-istream &operator>>(istream &is, archive &ar);
+std::ostream &operator<<(std::ostream &os, const archive &ar);
+std::istream &operator>>(std::istream &is, archive &ar);
 
 
 #ifndef NO_NAMESPACE_GINAC
 
 
 #ifndef NO_NAMESPACE_GINAC
index 83b777bbf9f8fc8c2592d5c34eea54a19aad2581..5e3ff581191dcd00fcd1b79f6318cd70e3e0f725 100644 (file)
@@ -104,7 +104,7 @@ basic::basic(const archive_node &n, const lst &sym_lst) : flags(0), refcount(0)
     debugmsg("basic constructor from archive_node", LOGLEVEL_CONSTRUCT);
 
     // Reconstruct tinfo_key from class name
     debugmsg("basic constructor from archive_node", LOGLEVEL_CONSTRUCT);
 
     // Reconstruct tinfo_key from class name
-    string class_name;
+    std::string class_name;
     if (n.find_string("class", class_name))
         tinfo_key = find_tinfo_key(class_name);
     else
     if (n.find_string("class", class_name))
         tinfo_key = find_tinfo_key(class_name);
     else
@@ -136,7 +136,7 @@ void basic::archive(archive_node &n) const
 // public
 
 /** Output to stream formatted to be useful as ginsh input. */
 // public
 
 /** Output to stream formatted to be useful as ginsh input. */
-void basic::print(ostream & os, unsigned upper_precedence) const
+void basic::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("basic print",LOGLEVEL_PRINT);
     os << "[basic object]";
 {
     debugmsg("basic print",LOGLEVEL_PRINT);
     os << "[basic object]";
@@ -144,7 +144,7 @@ void basic::print(ostream & os, unsigned upper_precedence) const
 
 /** Output to stream in ugly raw format, so brave developers can have a look
  * at the underlying structure. */
 
 /** Output to stream in ugly raw format, so brave developers can have a look
  * at the underlying structure. */
-void basic::printraw(ostream & os) const
+void basic::printraw(std::ostream & os) const
 {
     debugmsg("basic printraw",LOGLEVEL_PRINT);
     os << "[basic object]";
 {
     debugmsg("basic printraw",LOGLEVEL_PRINT);
     os << "[basic object]";
@@ -152,13 +152,14 @@ void basic::printraw(ostream & os) const
 
 /** Output to stream formatted in tree- (indented-) form, so developers can
  *  have a look at the underlying structure. */
 
 /** Output to stream formatted in tree- (indented-) form, so developers can
  *  have a look at the underlying structure. */
-void basic::printtree(ostream & os, unsigned indent) const
+void basic::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("basic printtree",LOGLEVEL_PRINT);
 {
     debugmsg("basic printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << "type=" << typeid(*this).name()
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
+    os << std::string(indent,' ') << "type=" << typeid(*this).name()
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
        << ", flags=" << flags
        << ", flags=" << flags
-       << ", nops=" << nops() << endl;
+       << ", nops=" << nops() << std::endl;
     for (unsigned i=0; i<nops(); ++i) {
         op(i).printtree(os,indent+delta_indent);
     }
     for (unsigned i=0; i<nops(); ++i) {
         op(i).printtree(os,indent+delta_indent);
     }
@@ -170,7 +171,7 @@ void basic::printtree(ostream & os, unsigned indent) const
  *  @param type variable type (one of the csrc_types)
  *  @param upper_precedence operator precedence of caller
  *  @see ex::printcsrc */
  *  @param type variable type (one of the csrc_types)
  *  @param upper_precedence operator precedence of caller
  *  @see ex::printcsrc */
-void basic::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void basic::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("basic print csrc", LOGLEVEL_PRINT);
 }
 {
     debugmsg("basic print csrc", LOGLEVEL_PRINT);
 }
@@ -178,14 +179,14 @@ void basic::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) co
 /** Little wrapper arount print to be called within a debugger. */
 void basic::dbgprint(void) const
 {
 /** Little wrapper arount print to be called within a debugger. */
 void basic::dbgprint(void) const
 {
-    print(cerr);
-    cerr << endl;
+    print(std::cerr);
+    std::cerr << std::endl;
 }
 
 /** Little wrapper arount printtree to be called within a debugger. */
 void basic::dbgprinttree(void) const
 {
 }
 
 /** Little wrapper arount printtree to be called within a debugger. */
 void basic::dbgprinttree(void) const
 {
-    printtree(cerr,0);
+    printtree(std::cerr,0);
 }
 
 basic * basic::duplicate() const
 }
 
 basic * basic::duplicate() const
@@ -311,14 +312,14 @@ ex basic::subs(const lst & ls, const lst & lr) const
 ex basic::diff(const symbol & s, unsigned nth) const
 {
     // trivial: zeroth derivative
 ex basic::diff(const symbol & s, unsigned nth) const
 {
     // trivial: zeroth derivative
-    if (!nth)
+    if (nth==0)
         return ex(*this);
     
     // evaluate unevaluated *this before differentiating
     if (!(flags & status_flags::evaluated))
         return ex(*this).diff(s, nth);
     
         return ex(*this);
     
     // evaluate unevaluated *this before differentiating
     if (!(flags & status_flags::evaluated))
         return ex(*this).diff(s, nth);
     
-    ex ndiff = derivative(s);
+    ex ndiff = this->derivative(s);
     while (!ndiff.is_zero() &&    // stop differentiating zeros
            nth>1) {
         ndiff = ndiff.diff(s);
     while (!ndiff.is_zero() &&    // stop differentiating zeros
            nth>1) {
         ndiff = ndiff.diff(s);
index ed049eaf1b239159b2770a227ec7bd2766555d23..2263081c2103b8740d5016cf2d77a82d7e3aed2e 100644 (file)
@@ -27,7 +27,7 @@
 #include <typeinfo>
 #include <vector>
 
 #include <typeinfo>
 #include <vector>
 
-// CINT needs <algorithm> to work properly with <vector> 
+// CINT needs <algorithm> to work properly with <vector>
 #include <algorithm>
 
 #include "flags.h"
 #include <algorithm>
 
 #include "flags.h"
@@ -47,8 +47,8 @@ class numeric;
 class relational;
 class archive_node;
 
 class relational;
 class archive_node;
 
-//typedef vector<ex> exvector;
-typedef vector<ex,malloc_alloc> exvector; // CINT does not like vector<...,default_alloc>
+// typedef std::vector<ex> exvector;
+typedef std::vector<ex,malloc_alloc> exvector; // CINT does not like vector<...,default_alloc>
 
 #define INLINE_BASIC_CONSTRUCTORS
 
 
 #define INLINE_BASIC_CONSTRUCTORS
 
@@ -119,10 +119,10 @@ protected:
     // new virtual functions which can be overridden by derived classes
 public: // only const functions please (may break reference counting)
     virtual basic * duplicate() const;
     // new virtual functions which can be overridden by derived classes
 public: // only const functions please (may break reference counting)
     virtual basic * duplicate() const;
-    virtual void print(ostream & os,unsigned upper_precedence=0) const;
-    virtual void printraw(ostream & os) const;
-    virtual void printtree(ostream & os, unsigned indent) const;
-    virtual void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    virtual void print(std::ostream & os,unsigned upper_precedence = 0) const;
+    virtual void printraw(std::ostream & os) const;
+    virtual void printtree(std::ostream & os, unsigned indent) const;
+    virtual void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence = 0) const;
     virtual void dbgprint(void) const;
     virtual void dbgprinttree(void) const;
     virtual bool info(unsigned inf) const;
     virtual void dbgprint(void) const;
     virtual void dbgprinttree(void) const;
     virtual bool info(unsigned inf) const;
@@ -134,13 +134,13 @@ public: // only const functions please (may break reference counting)
     virtual bool has(const ex & other) const;
     virtual int degree(const symbol & s) const;
     virtual int ldegree(const symbol & s) const;
     virtual bool has(const ex & other) const;
     virtual int degree(const symbol & s) const;
     virtual int ldegree(const symbol & s) const;
-    virtual ex coeff(const symbol & s, int n=1) const;
+    virtual ex coeff(const symbol & s, int n = 1) const;
     virtual ex collect(const symbol & s) const;
     virtual ex collect(const symbol & s) const;
-    virtual ex eval(int level=0) const;
-    virtual ex evalf(int level=0) const;
-    virtual ex series(const relational & r, int order) const;
+    virtual ex eval(int level = 0) const;
+    virtual ex evalf(int level = 0) const;
+    virtual ex series(const relational & r, int order, bool branchcut = true) const;
     virtual ex subs(const lst & ls, const lst & lr) const;
     virtual ex subs(const lst & ls, const lst & lr) const;
-    virtual ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+    virtual ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const;
     virtual ex to_rational(lst &repl_lst) const;
     virtual numeric integer_content(void) const;
     virtual ex smod(const numeric &xi) const;
     virtual ex to_rational(lst &repl_lst) const;
     virtual numeric integer_content(void) const;
     virtual ex smod(const numeric &xi) const;
index 65d3584c9ee719012940843d9f2d7580e102ea59..2bf3fbb7abac689dba46342c582655fe91932d2f 100644 (file)
@@ -91,7 +91,7 @@ void clifford::destroy(bool call_parent)
 
 // public
 
 
 // public
 
-clifford::clifford(const string & initname)
+clifford::clifford(const std::string & initname)
 {
     debugmsg("clifford constructor from string",LOGLEVEL_CONSTRUCT);
     name=initname;
 {
     debugmsg("clifford constructor from string",LOGLEVEL_CONSTRUCT);
     name=initname;
@@ -111,7 +111,7 @@ basic * clifford::duplicate() const
     return new clifford(*this);
 }
 
     return new clifford(*this);
 }
 
-void clifford::printraw(ostream & os) const
+void clifford::printraw(std::ostream & os) const
 {
     debugmsg("clifford printraw",LOGLEVEL_PRINT);
     os << "clifford(" << "name=" << name << ",serial=" << serial
 {
     debugmsg("clifford printraw",LOGLEVEL_PRINT);
     os << "clifford(" << "name=" << name << ",serial=" << serial
@@ -120,25 +120,26 @@ void clifford::printraw(ostream & os) const
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void clifford::printtree(ostream & os, unsigned indent) const
+void clifford::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("clifford printtree",LOGLEVEL_PRINT);
 {
     debugmsg("clifford printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << name << " (clifford): "
+    os << std::string(indent,' ') << name << " (clifford): "
        << "serial=" << serial << ","
        << seq.size() << "indices=";
        << "serial=" << serial << ","
        << seq.size() << "indices=";
-    printtreeindices(os,indent);
-    os << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+    printtreeindices(os, indent);
+    os << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void clifford::print(ostream & os, unsigned upper_precedence) const
+void clifford::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("clifford print",LOGLEVEL_PRINT);
     os << name;
     printindices(os);
 }
 
 {
     debugmsg("clifford print",LOGLEVEL_PRINT);
     os << name;
     printindices(os);
 }
 
-void clifford::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void clifford::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("clifford print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
 {
     debugmsg("clifford print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
@@ -185,16 +186,16 @@ unsigned clifford::calchash(void) const
 // non-virtual functions in this class
 //////////
 
 // non-virtual functions in this class
 //////////
 
-void clifford::setname(const string & n)
+void clifford::setname(const std::string & n)
 {
 {
-    name=n;
+    name = n;
 }
 
 // private
 
 }
 
 // private
 
-string & clifford::autoname_prefix(void)
+std::string & clifford::autoname_prefix(void)
 {
 {
-    static string * s=new string("clifford");
+    static std::string * s = new std::string("clifford");
     return *s;
 }
 
     return *s;
 }
 
index 44757c3e5e980e569ae1f93a0542aa8507881f2b..18d8f0a7e0efcc104550984a35a78fe5f712d159 100644 (file)
@@ -48,15 +48,15 @@ protected:
 
     // other constructors
 public:
 
     // other constructors
 public:
-    explicit clifford(const string & initname);
+    explicit clifford(const std::string & initname);
 
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
 
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
 protected:
     int compare_same_type(const basic & other) const;
     bool info(unsigned inf) const;
 protected:
     int compare_same_type(const basic & other) const;
@@ -68,14 +68,14 @@ protected:
     
     // non-virtual functions in this class
 public:
     
     // non-virtual functions in this class
 public:
-    void setname(const string & n);
+    void setname(const std::string & n);
 private:
 private:
-    string & autoname_prefix(void);
+    std::string & autoname_prefix(void);
 
 // member variables
 
 protected:
 
 // member variables
 
 protected:
-    string name;
+    std::string name;
     unsigned serial; // unique serial number for comparision
 private:
     static unsigned next_serial;
     unsigned serial; // unique serial number for comparision
 private:
     static unsigned next_serial;
index c35e03e5d632f3bcd896f01f0419c0891edff607..b0cbabf5a6aae20e426488741263720b39f9efb0 100644 (file)
@@ -194,7 +194,7 @@ basic * color::duplicate() const
     return new color(*this);
 }
 
     return new color(*this);
 }
 
-void color::printraw(ostream & os) const
+void color::printraw(std::ostream & os) const
 {
     debugmsg("color printraw",LOGLEVEL_PRINT);
     os << "color(type=" << (unsigned)type
 {
     debugmsg("color printraw",LOGLEVEL_PRINT);
     os << "color(type=" << (unsigned)type
@@ -204,20 +204,20 @@ void color::printraw(ostream & os) const
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void color::printtree(ostream & os, unsigned indent) const
+void color::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("color printtree",LOGLEVEL_PRINT);
 {
     debugmsg("color printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << "color object: "
+    os << std::string(indent,' ') << "color object: "
        << "type=" << (unsigned)type
        << ",representation_label=" << representation_label << ", ";
        << "type=" << (unsigned)type
        << ",representation_label=" << representation_label << ", ";
-    os << seq.size() << " indices" << endl;
+    os << seq.size() << " indices" << std::endl;
     printtreeindices(os,indent);
     printtreeindices(os,indent);
-    os << string(indent,' ') << "hash=" << hashvalue
-       << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+    os << std::string(indent,' ') << "hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void color::print(ostream & os, unsigned upper_precedence) const
+void color::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("color print",LOGLEVEL_PRINT);
     switch (type) {
 {
     debugmsg("color print",LOGLEVEL_PRINT);
     switch (type) {
@@ -247,7 +247,7 @@ void color::print(ostream & os, unsigned upper_precedence) const
     printindices(os);
 }
 
     printindices(os);
 }
 
-void color::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void color::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("color print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
 {
     debugmsg("color print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
@@ -962,17 +962,17 @@ ex brute_force_sum_color_indices(const ex & e)
         }
     }
 
         }
     }
 
-    vector<int> counter;
+    std::vector<int> counter;
     counter.resize(iv_double.size());
     int l;
     for (l=0; unsigned(l)<iv_double.size(); ++l) {
         counter[l]=1;
     }
 
     counter.resize(iv_double.size());
     int l;
     for (l=0; unsigned(l)<iv_double.size(); ++l) {
         counter[l]=1;
     }
 
-    ex sum=_ex0();
+    ex sum;
     
     while (1) {
     
     while (1) {
-        ex term=e;
+        ex term = e;
         for (l=0; unsigned(l)<iv_double.size(); ++l) {
             term=term.subs(iv_double[l]==coloridx((unsigned)(counter[l])));
             //iv_double[l].print(cout);
         for (l=0; unsigned(l)<iv_double.size(); ++l) {
             term=term.subs(iv_double[l]==coloridx((unsigned)(counter[l])));
             //iv_double[l].print(cout);
@@ -982,12 +982,12 @@ ex brute_force_sum_color_indices(const ex & e)
         sum += term;
         
         // increment counter[]
         sum += term;
         
         // increment counter[]
-        l=iv_double.size()-1;
+        l = iv_double.size()-1;
         while ((l>=0)&&((++counter[l])>(int)COLOR_EIGHT)) {
             counter[l]=1;    
             l--;
         }
         while ((l>=0)&&((++counter[l])>(int)COLOR_EIGHT)) {
             counter[l]=1;    
             l--;
         }
-        if (l<2) { cout << counter[0] << counter[1] << endl; }
+        if (l<2) { std::cout << counter[0] << counter[1] << std::endl; }
         if (l<0) break;
     }
     
         if (l<0) break;
     }
     
index 6e852575ddcef3de200932ba2a229fa2985c6d93..4899fda2f5fcce0639d39b090daa6fc3ebdb5efd 100644 (file)
@@ -36,7 +36,8 @@ const unsigned MAX_REPRESENTATION_LABELS = 4;
 const unsigned COLOR_EIGHT = 8; // N*N-1
 const unsigned COLOR_THREE = 3; // N
 
 const unsigned COLOR_EIGHT = 8; // N*N-1
 const unsigned COLOR_THREE = 3; // N
 
-typedef vector<exvector,malloc_alloc> exvectorvector;
+// typedef std::vector<exvector> exvectorvector;
+typedef std::vector<exvector,malloc_alloc> exvectorvector; // CINT does not like vector<...,default_alloc>
 
 /** Base class for color object */
 class color : public indexed
 
 /** Base class for color object */
 class color : public indexed
@@ -102,10 +103,10 @@ protected:
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
     ex eval(int level=0) const;
 protected:
     bool info(unsigned inf) const;
     ex eval(int level=0) const;
 protected:
index 3e871fbe9fbf83dc140d008ceb818616aa4b2ab5..aec4c671c2fc30496b25bd16c418bec6a5976113 100644 (file)
@@ -95,7 +95,7 @@ coloridx::coloridx(bool cov) : idx(cov)
     tinfo_key=TINFO_coloridx;
 }
 
     tinfo_key=TINFO_coloridx;
 }
 
-coloridx::coloridx(const string & n, bool cov) : idx(n,cov)
+coloridx::coloridx(const std::string & n, bool cov) : idx(n,cov)
 {
     debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
     tinfo_key=TINFO_coloridx;
 {
     debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
     tinfo_key=TINFO_coloridx;
@@ -147,7 +147,7 @@ basic * coloridx::duplicate() const
     return new coloridx(*this);
 }
 
     return new coloridx(*this);
 }
 
-void coloridx::printraw(ostream & os) const
+void coloridx::printraw(std::ostream & os) const
 {
     debugmsg("coloridx printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("coloridx printraw",LOGLEVEL_PRINT);
 
@@ -170,11 +170,11 @@ void coloridx::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void coloridx::printtree(ostream & os, unsigned indent) const
+void coloridx::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("coloridx printtree",LOGLEVEL_PRINT);
 
 {
     debugmsg("coloridx printtree",LOGLEVEL_PRINT);
 
-    os << string(indent,' ') << "coloridx: ";
+    os << std::string(indent,' ') << "coloridx: ";
 
     if (symbolic) {
         os << "symbolic,name=" << name;
 
     if (symbolic) {
         os << "symbolic,name=" << name;
@@ -189,11 +189,12 @@ void coloridx::printtree(ostream & os, unsigned indent) const
     }
 
     os << ", serial=" << serial
     }
 
     os << ", serial=" << serial
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void coloridx::print(ostream & os, unsigned upper_precedence) const
+void coloridx::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("coloridx print",LOGLEVEL_PRINT);
 
 {
     debugmsg("coloridx print",LOGLEVEL_PRINT);
 
index a8f368bbe5b83911b3f7c8b71cce32630d22fc6c..5031e323562cec562e39da6b01eb19ae788979fa 100644 (file)
@@ -53,16 +53,16 @@ protected:
     // other constructors
 public:
     explicit coloridx(bool cov);
     // other constructors
 public:
     explicit coloridx(bool cov);
-    explicit coloridx(const string & n, bool cov=false);
+    explicit coloridx(const std::string & n, bool cov=false);
     explicit coloridx(const char * n, bool cov=false);
     explicit coloridx(unsigned v, bool cov=false); 
 
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     explicit coloridx(const char * n, bool cov=false);
     explicit coloridx(unsigned v, bool cov=false); 
 
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
 
     // new virtual functions which can be overridden by derived classes
     bool info(unsigned inf) const;
 
     // new virtual functions which can be overridden by derived classes
index 56d096da796974af7039f50c5e52c15479e48e78..826f515307f73acc9bedc8b6c441124fc4efb5d2 100644 (file)
@@ -89,7 +89,7 @@ void constant::destroy(bool call_parent)
 
 // public
 
 
 // public
 
-constant::constant(const string & initname, evalffunctype efun) :
+constant::constant(const std::string & initname, evalffunctype efun) :
     basic(TINFO_constant), name(initname), ef(efun),
     // number(0), fct_assigned(true), serial(next_serial++)
     number(0), serial(next_serial++)
     basic(TINFO_constant), name(initname), ef(efun),
     // number(0), fct_assigned(true), serial(next_serial++)
     number(0), serial(next_serial++)
@@ -97,7 +97,7 @@ constant::constant(const string & initname, evalffunctype efun) :
     debugmsg("constant constructor from string, function",LOGLEVEL_CONSTRUCT);
 }
 
     debugmsg("constant constructor from string, function",LOGLEVEL_CONSTRUCT);
 }
 
-constant::constant(const string & initname, const numeric & initnumber) :
+constant::constant(const std::string & initname, const numeric & initnumber) :
     basic(TINFO_constant), name(initname), ef(0),
     number(new numeric(initnumber)), /* fct_assigned(false),*/ serial(next_serial++)
 {
     basic(TINFO_constant), name(initname), ef(0),
     number(new numeric(initnumber)), /* fct_assigned(false),*/ serial(next_serial++)
 {
@@ -119,7 +119,7 @@ ex constant::unarchive(const archive_node &n, const lst &sym_lst)
 {
     // Find constant by name (!! this is bad: 'twould be better if there
     // was a list of all global constants that we could search)
 {
     // Find constant by name (!! this is bad: 'twould be better if there
     // was a list of all global constants that we could search)
-    string s;
+    std::string s;
     if (n.find_string("name", s)) {
         if (s == Pi.name)
             return Pi;
     if (n.find_string("name", s)) {
         if (s == Pi.name)
             return Pi;
@@ -152,28 +152,29 @@ basic * constant::duplicate() const
     return new constant(*this);
 }
 
     return new constant(*this);
 }
 
-void constant::print(ostream & os, unsigned upper_precedence) const
+void constant::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("constant print",LOGLEVEL_PRINT);
     os << name;
 }
 
 {
     debugmsg("constant print",LOGLEVEL_PRINT);
     os << name;
 }
 
-void constant::printraw(ostream & os) const
+void constant::printraw(std::ostream & os) const
 {
     debugmsg("constant printraw",LOGLEVEL_PRINT);
     os << "constant(" << name << ")";
 }
 
 {
     debugmsg("constant printraw",LOGLEVEL_PRINT);
     os << "constant(" << name << ")";
 }
 
-void constant::printtree(ostream & os, unsigned indent) const
+void constant::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("constant printtree",LOGLEVEL_PRINT);
 {
     debugmsg("constant printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << name
+    os << std::string(indent,' ') << name
        << ", type=" << typeid(*this).name()
        << ", type=" << typeid(*this).name()
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void constant::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void constant::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("constant print csrc",LOGLEVEL_PRINT);
     os << name;
 {
     debugmsg("constant print csrc",LOGLEVEL_PRINT);
     os << name;
index 4d456bd3754c596c5b3ed65f96e9fcd2a58d9f8a..d099378fe92aee0fe20231d618358c76c208a6ec 100644 (file)
@@ -54,16 +54,16 @@ protected:
 
     // other constructors
 public:
 
     // other constructors
 public:
-    constant(const string & initname, evalffunctype efun=0);
-    constant(const string & initname, const numeric & initnumber);
+    constant(const std::string & initname, evalffunctype efun=0);
+    constant(const std::string & initname, const numeric & initnumber);
 
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
 
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     ex evalf(int level=0) const;
 protected:
     ex derivative(const symbol & s) const;
     ex evalf(int level=0) const;
 protected:
     ex derivative(const symbol & s) const;
@@ -79,7 +79,7 @@ protected:
 // member variables
 
 private:
 // member variables
 
 private:
-    string name;
+    std::string name;
     evalffunctype ef;
     numeric * number;
     // bool fct_assigned;
     evalffunctype ef;
     numeric * number;
     // bool fct_assigned;
index 86fda5b48d693e2f109ce896bdafb39cc7f5f844..9dac1847530c3797ec530fcb5b68e5873ac340ee 100755 (executable)
@@ -187,8 +187,8 @@ $interface=<<END_OF_INTERFACE;
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
-// typedef ${STLHEADER}<ex> ${STLT};
-typedef ${STLHEADER}<ex,malloc_alloc> ${STLT}; // CINT does not like ${STLHEADER}<...,default_alloc>
+// typedef std::${STLHEADER}<ex> ${STLT};
+typedef std::${STLHEADER}<ex,malloc_alloc> ${STLT}; // CINT does not like ${STLHEADER}<...,default_alloc>
 
 class ${CONTAINER} : public basic
 {
 
 class ${CONTAINER} : public basic
 {
@@ -210,9 +210,9 @@ ${constructors_interface}
 
 public:
     basic * duplicate() const;
 
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printtree(ostream & os, unsigned indent) const;
+    void printraw(std::ostream & os) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printtree(std::ostream & os, unsigned indent) const;
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex & let_op(int i);
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex & let_op(int i);
@@ -233,7 +233,7 @@ public:
     virtual ${CONTAINER} & append(const ex & b);
 ${PREPEND_INTERFACE}
 protected:
     virtual ${CONTAINER} & append(const ex & b);
 ${PREPEND_INTERFACE}
 protected:
-    virtual void printseq(ostream & os, char openbracket, char delim,
+    virtual void printseq(std::ostream & os, char openbracket, char delim,
                           char closebracket, unsigned this_precedence,
                           unsigned upper_precedence=0) const;
     virtual ex this${CONTAINER}(${STLT} const & v) const;
                           char closebracket, unsigned this_precedence,
                           unsigned upper_precedence=0) const;
     virtual ex this${CONTAINER}(${STLT} const & v) const;
@@ -446,7 +446,7 @@ basic * ${CONTAINER}::duplicate() const
     return new ${CONTAINER}(*this);
 }
 
     return new ${CONTAINER}(*this);
 }
 
-void ${CONTAINER}::printraw(ostream & os) const
+void ${CONTAINER}::printraw(std::ostream & os) const
 {
     debugmsg("${CONTAINER} printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("${CONTAINER} printraw",LOGLEVEL_PRINT);
 
@@ -458,25 +458,26 @@ void ${CONTAINER}::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void ${CONTAINER}::print(ostream & os, unsigned upper_precedence) const
+void ${CONTAINER}::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("${CONTAINER} print",LOGLEVEL_PRINT);
     // always print brackets around seq, ignore upper_precedence
     printseq(os,'${open_bracket}',',','${close_bracket}',precedence,precedence+1);
 }
 
 {
     debugmsg("${CONTAINER} print",LOGLEVEL_PRINT);
     // always print brackets around seq, ignore upper_precedence
     printseq(os,'${open_bracket}',',','${close_bracket}',precedence,precedence+1);
 }
 
-void ${CONTAINER}::printtree(ostream & os, unsigned indent) const
+void ${CONTAINER}::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("${CONTAINER} printtree",LOGLEVEL_PRINT);
 
 {
     debugmsg("${CONTAINER} printtree",LOGLEVEL_PRINT);
 
-    os << string(indent,' ') << "type=" << typeid(*this).name()
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
+    os << std::string(indent,' ') << "type=" << typeid(*this).name()
+       << ", hash=" << hashvalue 
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
        << ", flags=" << flags
        << ", flags=" << flags
-       << ", nops=" << nops() << endl;
+       << ", nops=" << nops() << std::endl;
     for (${STLT}::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printtree(os,indent+delta_indent);
     }
     for (${STLT}::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printtree(os,indent+delta_indent);
     }
-    os << string(indent+delta_indent,' ') << "=====" << endl;
+    os << std::string(indent+delta_indent,' ') << "=====" << std::endl;
 }
 
 // ${CONTAINER}::info() will be implemented by user elsewhere";
 }
 
 // ${CONTAINER}::info() will be implemented by user elsewhere";
@@ -609,7 +610,7 @@ ${PREPEND_IMPLEMENTATION}
 
 // protected
 
 
 // protected
 
-void ${CONTAINER}::printseq(ostream & os, char openbracket, char delim,
+void ${CONTAINER}::printseq(std::ostream & os, char openbracket, char delim,
                          char closebracket, unsigned this_precedence,
                          unsigned upper_precedence) const
 {
                          char closebracket, unsigned this_precedence,
                          unsigned upper_precedence) const
 {
@@ -657,7 +658,7 @@ bool ${CONTAINER}::is_canonical() const
     for (++it; it!=seq.end(); it_last=it, ++it) {
         if ((*it_last).compare(*it)>0) {
             if ((*it_last).compare(*it)>0) {
     for (++it; it!=seq.end(); it_last=it, ++it) {
         if ((*it_last).compare(*it)>0) {
             if ((*it_last).compare(*it)>0) {
-                cout << *it_last << ">" << *it << "\\n";
+                std::cout << *it_last << ">" << *it << "\\n";
                 return 0;
                }
         }
                 return 0;
                }
         }
index 8f9aafaffe692ae15fb81d816ce62802838f58c6..bd888add92dd18b49b8a86b347a9744f1bd3e5f5 100644 (file)
@@ -44,7 +44,7 @@
 // #define LOGMASK (LOGLEVEL_PRINT | LOGLEVEL_ASSIGNMENT | LOGLEVEL_OPERATOR | LOGLEVEL_DUPLICATE | LOGLEVEL_OPERATOR | LOGLEVEL_MEMBER_FUNCTION | LOGLEVEL_NONMEMBER_FUNCTION)
 
 #ifdef VERBOSE
 // #define LOGMASK (LOGLEVEL_PRINT | LOGLEVEL_ASSIGNMENT | LOGLEVEL_OPERATOR | LOGLEVEL_DUPLICATE | LOGLEVEL_OPERATOR | LOGLEVEL_MEMBER_FUNCTION | LOGLEVEL_NONMEMBER_FUNCTION)
 
 #ifdef VERBOSE
-#define debugmsg(msg, loglevel) if ((loglevel) & ~LOGMASK) clog << (msg) << endl;
+#define debugmsg(msg, loglevel) if ((loglevel) & ~LOGMASK) std::clog << (msg) << endl;
 #else
 #define debugmsg(msg, loglevel)
 #endif // def VERBOSE
 #else
 #define debugmsg(msg, loglevel)
 #endif // def VERBOSE
index 474b9fd3e075a6d26180a874334d88522700b83e..2857cdc846ab4ff78010791905b4b1929c83bbfb 100644 (file)
@@ -135,7 +135,7 @@ ex::ex(double const d)
     construct_from_double(d);
 }
 
     construct_from_double(d);
 }
 
-ex::ex(const string &s, const ex &l)
+ex::ex(const std::string &s, const ex &l)
 {
     debugmsg("ex constructor from string,lst",LOGLEVEL_CONSTRUCT);
     construct_from_string_and_lst(s, l);
 {
     debugmsg("ex constructor from string,lst",LOGLEVEL_CONSTRUCT);
     construct_from_string_and_lst(s, l);
@@ -177,14 +177,14 @@ void ex::swap(ex & other)
 }
 
 /** Output formatted to be useful as ginsh input. */
 }
 
 /** Output formatted to be useful as ginsh input. */
-void ex::print(ostream & os, unsigned upper_precedence) const
+void ex::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("ex print",LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
     bp->print(os,upper_precedence);
 }
 
 {
     debugmsg("ex print",LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
     bp->print(os,upper_precedence);
 }
 
-void ex::printraw(ostream & os) const
+void ex::printraw(std::ostream & os) const
 {
     debugmsg("ex printraw",LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
 {
     debugmsg("ex printraw",LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
@@ -193,7 +193,7 @@ void ex::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void ex::printtree(ostream & os, unsigned indent) const
+void ex::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("ex printtree",LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
 {
     debugmsg("ex printtree",LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
@@ -208,7 +208,7 @@ void ex::printtree(ostream & os, unsigned indent) const
  *  @param os output stream
  *  @param type variable type (one of the csrc_types)
  *  @param var_name variable name to be printed */
  *  @param os output stream
  *  @param type variable type (one of the csrc_types)
  *  @param var_name variable name to be printed */
-void ex::printcsrc(ostream & os, unsigned type, const char *var_name) const
+void ex::printcsrc(std::ostream & os, unsigned type, const char *var_name) const
 {
     debugmsg("ex print csrc", LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
 {
     debugmsg("ex print csrc", LOGLEVEL_PRINT);
     GINAC_ASSERT(bp!=0);
@@ -410,10 +410,10 @@ bool ex::is_equal(const ex & other) const
 {
     GINAC_ASSERT(bp!=0);
     GINAC_ASSERT(other.bp!=0);
 {
     GINAC_ASSERT(bp!=0);
     GINAC_ASSERT(other.bp!=0);
-    if (bp==other.bp) {
-        // special case: both expression point to same basic, trivially equal
-        return true; 
-    }
+    // if both expression point to same basic they are trivially equal
+    if (bp==other.bp)
+        return true;
+    
     return bp->is_equal(*other.bp);
 }
 #endif // ndef INLINE_EX_CONSTRUCTORS
     return bp->is_equal(*other.bp);
 }
 #endif // ndef INLINE_EX_CONSTRUCTORS
@@ -634,7 +634,7 @@ void ex::construct_from_double(double d)
     GINAC_ASSERT(bp->refcount=1);
 }
 
     GINAC_ASSERT(bp->refcount=1);
 }
 
-void ex::construct_from_string_and_lst(const string &s, const ex &l)
+void ex::construct_from_string_and_lst(const std::string &s, const ex &l)
 {
     set_lexer_string(s);
     set_lexer_symbols(l);
 {
     set_lexer_string(s);
     set_lexer_symbols(l);
index c7e1da8cb538d097faf31e55292d76d177f7db02..05f31573929d94b40f37c8580032123268b25118 100644 (file)
@@ -200,7 +200,7 @@ public:
      *  similar to the GiNaC output format. All symbols to be used in the
      *  expression must be specified in a lst in the second argument. Undefined
      *  symbols and other parser errors will throw an exception. */
      *  similar to the GiNaC output format. All symbols to be used in the
      *  expression must be specified in a lst in the second argument. Undefined
      *  symbols and other parser errors will throw an exception. */
-    ex(const string &s, const ex &l)
+    ex(const std::string &s, const ex &l)
 #ifdef INLINE_EX_CONSTRUCTORS
         {
             construct_from_string_and_lst(s, l);
 #ifdef INLINE_EX_CONSTRUCTORS
         {
             construct_from_string_and_lst(s, l);
@@ -222,10 +222,10 @@ public:
     // non-virtual functions in this class
 public:
     void swap(ex & other);
     // non-virtual functions in this class
 public:
     void swap(ex & other);
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent=0) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printcsrc(ostream & os, unsigned type, const char *var_name) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent=0) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printcsrc(std::ostream & os, unsigned type, const char *var_name) const;
     void dbgprint(void) const;
     void dbgprinttree(void) const;
     bool info(unsigned inf) const;
     void dbgprint(void) const;
     void dbgprinttree(void) const;
     bool info(unsigned inf) const;
@@ -252,7 +252,7 @@ public:
     ex eval(int level = 0) const;
     ex evalf(int level = 0) const;
     ex diff(const symbol & s, unsigned nth = 1) const;
     ex eval(int level = 0) const;
     ex evalf(int level = 0) const;
     ex diff(const symbol & s, unsigned nth = 1) const;
-    ex series(const ex & r, int order) const;
+    ex series(const ex & r, int order, bool branchcut = true) const;
     ex subs(const lst & ls, const lst & lr) const;
     ex subs(const ex & e) const;
     exvector get_indices(void) const;
     ex subs(const lst & ls, const lst & lr) const;
     ex subs(const ex & e) const;
     exvector get_indices(void) const;
@@ -307,7 +307,7 @@ private:
     void construct_from_long(long i);
     void construct_from_ulong(unsigned long i);
     void construct_from_double(double d);
     void construct_from_long(long i);
     void construct_from_ulong(unsigned long i);
     void construct_from_double(double d);
-    void construct_from_string_and_lst(const string &s, const ex &l);
+    void construct_from_string_and_lst(const std::string &s, const ex &l);
     void makewriteable();
 
 #ifdef OBSCURE_CINT_HACK
     void makewriteable();
 
 #ifdef OBSCURE_CINT_HACK
@@ -395,8 +395,8 @@ inline ex evalf(const ex & thisex, int level = 0)
 inline ex diff(const ex & thisex, const symbol & s, unsigned nth = 1)
 { return thisex.diff(s, nth); }
 
 inline ex diff(const ex & thisex, const symbol & s, unsigned nth = 1)
 { return thisex.diff(s, nth); }
 
-inline ex series(const ex & thisex, const ex & r, int order)
-{ return thisex.series(r, order); }
+inline ex series(const ex & thisex, const ex & r, int order, bool branchcut = true)
+{ return thisex.series(r, order, branchcut); }
 
 inline ex subs(const ex & thisex, const ex & e)
 { return thisex.subs(e); }
 
 inline ex subs(const ex & thisex, const ex & e)
 { return thisex.subs(e); }
index 68f062be3dd756d9ce9a3a7bd245db1d6381a67e..448e635b549f54bda9640d69ab306299c7d9de65 100644 (file)
@@ -168,7 +168,7 @@ public:
         return cmpval;
     }
 
         return cmpval;
     }
 
-    void printraw(ostream & os) const
+    void printraw(std::ostream & os) const
     {
         os << "expair(";
         rest.printraw(os);
     {
         os << "expair(";
         rest.printraw(os);
index bdfc2ff73f97f814bb4b1e87422a60f9645c67e5..4be6cdd6dce0ba575e3b88ace99c259304de034f 100644 (file)
@@ -209,7 +209,7 @@ basic * expairseq::duplicate() const
     return new expairseq(*this);
 }
 
     return new expairseq(*this);
 }
 
-void expairseq::print(ostream & os, unsigned upper_precedence) const
+void expairseq::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("expairseq print",LOGLEVEL_PRINT);
     os << "[[";
 {
     debugmsg("expairseq print",LOGLEVEL_PRINT);
     os << "[[";
@@ -217,7 +217,7 @@ void expairseq::print(ostream & os, unsigned upper_precedence) const
     os << "]]";
 }
 
     os << "]]";
 }
 
-void expairseq::printraw(ostream & os) const
+void expairseq::printraw(std::ostream & os) const
 {
     debugmsg("expairseq printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("expairseq printraw",LOGLEVEL_PRINT);
 
@@ -232,30 +232,31 @@ void expairseq::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void expairseq::printtree(ostream & os, unsigned indent) const
+void expairseq::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("expairseq printtree",LOGLEVEL_PRINT);
 
 {
     debugmsg("expairseq printtree",LOGLEVEL_PRINT);
 
-    os << string(indent,' ') << "type=" << typeid(*this).name()
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
+    os << std::string(indent,' ') << "type=" << typeid(*this).name()
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
        << ", flags=" << flags
        << ", flags=" << flags
-       << ", nops=" << nops() << endl;
+       << ", nops=" << nops() << std::endl;
     for (unsigned i=0; i<seq.size(); ++i) {
         seq[i].rest.printtree(os,indent+delta_indent);
         seq[i].coeff.printtree(os,indent+delta_indent);
         if (i!=seq.size()-1) {
     for (unsigned i=0; i<seq.size(); ++i) {
         seq[i].rest.printtree(os,indent+delta_indent);
         seq[i].coeff.printtree(os,indent+delta_indent);
         if (i!=seq.size()-1) {
-            os << string(indent+delta_indent,' ') << "-----" << endl;
+            os << std::string(indent+delta_indent,' ') << "-----" << std::endl;
         }
     }
     if (!overall_coeff.is_equal(default_overall_coeff())) {
         }
     }
     if (!overall_coeff.is_equal(default_overall_coeff())) {
-        os << string(indent+delta_indent,' ') << "-----" << endl;
-        os << string(indent+delta_indent,' ') << "overall_coeff" << endl;
+        os << std::string(indent+delta_indent,' ') << "-----" << std::endl;
+        os << std::string(indent+delta_indent,' ') << "overall_coeff" << std::endl;
         overall_coeff.printtree(os,indent+delta_indent);
     }
         overall_coeff.printtree(os,indent+delta_indent);
     }
-    os << string(indent+delta_indent,' ') << "=====" << endl;
+    os << std::string(indent+delta_indent,' ') << "=====" << std::endl;
 #ifdef EXPAIRSEQ_USE_HASHTAB
 #ifdef EXPAIRSEQ_USE_HASHTAB
-    os << string(indent+delta_indent,' ')
-       << "hashtab size " << hashtabsize << endl;
+    os << std::string(indent+delta_indent,' ')
+       << "hashtab size " << hashtabsize << std::endl;
     if (hashtabsize==0) return;
 #define MAXCOUNT 5
     unsigned count[MAXCOUNT+1];
     if (hashtabsize==0) return;
 #define MAXCOUNT 5
     unsigned count[MAXCOUNT+1];
@@ -266,14 +267,14 @@ void expairseq::printtree(ostream & os, unsigned indent) const
     for (unsigned i=0; i<hashtabsize; ++i) {
         this_bin_fill=0;
         if (hashtab[i].size()>0) {
     for (unsigned i=0; i<hashtabsize; ++i) {
         this_bin_fill=0;
         if (hashtab[i].size()>0) {
-            os << string(indent+delta_indent,' ') 
+            os << std::string(indent+delta_indent,' ') 
                << "bin " << i << " with entries ";
             for (epplist::const_iterator it=hashtab[i].begin();
                  it!=hashtab[i].end(); ++it) {
                 os << *it-seq.begin() << " ";
                 this_bin_fill++;
             }
                << "bin " << i << " with entries ";
             for (epplist::const_iterator it=hashtab[i].begin();
                  it!=hashtab[i].end(); ++it) {
                 os << *it-seq.begin() << " ";
                 this_bin_fill++;
             }
-            os << endl;
+            os << std::endl;
             cum_fill += this_bin_fill;
             cum_fill_sq += this_bin_fill*this_bin_fill;
         }
             cum_fill += this_bin_fill;
             cum_fill_sq += this_bin_fill*this_bin_fill;
         }
@@ -290,20 +291,20 @@ void expairseq::printtree(ostream & os, unsigned indent) const
         if (k>0) fact *= k;
         double prob = pow(lambda,k)/fact*exp(-lambda);
         cum_prob += prob;
         if (k>0) fact *= k;
         double prob = pow(lambda,k)/fact*exp(-lambda);
         cum_prob += prob;
-        os << string(indent+delta_indent,' ') << "bins with " << k << " entries: "
+        os << std::string(indent+delta_indent,' ') << "bins with " << k << " entries: "
            << int(1000.0*count[k]/hashtabsize)/10.0 << "% (expected: "
            << int(1000.0*count[k]/hashtabsize)/10.0 << "% (expected: "
-           << int(prob*1000)/10.0 << ")" << endl;
+           << int(prob*1000)/10.0 << ")" << std::endl;
     }
     }
-    os << string(indent+delta_indent,' ') << "bins with more entries: "
+    os << std::string(indent+delta_indent,' ') << "bins with more entries: "
        << int(1000.0*count[MAXCOUNT]/hashtabsize)/10.0 << "% (expected: "
        << int(1000.0*count[MAXCOUNT]/hashtabsize)/10.0 << "% (expected: "
-       << int((1-cum_prob)*1000)/10.0 << ")" << endl;
+       << int((1-cum_prob)*1000)/10.0 << ")" << std::endl;
     
     
-    os << string(indent+delta_indent,' ') << "variance: "
+    os << std::string(indent+delta_indent,' ') << "variance: "
        << 1.0/hashtabsize*cum_fill_sq-(1.0/hashtabsize*cum_fill)*(1.0/hashtabsize*cum_fill)
        << 1.0/hashtabsize*cum_fill_sq-(1.0/hashtabsize*cum_fill)*(1.0/hashtabsize*cum_fill)
-       << endl;
-    os << string(indent+delta_indent,' ') << "average fill: "
+       << std::endl;
+    os << std::string(indent+delta_indent,' ') << "average fill: "
        << (1.0*cum_fill)/hashtabsize
        << (1.0*cum_fill)/hashtabsize
-       << " (should be equal to " << (1.0*seq.size())/hashtabsize << ")" << endl;
+       << " (should be equal to " << (1.0*seq.size())/hashtabsize << ")" << std::endl;
 #endif // def EXPAIRSEQ_USE_HASHTAB
 }
 
 #endif // def EXPAIRSEQ_USE_HASHTAB
 }
 
@@ -461,9 +462,9 @@ bool expairseq::is_equal_same_type(const basic & other) const
 #ifdef EXPAIRSEQ_USE_HASHTAB
     // compare number of elements in each hashtab entry
     if (hashtabsize!=o.hashtabsize) {
 #ifdef EXPAIRSEQ_USE_HASHTAB
     // compare number of elements in each hashtab entry
     if (hashtabsize!=o.hashtabsize) {
-        cout << "this:" << endl;
+        cout << "this:" << std::endl;
         printtree(cout,0);
         printtree(cout,0);
-        cout << "other:" << endl;
+        cout << "other:" << std::endl;
         other.printtree(cout,0);
     }
         
         other.printtree(cout,0);
     }
         
@@ -562,7 +563,7 @@ ex expairseq::thisexpairseq(epvector * vp, const ex & oc) const
     return expairseq(vp,oc);
 }
 
     return expairseq(vp,oc);
 }
 
-void expairseq::printpair(ostream & os, const expair & p, unsigned upper_precedence) const
+void expairseq::printpair(std::ostream & os, const expair & p, unsigned upper_precedence) const
 {
     os << "[[";
     p.rest.bp->print(os,precedence);
 {
     os << "[[";
     p.rest.bp->print(os,precedence);
@@ -571,7 +572,8 @@ void expairseq::printpair(ostream & os, const expair & p, unsigned upper_precede
     os << "]]";
 }
 
     os << "]]";
 }
 
-void expairseq::printseq(ostream & os, char delim, unsigned this_precedence,
+void expairseq::printseq(std::ostream & os, char delim,
+                         unsigned this_precedence,
                          unsigned upper_precedence) const
 {
     if (this_precedence<=upper_precedence) os << "(";
                          unsigned upper_precedence) const
 {
     if (this_precedence<=upper_precedence) os << "(";
@@ -904,8 +906,6 @@ void expairseq::construct_from_epvector(const epvector & v)
 #endif // def EXPAIRSEQ_USE_HASHTAB
 }
 
 #endif // def EXPAIRSEQ_USE_HASHTAB
 }
 
-#include <iostream>
-
 void expairseq::make_flat(const exvector & v)
 {
     exvector::const_iterator cit, citend = v.end();
 void expairseq::make_flat(const exvector & v)
 {
     exvector::const_iterator cit, citend = v.end();
@@ -948,11 +948,11 @@ void expairseq::make_flat(const exvector & v)
     }
 
     /*
     }
 
     /*
-    cout << "after make flat" << endl;
+    cout << "after make flat" << std::endl;
     for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printraw(cout);
     }
     for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printraw(cout);
     }
-    cout << endl;
+    cout << std::endl;
     */
 }
 
     */
 }
 
@@ -1110,11 +1110,11 @@ void expairseq::canonicalize(void)
     */
 
     /*
     */
 
     /*
-    cout << "after canonicalize" << endl;
+    cout << "after canonicalize" << std::endl;
     for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printraw(cout);
     }
     for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printraw(cout);
     }
-    cout << endl;
+    cout << std::endl;
     cout.flush();
     */
 }
     cout.flush();
     */
 }
@@ -1163,11 +1163,11 @@ void expairseq::combine_same_terms_sorted_seq(void)
     }
 
     /*
     }
 
     /*
-    cout << "after combine" << endl;
+    cout << "after combine" << std::endl;
     for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printraw(cout);
     }
     for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
         (*cit).printraw(cout);
     }
-    cout << endl;
+    cout << std::endl;
     cout.flush();
     */
     
     cout.flush();
     */
     
@@ -1258,8 +1258,8 @@ void expairseq::remove_hashtab_entry(epvector::const_iterator element)
     }
     if (!erased) {
         printtree(cout,0);
     }
     if (!erased) {
         printtree(cout,0);
-        cout << "tried to erase " << element-seq.begin() << endl;
-        cout << "size " << seq.end()-seq.begin() << endl;
+        cout << "tried to erase " << element-seq.begin() << std::endl;
+        cout << "size " << seq.end()-seq.begin() << std::endl;
 
         unsigned hashindex=calc_hashindex((*element).rest);
         epplist & eppl=hashtab[hashindex];
 
         unsigned hashindex=calc_hashindex((*element).rest);
         epplist & eppl=hashtab[hashindex];
@@ -1463,15 +1463,15 @@ void expairseq::combine_same_terms(void)
     GINAC_ASSERT(!has_coeff_0());
     build_hashtab_and_combine(first_numeric,last_non_zero,touched,number_of_zeroes);
     /*
     GINAC_ASSERT(!has_coeff_0());
     build_hashtab_and_combine(first_numeric,last_non_zero,touched,number_of_zeroes);
     /*
-    cout << "in combine:" << endl;
+    cout << "in combine:" << std::endl;
     printtree(cout,0);
     printtree(cout,0);
-    cout << "size=" << seq.end() - seq.begin() << endl;
-    cout << "first_numeric=" << first_numeric - seq.begin() << endl;
-    cout << "last_non_zero=" << last_non_zero - seq.begin() << endl;
+    cout << "size=" << seq.end() - seq.begin() << std::endl;
+    cout << "first_numeric=" << first_numeric - seq.begin() << std::endl;
+    cout << "last_non_zero=" << last_non_zero - seq.begin() << std::endl;
     for (unsigned i=0; i<seq.size(); ++i) {
     for (unsigned i=0; i<seq.size(); ++i) {
-        if (touched[i]) cout << i << " is touched" << endl;
+        if (touched[i]) cout << i << " is touched" << std::endl;
     }
     }
-    cout << "end in combine" << endl;
+    cout << "end in combine" << std::endl;
     */
     
     // there should not be any terms with coeff 0 from the beginning,
     */
     
     // there should not be any terms with coeff 0 from the beginning,
@@ -1479,15 +1479,15 @@ void expairseq::combine_same_terms(void)
     if (number_of_zeroes!=0) {
         drop_coeff_0_terms(first_numeric,last_non_zero,touched,number_of_zeroes);
         /*
     if (number_of_zeroes!=0) {
         drop_coeff_0_terms(first_numeric,last_non_zero,touched,number_of_zeroes);
         /*
-        cout << "in combine after drop:" << endl;
+        cout << "in combine after drop:" << std::endl;
         printtree(cout,0);
         printtree(cout,0);
-        cout << "size=" << seq.end() - seq.begin() << endl;
-        cout << "first_numeric=" << first_numeric - seq.begin() << endl;
-        cout << "last_non_zero=" << last_non_zero - seq.begin() << endl;
+        cout << "size=" << seq.end() - seq.begin() << std::endl;
+        cout << "first_numeric=" << first_numeric - seq.begin() << std::endl;
+        cout << "last_non_zero=" << last_non_zero - seq.begin() << std::endl;
         for (unsigned i=0; i<seq.size(); ++i) {
         for (unsigned i=0; i<seq.size(); ++i) {
-            if (touched[i]) cout << i << " is touched" << endl;
+            if (touched[i]) cout << i << " is touched" << std::endl;
         }
         }
-        cout << "end in combine after drop" << endl;
+        cout << "end in combine after drop" << std::endl;
         */
     }
 
         */
     }
 
@@ -1529,10 +1529,10 @@ bool expairseq::is_canonical() const
                     cout << ">";
                     printpair(cout,*it,0);
                     cout << "\n";
                     cout << ">";
                     printpair(cout,*it,0);
                     cout << "\n";
-                    cout << "pair1:" << endl;
+                    cout << "pair1:" << std::endl;
                     (*it_last).rest.printtree(cout);
                     (*it_last).coeff.printtree(cout);
                     (*it_last).rest.printtree(cout);
                     (*it_last).coeff.printtree(cout);
-                    cout << "pair2:" << endl;
+                    cout << "pair2:" << std::endl;
                     (*it).rest.printtree(cout);
                     (*it).coeff.printtree(cout);
                     return 0;
                     (*it).rest.printtree(cout);
                     (*it).coeff.printtree(cout);
                     return 0;
index 6284ce28bee1459834e8cb29e9c53abe120687ab..7f467dc2293ddc1e517a019cc1e73382573d759d 100644 (file)
@@ -27,7 +27,7 @@
 #include <list>
 
 // CINT needs <algorithm> to work properly with <vector> and <list>
 #include <list>
 
 // CINT needs <algorithm> to work properly with <vector> and <list>
-//#include <algorithm>
+#include <algorithm>
 
 #include "expair.h"
 
 
 #include "expair.h"
 
@@ -37,7 +37,7 @@ namespace GiNaC {
 
 //#define EXPAIRSEQ_USE_HASHTAB
 
 
 //#define EXPAIRSEQ_USE_HASHTAB
 
-typedef vector<expair> epvector;
+typedef std::vector<expair> epvector;
 typedef epvector::iterator epviter;
 
 inline void iter_swap(epvector::iterator it1, epvector::iterator it2)
 typedef epvector::iterator epviter;
 
 inline void iter_swap(epvector::iterator it1, epvector::iterator it2)
@@ -47,8 +47,8 @@ inline void iter_swap(epvector::iterator it1, epvector::iterator it2)
 }
 
 typedef epvector::iterator epp;
 }
 
 typedef epvector::iterator epp;
-typedef list<epp> epplist;
-typedef vector<epplist> epplistvector;
+typedef std::list<epp> epplist;
+typedef std::vector<epplist> epplistvector;
 
 /** A sequence of class expair.
  *  This is used for time-critical classes like sums and products of terms
 
 /** A sequence of class expair.
  *  This is used for time-critical classes like sums and products of terms
@@ -92,9 +92,9 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex op(int i) const;
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex op(int i) const;
@@ -116,9 +116,10 @@ protected:
 protected:
     virtual ex thisexpairseq(const epvector & v, const ex & oc) const;
     virtual ex thisexpairseq(epvector * vp, const ex & oc) const;
 protected:
     virtual ex thisexpairseq(const epvector & v, const ex & oc) const;
     virtual ex thisexpairseq(epvector * vp, const ex & oc) const;
-    virtual void printseq(ostream & os, char delim, unsigned this_precedence,
+    virtual void printseq(std::ostream & os, char delim,
+                          unsigned this_precedence,
                           unsigned upper_precedence) const;
                           unsigned upper_precedence) const;
-    virtual void printpair(ostream & os, const expair & p,
+    virtual void printpair(std::ostream & os, const expair & p,
                            unsigned upper_precedence) const;
     virtual expair split_ex_to_pair(const ex & e) const;
     virtual expair combine_ex_with_coeff_to_pair(const ex & e,
                            unsigned upper_precedence) const;
     virtual expair split_ex_to_pair(const ex & e) const;
     virtual expair combine_ex_with_coeff_to_pair(const ex & e,
index d35c2f43e7b81a0ed646545b9842840f2363a4d0..c41ea41dd4211371e9dd1808c82b23efa9b3b4bf 100644 (file)
@@ -117,13 +117,13 @@ basic * fail::duplicate() const
     return new fail(*this);
 }
 
     return new fail(*this);
 }
 
-void fail::print(ostream & os, unsigned upper_precedence) const
+void fail::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("fail print",LOGLEVEL_PRINT);
     os << "FAIL";
 }
 
 {
     debugmsg("fail print",LOGLEVEL_PRINT);
     os << "FAIL";
 }
 
-void fail::printraw(ostream & os) const
+void fail::printraw(std::ostream & os) const
 {
     debugmsg("fail printraw",LOGLEVEL_PRINT);
     os << "FAIL";
 {
     debugmsg("fail printraw",LOGLEVEL_PRINT);
     os << "FAIL";
index 9d87d1bcafa381b6c0001a59aefec0764cc27145..41c546d88a13b5ab79d6fdae05dac9593aa43693 100644 (file)
@@ -50,8 +50,8 @@ protected:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
 protected:
     int compare_same_type(const basic & other) const;
     unsigned return_type(void) const { return return_types::noncommutative_composite; };
 protected:
     int compare_same_type(const basic & other) const;
     unsigned return_type(void) const { return return_types::noncommutative_composite; };
index 36b7c7b7f034c371b786809f559de594200be215..a69f58fe9c19f99ca4e3619d464e4ba4ef798d5f 100755 (executable)
@@ -95,7 +95,7 @@ $typedef_derivative_funcp=generate(
 'const ex &','');
 
 $typedef_series_funcp=generate(
 'const ex &','');
 
 $typedef_series_funcp=generate(
-'typedef ex (* series_funcp_${N})(${SEQ1}, const relational &, int);'."\n",
+'typedef ex (* series_funcp_${N})(${SEQ1}, const relational &, int, bool);'."\n",
 'const ex &','');
 
 $eval_func_interface=generate('    function_options & eval_func(eval_funcp_${N} e);'."\n",'','');
 'const ex &','');
 
 $eval_func_interface=generate('    function_options & eval_func(eval_funcp_${N} e);'."\n",'','');
@@ -145,9 +145,9 @@ $series_switch_statement=generate(
     <<'END_OF_SERIES_SWITCH_STATEMENT','seq[${N}-1]','');
     case ${N}:
         try {
     <<'END_OF_SERIES_SWITCH_STATEMENT','seq[${N}-1]','');
     case ${N}:
         try {
-            res = ((series_funcp_${N})(registered_functions()[serial].series_f))(${SEQ1},r,order);
+            res = ((series_funcp_${N})(registered_functions()[serial].series_f))(${SEQ1},r,order,branchcut);
         } catch (do_taylor) {
         } catch (do_taylor) {
-            res = basic::series(r, order);
+            res = basic::series(r, order, branchcut);
         }
         return res;
         break;
         }
         return res;
         break;
@@ -226,10 +226,8 @@ $interface=<<END_OF_INTERFACE;
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
 
-#ifdef __CINT__
 // CINT needs <algorithm> to work properly with <vector> 
 #include <algorithm>
 // CINT needs <algorithm> to work properly with <vector> 
 #include <algorithm>
-#endif // def __CINT__
 
 #include "exprseq.h"
 
 
 #include "exprseq.h"
 
@@ -330,10 +328,10 @@ class function_options
     friend class function;
 public:
     function_options();
     friend class function;
 public:
     function_options();
-    function_options(string const & n, string const & tn=string());
+    function_options(std::string const & n, std::string const & tn=std::string());
     ~function_options();
     void initialize(void);
     ~function_options();
     void initialize(void);
-    function_options & set_name(string const & n, string const & tn=string());
+    function_options & set_name(std::string const & n, std::string const & tn=std::string());
 // the following lines have been generated for max. ${maxargs} parameters
 $eval_func_interface
 $evalf_func_interface
 // the following lines have been generated for max. ${maxargs} parameters
 $eval_func_interface
 $evalf_func_interface
@@ -346,12 +344,12 @@ $series_func_interface
                                 unsigned strategy=remember_strategies::delete_never);
     function_options & overloaded(unsigned o);
     void test_and_set_nparams(unsigned n);
                                 unsigned strategy=remember_strategies::delete_never);
     function_options & overloaded(unsigned o);
     void test_and_set_nparams(unsigned n);
-    string get_name(void) const { return name; }
+    std::string get_name(void) const { return name; }
     unsigned get_nparams(void) const { return nparams; }
 
 protected:
     unsigned get_nparams(void) const { return nparams; }
 
 protected:
-    string name;
-    string TeX_name;
+    std::string name;
+    std::string TeX_name;
 
     unsigned nparams;
 
 
     unsigned nparams;
 
@@ -414,14 +412,14 @@ $constructors_interface
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const; 
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const; 
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     ex expand(unsigned options=0) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
     ex expand(unsigned options=0) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
-    ex series(const relational & r, int order) const;
+    ex series(const relational & r, int order, bool branchcut = true) const;
     ex thisexprseq(const exvector & v) const;
     ex thisexprseq(exvector * vp) const;
 protected:
     ex thisexprseq(const exvector & v) const;
     ex thisexprseq(exvector * vp) const;
 protected:
@@ -437,12 +435,12 @@ protected:
     // non-virtual functions in this class
 protected:
     ex pderivative(unsigned diff_param) const; // partial differentiation
     // non-virtual functions in this class
 protected:
     ex pderivative(unsigned diff_param) const; // partial differentiation
-    static vector<function_options> & registered_functions(void);
+    static std::vector<function_options> & registered_functions(void);
     bool lookup_remember_table(ex & result) const;
     void store_remember_table(ex const & result) const;
 public:
     static unsigned register_new(function_options const & opt);
     bool lookup_remember_table(ex & result) const;
     void store_remember_table(ex const & result) const;
 public:
     static unsigned register_new(function_options const & opt);
-    static unsigned find_function(const string &name, unsigned nparams);
+    static unsigned find_function(const std::string &name, unsigned nparams);
     unsigned getserial(void) const {return serial;}
     
 // member variables
     unsigned getserial(void) const {return serial;}
     
 // member variables
@@ -535,7 +533,7 @@ function_options::function_options()
     initialize();
 }
 
     initialize();
 }
 
-function_options::function_options(string const & n, string const & tn)
+function_options::function_options(std::string const & n, std::string const & tn)
 {
     initialize();
     set_name(n,tn);
 {
     initialize();
     set_name(n,tn);
@@ -557,11 +555,11 @@ void function_options::initialize(void)
     functions_with_same_name=1;
 }
 
     functions_with_same_name=1;
 }
 
-function_options & function_options::set_name(string const & n,
-                                              string const & tn)
+function_options & function_options::set_name(std::string const & n,
+                                              std::string const & tn)
 {
     name=n;
 {
     name=n;
-    if (tn==string()) {
+    if (tn==std::string()) {
         TeX_name="\\\\operatorname{"+name+"}";
     } else {
         TeX_name=tn;
         TeX_name="\\\\operatorname{"+name+"}";
     } else {
         TeX_name=tn;
@@ -615,9 +613,9 @@ void function_options::test_and_set_nparams(unsigned n)
         // we do not throw an exception here because this code is
         // usually executed before main(), so the exception could not
         // caught anyhow
         // we do not throw an exception here because this code is
         // usually executed before main(), so the exception could not
         // caught anyhow
-        cerr << "WARNING: number of parameters ("
-             << n << ") differs from number set before (" 
-             << nparams << ")" << endl;
+        std::cerr << "WARNING: number of parameters ("
+                  << n << ") differs from number set before (" 
+                  << nparams << ")" << std::endl;
     }
 }
 
     }
 }
 
@@ -716,10 +714,10 @@ function::function(const archive_node &n, const lst &sym_lst) : inherited(n, sym
     debugmsg("function constructor from archive_node", LOGLEVEL_CONSTRUCT);
 
     // Find serial number by function name
     debugmsg("function constructor from archive_node", LOGLEVEL_CONSTRUCT);
 
     // Find serial number by function name
-    string s;
+    std::string s;
     if (n.find_string("name", s)) {
         unsigned int ser = 0;
     if (n.find_string("name", s)) {
         unsigned int ser = 0;
-        vector<function_options>::const_iterator i = registered_functions().begin(), iend = registered_functions().end();
+        std::vector<function_options>::const_iterator i = registered_functions().begin(), iend = registered_functions().end();
         while (i != iend) {
             if (s == i->name) {
                 serial = ser;
         while (i != iend) {
             if (s == i->name) {
                 serial = ser;
@@ -758,7 +756,7 @@ basic * function::duplicate() const
     return new function(*this);
 }
 
     return new function(*this);
 }
 
-void function::printraw(ostream & os) const
+void function::printraw(std::ostream & os) const
 {
     debugmsg("function printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("function printraw",LOGLEVEL_PRINT);
 
@@ -772,7 +770,7 @@ void function::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void function::print(ostream & os, unsigned upper_precedence) const
+void function::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("function print",LOGLEVEL_PRINT);
 
 {
     debugmsg("function print",LOGLEVEL_PRINT);
 
@@ -782,31 +780,32 @@ void function::print(ostream & os, unsigned upper_precedence) const
     printseq(os,'(',',',')',exprseq::precedence,function::precedence);
 }
 
     printseq(os,'(',',',')',exprseq::precedence,function::precedence);
 }
 
-void function::printtree(ostream & os, unsigned indent) const
+void function::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("function printtree",LOGLEVEL_PRINT);
 
     GINAC_ASSERT(serial<registered_functions().size());
 
 {
     debugmsg("function printtree",LOGLEVEL_PRINT);
 
     GINAC_ASSERT(serial<registered_functions().size());
 
-    os << string(indent,' ') << "function "
+    os << std::string(indent,' ') << "function "
        << registered_functions()[serial].name
        << registered_functions()[serial].name
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
+       << ", hash=" << hashvalue 
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
        << ", flags=" << flags
        << ", flags=" << flags
-       << ", nops=" << nops() << endl;
+       << ", nops=" << nops() << std::endl;
     for (unsigned i=0; i<nops(); ++i) {
         seq[i].printtree(os,indent+delta_indent);
     }
     for (unsigned i=0; i<nops(); ++i) {
         seq[i].printtree(os,indent+delta_indent);
     }
-    os << string(indent+delta_indent,' ') << "=====" << endl;
+    os << std::string(indent+delta_indent,' ') << "=====" << std::endl;
 }
 
 }
 
-void function::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void function::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("function print csrc",LOGLEVEL_PRINT);
 
     GINAC_ASSERT(serial<registered_functions().size());
 
        // Print function name in lowercase
 {
     debugmsg("function print csrc",LOGLEVEL_PRINT);
 
     GINAC_ASSERT(serial<registered_functions().size());
 
        // Print function name in lowercase
-    string lname;
+    std::string lname;
     lname=registered_functions()[serial].name;
     for (unsigned i=0; i<lname.size(); i++)
         lname[i] = tolower(lname[i]);
     lname=registered_functions()[serial].name;
     for (unsigned i=0; i<lname.size(); i++)
         lname[i] = tolower(lname[i]);
@@ -890,7 +889,7 @@ ex function::thisexprseq(exvector * vp) const
 
 /** Implementation of ex::series for functions.
  *  \@see ex::series */
 
 /** Implementation of ex::series for functions.
  *  \@see ex::series */
-ex function::series(const relational & r, int order) const
+ex function::series(const relational & r, int order, bool branchcut = true) const
 {
     GINAC_ASSERT(serial<registered_functions().size());
 
 {
     GINAC_ASSERT(serial<registered_functions().size());
 
@@ -1014,9 +1013,9 @@ ${diff_switch_statement}
     throw(std::logic_error("function::pderivative(): no diff function defined"));
 }
 
     throw(std::logic_error("function::pderivative(): no diff function defined"));
 }
 
-vector<function_options> & function::registered_functions(void)
+std::vector<function_options> & function::registered_functions(void)
 {
 {
-    static vector<function_options> * rf=new vector<function_options>;
+    static std::vector<function_options> * rf = new std::vector<function_options>;
     return *rf;
 }
 
     return *rf;
 }
 
@@ -1044,8 +1043,8 @@ unsigned function::register_new(function_options const & opt)
         // we do not throw an exception here because this code is
         // usually executed before main(), so the exception could not
         // caught anyhow
         // we do not throw an exception here because this code is
         // usually executed before main(), so the exception could not
         // caught anyhow
-        cerr << "WARNING: function name " << opt.name
-             << " already in use!" << endl;
+        std::cerr << "WARNING: function name " << opt.name
+                  << " already in use!" << std::endl;
     }
     registered_functions().push_back(opt);
     if (opt.use_remember) {
     }
     registered_functions().push_back(opt);
     if (opt.use_remember) {
@@ -1061,9 +1060,9 @@ unsigned function::register_new(function_options const & opt)
 
 /** Find serial number of function by name and number of parameters.
  *  Throws exception if function was not found. */
 
 /** Find serial number of function by name and number of parameters.
  *  Throws exception if function was not found. */
-unsigned function::find_function(const string &name, unsigned nparams)
+unsigned function::find_function(const std::string &name, unsigned nparams)
 {
 {
-    vector<function_options>::const_iterator i = function::registered_functions().begin(), end = function::registered_functions().end();
+    std::vector<function_options>::const_iterator i = function::registered_functions().begin(), end = function::registered_functions().end();
     unsigned serial = 0;
     while (i != end) {
         if (i->get_name() == name && i->get_nparams() == nparams)
     unsigned serial = 0;
     while (i != end) {
         if (i->get_name() == name && i->get_nparams() == nparams)
index e0b5ad05dc4d1b5e5eaf2d6e2a2aa23d9e65f3e3..ff493c6e694b667d07604c82624a3db94da1513c 100644 (file)
@@ -97,29 +97,29 @@ void idx::destroy(bool call_parent)
 idx::idx(bool cov) : inherited(TINFO_idx), symbolic(true), covariant(cov)
 {
     debugmsg("idx constructor from bool",LOGLEVEL_CONSTRUCT);
 idx::idx(bool cov) : inherited(TINFO_idx), symbolic(true), covariant(cov)
 {
     debugmsg("idx constructor from bool",LOGLEVEL_CONSTRUCT);
-    serial=next_serial++;
-    name="index"+ToString(serial);
+    serial = next_serial++;
+    name = "index"+ToString(serial);
 }
 
 }
 
-idx::idx(const string & n, bool cov) : inherited(TINFO_idx),  
+idx::idx(const std::string & n, bool cov) : inherited(TINFO_idx),  
     symbolic(true), name(n), covariant(cov)
 {
     debugmsg("idx constructor from string,bool",LOGLEVEL_CONSTRUCT);
     symbolic(true), name(n), covariant(cov)
 {
     debugmsg("idx constructor from string,bool",LOGLEVEL_CONSTRUCT);
-    serial=next_serial++;
+    serial = next_serial++;
 }
 
 idx::idx(const char * n, bool cov) : inherited(TINFO_idx),  
     symbolic(true), name(n), covariant(cov)
 {
     debugmsg("idx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
 }
 
 idx::idx(const char * n, bool cov) : inherited(TINFO_idx),  
     symbolic(true), name(n), covariant(cov)
 {
     debugmsg("idx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
-    serial=next_serial++;
+    serial = next_serial++;
 }
 
 idx::idx(unsigned v, bool cov) : inherited(TINFO_idx),
     symbolic(false), value(v), covariant(cov)
 {
     debugmsg("idx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
 }
 
 idx::idx(unsigned v, bool cov) : inherited(TINFO_idx),
     symbolic(false), value(v), covariant(cov)
 {
     debugmsg("idx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
-    serial=0;
+    serial = 0;
 }
 
 //////////
 }
 
 //////////
@@ -181,7 +181,7 @@ basic * idx::duplicate() const
     return new idx(*this);
 }
 
     return new idx(*this);
 }
 
-void idx::printraw(ostream & os) const
+void idx::printraw(std::ostream & os) const
 {
     debugmsg("idx printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("idx printraw",LOGLEVEL_PRINT);
 
@@ -204,11 +204,11 @@ void idx::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void idx::printtree(ostream & os, unsigned indent) const
+void idx::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("idx printtree",LOGLEVEL_PRINT);
 
 {
     debugmsg("idx printtree",LOGLEVEL_PRINT);
 
-    os << string(indent,' ') << "idx: ";
+    os << std::string(indent,' ') << "idx: ";
 
     if (symbolic) {
         os << "symbolic,name=" << name;
 
     if (symbolic) {
         os << "symbolic,name=" << name;
@@ -223,11 +223,12 @@ void idx::printtree(ostream & os, unsigned indent) const
     }
 
     os << ", serial=" << serial
     }
 
     os << ", serial=" << serial
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void idx::print(ostream & os, unsigned upper_precedence) const
+void idx::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("idx print",LOGLEVEL_PRINT);
 
 {
     debugmsg("idx print",LOGLEVEL_PRINT);
 
index 334b58cadb1ab1abe795a885f893765c00cc0314..f332f57484120cf0663882e27712e04d580249c8 100644 (file)
@@ -51,16 +51,16 @@ protected:
     // other constructors
 public:
     explicit idx(bool cov);
     // other constructors
 public:
     explicit idx(bool cov);
-    explicit idx(const string & n, bool cov=false);
+    explicit idx(const std::string & n, bool cov=false);
     explicit idx(const char * n, bool cov=false);
     explicit idx(unsigned v, bool cov=false); 
 
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     explicit idx(const char * n, bool cov=false);
     explicit idx(unsigned v, bool cov=false); 
 
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
 protected:
     int compare_same_type(const basic & other) const;
     bool info(unsigned inf) const;
 protected:
     int compare_same_type(const basic & other) const;
@@ -78,14 +78,14 @@ public:
     bool is_symbolic(void) const;
     unsigned get_value(void) const;
     bool is_covariant(void) const;
     bool is_symbolic(void) const;
     unsigned get_value(void) const;
     bool is_covariant(void) const;
-    void setname(const string & n) {name=n;}
-    string getname(void) const {return name;}
+    void setname(const std::string & n) {name=n;}
+    std::string getname(void) const {return name;}
 
     // member variables
 protected:
     unsigned serial;
     bool symbolic;
 
     // member variables
 protected:
     unsigned serial;
     bool symbolic;
-    string name;
+    std::string name;
     unsigned value;
     static unsigned next_serial;
     bool covariant; // x_mu, default is contravariant: x^mu
     unsigned value;
     static unsigned next_serial;
     bool covariant; // x_mu, default is contravariant: x^mu
@@ -104,8 +104,6 @@ inline const idx &ex_to_idx(const ex &e)
 
 // global functions
 
 
 // global functions
 
-// typedef vector<ex> exvector;
-
 int canonicalize_indices(exvector & iv, bool antisymmetric=false);
 exvector idx_intersect(const exvector & iv1, const exvector & iv2);
 ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2,
 int canonicalize_indices(exvector & iv, bool antisymmetric=false);
 exvector idx_intersect(const exvector & iv1, const exvector & iv2);
 ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2,
index 0f6726e543a633ed93bad6dcb3b8c550af6710ec..fb35d8c1819967e3b89228eb48b8763d175d258b 100644 (file)
@@ -166,7 +166,7 @@ basic * indexed::duplicate() const
     return new indexed(*this);
 }
 
     return new indexed(*this);
 }
 
-void indexed::printraw(ostream & os) const
+void indexed::printraw(std::ostream & os) const
 {
     debugmsg("indexed printraw",LOGLEVEL_PRINT);
     os << "indexed(indices=";
 {
     debugmsg("indexed printraw",LOGLEVEL_PRINT);
     os << "indexed(indices=";
@@ -174,22 +174,22 @@ void indexed::printraw(ostream & os) const
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void indexed::printtree(ostream & os, unsigned indent) const
+void indexed::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("indexed printtree",LOGLEVEL_PRINT);
 {
     debugmsg("indexed printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << "indexed: " << seq.size() << " indices";
-    os << ",hash=" << hashvalue << ",flags=" << flags << endl;
+    os << std::string(indent,' ') << "indexed: " << seq.size() << " indices";
+    os << ",hash=" << hashvalue << ",flags=" << flags << std::endl;
     printtreeindices(os,indent);
 }
 
     printtreeindices(os,indent);
 }
 
-void indexed::print(ostream & os, unsigned upper_precedence) const
+void indexed::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("indexed print",LOGLEVEL_PRINT);
     os << "UNNAMEDINDEX";
     printindices(os);
 }
 
 {
     debugmsg("indexed print",LOGLEVEL_PRINT);
     os << "UNNAMEDINDEX";
     printindices(os);
 }
 
-void indexed::printcsrc(ostream & os, unsigned type,
+void indexed::printcsrc(std::ostream & os, unsigned type,
                         unsigned upper_precedence) const
 {
     debugmsg("indexed print csrc",LOGLEVEL_PRINT);
                         unsigned upper_precedence) const
 {
     debugmsg("indexed print csrc",LOGLEVEL_PRINT);
@@ -272,7 +272,7 @@ ex indexed::thisexprseq(exvector * vp) const
 
 // protected
 
 
 // protected
 
-void indexed::printrawindices(ostream & os) const
+void indexed::printrawindices(std::ostream & os) const
 {
     if (seq.size()!=0) {
         for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
 {
     if (seq.size()!=0) {
         for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
@@ -282,18 +282,18 @@ void indexed::printrawindices(ostream & os) const
     }
 }
 
     }
 }
 
-void indexed::printtreeindices(ostream & os, unsigned indent) const
+void indexed::printtreeindices(std::ostream & os, unsigned indent) const
 {
     if (seq.size()!=0) {
         for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
 {
     if (seq.size()!=0) {
         for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
-            os << string(indent+delta_indent,' ');
+            os << std::string(indent+delta_indent,' ');
             (*cit).printraw(os);
             (*cit).printraw(os);
-            os << endl;
+            os << std::endl;
         }
     }
 }
 
         }
     }
 }
 
-void indexed::printindices(ostream & os) const
+void indexed::printindices(std::ostream & os) const
 {
     if (seq.size()!=0) {
         if (seq.size()>1) {
 {
     if (seq.size()!=0) {
         if (seq.size()>1) {
index 919fc18e81f3026119a10fdf1bd3810ede99ae22..aa0042b46e1c26b34797a6f8c4fc4e12724e0609 100644 (file)
@@ -59,10 +59,10 @@ public:
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const;
     bool info(unsigned inf) const;
     exvector get_indices(void) const;
 protected:
     bool info(unsigned inf) const;
     exvector get_indices(void) const;
 protected:
@@ -79,9 +79,9 @@ protected:
     
     // non-virtual functions in this class
 protected:
     
     // non-virtual functions in this class
 protected:
-    void printrawindices(ostream & os) const;
-    void printtreeindices(ostream & os, unsigned indent) const;
-    void printindices(ostream & os) const;
+    void printrawindices(std::ostream & os) const;
+    void printtreeindices(std::ostream & os, unsigned indent) const;
+    void printindices(std::ostream & os) const;
     bool all_of_type_idx(void) const;
 
 // member variables
     bool all_of_type_idx(void) const;
 
 // member variables
index 5802325f944345c448a1bd34c3268d81c6126703..14e53b5e0c27522767fa4fd23d96aac7522b417e 100644 (file)
@@ -107,18 +107,21 @@ static ex csgn_eval(const ex & x)
     return csgn(x).hold();
 }
 
     return csgn(x).hold();
 }
 
-static ex csgn_series(const ex & x, const relational & rel, int order)
+static ex csgn_series(const ex & arg,
+                      const relational & rel,
+                      int order,
+                      bool branchcut)
 {
 {
-    const ex x_pt = x.subs(rel);
-    if (x_pt.info(info_flags::numeric)) {
-        if (ex_to_numeric(x_pt).real().is_zero())
+    const ex arg_pt = arg.subs(rel);
+    if (arg_pt.info(info_flags::numeric)) {
+        if (ex_to_numeric(arg_pt).real().is_zero())
             throw (std::domain_error("csgn_series(): on imaginary axis"));
         epvector seq;
             throw (std::domain_error("csgn_series(): on imaginary axis"));
         epvector seq;
-        seq.push_back(expair(csgn(x_pt), _ex0()));
+        seq.push_back(expair(csgn(arg_pt), _ex0()));
         return pseries(rel,seq);
     }
     epvector seq;
         return pseries(rel,seq);
     }
     epvector seq;
-    seq.push_back(expair(csgn(x_pt), _ex0()));
+    seq.push_back(expair(csgn(arg_pt), _ex0()));
     return pseries(rel,seq);
 }
 
     return pseries(rel,seq);
 }
 
@@ -130,26 +133,41 @@ REGISTER_FUNCTION(csgn, eval_func(csgn_eval).
 // dilogarithm
 //////////
 
 // dilogarithm
 //////////
 
+static ex Li2_evalf(const ex & x)
+{
+    BEGIN_TYPECHECK
+        TYPECHECK(x,numeric)
+    END_TYPECHECK(Li2(x))
+    
+    return Li2(ex_to_numeric(x));  // -> numeric Li2(numeric)
+}
+
 static ex Li2_eval(const ex & x)
 {
 static ex Li2_eval(const ex & x)
 {
-    // Li2(0) -> 0
-    if (x.is_zero())
-        return x;
-    // Li2(1) -> Pi^2/6
-    if (x.is_equal(_ex1()))
-        return power(Pi,_ex2())/_ex6();
-    // Li2(1/2) -> Pi^2/12 - log(2)^2/2
-    if (x.is_equal(_ex1_2()))
-        return power(Pi,_ex2())/_ex12() + power(log(_ex2()),_ex2())*_ex_1_2();
-    // Li2(-1) -> -Pi^2/12
-    if (x.is_equal(_ex_1()))
-        return -power(Pi,_ex2())/_ex12();
-    // Li2(I) -> -Pi^2/48+Catalan*I
-    if (x.is_equal(I))
-        return power(Pi,_ex2())/_ex_48() + Catalan*I;
-    // Li2(-I) -> -Pi^2/48-Catalan*I
-    if (x.is_equal(-I))
-        return power(Pi,_ex2())/_ex_48() - Catalan*I;
+    if (x.info(info_flags::numeric)) {
+        // Li2(0) -> 0
+        if (x.is_zero())
+            return _ex0();
+        // Li2(1) -> Pi^2/6
+        if (x.is_equal(_ex1()))
+            return power(Pi,_ex2())/_ex6();
+        // Li2(1/2) -> Pi^2/12 - log(2)^2/2
+        if (x.is_equal(_ex1_2()))
+            return power(Pi,_ex2())/_ex12() + power(log(_ex2()),_ex2())*_ex_1_2();
+        // Li2(-1) -> -Pi^2/12
+        if (x.is_equal(_ex_1()))
+            return -power(Pi,_ex2())/_ex12();
+        // Li2(I) -> -Pi^2/48+Catalan*I
+        if (x.is_equal(I))
+            return power(Pi,_ex2())/_ex_48() + Catalan*I;
+        // Li2(-I) -> -Pi^2/48-Catalan*I
+        if (x.is_equal(-I))
+            return power(Pi,_ex2())/_ex_48() - Catalan*I;
+        // Li2(float)
+        if (!x.info(info_flags::crational))
+            return Li2_evalf(x);
+    }
+    
     return Li2(x).hold();
 }
 
     return Li2(x).hold();
 }
 
@@ -161,49 +179,89 @@ static ex Li2_deriv(const ex & x, unsigned deriv_param)
     return -log(1-x)/x;
 }
 
     return -log(1-x)/x;
 }
 
-static ex Li2_series(const ex &x, const relational &rel, int order)
+static ex Li2_series(const ex &x, const relational &rel, int order, bool branchcut)
 {
     const ex x_pt = x.subs(rel);
 {
     const ex x_pt = x.subs(rel);
-    if (!x_pt.is_zero() && !x_pt.is_equal(_ex1()))
-        throw do_taylor();  // caught by function::series()
-    // First case: x==0 (derivatives have poles)
-    if (x_pt.is_zero()) {
-        // method:
-        // The problem is that in d/dx Li2(x==0) == -log(1-x)/x we cannot 
-        // simply substitute x==0.  The limit, however, exists: it is 1.  We
-        // also know all higher derivatives' limits: (d/dx)^n Li2(x) == n!/n^2.
-        // So the primitive series expansion is Li2(x==0) == x + x^2/4 + x^3/9
-        // and so on.
-        // We first construct such a primitive series expansion manually in
-        // a dummy symbol s and then insert the argument's series expansion
-        // for s.  Reexpanding the resulting series returns the desired result.
-        const symbol s;
-        ex ser;
-        // construct manually the primitive expansion
-        for (int i=1; i<order; ++i)
-            ser += pow(s,i)/pow(numeric(i),numeric(2));
-        // substitute the argument's series expansion
-        ser = ser.subs(s==x.series(rel,order));
-        // maybe that was terminanting, so add a proper order term
-        epvector nseq;
-        nseq.push_back(expair(Order(_ex1()), numeric(order)));
-        ser += pseries(rel, nseq);
-        // reexpand will collapse the series again
-        ser = ser.series(rel,order);
-        return ser;
-        // NOTE: Of course, this still does not allow us to compute anything
-        // like sin(Li2(x)).series(x==0,2), since then this code here is not
-        // reached and the derivative of sin(Li2(x)) doesn't allow the
-        // substitution x==0.  Probably limits *are* needed for the general
-        // cases.
+    if (x_pt.info(info_flags::numeric)) {
+        // First special case: x==0 (derivatives have poles)
+        if (x_pt.is_zero()) {
+            // method:
+            // The problem is that in d/dx Li2(x==0) == -log(1-x)/x we cannot 
+            // simply substitute x==0.  The limit, however, exists: it is 1.
+            // We also know all higher derivatives' limits:
+            // (d/dx)^n Li2(x) == n!/n^2.
+            // So the primitive series expansion is
+            // Li2(x==0) == x + x^2/4 + x^3/9 + ...
+            // and so on.
+            // We first construct such a primitive series expansion manually in
+            // a dummy symbol s and then insert the argument's series expansion
+            // for s.  Reexpanding the resulting series returns the desired
+            // result.
+            const symbol s;
+            ex ser;
+            // manually construct the primitive expansion
+            for (int i=1; i<order; ++i)
+                ser += pow(s,i) / pow(numeric(i), _num2());
+            // substitute the argument's series expansion
+            ser = ser.subs(s==x.series(rel, order));
+            // maybe that was terminating, so add a proper order term
+            epvector nseq;
+            nseq.push_back(expair(Order(_ex1()), order));
+            ser += pseries(rel, nseq);
+            // reexpanding it will collapse the series again
+            return ser.series(rel, order);
+            // NB: Of course, this still does not allow us to compute anything
+            // like sin(Li2(x)).series(x==0,2), since then this code here is
+            // not reached and the derivative of sin(Li2(x)) doesn't allow the
+            // substitution x==0.  Probably limits *are* needed for the general
+            // cases.  In case L'Hospital's rule is implemented for limits and
+            // basic::series() takes care of this, this whole block is probably
+            // obsolete!
+        }
+        // second special case: x==1 (branch point)
+        if (x_pt == _ex1()) {
+            // method:
+            // construct series manually in a dummy symbol s
+            const symbol s;
+            ex ser = zeta(2);
+            // manually construct the primitive expansion
+            for (int i=1; i<order; ++i)
+                ser += pow(1-s,i) * (numeric(1,i)*(I*Pi+log(s-1)) - numeric(1,i*i));
+            // substitute the argument's series expansion
+            ser = ser.subs(s==x.series(rel, order));
+            // maybe that was terminating, so add a proper order term
+            epvector nseq;
+            nseq.push_back(expair(Order(_ex1()), order));
+            ser += pseries(rel, nseq);
+            // reexpanding it will collapse the series again
+            return ser.series(rel, order);
+        }
+        // third special case: x real, >=1 (branch cut)
+        if (ex_to_numeric(x_pt).is_real() && ex_to_numeric(x_pt)>1) {
+            // method:
+            // This is the branch cut: assemble the primitive series manually
+            // and then add the corresponding complex step function.
+            const symbol *s = static_cast<symbol *>(rel.lhs().bp);
+            const ex point = rel.rhs();
+            const symbol foo;
+            epvector seq;
+            // zeroth order term:
+            seq.push_back(expair(Li2(x_pt), _ex0()));
+            // compute the intermediate terms:
+            ex replarg = series(Li2(x), *s==foo, order);
+            for (unsigned i=1; i<replarg.nops()-1; ++i)
+                seq.push_back(expair((replarg.op(i)/power(*s-foo,i)).series(foo==point,1,branchcut).op(0).subs(foo==*s),i));
+            // append an order term:
+            seq.push_back(expair(Order(_ex1()), replarg.nops()-1));
+            return pseries(rel, seq);
+        }
     }
     }
-    // second problematic case: x real, >=1 (branch cut)
-    return pseries();
-    // TODO: Li2_series should do something around branch point?
-    // Careful: may involve logs!
+    // all other cases should be safe, by now:
+    throw do_taylor();  // caught by function::series()
 }
 
 REGISTER_FUNCTION(Li2, eval_func(Li2_eval).
 }
 
 REGISTER_FUNCTION(Li2, eval_func(Li2_eval).
+                       evalf_func(Li2_evalf).
                        derivative_func(Li2_deriv).
                        series_func(Li2_series));
 
                        derivative_func(Li2_deriv).
                        series_func(Li2_series));
 
@@ -283,13 +341,13 @@ static ex Order_eval(const ex & x)
        return Order(x).hold();
 }
 
        return Order(x).hold();
 }
 
-static ex Order_series(const ex & x, const relational & r, int order)
+static ex Order_series(const ex & x, const relational & r, int order, bool branchcut)
 {
        // Just wrap the function into a pseries object
        epvector new_seq;
     GINAC_ASSERT(is_ex_exactly_of_type(r.lhs(),symbol));
     const symbol *s = static_cast<symbol *>(r.lhs().bp);
 {
        // Just wrap the function into a pseries object
        epvector new_seq;
     GINAC_ASSERT(is_ex_exactly_of_type(r.lhs(),symbol));
     const symbol *s = static_cast<symbol *>(r.lhs().bp);
-       new_seq.push_back(expair(Order(_ex1()), numeric(min(x.ldegree(*s), order))));
+       new_seq.push_back(expair(Order(_ex1()), numeric(std::min(x.ldegree(*s), order))));
        return pseries(r, new_seq);
 }
 
        return pseries(r, new_seq);
 }
 
@@ -323,9 +381,8 @@ ex lsolve(const ex &eqns, const ex &symbols)
 {
     // solve a system of linear equations
     if (eqns.info(info_flags::relation_equal)) {
 {
     // solve a system of linear equations
     if (eqns.info(info_flags::relation_equal)) {
-        if (!symbols.info(info_flags::symbol)) {
+        if (!symbols.info(info_flags::symbol))
             throw(std::invalid_argument("lsolve: 2nd argument must be a symbol"));
             throw(std::invalid_argument("lsolve: 2nd argument must be a symbol"));
-        }
         ex sol=lsolve(lst(eqns),lst(symbols));
         
         GINAC_ASSERT(sol.nops()==1);
         ex sol=lsolve(lst(eqns),lst(symbols));
         
         GINAC_ASSERT(sol.nops()==1);
index 213d9d7ff04ea70fd902b39e9bd4b4a282256209..26b5bd7863138ffec58fa1d3265d4459fd779945 100644 (file)
@@ -56,7 +56,7 @@ static ex lgamma_evalf(const ex & x)
  *  Knows about integer arguments and that's it.  Somebody ought to provide
  *  some good numerical evaluation some day...
  *
  *  Knows about integer arguments and that's it.  Somebody ought to provide
  *  some good numerical evaluation some day...
  *
- *  @exception std::domain_error("lgamma_eval(): logarithmic pole") */
+ *  @exception GiNaC::pole_error("lgamma_eval(): logarithmic pole",0) */
 static ex lgamma_eval(const ex & x)
 {
     if (x.info(info_flags::numeric)) {
 static ex lgamma_eval(const ex & x)
 {
     if (x.info(info_flags::numeric)) {
@@ -66,7 +66,7 @@ static ex lgamma_eval(const ex & x)
             if (x.info(info_flags::posint)) {
                 return log(factorial(x.exadd(_ex_1())));
             } else {
             if (x.info(info_flags::posint)) {
                 return log(factorial(x.exadd(_ex_1())));
             } else {
-                throw (std::domain_error("lgamma_eval(): logarithmic pole"));
+                throw (pole_error("lgamma_eval(): logarithmic pole",0));
             }
         }
         //  lgamma_evalf should be called here once it becomes available
             }
         }
         //  lgamma_evalf should be called here once it becomes available
@@ -85,7 +85,10 @@ static ex lgamma_deriv(const ex & x, unsigned deriv_param)
 }
 
 
 }
 
 
-static ex lgamma_series(const ex & x, const relational & rel, int order)
+static ex lgamma_series(const ex & arg,
+                        const relational & rel,
+                        int order,
+                        bool branchcut)
 {
     // method:
     // Taylor series where there is no pole falls back to psi function
 {
     // method:
     // Taylor series where there is no pole falls back to psi function
@@ -98,11 +101,11 @@ static ex lgamma_series(const ex & x, const relational & rel, int order)
     // This, however, seems to fail utterly because you run into branch-cut
     // problems.  Somebody ought to implement it some day using an asymptotic
     // series for tgamma:
     // This, however, seems to fail utterly because you run into branch-cut
     // problems.  Somebody ought to implement it some day using an asymptotic
     // series for tgamma:
-    const ex x_pt = x.subs(rel);
-    if (!x_pt.info(info_flags::integer) || x_pt.info(info_flags::positive))
+    const ex arg_pt = arg.subs(rel);
+    if (!arg_pt.info(info_flags::integer) || arg_pt.info(info_flags::positive))
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a simple pole of tgamma(-m):
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a simple pole of tgamma(-m):
-    throw (std::domain_error("lgamma_series: please implemnt my at the poles"));
+    throw (std::overflow_error("lgamma_series: please implement my at the poles"));
     return _ex0();  // not reached
 }
 
     return _ex0();  // not reached
 }
 
@@ -131,7 +134,7 @@ static ex tgamma_evalf(const ex & x)
  *  arguments, half-integer arguments and that's it. Somebody ought to provide
  *  some good numerical evaluation some day...
  *
  *  arguments, half-integer arguments and that's it. Somebody ought to provide
  *  some good numerical evaluation some day...
  *
- *  @exception std::domain_error("tgamma_eval(): simple pole") */
+ *  @exception pole_error("tgamma_eval(): simple pole",0) */
 static ex tgamma_eval(const ex & x)
 {
     if (x.info(info_flags::numeric)) {
 static ex tgamma_eval(const ex & x)
 {
     if (x.info(info_flags::numeric)) {
@@ -141,7 +144,7 @@ static ex tgamma_eval(const ex & x)
             if (x.info(info_flags::posint)) {
                 return factorial(ex_to_numeric(x).sub(_num1()));
             } else {
             if (x.info(info_flags::posint)) {
                 return factorial(ex_to_numeric(x).sub(_num1()));
             } else {
-                throw (std::domain_error("tgamma_eval(): simple pole"));
+                throw (pole_error("tgamma_eval(): simple pole",1));
             }
         }
         // trap half integer arguments:
             }
         }
         // trap half integer arguments:
@@ -178,7 +181,10 @@ static ex tgamma_deriv(const ex & x, unsigned deriv_param)
 }
 
 
 }
 
 
-static ex tgamma_series(const ex & x, const relational & rel, int order)
+static ex tgamma_series(const ex & arg,
+                        const relational & rel,
+                        int order,
+                        bool branchcut)
 {
     // method:
     // Taylor series where there is no pole falls back to psi function
 {
     // method:
     // Taylor series where there is no pole falls back to psi function
@@ -188,15 +194,15 @@ static ex tgamma_series(const ex & x, const relational & rel, int order)
     // from which follows
     //   series(tgamma(x),x==-m,order) ==
     //   series(tgamma(x+m+1)/(x*(x+1)*...*(x+m)),x==-m,order+1);
     // from which follows
     //   series(tgamma(x),x==-m,order) ==
     //   series(tgamma(x+m+1)/(x*(x+1)*...*(x+m)),x==-m,order+1);
-    const ex x_pt = x.subs(rel);
-    if (!x_pt.info(info_flags::integer) || x_pt.info(info_flags::positive))
+    const ex arg_pt = arg.subs(rel);
+    if (!arg_pt.info(info_flags::integer) || arg_pt.info(info_flags::positive))
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a simple pole at -m:
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a simple pole at -m:
-    numeric m = -ex_to_numeric(x_pt);
+    numeric m = -ex_to_numeric(arg_pt);
     ex ser_denom = _ex1();
     for (numeric p; p<=m; ++p)
     ex ser_denom = _ex1();
     for (numeric p; p<=m; ++p)
-        ser_denom *= x+p;
-    return (tgamma(x+m+_ex1())/ser_denom).series(rel, order+1);
+        ser_denom *= arg+p;
+    return (tgamma(arg+m+_ex1())/ser_denom).series(rel, order+1);
 }
 
 
 }
 
 
@@ -235,13 +241,13 @@ static ex beta_eval(const ex & x, const ex & y)
                 if (nx<=-ny)
                     return pow(_num_1(), ny)*beta(1-x-y, y);
                 else
                 if (nx<=-ny)
                     return pow(_num_1(), ny)*beta(1-x-y, y);
                 else
-                    throw (std::domain_error("beta_eval(): simple pole"));
+                    throw (pole_error("beta_eval(): simple pole",1));
             }
             if (ny.is_negative()) {
                 if (ny<=-nx)
                     return pow(_num_1(), nx)*beta(1-y-x, x);
                 else
             }
             if (ny.is_negative()) {
                 if (ny<=-nx)
                     return pow(_num_1(), nx)*beta(1-y-x, x);
                 else
-                    throw (std::domain_error("beta_eval(): simple pole"));
+                    throw (pole_error("beta_eval(): simple pole",1));
             }
             return tgamma(x)*tgamma(y)/tgamma(x+y);
         }
             }
             return tgamma(x)*tgamma(y)/tgamma(x+y);
         }
@@ -273,37 +279,41 @@ static ex beta_deriv(const ex & x, const ex & y, unsigned deriv_param)
 }
 
 
 }
 
 
-static ex beta_series(const ex & x, const ex & y, const relational & rel, int order)
+static ex beta_series(const ex & arg1,
+                      const ex & arg2,
+                      const relational & rel,
+                      int order,
+                      bool branchcut)
 {
     // method:
     // Taylor series where there is no pole of one of the tgamma functions
     // falls back to beta function evaluation.  Otherwise, fall back to
     // tgamma series directly.
 {
     // method:
     // Taylor series where there is no pole of one of the tgamma functions
     // falls back to beta function evaluation.  Otherwise, fall back to
     // tgamma series directly.
-    const ex x_pt = x.subs(rel);
-    const ex y_pt = y.subs(rel);
+    const ex arg1_pt = arg1.subs(rel);
+    const ex arg2_pt = arg2.subs(rel);
     GINAC_ASSERT(is_ex_exactly_of_type(rel.lhs(),symbol));
     const symbol *s = static_cast<symbol *>(rel.lhs().bp);
     GINAC_ASSERT(is_ex_exactly_of_type(rel.lhs(),symbol));
     const symbol *s = static_cast<symbol *>(rel.lhs().bp);
-    ex x_ser, y_ser, xy_ser;
-    if ((!x_pt.info(info_flags::integer) || x_pt.info(info_flags::positive)) &&
-        (!y_pt.info(info_flags::integer) || y_pt.info(info_flags::positive)))
+    ex arg1_ser, arg2_ser, arg1arg2_ser;
+    if ((!arg1_pt.info(info_flags::integer) || arg1_pt.info(info_flags::positive)) &&
+        (!arg2_pt.info(info_flags::integer) || arg2_pt.info(info_flags::positive)))
         throw do_taylor();  // caught by function::series()
         throw do_taylor();  // caught by function::series()
-    // trap the case where x is on a pole directly:
-    if (x.info(info_flags::integer) && !x.info(info_flags::positive))
-        x_ser = tgamma(x+*s).series(rel,order);
+    // trap the case where arg1 is on a pole:
+    if (arg1.info(info_flags::integer) && !arg1.info(info_flags::positive))
+        arg1_ser = tgamma(arg1+*s).series(rel,order);
     else
     else
-        x_ser = tgamma(x).series(rel,order);
-    // trap the case where y is on a pole directly:
-    if (y.info(info_flags::integer) && !y.info(info_flags::positive))
-        y_ser = tgamma(y+*s).series(rel,order);
+        arg1_ser = tgamma(arg1).series(rel,order);
+    // trap the case where arg2 is on a pole:
+    if (arg2.info(info_flags::integer) && !arg2.info(info_flags::positive))
+        arg2_ser = tgamma(arg2+*s).series(rel,order);
     else
     else
-        y_ser = tgamma(y).series(rel,order);
-    // trap the case where y is on a pole directly:
-    if ((x+y).info(info_flags::integer) && !(x+y).info(info_flags::positive))
-        xy_ser = tgamma(y+x+*s).series(rel,order);
+        arg2_ser = tgamma(arg2).series(rel,order);
+    // trap the case where arg1+arg2 is on a pole:
+    if ((arg1+arg2).info(info_flags::integer) && !(arg1+arg2).info(info_flags::positive))
+        arg1arg2_ser = tgamma(arg2+arg1+*s).series(rel,order);
     else
     else
-        xy_ser = tgamma(y+x).series(rel,order);
-    // compose the result:
-    return (x_ser*y_ser/xy_ser).series(rel,order);
+        arg1arg2_ser = tgamma(arg2+arg1).series(rel,order);
+    // compose the result (expanding all the terms):
+    return (arg1_ser*arg2_ser/arg1arg2_ser).series(rel,order).expand();
 }
 
 
 }
 
 
@@ -342,7 +352,7 @@ static ex psi1_eval(const ex & x)
                 return rat-Euler;
             } else {
                 // for non-positive integers there is a pole:
                 return rat-Euler;
             } else {
                 // for non-positive integers there is a pole:
-                throw (std::domain_error("psi_eval(): simple pole"));
+                throw (pole_error("psi_eval(): simple pole",1));
             }
         }
         if ((_num2()*nx).is_integer()) {
             }
         }
         if ((_num2()*nx).is_integer()) {
@@ -379,7 +389,10 @@ static ex psi1_deriv(const ex & x, unsigned deriv_param)
     return psi(_ex1(), x);
 }
 
     return psi(_ex1(), x);
 }
 
-static ex psi1_series(const ex & x, const relational & rel, int order)
+static ex psi1_series(const ex & arg,
+                      const relational & rel,
+                      int order,
+                      bool branchcut)
 {
     // method:
     // Taylor series where there is no pole falls back to polygamma function
 {
     // method:
     // Taylor series where there is no pole falls back to polygamma function
@@ -389,15 +402,15 @@ static ex psi1_series(const ex & x, const relational & rel, int order)
     // from which follows
     //   series(psi(x),x==-m,order) ==
     //   series(psi(x+m+1) - 1/x - 1/(x+1) - 1/(x+m)),x==-m,order);
     // from which follows
     //   series(psi(x),x==-m,order) ==
     //   series(psi(x+m+1) - 1/x - 1/(x+1) - 1/(x+m)),x==-m,order);
-    const ex x_pt = x.subs(rel);
-    if (!x_pt.info(info_flags::integer) || x_pt.info(info_flags::positive))
+    const ex arg_pt = arg.subs(rel);
+    if (!arg_pt.info(info_flags::integer) || arg_pt.info(info_flags::positive))
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a simple pole at -m:
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a simple pole at -m:
-    numeric m = -ex_to_numeric(x_pt);
+    numeric m = -ex_to_numeric(arg_pt);
     ex recur;
     for (numeric p; p<=m; ++p)
     ex recur;
     for (numeric p; p<=m; ++p)
-        recur += power(x+p,_ex_1());
-    return (psi(x+m+_ex1())-recur).series(rel, order);
+        recur += power(arg+p,_ex_1());
+    return (psi(arg+m+_ex1())-recur).series(rel, order);
 }
 
 const unsigned function_index_psi1 =
 }
 
 const unsigned function_index_psi1 =
@@ -454,7 +467,7 @@ static ex psi2_eval(const ex & n, const ex & x)
                 return recur+psi(n,_ex1());
             } else {
                 // for non-positive integers there is a pole:
                 return recur+psi(n,_ex1());
             } else {
                 // for non-positive integers there is a pole:
-                throw (std::domain_error("psi2_eval(): pole"));
+                throw (pole_error("psi2_eval(): pole",1));
             }
         }
         if ((_num2()*nx).is_integer()) {
             }
         }
         if ((_num2()*nx).is_integer()) {
@@ -499,7 +512,11 @@ static ex psi2_deriv(const ex & n, const ex & x, unsigned deriv_param)
     return psi(n+_ex1(), x);
 }
 
     return psi(n+_ex1(), x);
 }
 
-static ex psi2_series(const ex & n, const ex & x, const relational & rel, int order)
+static ex psi2_series(const ex & n,
+                      const ex & arg,
+                      const relational & rel,
+                      int order,
+                      bool branchcut)
 {
     // method:
     // Taylor series where there is no pole falls back to polygamma function
 {
     // method:
     // Taylor series where there is no pole falls back to polygamma function
@@ -510,16 +527,16 @@ static ex psi2_series(const ex & n, const ex & x, const relational & rel, int or
     //   series(psi(x),x==-m,order) == 
     //   series(psi(x+m+1) - (-1)^n * n! * ((x)^(-n-1) + (x+1)^(-n-1) + ...
     //                                      ... + (x+m)^(-n-1))),x==-m,order);
     //   series(psi(x),x==-m,order) == 
     //   series(psi(x+m+1) - (-1)^n * n! * ((x)^(-n-1) + (x+1)^(-n-1) + ...
     //                                      ... + (x+m)^(-n-1))),x==-m,order);
-    const ex x_pt = x.subs(rel);
-    if (!x_pt.info(info_flags::integer) || x_pt.info(info_flags::positive))
+    const ex arg_pt = arg.subs(rel);
+    if (!arg_pt.info(info_flags::integer) || arg_pt.info(info_flags::positive))
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a pole of order n+1 at -m:
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a pole of order n+1 at -m:
-    numeric m = -ex_to_numeric(x_pt);
+    numeric m = -ex_to_numeric(arg_pt);
     ex recur;
     for (numeric p; p<=m; ++p)
     ex recur;
     for (numeric p; p<=m; ++p)
-        recur += power(x+p,-n+_ex_1());
+        recur += power(arg+p,-n+_ex_1());
     recur *= factorial(n)*power(_ex_1(),n);
     recur *= factorial(n)*power(_ex_1(),n);
-    return (psi(n, x+m+_ex1())-recur).series(rel, order);
+    return (psi(n, arg+m+_ex1())-recur).series(rel, order);
 }
 
 const unsigned function_index_psi2 =
 }
 
 const unsigned function_index_psi2 =
index 81f92a93aca908aa6f698e79dd1a4380d5998d61..75c92b7621750635c2013d19a9bf40475081d44f 100644 (file)
@@ -110,7 +110,7 @@ static ex log_eval(const ex & x)
 {
     if (x.info(info_flags::numeric)) {
         if (x.is_equal(_ex0()))  // log(0) -> infinity
 {
     if (x.info(info_flags::numeric)) {
         if (x.is_equal(_ex0()))  // log(0) -> infinity
-            throw(std::domain_error("log_eval(): log(0)"));
+            throw(pole_error("log_eval(): log(0)",0));
         if (x.info(info_flags::real) && x.info(info_flags::negative))
             return (log(-x)+I*Pi);
         if (x.is_equal(_ex1()))  // log(1) -> 0
         if (x.info(info_flags::real) && x.info(info_flags::negative))
             return (log(-x)+I*Pi);
         if (x.is_equal(_ex1()))  // log(1) -> 0
@@ -144,26 +144,60 @@ static ex log_deriv(const ex & x, unsigned deriv_param)
     return power(x, _ex_1());
 }
 
     return power(x, _ex_1());
 }
 
-static ex log_series(const ex &x, const relational &rel, int order)
+static ex log_series(const ex &arg,
+                     const relational &rel,
+                     int order,
+                     bool branchcut)
 {
 {
-    const ex x_pt = x.subs(rel);
-    if (!x_pt.info(info_flags::negative) && !x_pt.is_zero())
-        throw do_taylor();  // caught by function::series()
-    // now we either have to care for the branch cut or the branch point:
-    if (x_pt.is_zero()) {  // branch point: return a plain log(x).
+    GINAC_ASSERT(is_ex_exactly_of_type(rel.lhs(),symbol));
+    ex arg_pt;
+    bool must_expand_arg = false;
+    // maybe substitution of rel into arg fails because of a pole
+    try {
+        arg_pt = arg.subs(rel);
+    } catch (pole_error) {
+        must_expand_arg = true;
+    }
+    // or we are at the branch cut anyways
+    if (arg_pt.is_zero())
+        must_expand_arg = true;
+    
+    if (must_expand_arg) {
+        // method:
+        // This is the branch point: Series expand the argument first, then
+        // trivially factorize it to isolate that part which has constant
+        // leading coefficient in this fashion:
+        //   x^n + Order(x^(n+m))  ->  x^n * (1 + Order(x^m)).
+        // Return a plain n*log(x) for the x^n part and series expand the
+        // other part.  Add them together and reexpand again in order to have
+        // one unnested pseries object.  All this also works for negative n.
+        const pseries argser = ex_to_pseries(arg.series(rel, order, branchcut));
+        const symbol *s = static_cast<symbol *>(rel.lhs().bp);
+        const ex point = rel.rhs();
+        const int n = argser.ldegree(*s);
         epvector seq;
         epvector seq;
-        seq.push_back(expair(log(x), _ex0()));
-        return pseries(rel, seq);
-    } // on the branch cut:
-    const ex point = rel.rhs();
-    const symbol *s = static_cast<symbol *>(rel.lhs().bp);
-    const symbol foo;
-    // compute the formal series:
-    ex replx = series(log(x),*s==foo,order).subs(foo==point);
-    epvector seq;
-    seq.push_back(expair(-I*csgn(x*I)*Pi,_ex0()));
-    seq.push_back(expair(Order(_ex1()),order));
-    return series(replx - I*Pi + pseries(rel, seq),rel,order);
+        seq.push_back(expair(n*log(*s-point), _ex0()));
+        if (!argser.is_terminating() || argser.nops()!=1) {
+            // in this case n more terms are needed
+            ex newarg = ex_to_pseries(arg.series(rel, order+n, branchcut)).shift_exponents(-n).convert_to_poly(true);
+            return pseries(rel, seq).add_series(ex_to_pseries(log(newarg).series(rel, order, branchcut)));
+        } else  // it was a monomial
+            return pseries(rel, seq);
+    }
+    if (branchcut && arg_pt.info(info_flags::negative)) {
+        // method:
+        // This is the branch cut: assemble the primitive series manually and
+        // then add the corresponding complex step function.
+        const symbol *s = static_cast<symbol *>(rel.lhs().bp);
+        const ex point = rel.rhs();
+        const symbol foo;
+        ex replarg = series(log(arg), *s==foo, order, false).subs(foo==point);
+        epvector seq;
+        seq.push_back(expair(-I*csgn(arg*I)*Pi, _ex0()));
+        seq.push_back(expair(Order(_ex1()), order));
+        return series(replarg - I*Pi + pseries(rel, seq), rel, order);
+    }
+    throw do_taylor();  // caught by function::series()
 }
 
 REGISTER_FUNCTION(log, eval_func(log_eval).
 }
 
 REGISTER_FUNCTION(log, eval_func(log_eval).
@@ -375,7 +409,7 @@ static ex tan_eval(const ex & x)
         if (z.is_equal(_num25())) // tan(5/12*Pi) -> 2+sqrt(3)
             return sign*(power(_ex3(),_ex1_2())+_ex2());
         if (z.is_equal(_num30())) // tan(Pi/2)    -> infinity
         if (z.is_equal(_num25())) // tan(5/12*Pi) -> 2+sqrt(3)
             return sign*(power(_ex3(),_ex1_2())+_ex2());
         if (z.is_equal(_num30())) // tan(Pi/2)    -> infinity
-            throw (std::domain_error("tan_eval(): simple pole"));
+            throw (pole_error("tan_eval(): simple pole",1));
     }
     
     if (is_ex_exactly_of_type(x, function)) {
     }
     
     if (is_ex_exactly_of_type(x, function)) {
@@ -407,7 +441,10 @@ static ex tan_deriv(const ex & x, unsigned deriv_param)
     return (_ex1()+power(tan(x),_ex2()));
 }
 
     return (_ex1()+power(tan(x),_ex2()));
 }
 
-static ex tan_series(const ex &x, const relational &rel, int order)
+static ex tan_series(const ex &x,
+                     const relational &rel,
+                     int order,
+                     bool branchcut)
 {
     // method:
     // Taylor series where there is no pole falls back to tan_deriv.
 {
     // method:
     // Taylor series where there is no pole falls back to tan_deriv.
@@ -764,7 +801,10 @@ static ex tanh_deriv(const ex & x, unsigned deriv_param)
     return _ex1()-power(tanh(x),_ex2());
 }
 
     return _ex1()-power(tanh(x),_ex2());
 }
 
-static ex tanh_series(const ex &x, const relational &rel, int order)
+static ex tanh_series(const ex &x,
+                      const relational &rel,
+                      int order,
+                      bool branchcut)
 {
     // method:
     // Taylor series where there is no pole falls back to tanh_deriv.
 {
     // method:
     // Taylor series where there is no pole falls back to tanh_deriv.
@@ -886,7 +926,7 @@ static ex atanh_eval(const ex & x)
             return _ex0();
         // atanh({+|-}1) -> throw
         if (x.is_equal(_ex1()) || x.is_equal(_ex_1()))
             return _ex0();
         // atanh({+|-}1) -> throw
         if (x.is_equal(_ex1()) || x.is_equal(_ex_1()))
-            throw (std::domain_error("atanh_eval(): logarithmic pole"));
+            throw (pole_error("atanh_eval(): logarithmic pole",0));
         // atanh(float) -> float
         if (!x.info(info_flags::crational))
             return atanh_evalf(x);
         // atanh(float) -> float
         if (!x.info(info_flags::crational))
             return atanh_evalf(x);
index 0ba72d1ac5bb40bd538fae496c2fc27bd8b9e04f..a7c8c06fffb35d0e8e3d4989ab6d58f98d004934 100644 (file)
@@ -65,7 +65,7 @@ extern int ginac_yyparse();
 extern ex parsed_ex;
 
 /** Get error message from the parser. */
 extern ex parsed_ex;
 
 /** Get error message from the parser. */
-extern string get_parser_error(void);
+extern std::string get_parser_error(void);
 
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
 
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
index 5a3bfbdb22e1f2d62f98dd868d17270ffc8d35c6..9795803e5ac31e02e77ca22a36fe016a25b7c4e6 100644 (file)
@@ -69,7 +69,7 @@ struct sym_def {
        ex sym;
        bool predefined;        // true = user supplied symbol, false = lexer generated symbol
 };
        ex sym;
        bool predefined;        // true = user supplied symbol, false = lexer generated symbol
 };
-typedef map<string, sym_def> sym_tab;
+typedef std::map<std::string, sym_def> sym_tab;
 static sym_tab syms;
 
 // lex input function
 static sym_tab syms;
 
 // lex input function
@@ -140,7 +140,7 @@ Digits                      ginac_yylval = (long)Digits; return T_DIGITS;
  */
 
 // The string from which we will read
  */
 
 // The string from which we will read
-static string lexer_string;
+static std::string lexer_string;
 
 // The current position within the string
 static int curr_pos = 0;
 
 // The current position within the string
 static int curr_pos = 0;
@@ -169,7 +169,7 @@ namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
 // Set the input string
 #endif // ndef NO_NAMESPACE_GINAC
 
 // Set the input string
-void set_lexer_string(const string &s)
+void set_lexer_string(const std::string &s)
 {
        lexer_string = s;
        curr_pos = 0;
 {
        lexer_string = s;
        curr_pos = 0;
index 8ff6b916ae8354ac58261d04597fe727a92a14cc..1afa969f6f25f0a923e99416973e42e074097874 100644 (file)
@@ -95,7 +95,7 @@ void isospin::destroy(bool call_parent)
 
 // public
 
 
 // public
 
-isospin::isospin(const string & initname)
+isospin::isospin(const std::string & initname)
 {
     debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT);
     name=initname;
 {
     debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT);
     name=initname;
@@ -149,7 +149,7 @@ basic * isospin::duplicate() const
     return new isospin(*this);
 }
 
     return new isospin(*this);
 }
 
-void isospin::printraw(ostream & os) const
+void isospin::printraw(std::ostream & os) const
 {
     debugmsg("isospin printraw",LOGLEVEL_PRINT);
     os << "isospin(" << "name=" << name << ",serial=" << serial
 {
     debugmsg("isospin printraw",LOGLEVEL_PRINT);
     os << "isospin(" << "name=" << name << ",serial=" << serial
@@ -158,25 +158,26 @@ void isospin::printraw(ostream & os) const
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void isospin::printtree(ostream & os, unsigned indent) const
+void isospin::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("isospin printtree",LOGLEVEL_PRINT);
 {
     debugmsg("isospin printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << name << " (isospin): "
+    os << std::string(indent,' ') << name << " (isospin): "
        << "serial=" << serial << ","
        << seq.size() << "indices=";
     printtreeindices(os,indent);
        << "serial=" << serial << ","
        << seq.size() << "indices=";
     printtreeindices(os,indent);
-    os << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+    os << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void isospin::print(ostream & os, unsigned upper_precedence) const
+void isospin::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("isospin print",LOGLEVEL_PRINT);
     os << name;
     printindices(os);
 }
 
 {
     debugmsg("isospin print",LOGLEVEL_PRINT);
     os << name;
     printindices(os);
 }
 
-void isospin::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void isospin::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("isospin print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
 {
     debugmsg("isospin print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
@@ -223,16 +224,16 @@ unsigned isospin::calchash(void) const
 // non-virtual functions in this class
 //////////
 
 // non-virtual functions in this class
 //////////
 
-void isospin::setname(const string & n)
+void isospin::setname(const std::string & n)
 {
 {
-    name=n;
+    name = n;
 }
 
 // private
 
 }
 
 // private
 
-string & isospin::autoname_prefix(void)
+std::string & isospin::autoname_prefix(void)
 {
 {
-    static string * s=new string("isospin");
+    static std::string * s = new std::string("isospin");
     return *s;
 }
 
     return *s;
 }
 
index 0cc29bc71d297bf2d363f0425de58d1ea63cfb6d..8103fc1a6ec291d2e85714a686b16673b4d37200 100644 (file)
@@ -49,15 +49,15 @@ protected:
 
     // other constructors
 public:
 
     // other constructors
 public:
-    explicit isospin(const string & initname);
+    explicit isospin(const std::string & initname);
 
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
 
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
 protected:
     int compare_same_type(const basic & other) const;
     bool info(unsigned inf) const;
 protected:
     int compare_same_type(const basic & other) const;
@@ -69,14 +69,14 @@ protected:
     
     // non-virtual functions in this class
 public:
     
     // non-virtual functions in this class
 public:
-    void setname(const string & n);
+    void setname(const std::string & n);
 private:
 private:
-    string & autoname_prefix(void);
+    std::string & autoname_prefix(void);
 
 // member variables
 
 protected:
 
 // member variables
 
 protected:
-    string name;
+    std::string name;
     unsigned serial; // unique serial number for comparision
 private:
     static unsigned next_serial;
     unsigned serial; // unique serial number for comparision
 private:
     static unsigned next_serial;
index 5835050e4616c4f60d2f1cce963ca632a60cd68c..9a0aa7bd34a854e6886a2323f840fd7568cbfa26 100644 (file)
@@ -103,7 +103,7 @@ lorentzidx::lorentzidx(bool cov, bool oonly, unsigned dimp) :
     tinfo_key=TINFO_lorentzidx;
 }
 
     tinfo_key=TINFO_lorentzidx;
 }
 
-lorentzidx::lorentzidx(const string & n, bool cov, bool oonly, unsigned dimp)
+lorentzidx::lorentzidx(const std::string & n, bool cov, bool oonly, unsigned dimp)
     : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp)
 {
     debugmsg("lorentzidx constructor from string,bool,bool,unsigned",
     : idx(n,cov), orthogonal_only(oonly), dim_parallel_space(dimp)
 {
     debugmsg("lorentzidx constructor from string,bool,bool,unsigned",
@@ -175,7 +175,7 @@ basic * lorentzidx::duplicate() const
     return new lorentzidx(*this);
 }
 
     return new lorentzidx(*this);
 }
 
-void lorentzidx::printraw(ostream & os) const
+void lorentzidx::printraw(std::ostream & os) const
 {
     debugmsg("lorentzidx printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("lorentzidx printraw",LOGLEVEL_PRINT);
 
@@ -205,11 +205,11 @@ void lorentzidx::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void lorentzidx::printtree(ostream & os, unsigned indent) const
+void lorentzidx::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("lorentzidx printtree",LOGLEVEL_PRINT);
 
 {
     debugmsg("lorentzidx printtree",LOGLEVEL_PRINT);
 
-    os << string(indent,' ') << "lorentzidx: ";
+    os << std::string(indent,' ') << "lorentzidx: ";
 
     if (symbolic) {
         os << "symbolic,name=" << name;
 
     if (symbolic) {
         os << "symbolic,name=" << name;
@@ -231,11 +231,12 @@ void lorentzidx::printtree(ostream & os, unsigned indent) const
     }
 
     os << ", serial=" << serial
     }
 
     os << ", serial=" << serial
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void lorentzidx::print(ostream & os, unsigned upper_precedence) const
+void lorentzidx::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("lorentzidx print",LOGLEVEL_PRINT);
 
 {
     debugmsg("lorentzidx print",LOGLEVEL_PRINT);
 
index 6cd5fc2a7b8f089c5430c9fb6264ef5e4b704e60..8ff27764728ac7dae1fe666876087fef2cce4753 100644 (file)
@@ -53,7 +53,7 @@ protected:
     // other constructors
 public:
     explicit lorentzidx(bool cov, bool oonly=false, unsigned dimp=0);
     // other constructors
 public:
     explicit lorentzidx(bool cov, bool oonly=false, unsigned dimp=0);
-    explicit lorentzidx(const string & n, bool cov=false,
+    explicit lorentzidx(const std::string & n, bool cov=false,
                         bool oonly=false, unsigned dimp=0);
     explicit lorentzidx(const char * n, bool cov=false,
                         bool oonly=false, unsigned dimp=0);
                         bool oonly=false, unsigned dimp=0);
     explicit lorentzidx(const char * n, bool cov=false,
                         bool oonly=false, unsigned dimp=0);
@@ -62,9 +62,9 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
 
     // new virtual functions which can be overridden by derived classes
     bool info(unsigned inf) const;
 
     // new virtual functions which can be overridden by derived classes
index 8a30034eca4af1c8deea7f4a55552f903e622897..2b2215fdb14a41a1306fbfd9c003f18611140937 100644 (file)
@@ -105,14 +105,14 @@ void lortensor::destroy(bool call_parent)
 
 // protected
 
 
 // protected
 
-lortensor::lortensor(lortensor_types const lt, const string & n) : type(lt), name(n)
+lortensor::lortensor(lortensor_types const lt, const std::string & n) : type(lt), name(n)
 {
     debugmsg("lortensor constructor from lortensor_types,string",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
     tinfo_key=TINFO_lortensor;
 }
 
 {
     debugmsg("lortensor constructor from lortensor_types,string",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
     tinfo_key=TINFO_lortensor;
 }
 
-lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu) : indexed(mu), type(lt), name(n)
+lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu) : indexed(mu), type(lt), name(n)
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;    
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;    
@@ -120,7 +120,7 @@ lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu)
     tinfo_key=TINFO_lortensor;
 }
 
     tinfo_key=TINFO_lortensor;
 }
 
-lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu) : indexed(mu,nu), type(lt), name(n)
+lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu) : indexed(mu,nu), type(lt), name(n)
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
@@ -128,7 +128,7 @@ lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu,
     tinfo_key=TINFO_lortensor;
 }
 
     tinfo_key=TINFO_lortensor;
 }
 
-lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu, const ex & rho) : indexed(mu,nu,rho), type(lt), name(n)
+lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu, const ex & rho) : indexed(mu,nu,rho), type(lt), name(n)
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
@@ -136,7 +136,7 @@ lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu,
     tinfo_key=TINFO_lortensor;
 }
 
     tinfo_key=TINFO_lortensor;
 }
 
-lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma) : indexed(mu,nu,rho,sigma), type(lt), name(n)
+lortensor::lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma) : indexed(mu,nu,rho,sigma), type(lt), name(n)
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
 {
     debugmsg("lortensor constructor from lortensor_types,string,ex,ex,ex,ex",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
@@ -144,7 +144,7 @@ lortensor::lortensor(lortensor_types const lt, const string & n, const ex & mu,
     tinfo_key=TINFO_lortensor;
 }
 
     tinfo_key=TINFO_lortensor;
 }
 
-lortensor::lortensor(lortensor_types const lt, const string & n, const exvector & iv) : indexed(iv), type(lt), name(n)
+lortensor::lortensor(lortensor_types const lt, const std::string & n, const exvector & iv) : indexed(iv), type(lt), name(n)
 {
     debugmsg("lortensor constructor from lortensor_types,string,exvector",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
 {
     debugmsg("lortensor constructor from lortensor_types,string,exvector",LOGLEVEL_CONSTRUCT);
     serial=next_serial++;
@@ -152,14 +152,14 @@ lortensor::lortensor(lortensor_types const lt, const string & n, const exvector
     tinfo_key=TINFO_lortensor;
 }
 
     tinfo_key=TINFO_lortensor;
 }
 
-lortensor::lortensor(lortensor_types const lt, const string & n, unsigned s, const exvector & iv) : indexed(iv), type(lt), name(n), serial(s)
+lortensor::lortensor(lortensor_types const lt, const std::string & n, unsigned s, const exvector & iv) : indexed(iv), type(lt), name(n), serial(s)
 {
     debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT);
     GINAC_ASSERT(all_of_type_lorentzidx());
     tinfo_key=TINFO_lortensor;
 }
 
 {
     debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT);
     GINAC_ASSERT(all_of_type_lorentzidx());
     tinfo_key=TINFO_lortensor;
 }
 
-lortensor::lortensor(lortensor_types const lt, const string & n, unsigned s, exvector *ivp) : indexed(ivp), type(lt), name(n), serial(s)
+lortensor::lortensor(lortensor_types const lt, const std::string & n, unsigned s, exvector *ivp) : indexed(ivp), type(lt), name(n), serial(s)
 {
     debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT);
     GINAC_ASSERT(all_of_type_lorentzidx());
 {
     debugmsg("lortensor constructor from lortensor_types,string,unsigned,exvector",LOGLEVEL_CONSTRUCT);
     GINAC_ASSERT(all_of_type_lorentzidx());
@@ -178,7 +178,7 @@ basic * lortensor::duplicate() const
     return new lortensor(*this);
 }
 
     return new lortensor(*this);
 }
 
-void lortensor::printraw(ostream & os) const
+void lortensor::printraw(std::ostream & os) const
 {
     debugmsg("lortensor printraw",LOGLEVEL_PRINT);
     os << "lortensor(type=" << (unsigned)type
 {
     debugmsg("lortensor printraw",LOGLEVEL_PRINT);
     os << "lortensor(type=" << (unsigned)type
@@ -187,19 +187,19 @@ void lortensor::printraw(ostream & os) const
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void lortensor::printtree(ostream & os, unsigned indent) const
+void lortensor::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("lortensor printtree",LOGLEVEL_PRINT);
 {
     debugmsg("lortensor printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') <<"lortensor object: "
+    os << std::string(indent,' ') <<"lortensor object: "
        << "type=" << (unsigned)type << ","
        << "type=" << (unsigned)type << ","
-       << seq.size() << " indices" << endl;
+       << seq.size() << " indices" << std::endl;
     printtreeindices(os,indent);
     printtreeindices(os,indent);
-    os << string(indent,' ') << "hash=" << hashvalue
-       << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+    os << std::string(indent,' ') << "hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void lortensor::print(ostream & os, unsigned upper_precedence) const
+void lortensor::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("lortensor print",LOGLEVEL_PRINT);
     switch (type) {
 {
     debugmsg("lortensor print",LOGLEVEL_PRINT);
     switch (type) {
@@ -226,7 +226,7 @@ void lortensor::print(ostream & os, unsigned upper_precedence) const
     printindices(os);
 }
 
     printindices(os);
 }
 
-void lortensor::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void lortensor::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("lortensor print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
 {
     debugmsg("lortensor print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
@@ -327,9 +327,9 @@ ex lortensor::thisexprseq(exvector *vp) const
 
 // protected
 
 
 // protected
 
-void lortensor::setname(const string & n)
+void lortensor::setname(const std::string & n)
 {
 {
-    name=n;
+    name = n;
 }
 
 bool lortensor::all_of_type_lorentzidx(void) const
 }
 
 bool lortensor::all_of_type_lorentzidx(void) const
@@ -344,9 +344,9 @@ bool lortensor::all_of_type_lorentzidx(void) const
 
 // private
 
 
 // private
 
-string & lortensor::autoname_prefix(void)
+std::string & lortensor::autoname_prefix(void)
 {
 {
-    static string * s=new string("lortensor");
+    static std::string * s = new std::string("lortensor");
     return *s;
 }
 
     return *s;
 }
 
@@ -372,12 +372,12 @@ lortensor lortensor_epsilon(const ex & mu, const ex & nu, const ex & rho, const
     return lortensor(lortensor::lortensor_epsilon,"",mu,nu,rho,sigma);
 }
 
     return lortensor(lortensor::lortensor_epsilon,"",mu,nu,rho,sigma);
 }
 
-lortensor lortensor_rank1(const string & n, const ex & mu)
+lortensor lortensor_rank1(const std::string & n, const ex & mu)
 {
     return lortensor(lortensor::lortensor_rank1,n,mu);
 }
 
 {
     return lortensor(lortensor::lortensor_rank1,n,mu);
 }
 
-lortensor lortensor_rank2(const string & n, const ex & mu, const ex & nu)
+lortensor lortensor_rank2(const std::string & n, const ex & mu, const ex & nu)
 {
     return lortensor(lortensor::lortensor_rank2,n,mu,nu);
 }
 {
     return lortensor(lortensor::lortensor_rank2,n,mu,nu);
 }
index 86bf70a04e9d46c6be033ae9fc9e1388bc8327d7..4d360589f8261a57ce19e4fc529a42ccd3e0a6e0 100644 (file)
@@ -42,8 +42,8 @@ class lortensor : public indexed
     friend lortensor lortensor_epsilon(const ex & mu, const ex & nu,
                                        const ex & rho, const ex & sigma);
     // friend lortensor lortensor_rankn(const string & n, const exvector & iv);
     friend lortensor lortensor_epsilon(const ex & mu, const ex & nu,
                                        const ex & rho, const ex & sigma);
     // friend lortensor lortensor_rankn(const string & n, const exvector & iv);
-    friend lortensor lortensor_rank1(const string & n, const ex & mu);
-    friend lortensor lortensor_rank2(const string & n, const ex & mu, const ex & nu);
+    friend lortensor lortensor_rank1(const std::string & n, const ex & mu);
+    friend lortensor lortensor_rank2(const std::string & n, const ex & mu, const ex & nu);
     friend ex simplify_lortensor_mul(const ex & m);
     friend ex simplify_lortensor(const ex & e);
     
     friend ex simplify_lortensor_mul(const ex & m);
     friend ex simplify_lortensor(const ex & e);
     
@@ -73,23 +73,23 @@ protected:
 
     // other constructors
 protected:
 
     // other constructors
 protected:
-    lortensor(lortensor_types const lt, const string & n);
-    lortensor(lortensor_types const lt, const string & n, const ex & mu);
-    lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu);
-    lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu,
+    lortensor(lortensor_types const lt, const std::string & n);
+    lortensor(lortensor_types const lt, const std::string & n, const ex & mu);
+    lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu);
+    lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu,
               const ex & rho);
               const ex & rho);
-    lortensor(lortensor_types const lt, const string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma);
-    lortensor(lortensor_types const lt, const string & n, const exvector & iv);
-    lortensor(lortensor_types const lt, const string & n, unsigned s, const exvector & iv);
-    lortensor(lortensor_types const lt, const string & n, unsigned s, exvector * ivp);
+    lortensor(lortensor_types const lt, const std::string & n, const ex & mu, const ex & nu, const ex & rho, const ex & sigma);
+    lortensor(lortensor_types const lt, const std::string & n, const exvector & iv);
+    lortensor(lortensor_types const lt, const std::string & n, unsigned s, const exvector & iv);
+    lortensor(lortensor_types const lt, const std::string & n, unsigned s, exvector * ivp);
     
     //functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
     
     //functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
     ex eval(int level=0) const;
 protected:
     bool info(unsigned inf) const;
     ex eval(int level=0) const;
 protected:
@@ -105,18 +105,18 @@ protected:
 
     //non virtual functions in this class
 public:
 
     //non virtual functions in this class
 public:
-    void setname(const string & n);
-    string getname(void) const {return name;}
+    void setname(const std::string & n);
+    std::string getname(void) const {return name;}
 protected:
     bool all_of_type_lorentzidx(void) const;
 private:
 protected:
     bool all_of_type_lorentzidx(void) const;
 private:
-    string & autoname_prefix(void);
+    std::string & autoname_prefix(void);
 
     //member variables
 
 protected:
     lortensor_types type;
 
     //member variables
 
 protected:
     lortensor_types type;
-    string name;
+    std::string name;
     unsigned serial;
 private:
     static unsigned next_serial;
     unsigned serial;
 private:
     static unsigned next_serial;
index 1c4b6dd52873209c53206099e50fa50f45cf8655..fc9d7e269764a98391683edfc3fec5410a3708b8 100644 (file)
@@ -168,7 +168,7 @@ basic * matrix::duplicate() const
     return new matrix(*this);
 }
 
     return new matrix(*this);
 }
 
-void matrix::print(ostream & os, unsigned upper_precedence) const
+void matrix::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("matrix print",LOGLEVEL_PRINT);
     os << "[[ ";
 {
     debugmsg("matrix print",LOGLEVEL_PRINT);
     os << "[[ ";
@@ -186,7 +186,7 @@ void matrix::print(ostream & os, unsigned upper_precedence) const
     os << m[row*col-1] << "]] ]]";
 }
 
     os << m[row*col-1] << "]] ]]";
 }
 
-void matrix::printraw(ostream & os) const
+void matrix::printraw(std::ostream & os) const
 {
     debugmsg("matrix printraw",LOGLEVEL_PRINT);
     os << "matrix(" << row << "," << col <<",";
 {
     debugmsg("matrix printraw",LOGLEVEL_PRINT);
     os << "matrix(" << row << "," << col <<",";
@@ -498,8 +498,8 @@ ex matrix::determinant(void) const
     // For this to be efficient it turns out that the emptiest columns (i.e.
     // the ones with most zeros) should be the ones on the right hand side.
     // Therefore we presort the columns of the matrix:
     // For this to be efficient it turns out that the emptiest columns (i.e.
     // the ones with most zeros) should be the ones on the right hand side.
     // Therefore we presort the columns of the matrix:
-    typedef pair<unsigned,unsigned> uintpair;  // # of zeros, column
-    vector<uintpair> c_zeros;  // number of zeros in column
+    typedef std::pair<unsigned,unsigned> uintpair;  // # of zeros, column
+    std::vector<uintpair> c_zeros;  // number of zeros in column
     for (unsigned c=0; c<col; ++c) {
         unsigned acc = 0;
         for (unsigned r=0; r<row; ++r)
     for (unsigned c=0; c<col; ++c) {
         unsigned acc = 0;
         for (unsigned r=0; r<row; ++r)
@@ -508,14 +508,14 @@ ex matrix::determinant(void) const
         c_zeros.push_back(uintpair(acc,c));
     }
     sort(c_zeros.begin(),c_zeros.end());
         c_zeros.push_back(uintpair(acc,c));
     }
     sort(c_zeros.begin(),c_zeros.end());
-    vector<unsigned> pre_sort;  // unfortunately vector<uintpair> can't be used
-                                // for permutation_sign.
-    for (vector<uintpair>::iterator i=c_zeros.begin(); i!=c_zeros.end(); ++i)
+    // unfortunately std::vector<uintpair> can't be used for permutation_sign.
+    std::vector<unsigned> pre_sort;
+    for (std::vector<uintpair>::iterator i=c_zeros.begin(); i!=c_zeros.end(); ++i)
         pre_sort.push_back(i->second);
     int sign = permutation_sign(pre_sort);
     exvector result(row*col);  // represents sorted matrix
     unsigned c = 0;
         pre_sort.push_back(i->second);
     int sign = permutation_sign(pre_sort);
     exvector result(row*col);  // represents sorted matrix
     unsigned c = 0;
-    for (vector<unsigned>::iterator i=pre_sort.begin();
+    for (std::vector<unsigned>::iterator i=pre_sort.begin();
          i!=pre_sort.end();
          ++i,++c) {
         for (unsigned r=0; r<row; ++r)
          i!=pre_sort.end();
          ++i,++c) {
         for (unsigned r=0; r<row; ++r)
@@ -894,14 +894,14 @@ ex matrix::determinant_minor(void) const
     // 2*binomial(n,n/2) minors.
     
     // Unique flipper counter for partitioning into minors
     // 2*binomial(n,n/2) minors.
     
     // Unique flipper counter for partitioning into minors
-    vector<unsigned> Pkey;
+    std::vector<unsigned> Pkey;
     Pkey.reserve(this->col);
     // key for minor determinant (a subpartition of Pkey)
     Pkey.reserve(this->col);
     // key for minor determinant (a subpartition of Pkey)
-    vector<unsigned> Mkey;
+    std::vector<unsigned> Mkey;
     Mkey.reserve(this->col-1);
     // we store our subminors in maps, keys being the rows they arise from
     Mkey.reserve(this->col-1);
     // we store our subminors in maps, keys being the rows they arise from
-    typedef map<vector<unsigned>,class ex> Rmap;
-    typedef map<vector<unsigned>,class ex>::value_type Rmap_value;
+    typedef std::map<std::vector<unsigned>,class ex> Rmap;
+    typedef std::map<std::vector<unsigned>,class ex>::value_type Rmap_value;
     Rmap A;
     Rmap B;
     ex det;
     Rmap A;
     Rmap B;
     ex det;
index dc8eb48246542e9ace9c50b9b96dde8060552a67..f4665278d6e51b17177af736deb905edbe76c1ef 100644 (file)
@@ -59,8 +59,8 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
     unsigned nops() const;
     ex op(int i) const;
     ex & let_op(int i);
     unsigned nops() const;
     ex op(int i) const;
     ex & let_op(int i);
index e6d4a617678589b1deb96f751f15937d890ab6d8..1cc7abf6d4c01210e403e6efbe12d6e3be5e1741 100644 (file)
@@ -183,7 +183,7 @@ basic * mul::duplicate() const
     return new mul(*this);
 }
 
     return new mul(*this);
 }
 
-void mul::print(ostream & os, unsigned upper_precedence) const
+void mul::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("mul print",LOGLEVEL_PRINT);
     if (precedence<=upper_precedence) os << "(";
 {
     debugmsg("mul print",LOGLEVEL_PRINT);
     if (precedence<=upper_precedence) os << "(";
@@ -218,7 +218,7 @@ void mul::print(ostream & os, unsigned upper_precedence) const
     if (precedence<=upper_precedence) os << ")";
 }
 
     if (precedence<=upper_precedence) os << ")";
 }
 
-void mul::printraw(ostream & os) const
+void mul::printraw(std::ostream & os) const
 {
     debugmsg("mul printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("mul printraw",LOGLEVEL_PRINT);
 
@@ -234,7 +234,7 @@ void mul::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void mul::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void mul::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("mul print csrc", LOGLEVEL_PRINT);
     if (precedence <= upper_precedence)
 {
     debugmsg("mul print csrc", LOGLEVEL_PRINT);
     if (precedence <= upper_precedence)
@@ -266,7 +266,7 @@ void mul::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) cons
             (ex(power(it->rest, abs(ex_to_numeric(it->coeff))))).bp->printcsrc(os, type, upper_precedence);
 
         // Separator is "/" for negative integer powers, "*" otherwise
             (ex(power(it->rest, abs(ex_to_numeric(it->coeff))))).bp->printcsrc(os, type, upper_precedence);
 
         // Separator is "/" for negative integer powers, "*" otherwise
-        it++;
+        ++it;
         if (it != itend) {
             if (ex_to_numeric(it->coeff).is_integer() && it->coeff.compare(_num0()) < 0)
                 os << "/";
         if (it != itend) {
             if (ex_to_numeric(it->coeff).is_integer() && it->coeff.compare(_num0()) < 0)
                 os << "/";
@@ -304,7 +304,7 @@ bool mul::info(unsigned inf) const
     return inherited::info(inf);
 }
 
     return inherited::info(inf);
 }
 
-typedef vector<int> intvector;
+typedef std::vector<int> intvector;
 
 int mul::degree(const symbol & s) const
 {
 
 int mul::degree(const symbol & s) const
 {
@@ -471,22 +471,21 @@ ex mul::simplify_ncmul(const exvector & v) const
 
 // protected
 
 
 // protected
 
-/** Implementation of ex::diff() for a product. It applies the product rule.
+/** Implementation of ex::diff() for a product.  It applies the product rule.
  *  @see ex::diff */
 ex mul::derivative(const symbol & s) const
 {
  *  @see ex::diff */
 ex mul::derivative(const symbol & s) const
 {
-    exvector new_seq;
-    new_seq.reserve(seq.size());
-
-    // D(a*b*c)=D(a)*b*c+a*D(b)*c+a*b*D(c)
-    for (unsigned i=0; i!=seq.size(); i++) {
-        epvector sub_seq = seq;
-        sub_seq[i] = split_ex_to_pair(sub_seq[i].coeff*
-                                      power(sub_seq[i].rest,sub_seq[i].coeff-1)*
-                                      sub_seq[i].rest.diff(s));
-        new_seq.push_back((new mul(sub_seq,overall_coeff))->setflag(status_flags::dynallocated));
+    exvector addseq;
+    addseq.reserve(seq.size());
+    
+    // D(a*b*c) = D(a)*b*c + a*D(b)*c + a*b*D(c)
+    for (unsigned i=0; i!=seq.size(); ++i) {
+        epvector mulseq = seq;
+        mulseq[i] = split_ex_to_pair(power(seq[i].rest,seq[i].coeff - _ex1())*
+                                     seq[i].rest.diff(s));
+        addseq.push_back((new mul(mulseq,overall_coeff*seq[i].coeff))->setflag(status_flags::dynallocated));
     }
     }
-    return (new add(new_seq))->setflag(status_flags::dynallocated);
+    return (new add(addseq))->setflag(status_flags::dynallocated);
 }
 
 int mul::compare_same_type(const basic & other) const
 }
 
 int mul::compare_same_type(const basic & other) const
@@ -574,9 +573,9 @@ expair mul::combine_ex_with_coeff_to_pair(const ex & e,
     // we create a temporary power object
     // otherwise it would be hard to correctly simplify
     // expression like (4^(1/3))^(3/2)
     // we create a temporary power object
     // otherwise it would be hard to correctly simplify
     // expression like (4^(1/3))^(3/2)
-    if (are_ex_trivially_equal(c,_ex1())) {
+    if (are_ex_trivially_equal(c,_ex1()))
         return split_ex_to_pair(e);
         return split_ex_to_pair(e);
-    }
+    
     return split_ex_to_pair(power(e,c));
 }
     
     return split_ex_to_pair(power(e,c));
 }
     
@@ -587,9 +586,9 @@ expair mul::combine_pair_with_coeff_to_pair(const expair & p,
     // we create a temporary power object
     // otherwise it would be hard to correctly simplify
     // expression like (4^(1/3))^(3/2)
     // we create a temporary power object
     // otherwise it would be hard to correctly simplify
     // expression like (4^(1/3))^(3/2)
-    if (are_ex_trivially_equal(c,_ex1())) {
+    if (are_ex_trivially_equal(c,_ex1()))
         return p;
         return p;
-    }
+    
     return split_ex_to_pair(power(recombine_pair_to_ex(p),c));
 }
     
     return split_ex_to_pair(power(recombine_pair_to_ex(p),c));
 }
     
@@ -597,11 +596,10 @@ ex mul::recombine_pair_to_ex(const expair & p) const
 {
     // if (p.coeff.compare(_ex1())==0) {
     // if (are_ex_trivially_equal(p.coeff,_ex1())) {
 {
     // if (p.coeff.compare(_ex1())==0) {
     // if (are_ex_trivially_equal(p.coeff,_ex1())) {
-    if (ex_to_numeric(p.coeff).is_equal(_num1())) {
+    if (ex_to_numeric(p.coeff).is_equal(_num1())) 
         return p.rest;
         return p.rest;
-    } else {
+    else
         return power(p.rest,p.coeff);
         return power(p.rest,p.coeff);
-    }
 }
 
 bool mul::expair_needs_further_processing(epp it)
 }
 
 bool mul::expair_needs_further_processing(epp it)
@@ -678,44 +676,39 @@ ex mul::expand(unsigned options) const
     
     unsigned current_position = 0;
     epvector::const_iterator last = expanded_seq.end();
     
     unsigned current_position = 0;
     epvector::const_iterator last = expanded_seq.end();
-    for (epvector::const_iterator cit=expanded_seq.begin(); cit!=last; ++cit) {
-        if (is_ex_exactly_of_type((*cit).rest,add)&&
-            (ex_to_numeric((*cit).coeff).is_equal(_num1()))) {
+    for (epvector::const_iterator cit = expanded_seq.begin(); cit!=last; ++cit) {
+        if (is_ex_exactly_of_type((*cit).rest,add) &&
+            ((*cit).coeff.is_equal(_ex1()))) {
             positions_of_adds[number_of_adds] = current_position;
             const add & expanded_addref = ex_to_add((*cit).rest);
             unsigned addref_nops = expanded_addref.nops();
             number_of_add_operands[number_of_adds] = addref_nops;
             number_of_expanded_terms *= addref_nops;
             positions_of_adds[number_of_adds] = current_position;
             const add & expanded_addref = ex_to_add((*cit).rest);
             unsigned addref_nops = expanded_addref.nops();
             number_of_add_operands[number_of_adds] = addref_nops;
             number_of_expanded_terms *= addref_nops;
-            number_of_adds++;
+            ++number_of_adds;
         }
         }
-        current_position++;
+        ++current_position;
     }
     
     if (number_of_adds==0) {
     }
     
     if (number_of_adds==0) {
-        if (expanded_seqp==0) {
+        if (expanded_seqp==0)
             return this->setflag(status_flags::expanded);
             return this->setflag(status_flags::expanded);
-        }
-        return (new mul(expanded_seqp,overall_coeff))->
-            setflag(status_flags::dynallocated |
-                    status_flags::expanded);
+        else
+            return ((new mul(expanded_seqp,overall_coeff))->
+                    setflag(status_flags::dynallocated |
+                            status_flags::expanded));
     }
     
     exvector distrseq;
     distrseq.reserve(number_of_expanded_terms);
     
     intvector k;
     }
     
     exvector distrseq;
     distrseq.reserve(number_of_expanded_terms);
     
     intvector k;
-    k.resize(number_of_adds);
-    
-    int l;
-    for (l=0; l<number_of_adds; l++) {
-        k[l]=0;
-    }
+    k.resize(number_of_adds, 0);
     
     while (1) {
         epvector term;
         term = expanded_seq;
     
     while (1) {
         epvector term;
         term = expanded_seq;
-        for (l=0; l<number_of_adds; l++) {
-            const add & addref=ex_to_add(expanded_seq[positions_of_adds[l]].rest);
+        for (int l=0; l<number_of_adds; ++l) {
+            const add & addref = ex_to_add(expanded_seq[positions_of_adds[l]].rest);
             GINAC_ASSERT(term[positions_of_adds[l]].coeff.compare(_ex1())==0);
             term[positions_of_adds[l]]=split_ex_to_pair(addref.op(k[l]));
         }
             GINAC_ASSERT(term[positions_of_adds[l]].coeff.compare(_ex1())==0);
             term[positions_of_adds[l]]=split_ex_to_pair(addref.op(k[l]));
         }
@@ -724,10 +717,10 @@ ex mul::expand(unsigned options) const
                                    status_flags::expanded));
         
         // increment k[]
                                    status_flags::expanded));
         
         // increment k[]
-        l=number_of_adds-1;
+        int l = number_of_adds-1;
         while ((l>=0) && ((++k[l])>=number_of_add_operands[l])) {
         while ((l>=0) && ((++k[l])>=number_of_add_operands[l])) {
-            k[l]=0;    
-            l--;
+            k[l] = 0;    
+            --l;
         }
         if (l<0) break;
     }
         }
         if (l<0) break;
     }
index a0a460027630db6f48871ec4c7ac1693e09a2809..b8409f4da35ae7f50647b0c04cb6fbafb242e1b8 100644 (file)
@@ -55,7 +55,6 @@ public:
     mul(const ex & lh, const ex & rh);
     mul(const exvector & v);
     mul(const epvector & v);
     mul(const ex & lh, const ex & rh);
     mul(const exvector & v);
     mul(const epvector & v);
-    //mul(const epvector & v, bool do_not_canonicalize=0);
     mul(const epvector & v, const ex & oc);
     mul(epvector * vp, const ex & oc);
     mul(const ex & lh, const ex & mh, const ex & rh);
     mul(const epvector & v, const ex & oc);
     mul(epvector * vp, const ex & oc);
     mul(const ex & lh, const ex & mh, const ex & rh);
@@ -63,17 +62,17 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence) const;
-    void printraw(ostream & os) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const;
+    void print(std::ostream & os, unsigned upper_precedence) const;
+    void printraw(std::ostream & os) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const;
     bool info(unsigned inf) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
     bool info(unsigned inf) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
-    ex coeff(const symbol & s, int n=1) const;
+    ex coeff(const symbol & s, int n = 1) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
-    ex series(const relational & s, int order) const;
-    ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+    ex series(const relational & s, int order, bool branchcut = true) const;
+    ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const;
     numeric integer_content(void) const;
     ex smod(const numeric &xi) const;
     numeric max_coefficient(void) const;
     numeric integer_content(void) const;
     ex smod(const numeric &xi) const;
     numeric max_coefficient(void) const;
index 7cd8014931db652672366b61bf9762ebb760603c..9d13a43da1b6fd56981b9070234fc986e4ddd4da 100644 (file)
@@ -173,13 +173,13 @@ basic * ncmul::duplicate() const
     return new ncmul(*this);
 }
 
     return new ncmul(*this);
 }
 
-void ncmul::print(ostream & os, unsigned upper_precedence) const
+void ncmul::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("ncmul print",LOGLEVEL_PRINT);
     printseq(os,'(','%',')',precedence,upper_precedence);
 }
 
 {
     debugmsg("ncmul print",LOGLEVEL_PRINT);
     printseq(os,'(','%',')',precedence,upper_precedence);
 }
 
-void ncmul::printraw(ostream & os) const
+void ncmul::printraw(std::ostream & os) const
 {
     debugmsg("ncmul printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("ncmul printraw",LOGLEVEL_PRINT);
 
@@ -192,7 +192,7 @@ void ncmul::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void ncmul::printcsrc(ostream & os, unsigned upper_precedence) const
+void ncmul::printcsrc(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("ncmul print csrc",LOGLEVEL_PRINT);
     exvector::const_iterator it;
 {
     debugmsg("ncmul print csrc",LOGLEVEL_PRINT);
     exvector::const_iterator it;
@@ -211,7 +211,7 @@ bool ncmul::info(unsigned inf) const
     throw(std::logic_error("which flags have to be implemented in ncmul::info()?"));
 }
 
     throw(std::logic_error("which flags have to be implemented in ncmul::info()?"));
 }
 
-typedef vector<int> intvector;
+typedef std::vector<int> intvector;
 
 ex ncmul::expand(unsigned options) const
 {
 
 ex ncmul::expand(unsigned options) const
 {
@@ -357,8 +357,8 @@ void ncmul::append_factors(exvector & v, const ex & e) const
     v.push_back(e);
 }
 
     v.push_back(e);
 }
 
-typedef vector<unsigned> unsignedvector;
-typedef vector<exvector> exvectorvector;
+typedef std::vector<unsigned> unsignedvector;
+typedef std::vector<exvector> exvectorvector;
 
 ex ncmul::eval(int level) const
 {
 
 ex ncmul::eval(int level) const
 {
index b5cc1669281670c872f120d31b7a0016c24b02ae..7476e290392762e46c57ccc7567de56b281a87d1 100644 (file)
@@ -66,9 +66,9 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence) const;
-    void printraw(ostream & os) const;
-    void printcsrc(ostream & os, unsigned upper_precedence) const;
+    void print(std::ostream & os, unsigned upper_precedence) const;
+    void printraw(std::ostream & os) const;
+    void printcsrc(std::ostream & os, unsigned upper_precedence) const;
     bool info(unsigned inf) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
     bool info(unsigned inf) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
index 79d16461631e4533beaf0d6856b9a17e0b3fa182..a15ec62d4ef1434ef1c38294ab8be41b732cb184 100644 (file)
@@ -145,7 +145,7 @@ struct sym_desc {
 };
 
 // Vector of sym_desc structures
 };
 
 // Vector of sym_desc structures
-typedef vector<sym_desc> sym_desc_vec;
+typedef std::vector<sym_desc> sym_desc_vec;
 
 // Add symbol the sym_desc_vec (used internally by get_symbol_stats())
 static void add_symbol(const symbol *s, sym_desc_vec &v)
 
 // Add symbol the sym_desc_vec (used internally by get_symbol_stats())
 static void add_symbol(const symbol *s, sym_desc_vec &v)
@@ -203,11 +203,11 @@ static void get_symbol_stats(const ex &a, const ex &b, sym_desc_vec &v)
     }
     sort(v.begin(), v.end());
 #if 0
     }
     sort(v.begin(), v.end());
 #if 0
-       clog << "Symbols:\n";
+       std::clog << "Symbols:\n";
        it = v.begin(); itend = v.end();
        while (it != itend) {
        it = v.begin(); itend = v.end();
        while (it != itend) {
-               clog << " " << *it->sym << ": deg_a=" << it->deg_a << ", deg_b=" << it->deg_b << ", ldeg_a=" << it->ldeg_a << ", ldeg_b=" << it->ldeg_b << ", max_deg=" << it->max_deg << endl;
-               clog << "  lcoeff_a=" << a.lcoeff(*(it->sym)) << ", lcoeff_b=" << b.lcoeff(*(it->sym)) << endl;
+               std::clog << " " << *it->sym << ": deg_a=" << it->deg_a << ", deg_b=" << it->deg_b << ", ldeg_a=" << it->ldeg_a << ", ldeg_b=" << it->ldeg_b << ", max_deg=" << it->max_deg << endl;
+               std::clog << "  lcoeff_a=" << a.lcoeff(*(it->sym)) << ", lcoeff_b=" << b.lcoeff(*(it->sym)) << endl;
                it++;
        }
 #endif
                it++;
        }
 #endif
@@ -608,8 +608,8 @@ bool divide(const ex &a, const ex &b, ex &q, bool check_args)
  *  Remembering
  */
 
  *  Remembering
  */
 
-typedef pair<ex, ex> ex2;
-typedef pair<ex, bool> exbool;
+typedef std::pair<ex, ex> ex2;
+typedef std::pair<ex, bool> exbool;
 
 struct ex2_less {
     bool operator() (const ex2 p, const ex2 q) const 
 
 struct ex2_less {
     bool operator() (const ex2 p, const ex2 q) const 
@@ -618,7 +618,7 @@ struct ex2_less {
     }
 };
 
     }
 };
 
-typedef map<ex2, exbool, ex2_less> ex2_exbool_remember;
+typedef std::map<ex2, exbool, ex2_less> ex2_exbool_remember;
 #endif
 
 
 #endif
 
 
@@ -893,7 +893,7 @@ ex ex::primpart(const symbol &x, const ex &c) const
 
 static ex eu_gcd(const ex &a, const ex &b, const symbol *x)
 {
 
 static ex eu_gcd(const ex &a, const ex &b, const symbol *x)
 {
-//clog << "eu_gcd(" << a << "," << b << ")\n";
+//std::clog << "eu_gcd(" << a << "," << b << ")\n";
 
     // Sort c and d so that c has higher degree
     ex c, d;
 
     // Sort c and d so that c has higher degree
     ex c, d;
@@ -913,7 +913,7 @@ static ex eu_gcd(const ex &a, const ex &b, const symbol *x)
        // Euclidean algorithm
     ex r;
     for (;;) {
        // Euclidean algorithm
     ex r;
     for (;;) {
-//clog << " d = " << d << endl;
+//std::clog << " d = " << d << endl;
         r = rem(c, d, *x, false);
         if (r.is_zero())
             return d / d.lcoeff(*x);
         r = rem(c, d, *x, false);
         if (r.is_zero())
             return d / d.lcoeff(*x);
@@ -935,7 +935,7 @@ static ex eu_gcd(const ex &a, const ex &b, const symbol *x)
 
 static ex euprem_gcd(const ex &a, const ex &b, const symbol *x)
 {
 
 static ex euprem_gcd(const ex &a, const ex &b, const symbol *x)
 {
-//clog << "euprem_gcd(" << a << "," << b << ")\n";
+//std::clog << "euprem_gcd(" << a << "," << b << ")\n";
 
     // Sort c and d so that c has higher degree
     ex c, d;
 
     // Sort c and d so that c has higher degree
     ex c, d;
@@ -954,7 +954,7 @@ static ex euprem_gcd(const ex &a, const ex &b, const symbol *x)
        // Euclidean algorithm with pseudo-remainders
     ex r;
     for (;;) {
        // Euclidean algorithm with pseudo-remainders
     ex r;
     for (;;) {
-//clog << " d = " << d << endl;
+//std::clog << " d = " << d << endl;
         r = prem(c, d, *x, false);
         if (r.is_zero())
             return d.primpart(*x) * gamma;
         r = prem(c, d, *x, false);
         if (r.is_zero())
             return d.primpart(*x) * gamma;
@@ -976,7 +976,7 @@ static ex euprem_gcd(const ex &a, const ex &b, const symbol *x)
 
 static ex peu_gcd(const ex &a, const ex &b, const symbol *x)
 {
 
 static ex peu_gcd(const ex &a, const ex &b, const symbol *x)
 {
-//clog << "peu_gcd(" << a << "," << b << ")\n";
+//std::clog << "peu_gcd(" << a << "," << b << ")\n";
 
     // Sort c and d so that c has higher degree
     ex c, d;
 
     // Sort c and d so that c has higher degree
     ex c, d;
@@ -1004,7 +1004,7 @@ static ex peu_gcd(const ex &a, const ex &b, const symbol *x)
     // Euclidean algorithm with content removal
        ex r;
     for (;;) {
     // Euclidean algorithm with content removal
        ex r;
     for (;;) {
-//clog << " d = " << d << endl;
+//std::clog << " d = " << d << endl;
         r = prem(c, d, *x, false);
         if (r.is_zero())
             return gamma * d;
         r = prem(c, d, *x, false);
         if (r.is_zero())
             return gamma * d;
@@ -1025,7 +1025,7 @@ static ex peu_gcd(const ex &a, const ex &b, const symbol *x)
 
 static ex red_gcd(const ex &a, const ex &b, const symbol *x)
 {
 
 static ex red_gcd(const ex &a, const ex &b, const symbol *x)
 {
-//clog << "red_gcd(" << a << "," << b << ")\n";
+//std::clog << "red_gcd(" << a << "," << b << ")\n";
 
     // Sort c and d so that c has higher degree
     ex c, d;
 
     // Sort c and d so that c has higher degree
     ex c, d;
@@ -1058,7 +1058,7 @@ static ex red_gcd(const ex &a, const ex &b, const symbol *x)
 
     for (;;) {
         // Calculate polynomial pseudo-remainder
 
     for (;;) {
         // Calculate polynomial pseudo-remainder
-//clog << " d = " << d << endl;
+//std::clog << " d = " << d << endl;
         r = prem(c, d, *x, false);
         if (r.is_zero())
             return gamma * d.primpart(*x);
         r = prem(c, d, *x, false);
         if (r.is_zero())
             return gamma * d.primpart(*x);
@@ -1092,7 +1092,7 @@ static ex red_gcd(const ex &a, const ex &b, const symbol *x)
 
 static ex sr_gcd(const ex &a, const ex &b, sym_desc_vec::const_iterator var)
 {
 
 static ex sr_gcd(const ex &a, const ex &b, sym_desc_vec::const_iterator var)
 {
-//clog << "sr_gcd(" << a << "," << b << ")\n";
+//std::clog << "sr_gcd(" << a << "," << b << ")\n";
 #if STATISTICS
        sr_gcd_called++;
 #endif
 #if STATISTICS
        sr_gcd_called++;
 #endif
@@ -1124,7 +1124,7 @@ static ex sr_gcd(const ex &a, const ex &b, sym_desc_vec::const_iterator var)
         return gamma;
     c = c.primpart(x, cont_c);
     d = d.primpart(x, cont_d);
         return gamma;
     c = c.primpart(x, cont_c);
     d = d.primpart(x, cont_d);
-//clog << " content " << gamma << " removed, continuing with sr_gcd(" << c << "," << d << ")\n";
+//std::clog << " content " << gamma << " removed, continuing with sr_gcd(" << c << "," << d << ")\n";
 
     // First element of subresultant sequence
     ex r = _ex0(), ri = _ex1(), psi = _ex1();
 
     // First element of subresultant sequence
     ex r = _ex0(), ri = _ex1(), psi = _ex1();
@@ -1132,14 +1132,14 @@ static ex sr_gcd(const ex &a, const ex &b, sym_desc_vec::const_iterator var)
 
     for (;;) {
         // Calculate polynomial pseudo-remainder
 
     for (;;) {
         // Calculate polynomial pseudo-remainder
-//clog << " start of loop, psi = " << psi << ", calculating pseudo-remainder...\n";
-//clog << " d = " << d << endl;
+//std::clog << " start of loop, psi = " << psi << ", calculating pseudo-remainder...\n";
+//std::clog << " d = " << d << endl;
         r = prem(c, d, x, false);
         if (r.is_zero())
             return gamma * d.primpart(x);
         c = d;
         cdeg = ddeg;
         r = prem(c, d, x, false);
         if (r.is_zero())
             return gamma * d.primpart(x);
         c = d;
         cdeg = ddeg;
-//clog << " dividing...\n";
+//std::clog << " dividing...\n";
         if (!divide_in_z(r, ri * pow(psi, delta), d, var+1))
             throw(std::runtime_error("invalid expression in sr_gcd(), division failed"));
         ddeg = d.degree(x);
         if (!divide_in_z(r, ri * pow(psi, delta), d, var+1))
             throw(std::runtime_error("invalid expression in sr_gcd(), division failed"));
         ddeg = d.degree(x);
@@ -1151,7 +1151,7 @@ static ex sr_gcd(const ex &a, const ex &b, sym_desc_vec::const_iterator var)
         }
 
         // Next element of subresultant sequence
         }
 
         // Next element of subresultant sequence
-//clog << " calculating next subresultant...\n";
+//std::clog << " calculating next subresultant...\n";
         ri = c.expand().lcoeff(x);
         if (delta == 1)
             psi = ri;
         ri = c.expand().lcoeff(x);
         if (delta == 1)
             psi = ri;
@@ -1326,7 +1326,7 @@ class gcdheu_failed {};
  *  @exception gcdheu_failed() */
 static ex heur_gcd(const ex &a, const ex &b, ex *ca, ex *cb, sym_desc_vec::const_iterator var)
 {
  *  @exception gcdheu_failed() */
 static ex heur_gcd(const ex &a, const ex &b, ex *ca, ex *cb, sym_desc_vec::const_iterator var)
 {
-//clog << "heur_gcd(" << a << "," << b << ")\n";
+//std::clog << "heur_gcd(" << a << "," << b << ")\n";
 #if STATISTICS
        heur_gcd_called++;
 #endif
 #if STATISTICS
        heur_gcd_called++;
 #endif
@@ -1365,7 +1365,7 @@ static ex heur_gcd(const ex &a, const ex &b, ex *ca, ex *cb, sym_desc_vec::const
     // 6 tries maximum
     for (int t=0; t<6; t++) {
         if (xi.int_length() * maxdeg > 100000) {
     // 6 tries maximum
     for (int t=0; t<6; t++) {
         if (xi.int_length() * maxdeg > 100000) {
-//clog << "giving up heur_gcd, xi.int_length = " << xi.int_length() << ", maxdeg = " << maxdeg << endl;
+//std::clog << "giving up heur_gcd, xi.int_length = " << xi.int_length() << ", maxdeg = " << maxdeg << endl;
             throw gcdheu_failed();
                }
 
             throw gcdheu_failed();
                }
 
@@ -1437,7 +1437,7 @@ static ex heur_gcd(const ex &a, const ex &b, ex *ca, ex *cb, sym_desc_vec::const
  *  @return the GCD as a new expression */
 ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args)
 {
  *  @return the GCD as a new expression */
 ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args)
 {
-//clog << "gcd(" << a << "," << b << ")\n";
+//std::clog << "gcd(" << a << "," << b << ")\n";
 #if STATISTICS
        gcd_called++;
 #endif
 #if STATISTICS
        gcd_called++;
 #endif
@@ -1588,20 +1588,20 @@ factored_b:
     int min_ldeg = min(ldeg_a, ldeg_b);
     if (min_ldeg > 0) {
         ex common = power(x, min_ldeg);
     int min_ldeg = min(ldeg_a, ldeg_b);
     if (min_ldeg > 0) {
         ex common = power(x, min_ldeg);
-//clog << "trivial common factor " << common << endl;
+//std::clog << "trivial common factor " << common << endl;
         return gcd((aex / common).expand(), (bex / common).expand(), ca, cb, false) * common;
     }
 
     // Try to eliminate variables
     if (var->deg_a == 0) {
         return gcd((aex / common).expand(), (bex / common).expand(), ca, cb, false) * common;
     }
 
     // Try to eliminate variables
     if (var->deg_a == 0) {
-//clog << "eliminating variable " << x << " from b" << endl;
+//std::clog << "eliminating variable " << x << " from b" << endl;
         ex c = bex.content(x);
         ex g = gcd(aex, c, ca, cb, false);
         if (cb)
             *cb *= bex.unit(x) * bex.primpart(x, c);
         return g;
     } else if (var->deg_b == 0) {
         ex c = bex.content(x);
         ex g = gcd(aex, c, ca, cb, false);
         if (cb)
             *cb *= bex.unit(x) * bex.primpart(x, c);
         return g;
     } else if (var->deg_b == 0) {
-//clog << "eliminating variable " << x << " from a" << endl;
+//std::clog << "eliminating variable " << x << " from a" << endl;
         ex c = aex.content(x);
         ex g = gcd(c, bex, ca, cb, false);
         if (ca)
         ex c = aex.content(x);
         ex g = gcd(c, bex, ca, cb, false);
         if (ca)
@@ -1618,7 +1618,7 @@ factored_b:
         g = *new ex(fail());
     }
     if (is_ex_exactly_of_type(g, fail)) {
         g = *new ex(fail());
     }
     if (is_ex_exactly_of_type(g, fail)) {
-//clog << "heuristics failed" << endl;
+//std::clog << "heuristics failed" << endl;
 #if STATISTICS
                heur_gcd_failed++;
 #endif
 #if STATISTICS
                heur_gcd_failed++;
 #endif
@@ -1853,7 +1853,7 @@ static ex frac_cancel(const ex &n, const ex &d)
     ex den = d;
     numeric pre_factor = _num1();
 
     ex den = d;
     numeric pre_factor = _num1();
 
-//clog << "frac_cancel num = " << num << ", den = " << den << endl;
+//std::clog << "frac_cancel num = " << num << ", den = " << den << endl;
 
     // Handle special cases where numerator or denominator is 0
     if (num.is_zero())
 
     // Handle special cases where numerator or denominator is 0
     if (num.is_zero())
@@ -1888,7 +1888,7 @@ static ex frac_cancel(const ex &n, const ex &d)
        }
 
        // Return result as list
        }
 
        // Return result as list
-//clog << " returns num = " << num << ", den = " << den << ", pre_factor = " << pre_factor << endl;
+//std::clog << " returns num = " << num << ", den = " << den << ", pre_factor = " << pre_factor << endl;
     return (new lst(num * pre_factor.numer(), den * pre_factor.denom()))->setflag(status_flags::dynallocated);
 }
 
     return (new lst(num * pre_factor.numer(), den * pre_factor.denom()))->setflag(status_flags::dynallocated);
 }
 
@@ -1936,13 +1936,13 @@ ex add::normal(lst &sym_lst, lst &repl_lst, int level) const
     // Determine common denominator
     ex den = _ex1();
     exvector::const_iterator ait = o.begin(), aitend = o.end();
     // Determine common denominator
     ex den = _ex1();
     exvector::const_iterator ait = o.begin(), aitend = o.end();
-//clog << "add::normal uses the following summands:\n";
+//std::clog << "add::normal uses the following summands:\n";
     while (ait != aitend) {
     while (ait != aitend) {
-//clog << " num = " << ait->op(0) << ", den = " << ait->op(1) << endl;
+//std::clog << " num = " << ait->op(0) << ", den = " << ait->op(1) << endl;
         den = lcm(ait->op(1), den, false);
         ait++;
     }
         den = lcm(ait->op(1), den, false);
         ait++;
     }
-//clog << " common denominator = " << den << endl;
+//std::clog << " common denominator = " << den << endl;
 
     // Add fractions
     if (den.is_equal(_ex1())) {
 
     // Add fractions
     if (den.is_equal(_ex1())) {
index f4dd738087de9fe0cc71b9f8a436694120b519e3..36b3551c9d64dac317c3a5f97f82bc42ea00b63c 100644 (file)
@@ -396,7 +396,7 @@ basic * numeric::duplicate() const
  *  long as it only uses cl_LF and no other floating point types.
  *
  *  @see numeric::print() */
  *  long as it only uses cl_LF and no other floating point types.
  *
  *  @see numeric::print() */
-static void print_real_number(ostream & os, const cl_R & num)
+static void print_real_number(std::ostream & os, const cl_R & num)
 {
     cl_print_flags ourflags;
     if (::instanceof(num, ::cl_RA_ring)) {
 {
     cl_print_flags ourflags;
     if (::instanceof(num, ::cl_RA_ring)) {
@@ -416,7 +416,7 @@ static void print_real_number(ostream & os, const cl_R & num)
  *  with the other routines and produces something compatible to ginsh input.
  *  
  *  @see print_real_number() */
  *  with the other routines and produces something compatible to ginsh input.
  *  
  *  @see print_real_number() */
-void numeric::print(ostream & os, unsigned upper_precedence) const
+void numeric::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("numeric print", LOGLEVEL_PRINT);
     if (this->is_real()) {
 {
     debugmsg("numeric print", LOGLEVEL_PRINT);
     if (this->is_real()) {
@@ -479,7 +479,7 @@ void numeric::print(ostream & os, unsigned upper_precedence) const
 }
 
 
 }
 
 
-void numeric::printraw(ostream & os) const
+void numeric::printraw(std::ostream & os) const
 {
     // The method printraw doesn't do much, it simply uses CLN's operator<<()
     // for output, which is ugly but reliable. e.g: 2+2i
 {
     // The method printraw doesn't do much, it simply uses CLN's operator<<()
     // for output, which is ugly but reliable. e.g: 2+2i
@@ -488,17 +488,18 @@ void numeric::printraw(ostream & os) const
 }
 
 
 }
 
 
-void numeric::printtree(ostream & os, unsigned indent) const
+void numeric::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("numeric printtree", LOGLEVEL_PRINT);
     os << std::string(indent,' ') << *value
        << " (numeric): "
 {
     debugmsg("numeric printtree", LOGLEVEL_PRINT);
     os << std::string(indent,' ') << *value
        << " (numeric): "
-       << "hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+       << "hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 
 }
 
 
-void numeric::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void numeric::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("numeric print csrc", LOGLEVEL_PRINT);
     ios::fmtflags oldflags = os.flags();
 {
     debugmsg("numeric print csrc", LOGLEVEL_PRINT);
     ios::fmtflags oldflags = os.flags();
@@ -616,9 +617,10 @@ ex numeric::eval(int level) const
 
 /** Cast numeric into a floating-point object.  For example exact numeric(1) is
  *  returned as a 1.0000000000000000000000 and so on according to how Digits is
 
 /** Cast numeric into a floating-point object.  For example exact numeric(1) is
  *  returned as a 1.0000000000000000000000 and so on according to how Digits is
- *  currently set.
+ *  currently set.  In case the object already was a floating point number the
+ *  precision is trimmed to match the currently set default.
  *
  *
- *  @param level  ignored, but needed for overriding basic::evalf.
+ *  @param level  ignored, only needed for overriding basic::evalf.
  *  @return  an ex-handle to a numeric. */
 ex numeric::evalf(int level) const
 {
  *  @return  an ex-handle to a numeric. */
 ex numeric::evalf(int level) const
 {
@@ -1360,6 +1362,106 @@ const numeric atanh(const numeric & x)
 }
 
 
 }
 
 
+/*static ::cl_N Li2_series(const ::cl_N & x,
+                         const ::cl_float_format_t & prec)
+{
+    // Note: argument must be in the unit circle
+    // This is very inefficient unless we have fast floating point Bernoulli
+    // numbers implemented!
+    ::cl_N c1 = -::log(1-x);
+    ::cl_N c2 = c1;
+    // hard-wire the first two Bernoulli numbers
+    ::cl_N acc = c1 - ::square(c1)/4;
+    ::cl_N aug;
+    ::cl_F pisq = ::square(::cl_pi(prec));  // pi^2
+    ::cl_F piac = ::cl_float(1, prec);  // accumulator: pi^(2*i)
+    unsigned i = 1;
+    c1 = ::square(c1);
+    do {
+        c2 = c1 * c2;
+        piac = piac * pisq;
+        aug = c2 * (*(bernoulli(numeric(2*i)).clnptr())) / ::factorial(2*i+1);
+        // aug = c2 * ::cl_I(i%2 ? 1 : -1) / ::cl_I(2*i+1) * ::cl_zeta(2*i, prec) / piac / (::cl_I(1)<<(2*i-1));
+        acc = acc + aug;
+        ++i;
+    } while (acc != acc+aug);
+    return acc;
+}*/
+
+/** Numeric evaluation of Dilogarithm within circle of convergence (unit
+ *  circle) using a power series. */
+static ::cl_N Li2_series(const ::cl_N & x,
+                         const ::cl_float_format_t & prec)
+{
+    // Note: argument must be in the unit circle
+    ::cl_N aug, acc;
+    ::cl_N num = ::complex(::cl_float(1, prec), 0);
+    ::cl_I den = 0;
+    unsigned i = 1;
+    do {
+        num = num * x;
+        den = den + i;  // 1, 4, 9, 16, ...
+        i += 2;
+        aug = num / den;
+        acc = acc + aug;
+    } while (acc != acc+aug);
+    return acc;
+}
+
+/** Folds Li2's argument inside a small rectangle to enhance convergence. */
+static ::cl_N Li2_projection(const ::cl_N & x,
+                             const ::cl_float_format_t & prec)
+{
+    const ::cl_R re = ::realpart(x);
+    const ::cl_R im = ::imagpart(x);
+    if (re > ::cl_F(".5"))
+        // zeta(2) - Li2(1-x) - log(x)*log(1-x)
+        return(::cl_zeta(2)
+               - Li2_series(1-x, prec)
+               - ::log(x)*::log(1-x));
+    if ((re <= 0 && ::abs(im) > ::cl_F(".75")) || (re < ::cl_F("-.5")))
+        // -log(1-x)^2 / 2 - Li2(x/(x-1))
+        return(-::square(::log(1-x))/2
+               - Li2_series(x/(x-1), prec));
+    if (re > 0 && ::abs(im) > ::cl_LF(".75"))
+        // Li2(x^2)/2 - Li2(-x)
+        return(Li2_projection(::square(x), prec)/2
+               - Li2_projection(-x, prec));
+    return Li2_series(x, prec);
+}
+
+/** Numeric evaluation of Dilogarithm.  The domain is the entire complex plane,
+ *  the branch cut lies along the positive real axis, starting at 1 and
+ *  continuous with quadrant IV.
+ *
+ *  @return  arbitrary precision numerical Li2(x). */
+const numeric Li2(const numeric & x)
+{
+    if (::zerop(*x.value))
+        return x;
+    
+    // what is the desired float format?
+    // first guess: default format
+    ::cl_float_format_t prec = ::cl_default_float_format;
+    // second guess: the argument's format
+    if (!::instanceof(::realpart(*x.value),cl_RA_ring))
+        prec = ::cl_float_format(The(::cl_F)(::realpart(*x.value)));
+    else if (!::instanceof(::imagpart(*x.value),cl_RA_ring))
+        prec = ::cl_float_format(The(::cl_F)(::imagpart(*x.value)));
+    
+    if (*x.value==1)  // may cause trouble with log(1-x)
+        return ::cl_zeta(2, prec);
+    
+    if (::abs(*x.value) > 1)
+        // -log(-x)^2 / 2 - zeta(2) - Li2(1/x)
+        return(-::square(::log(-*x.value))/2
+               - ::cl_zeta(2, prec)
+               - Li2_projection(::recip(*x.value), prec));
+    else
+        return Li2_projection(*x.value, prec);
+}
+
+
 /** Numeric evaluation of Riemann's Zeta function.  Currently works only for
  *  integer arguments. */
 const numeric zeta(const numeric & x)
 /** Numeric evaluation of Riemann's Zeta function.  Currently works only for
  *  integer arguments. */
 const numeric zeta(const numeric & x)
@@ -1371,12 +1473,12 @@ const numeric zeta(const numeric & x)
     // pass the number casted to an int:
     if (x.is_real()) {
         int aux = (int)(::cl_double_approx(::realpart(*x.value)));
     // pass the number casted to an int:
     if (x.is_real()) {
         int aux = (int)(::cl_double_approx(::realpart(*x.value)));
-        if (zerop(*x.value-aux))
+        if (::zerop(*x.value-aux))
             return ::cl_zeta(aux);  // -> CLN
     }
             return ::cl_zeta(aux);  // -> CLN
     }
-    clog << "zeta(" << x
-         << "): Does anybody know good way to calculate this numerically?"
-         << endl;
+    std::clog << "zeta(" << x
+              << "): Does anybody know good way to calculate this numerically?"
+              << std::endl;
     return numeric(0);
 }
 
     return numeric(0);
 }
 
@@ -1385,16 +1487,16 @@ const numeric zeta(const numeric & x)
  *  This is only a stub! */
 const numeric lgamma(const numeric & x)
 {
  *  This is only a stub! */
 const numeric lgamma(const numeric & x)
 {
-    clog << "lgamma(" << x
-         << "): Does anybody know good way to calculate this numerically?"
-         << endl;
+    std::clog << "lgamma(" << x
+              << "): Does anybody know good way to calculate this numerically?"
+              << std::endl;
     return numeric(0);
 }
 const numeric tgamma(const numeric & x)
 {
     return numeric(0);
 }
 const numeric tgamma(const numeric & x)
 {
-    clog << "tgamma(" << x
-         << "): Does anybody know good way to calculate this numerically?"
-         << endl;
+    std::clog << "tgamma(" << x
+              << "): Does anybody know good way to calculate this numerically?"
+              << std::endl;
     return numeric(0);
 }
 
     return numeric(0);
 }
 
@@ -1403,9 +1505,9 @@ const numeric tgamma(const numeric & x)
  *  This is only a stub! */
 const numeric psi(const numeric & x)
 {
  *  This is only a stub! */
 const numeric psi(const numeric & x)
 {
-    clog << "psi(" << x
-         << "): Does anybody know good way to calculate this numerically?"
-         << endl;
+    std::clog << "psi(" << x
+              << "): Does anybody know good way to calculate this numerically?"
+              << std::endl;
     return numeric(0);
 }
 
     return numeric(0);
 }
 
@@ -1414,9 +1516,9 @@ const numeric psi(const numeric & x)
  *  This is only a stub! */
 const numeric psi(const numeric & n, const numeric & x)
 {
  *  This is only a stub! */
 const numeric psi(const numeric & n, const numeric & x)
 {
-    clog << "psi(" << n << "," << x
-         << "): Does anybody know good way to calculate this numerically?"
-         << endl;
+    std::clog << "psi(" << n << "," << x
+              << "): Does anybody know good way to calculate this numerically?"
+              << std::endl;
     return numeric(0);
 }
 
     return numeric(0);
 }
 
@@ -1515,13 +1617,13 @@ const numeric bernoulli(const numeric & nn)
     // we don't use it.)
     
     // the special cases not covered by the algorithm below
     // we don't use it.)
     
     // the special cases not covered by the algorithm below
-    if (!nn.compare(_num1()))
-        return numeric(-1,2);
+    if (nn.is_equal(_num1()))
+        return _num_1_2();
     if (nn.is_odd())
         return _num0();
     
     // store nonvanishing Bernoulli numbers here
     if (nn.is_odd())
         return _num0();
     
     // store nonvanishing Bernoulli numbers here
-    static vector< ::cl_RA > results;
+    static std::vector< ::cl_RA > results;
     static int highest_result = 0;
     // algorithm not applicable to B(0), so just store it
     if (results.size()==0)
     static int highest_result = 0;
     // algorithm not applicable to B(0), so just store it
     if (results.size()==0)
@@ -1535,13 +1637,13 @@ const numeric bernoulli(const numeric & nn)
         long d1 = i;
         long d2 = 2*i-1;
         for (int j=i; j>0; --j) {
         long d1 = i;
         long d2 = 2*i-1;
         for (int j=i; j>0; --j) {
-            B = cl_I(n*m) * (B+results[j]) / (d1*d2);
+            B = ::cl_I(n*m) * (B+results[j]) / (d1*d2);
             n += 4;
             m += 2;
             d1 -= 1;
             d2 -= 2;
         }
             n += 4;
             m += 2;
             d1 -= 1;
             d2 -= 2;
         }
-        B = (1 - ((B+1)/(2*i+3))) / (cl_I(1)<<(2*i+2));
+        B = (1 - ((B+1)/(2*i+3))) / (::cl_I(1)<<(2*i+2));
         results.push_back(B);
         ++highest_result;
     }
         results.push_back(B);
         ++highest_result;
     }
@@ -1816,14 +1918,14 @@ _numeric_digits::operator long()
 }
 
 
 }
 
 
-void _numeric_digits::print(ostream & os) const
+void _numeric_digits::print(std::ostream & os) const
 {
     debugmsg("_numeric_digits print", LOGLEVEL_PRINT);
     os << digits;
 }
 
 
 {
     debugmsg("_numeric_digits print", LOGLEVEL_PRINT);
     os << digits;
 }
 
 
-ostream& operator<<(ostream& os, const _numeric_digits & e)
+std::ostream& operator<<(std::ostream& os, const _numeric_digits & e)
 {
     e.print(os);
     return os;
 {
     e.print(os);
     return os;
index 7fb9d9d77ecd8dba4e0a4ef4ebe20485d5908dcb..d55e1d134e70b719dd5b6753f6af5506d6f80640 100644 (file)
@@ -52,7 +52,7 @@ public:
     _numeric_digits();
     _numeric_digits& operator=(long prec);
     operator long();
     _numeric_digits();
     _numeric_digits& operator=(long prec);
     operator long();
-    void print(ostream & os) const;
+    void print(std::ostream & os) const;
 // member variables
 private:
     long digits;
 // member variables
 private:
     long digits;
@@ -81,8 +81,9 @@ class numeric : public basic
     friend const numeric asinh(const numeric & x);
     friend const numeric acosh(const numeric & x);
     friend const numeric atanh(const numeric & x);
     friend const numeric asinh(const numeric & x);
     friend const numeric acosh(const numeric & x);
     friend const numeric atanh(const numeric & x);
+    friend const numeric Li2(const numeric & x);
     friend const numeric zeta(const numeric & x);
     friend const numeric zeta(const numeric & x);
-    friend const numeric bernoulli(const numeric & n);
+    // friend const numeric bernoulli(const numeric & n);
     friend const numeric fibonacci(const numeric & n);
     friend numeric abs(const numeric & x);
     friend numeric mod(const numeric & a, const numeric & b);
     friend const numeric fibonacci(const numeric & n);
     friend numeric abs(const numeric & x);
     friend numeric mod(const numeric & a, const numeric & b);
@@ -123,10 +124,10 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned precedence=0) const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void printcsrc(ostream & os, unsigned type, unsigned precedence=0) const;
+    void print(std::ostream & os, unsigned precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned precedence=0) const;
     bool info(unsigned inf) const;
     bool has(const ex & other) const;
     ex eval(int level=0) const;
     bool info(unsigned inf) const;
     bool has(const ex & other) const;
     ex eval(int level=0) const;
@@ -165,6 +166,7 @@ public:
     const numeric & operator=(const char * s);
     numeric inverse(void) const;
     int csgn(void) const;
     const numeric & operator=(const char * s);
     numeric inverse(void) const;
     int csgn(void) const;
+    ::cl_N* clnptr(void) const { return value; } /**< ptr to representation. */
     int compare(const numeric & other) const;
     bool is_equal(const numeric & other) const;
     bool is_zero(void) const;
     int compare(const numeric & other) const;
     bool is_equal(const numeric & other) const;
     bool is_zero(void) const;
@@ -232,6 +234,7 @@ const numeric tanh(const numeric & x);
 const numeric asinh(const numeric & x);
 const numeric acosh(const numeric & x);
 const numeric atanh(const numeric & x);
 const numeric asinh(const numeric & x);
 const numeric acosh(const numeric & x);
 const numeric atanh(const numeric & x);
+const numeric Li2(const numeric & x);
 const numeric zeta(const numeric & x);
 const numeric lgamma(const numeric & x);
 const numeric tgamma(const numeric & x);
 const numeric zeta(const numeric & x);
 const numeric lgamma(const numeric & x);
 const numeric tgamma(const numeric & x);
index f901760e72e3eb0421f6a4d076aed1d3e04ba8de..f0d2eb8da57bb18ddec0d30dbd73705c82019ae6 100644 (file)
@@ -257,13 +257,13 @@ relational operator>=(const ex & lh, const ex & rh)
 
 // input/output stream operators
 
 
 // input/output stream operators
 
-ostream & operator<<(ostream & os, const ex & e)
+std::ostream & operator<<(std::ostream & os, const ex & e)
 {
     e.print(os);
     return os;
 }
 
 {
     e.print(os);
     return os;
 }
 
-istream & operator>>(istream & is, ex & e)
+std::istream & operator>>(std::istream & is, ex & e)
 {
     throw (std::logic_error("expression input from streams not implemented"));
 }
 {
     throw (std::logic_error("expression input from streams not implemented"));
 }
index a7d84b0ada2642333dc0089c853d3386fdda68d6..30702ff18f9000da47f586e8818be8dc0224fb58 100644 (file)
@@ -79,8 +79,8 @@ relational operator>(const ex & lh, const ex & rh);
 relational operator>=(const ex & lh, const ex & rh);
 
 // input/output stream operators
 relational operator>=(const ex & lh, const ex & rh);
 
 // input/output stream operators
-ostream & operator<<(ostream & os, const ex & e);
-istream & operator>>(istream & is, ex & e);
+std::ostream & operator<<(std::ostream & os, const ex & e);
+std::istream & operator>>(std::istream & is, ex & e);
 
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
 
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
index 8ec1945f718ea833571b978448ceee7d68469f3f..fc52a5f814684845d23ba427fcf4216389fce14e 100644 (file)
@@ -42,7 +42,7 @@ namespace GiNaC {
 
 GINAC_IMPLEMENT_REGISTERED_CLASS(power, basic)
 
 
 GINAC_IMPLEMENT_REGISTERED_CLASS(power, basic)
 
-typedef vector<int> intvector;
+typedef std::vector<int> intvector;
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
@@ -147,7 +147,7 @@ basic * power::duplicate() const
     return new power(*this);
 }
 
     return new power(*this);
 }
 
-void power::print(ostream & os, unsigned upper_precedence) const
+void power::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("power print",LOGLEVEL_PRINT);
     if (exponent.is_equal(_ex1_2())) {
 {
     debugmsg("power print",LOGLEVEL_PRINT);
     if (exponent.is_equal(_ex1_2())) {
@@ -161,7 +161,7 @@ void power::print(ostream & os, unsigned upper_precedence) const
     }
 }
 
     }
 }
 
-void power::printraw(ostream & os) const
+void power::printraw(std::ostream & os) const
 {
     debugmsg("power printraw",LOGLEVEL_PRINT);
 
 {
     debugmsg("power printraw",LOGLEVEL_PRINT);
 
@@ -172,18 +172,19 @@ void power::printraw(ostream & os) const
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void power::printtree(ostream & os, unsigned indent) const
+void power::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("power printtree",LOGLEVEL_PRINT);
 
 {
     debugmsg("power printtree",LOGLEVEL_PRINT);
 
-    os << string(indent,' ') << "power: "
-       << "hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
-    basis.printtree(os,indent+delta_indent);
-    exponent.printtree(os,indent+delta_indent);
+    os << std::string(indent,' ') << "power: "
+       << "hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
+    basis.printtree(os, indent+delta_indent);
+    exponent.printtree(os, indent+delta_indent);
 }
 
 }
 
-static void print_sym_pow(ostream & os, unsigned type, const symbol &x, int exp)
+static void print_sym_pow(std::ostream & os, unsigned type, const symbol &x, int exp)
 {
     // Optimal output of integer powers of symbols to aid compiler CSE
     if (exp == 1) {
 {
     // Optimal output of integer powers of symbols to aid compiler CSE
     if (exp == 1) {
@@ -205,7 +206,7 @@ static void print_sym_pow(ostream & os, unsigned type, const symbol &x, int exp)
     }
 }
 
     }
 }
 
-void power::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void power::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("power print csrc", LOGLEVEL_PRINT);
     
 {
     debugmsg("power print csrc", LOGLEVEL_PRINT);
     
@@ -370,7 +371,7 @@ ex power::eval(int level) const
         if ((num_exponent->real()).is_zero())
             throw (std::domain_error("power::eval(): pow(0,I) is undefined"));
         else if ((num_exponent->real()).is_negative())
         if ((num_exponent->real()).is_zero())
             throw (std::domain_error("power::eval(): pow(0,I) is undefined"));
         else if ((num_exponent->real()).is_negative())
-            throw (std::overflow_error("power::eval(): division by zero"));
+            throw (pole_error("power::eval(): division by zero",1));
         else
             return _ex0();
     }
         else
             return _ex0();
     }
@@ -524,7 +525,12 @@ ex power::derivative(const symbol & s) const
 {
     if (exponent.info(info_flags::real)) {
         // D(b^r) = r * b^(r-1) * D(b) (faster than the formula below)
 {
     if (exponent.info(info_flags::real)) {
         // D(b^r) = r * b^(r-1) * D(b) (faster than the formula below)
-        return mul(mul(exponent, power(basis, exponent - _ex1())), basis.diff(s));
+        //return mul(mul(exponent, power(basis, exponent - _ex1())), basis.diff(s));
+        epvector newseq;
+        newseq.reserve(2);
+        newseq.push_back(expair(basis, exponent - _ex1()));
+        newseq.push_back(expair(basis.diff(s),_ex1()));
+        return mul(newseq, exponent);
     } else {
         // D(b^e) = b^e * (D(e)*ln(b) + e*D(b)/b)
         return mul(power(basis, exponent),
     } else {
         // D(b^e) = b^e * (D(e)*ln(b) + e*D(b)/b)
         return mul(power(basis, exponent),
index b4faa178a6daadfe8a708c218ab375e4023cb5a2..3d8be419acbe2d8a0369024e04815255f720f7b9 100644 (file)
@@ -61,21 +61,21 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void print(std::ostream & os, unsigned upper_precedence = 0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence = 0) const;
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex & let_op(int i);
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex & let_op(int i);
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
-    ex coeff(const symbol & s, int n=1) const;
+    ex coeff(const symbol & s, int n = 1) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
-    ex series(const relational & s, int order) const;
+    ex series(const relational & s, int order, bool branchcut = true) const;
     ex subs(const lst & ls, const lst & lr) const;
     ex subs(const lst & ls, const lst & lr) const;
-    ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+    ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const;
     ex to_rational(lst &repl_lst) const;
     ex simplify_ncmul(const exvector & v) const;
 protected:
     ex to_rational(lst &repl_lst) const;
     ex simplify_ncmul(const exvector & v) const;
 protected:
@@ -83,7 +83,7 @@ protected:
     int compare_same_type(const basic & other) const;
     unsigned return_type(void) const;
     unsigned return_type_tinfo(void) const;
     int compare_same_type(const basic & other) const;
     unsigned return_type(void) const;
     unsigned return_type_tinfo(void) const;
-    ex expand(unsigned options=0) const;
+    ex expand(unsigned options = 0) const;
     
     // new virtual functions which can be overridden by derived classes
     // none
     
     // new virtual functions which can be overridden by derived classes
     // none
index d12907a2cbb43d6c1efc20ad06ca6744fc1d1ee8..38499480fd5aba5e6d0f44983109d2dd39195cae 100644 (file)
@@ -97,13 +97,13 @@ void pseries::destroy(bool call_parent)
  *  the last coefficient can be Order(_ex1()) to represent a truncated,
  *  non-terminating series.
  *
  *  the last coefficient can be Order(_ex1()) to represent a truncated,
  *  non-terminating series.
  *
- *  @param rel__  expansion variable and point (must hold a relational)
+ *  @param rel_  expansion variable and point (must hold a relational)
  *  @param ops_  vector of {coefficient, power} pairs (coefficient must not be zero)
  *  @return newly constructed pseries */
 pseries::pseries(const ex &rel_, const epvector &ops_)
     : basic(TINFO_pseries), seq(ops_)
 {
  *  @param ops_  vector of {coefficient, power} pairs (coefficient must not be zero)
  *  @return newly constructed pseries */
 pseries::pseries(const ex &rel_, const epvector &ops_)
     : basic(TINFO_pseries), seq(ops_)
 {
-    debugmsg("pseries constructor from rel,epvector", LOGLEVEL_CONSTRUCT);
+    debugmsg("pseries constructor from ex,epvector", LOGLEVEL_CONSTRUCT);
     GINAC_ASSERT(is_ex_exactly_of_type(rel_, relational));
     GINAC_ASSERT(is_ex_exactly_of_type(rel_.lhs(),symbol));
     point = rel_.rhs();
     GINAC_ASSERT(is_ex_exactly_of_type(rel_, relational));
     GINAC_ASSERT(is_ex_exactly_of_type(rel_.lhs(),symbol));
     point = rel_.rhs();
@@ -119,7 +119,7 @@ pseries::pseries(const ex &rel_, const epvector &ops_)
 pseries::pseries(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
 {
     debugmsg("pseries constructor from archive_node", LOGLEVEL_CONSTRUCT);
 pseries::pseries(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
 {
     debugmsg("pseries constructor from archive_node", LOGLEVEL_CONSTRUCT);
-    for (unsigned int i=0; true; i++) {
+    for (unsigned int i=0; true; ++i) {
         ex rest;
         ex coeff;
         if (n.find_ex("coeff", rest, sym_lst, i) && n.find_ex("power", coeff, sym_lst, i))
         ex rest;
         ex coeff;
         if (n.find_ex("coeff", rest, sym_lst, i) && n.find_ex("power", coeff, sym_lst, i))
@@ -145,7 +145,7 @@ void pseries::archive(archive_node &n) const
     while (i != iend) {
         n.add_ex("coeff", i->rest);
         n.add_ex("power", i->coeff);
     while (i != iend) {
         n.add_ex("coeff", i->rest);
         n.add_ex("power", i->coeff);
-        i++;
+        ++i;
     }
     n.add_ex("var", var);
     n.add_ex("point", point);
     }
     n.add_ex("var", var);
     n.add_ex("point", point);
@@ -161,10 +161,10 @@ basic *pseries::duplicate() const
     return new pseries(*this);
 }
 
     return new pseries(*this);
 }
 
-void pseries::print(ostream &os, unsigned upper_precedence) const
+void pseries::print(std::ostream &os, unsigned upper_precedence) const
 {
     debugmsg("pseries print", LOGLEVEL_PRINT);
 {
     debugmsg("pseries print", LOGLEVEL_PRINT);
-    for (epvector::const_iterator i=seq.begin(); i!=seq.end(); i++) {
+    for (epvector::const_iterator i=seq.begin(); i!=seq.end(); ++i) {
         // omit zero terms
         if (i->rest.is_zero())
             continue;
         // omit zero terms
         if (i->rest.is_zero())
             continue;
@@ -199,38 +199,43 @@ void pseries::print(ostream &os, unsigned upper_precedence) const
     }
 }
 
     }
 }
 
-void pseries::printraw(ostream &os) const
+
+void pseries::printraw(std::ostream &os) const
 {
     debugmsg("pseries printraw", LOGLEVEL_PRINT);
     os << "pseries(" << var << ";" << point << ";";
 {
     debugmsg("pseries printraw", LOGLEVEL_PRINT);
     os << "pseries(" << var << ";" << point << ";";
-    for (epvector::const_iterator i=seq.begin(); i!=seq.end(); i++) {
+    for (epvector::const_iterator i=seq.begin(); i!=seq.end(); ++i) {
         os << "(" << (*i).rest << "," << (*i).coeff << "),";
     }
     os << ")";
 }
 
         os << "(" << (*i).rest << "," << (*i).coeff << "),";
     }
     os << ")";
 }
 
-void pseries::printtree(ostream & os, unsigned indent) const
+
+void pseries::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("pseries printtree",LOGLEVEL_PRINT);
 {
     debugmsg("pseries printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << "pseries " 
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+    os << std::string(indent,' ') << "pseries " 
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
     for (unsigned i=0; i<seq.size(); ++i) {
         seq[i].rest.printtree(os,indent+delta_indent);
         seq[i].coeff.printtree(os,indent+delta_indent);
     for (unsigned i=0; i<seq.size(); ++i) {
         seq[i].rest.printtree(os,indent+delta_indent);
         seq[i].coeff.printtree(os,indent+delta_indent);
-        if (i!=seq.size()-1) {
-            os << string(indent+delta_indent,' ') << "-----" << endl;
-        }
+        if (i!=seq.size()-1)
+            os << std::string(indent+delta_indent,' ') << "-----" << std::endl;
     }
     var.printtree(os, indent+delta_indent);
     point.printtree(os, indent+delta_indent);
 }
 
     }
     var.printtree(os, indent+delta_indent);
     point.printtree(os, indent+delta_indent);
 }
 
+/** Return the number of operands including a possible order term. */
 unsigned pseries::nops(void) const
 {
     return seq.size();
 }
 
 unsigned pseries::nops(void) const
 {
     return seq.size();
 }
 
+
+/** Return the ith term in the series when represented as a sum. */
 ex pseries::op(int i) const
 {
     if (i < 0 || unsigned(i) >= seq.size())
 ex pseries::op(int i) const
 {
     if (i < 0 || unsigned(i) >= seq.size())
@@ -238,11 +243,16 @@ ex pseries::op(int i) const
     return seq[i].rest * power(var - point, seq[i].coeff);
 }
 
     return seq[i].rest * power(var - point, seq[i].coeff);
 }
 
+
 ex &pseries::let_op(int i)
 {
     throw (std::logic_error("let_op not defined for pseries"));
 }
 
 ex &pseries::let_op(int i)
 {
     throw (std::logic_error("let_op not defined for pseries"));
 }
 
+
+/** Return degree of highest power of the series.  This is usually the exponent
+ *  of the Order term.  If s is not the expansion variable of the series, the
+ *  series is examined termwise. */
 int pseries::degree(const symbol &s) const
 {
     if (var.is_equal(s)) {
 int pseries::degree(const symbol &s) const
 {
     if (var.is_equal(s)) {
@@ -260,12 +270,17 @@ int pseries::degree(const symbol &s) const
             int pow = it->rest.degree(s);
             if (pow > max_pow)
                 max_pow = pow;
             int pow = it->rest.degree(s);
             if (pow > max_pow)
                 max_pow = pow;
-            it++;
+            ++it;
         }
         return max_pow;
     }
 }
 
         }
         return max_pow;
     }
 }
 
+/** Return degree of lowest power of the series.  This is usually the exponent
+ *  of the leading term.  If s is not the expansion variable of the series, the
+ *  series is examined termwise.  If s is the expansion variable but the
+ *  expansion point is not zero the series is not expanded to find the degree.
+ *  I.e.: (1-x) + (1-x)^2 + Order((1-x)^3) has ldegree(x) 1, not 0. */
 int pseries::ldegree(const symbol &s) const
 {
     if (var.is_equal(s)) {
 int pseries::ldegree(const symbol &s) const
 {
     if (var.is_equal(s)) {
@@ -283,7 +298,7 @@ int pseries::ldegree(const symbol &s) const
             int pow = it->rest.ldegree(s);
             if (pow < min_pow)
                 min_pow = pow;
             int pow = it->rest.ldegree(s);
             if (pow < min_pow)
                 min_pow = pow;
-            it++;
+            ++it;
         }
         return min_pow;
     }
         }
         return min_pow;
     }
@@ -294,7 +309,7 @@ ex pseries::coeff(const symbol &s, int n) const
     if (var.is_equal(s)) {
         if (seq.size() == 0)
             return _ex0();
     if (var.is_equal(s)) {
         if (seq.size() == 0)
             return _ex0();
-
+        
         // Binary search in sequence for given power
         numeric looking_for = numeric(n);
         int lo = 0, hi = seq.size() - 1;
         // Binary search in sequence for given power
         numeric looking_for = numeric(n);
         int lo = 0, hi = seq.size() - 1;
@@ -320,11 +335,13 @@ ex pseries::coeff(const symbol &s, int n) const
         return convert_to_poly().coeff(s, n);
 }
 
         return convert_to_poly().coeff(s, n);
 }
 
+
 ex pseries::collect(const symbol &s) const
 {
     return *this;
 }
 
 ex pseries::collect(const symbol &s) const
 {
     return *this;
 }
 
+
 /** Evaluate coefficients. */
 ex pseries::eval(int level) const
 {
 /** Evaluate coefficients. */
 ex pseries::eval(int level) const
 {
@@ -340,11 +357,12 @@ ex pseries::eval(int level) const
     epvector::const_iterator it = seq.begin(), itend = seq.end();
     while (it != itend) {
         new_seq.push_back(expair(it->rest.eval(level-1), it->coeff));
     epvector::const_iterator it = seq.begin(), itend = seq.end();
     while (it != itend) {
         new_seq.push_back(expair(it->rest.eval(level-1), it->coeff));
-        it++;
+        ++it;
     }
     return (new pseries(relational(var,point), new_seq))->setflag(status_flags::dynallocated | status_flags::evaluated);
 }
 
     }
     return (new pseries(relational(var,point), new_seq))->setflag(status_flags::dynallocated | status_flags::evaluated);
 }
 
+
 /** Evaluate coefficients numerically. */
 ex pseries::evalf(int level) const
 {
 /** Evaluate coefficients numerically. */
 ex pseries::evalf(int level) const
 {
@@ -360,11 +378,12 @@ ex pseries::evalf(int level) const
     epvector::const_iterator it = seq.begin(), itend = seq.end();
     while (it != itend) {
         new_seq.push_back(expair(it->rest.evalf(level-1), it->coeff));
     epvector::const_iterator it = seq.begin(), itend = seq.end();
     while (it != itend) {
         new_seq.push_back(expair(it->rest.evalf(level-1), it->coeff));
-        it++;
+        ++it;
     }
     return (new pseries(relational(var,point), new_seq))->setflag(status_flags::dynallocated | status_flags::evaluated);
 }
 
     }
     return (new pseries(relational(var,point), new_seq))->setflag(status_flags::dynallocated | status_flags::evaluated);
 }
 
+
 ex pseries::subs(const lst & ls, const lst & lr) const
 {
     // If expansion variable is being substituted, convert the series to a
 ex pseries::subs(const lst & ls, const lst & lr) const
 {
     // If expansion variable is being substituted, convert the series to a
@@ -375,16 +394,32 @@ ex pseries::subs(const lst & ls, const lst & lr) const
     
     // Otherwise construct a new series with substituted coefficients and
     // expansion point
     
     // Otherwise construct a new series with substituted coefficients and
     // expansion point
-    epvector new_seq;
-    new_seq.reserve(seq.size());
+    epvector newseq;
+    newseq.reserve(seq.size());
     epvector::const_iterator it = seq.begin(), itend = seq.end();
     while (it != itend) {
     epvector::const_iterator it = seq.begin(), itend = seq.end();
     while (it != itend) {
-        new_seq.push_back(expair(it->rest.subs(ls, lr), it->coeff));
-        it++;
+        newseq.push_back(expair(it->rest.subs(ls, lr), it->coeff));
+        ++it;
     }
     }
-    return (new pseries(relational(var,point.subs(ls, lr)), new_seq))->setflag(status_flags::dynallocated);
+    return (new pseries(relational(var,point.subs(ls, lr)), newseq))->setflag(status_flags::dynallocated);
 }
 
 }
 
+
+/** Implementation of ex::expand() for a power series.  It expands all the
+ *  terms individually and returns the resulting series as a new pseries.
+ *  @see ex::diff */
+ex pseries::expand(unsigned options) const
+{
+    epvector newseq;
+    newseq.reserve(seq.size());
+    for (epvector::const_iterator i=seq.begin(); i!=seq.end(); ++i)
+        newseq.push_back(expair(i->rest.expand(), i->coeff));
+    return (new pseries(relational(var,point), newseq))
+        ->setflag(status_flags::dynallocated |
+                  status_flags::expanded);
+}
+
+
 /** Implementation of ex::diff() for a power series.  It treats the series as a
  *  polynomial.
  *  @see ex::diff */
 /** Implementation of ex::diff() for a power series.  It treats the series as a
  *  polynomial.
  *  @see ex::diff */
@@ -403,7 +438,7 @@ ex pseries::derivative(const symbol & s) const
                 if (!c.is_zero())
                     new_seq.push_back(expair(c, it->coeff - 1));
             }
                 if (!c.is_zero())
                     new_seq.push_back(expair(c, it->coeff - 1));
             }
-            it++;
+            ++it;
         }
         return pseries(relational(var,point), new_seq);
     } else {
         }
         return pseries(relational(var,point), new_seq);
     } else {
@@ -430,11 +465,18 @@ ex pseries::convert_to_poly(bool no_order) const
                 e += Order(power(var - point, it->coeff));
         } else
             e += it->rest * power(var - point, it->coeff);
                 e += Order(power(var - point, it->coeff));
         } else
             e += it->rest * power(var - point, it->coeff);
-        it++;
+        ++it;
     }
     return e;
 }
 
     }
     return e;
 }
 
+/** Returns true if there is no order term, i.e. the series terminates and
+ *  false otherwise. */
+bool pseries::is_terminating(void) const
+{
+    return !is_order_function((seq.end()-1)->rest);
+}
+
 
 /*
  *  Implementation of series expansion
 
 /*
  *  Implementation of series expansion
@@ -442,7 +484,7 @@ ex pseries::convert_to_poly(bool no_order) const
 
 /** Default implementation of ex::series(). This performs Taylor expansion.
  *  @see ex::series */
 
 /** Default implementation of ex::series(). This performs Taylor expansion.
  *  @see ex::series */
-ex basic::series(const relational & r, int order) const
+ex basic::series(const relational & r, int order, bool branchcut) const
 {
     epvector seq;
     numeric fac(1);
 {
     epvector seq;
     numeric fac(1);
@@ -461,14 +503,14 @@ ex basic::series(const relational & r, int order) const
             // Series terminates
             return pseries(r, seq);
         }
             // Series terminates
             return pseries(r, seq);
         }
-        coeff = fac.inverse() * deriv.subs(r);
+        coeff = deriv.subs(r);
         if (!coeff.is_zero())
         if (!coeff.is_zero())
-            seq.push_back(expair(coeff, numeric(n)));
+            seq.push_back(expair(fac.inverse() * coeff, numeric(n)));
     }
     
     // Higher-order terms, if present
     deriv = deriv.diff(*s);
     }
     
     // Higher-order terms, if present
     deriv = deriv.diff(*s);
-    if (!deriv.is_zero())
+    if (!deriv.expand().is_zero())
         seq.push_back(expair(Order(_ex1()), numeric(n)));
     return pseries(r, seq);
 }
         seq.push_back(expair(Order(_ex1()), numeric(n)));
     return pseries(r, seq);
 }
@@ -476,7 +518,7 @@ ex basic::series(const relational & r, int order) const
 
 /** Implementation of ex::series() for symbols.
  *  @see ex::series */
 
 /** Implementation of ex::series() for symbols.
  *  @see ex::series */
-ex symbol::series(const relational & r, int order) const
+ex symbol::series(const relational & r, int order, bool branchcut) const
 {
     epvector seq;
     const ex point = r.rhs();
 {
     epvector seq;
     const ex point = r.rhs();
@@ -523,7 +565,7 @@ ex pseries::add_series(const pseries &other) const
         if (a == a_end) {
             while (b != b_end) {
                 new_seq.push_back(*b);
         if (a == a_end) {
             while (b != b_end) {
                 new_seq.push_back(*b);
-                b++;
+                ++b;
             }
             break;
         } else
             }
             break;
         } else
@@ -533,7 +575,7 @@ ex pseries::add_series(const pseries &other) const
         if (b == b_end) {
             while (a != a_end) {
                 new_seq.push_back(*a);
         if (b == b_end) {
             while (a != a_end) {
                 new_seq.push_back(*a);
-                a++;
+                ++a;
             }
             break;
         } else
             }
             break;
         } else
@@ -545,13 +587,13 @@ ex pseries::add_series(const pseries &other) const
             new_seq.push_back(*a);
             if (is_order_function((*a).rest))
                 break;
             new_seq.push_back(*a);
             if (is_order_function((*a).rest))
                 break;
-            a++;
+            ++a;
         } else if (pow_b < pow_a) {
             // b has lesser power, get coefficient from b
             new_seq.push_back(*b);
             if (is_order_function((*b).rest))
                 break;
         } else if (pow_b < pow_a) {
             // b has lesser power, get coefficient from b
             new_seq.push_back(*b);
             if (is_order_function((*b).rest))
                 break;
-            b++;
+            ++b;
         } else {
             // Add coefficient of a and b
             if (is_order_function((*a).rest) || is_order_function((*b).rest)) {
         } else {
             // Add coefficient of a and b
             if (is_order_function((*a).rest) || is_order_function((*b).rest)) {
@@ -561,8 +603,8 @@ ex pseries::add_series(const pseries &other) const
                 ex sum = (*a).rest + (*b).rest;
                 if (!(sum.is_zero()))
                     new_seq.push_back(expair(sum, numeric(pow_a)));
                 ex sum = (*a).rest + (*b).rest;
                 if (!(sum.is_zero()))
                     new_seq.push_back(expair(sum, numeric(pow_a)));
-                a++;
-                b++;
+                ++a;
+                ++b;
             }
         }
     }
             }
         }
     }
@@ -573,22 +615,22 @@ ex pseries::add_series(const pseries &other) const
 /** Implementation of ex::series() for sums. This performs series addition when
  *  adding pseries objects.
  *  @see ex::series */
 /** Implementation of ex::series() for sums. This performs series addition when
  *  adding pseries objects.
  *  @see ex::series */
-ex add::series(const relational & r, int order) const
+ex add::series(const relational & r, int order, bool branchcut) const
 {
     ex acc; // Series accumulator
     
     // Get first term from overall_coeff
 {
     ex acc; // Series accumulator
     
     // Get first term from overall_coeff
-    acc = overall_coeff.series(r, order);
+    acc = overall_coeff.series(r, order, branchcut);
     
     // Add remaining terms
     epvector::const_iterator it = seq.begin();
     epvector::const_iterator itend = seq.end();
     
     // Add remaining terms
     epvector::const_iterator it = seq.begin();
     epvector::const_iterator itend = seq.end();
-    for (; it!=itend; it++) {
+    for (; it!=itend; ++it) {
         ex op;
         if (is_ex_exactly_of_type(it->rest, pseries))
             op = it->rest;
         else
         ex op;
         if (is_ex_exactly_of_type(it->rest, pseries))
             op = it->rest;
         else
-            op = it->rest.series(r, order);
+            op = it->rest.series(r, order, branchcut);
         if (!it->coeff.is_equal(_ex1()))
             op = ex_to_pseries(op).mul_const(ex_to_numeric(it->coeff));
         
         if (!it->coeff.is_equal(_ex1()))
             op = ex_to_pseries(op).mul_const(ex_to_numeric(it->coeff));
         
@@ -615,7 +657,7 @@ ex pseries::mul_const(const numeric &other) const
             new_seq.push_back(expair(it->rest * other, it->coeff));
         else
             new_seq.push_back(*it);
             new_seq.push_back(expair(it->rest * other, it->coeff));
         else
             new_seq.push_back(*it);
-        it++;
+        ++it;
     }
     return pseries(relational(var,point), new_seq);
 }
     }
     return pseries(relational(var,point), new_seq);
 }
@@ -653,14 +695,14 @@ ex pseries::mul_series(const pseries &other) const
         higher_order_a = a_max + b_min;
     if (is_order_function(other.coeff(*s, b_max)))
         higher_order_b = b_max + a_min;
         higher_order_a = a_max + b_min;
     if (is_order_function(other.coeff(*s, b_max)))
         higher_order_b = b_max + a_min;
-    int higher_order_c = min(higher_order_a, higher_order_b);
+    int higher_order_c = std::min(higher_order_a, higher_order_b);
     if (cdeg_max >= higher_order_c)
         cdeg_max = higher_order_c - 1;
     
     if (cdeg_max >= higher_order_c)
         cdeg_max = higher_order_c - 1;
     
-    for (int cdeg=cdeg_min; cdeg<=cdeg_max; cdeg++) {
+    for (int cdeg=cdeg_min; cdeg<=cdeg_max; ++cdeg) {
         ex co = _ex0();
         // c(i)=a(0)b(i)+...+a(i)b(0)
         ex co = _ex0();
         // c(i)=a(0)b(i)+...+a(i)b(0)
-        for (int i=a_min; cdeg-i>=b_min; i++) {
+        for (int i=a_min; cdeg-i>=b_min; ++i) {
             ex a_coeff = coeff(*s, i);
             ex b_coeff = other.coeff(*s, cdeg-i);
             if (!is_order_function(a_coeff) && !is_order_function(b_coeff))
             ex a_coeff = coeff(*s, i);
             ex b_coeff = other.coeff(*s, cdeg-i);
             if (!is_order_function(a_coeff) && !is_order_function(b_coeff))
@@ -678,17 +720,17 @@ ex pseries::mul_series(const pseries &other) const
 /** Implementation of ex::series() for product. This performs series
  *  multiplication when multiplying series.
  *  @see ex::series */
 /** Implementation of ex::series() for product. This performs series
  *  multiplication when multiplying series.
  *  @see ex::series */
-ex mul::series(const relational & r, int order) const
+ex mul::series(const relational & r, int order, bool branchcut) const
 {
     ex acc; // Series accumulator
     
     // Get first term from overall_coeff
 {
     ex acc; // Series accumulator
     
     // Get first term from overall_coeff
-    acc = overall_coeff.series(r, order);
+    acc = overall_coeff.series(r, order, branchcut);
     
     // Multiply with remaining terms
     epvector::const_iterator it = seq.begin();
     epvector::const_iterator itend = seq.end();
     
     // Multiply with remaining terms
     epvector::const_iterator it = seq.begin();
     epvector::const_iterator itend = seq.end();
-    for (; it!=itend; it++) {
+    for (; it!=itend; ++it) {
         ex op = it->rest;
         if (op.info(info_flags::numeric)) {
             // series * const (special case, faster)
         ex op = it->rest;
         if (op.info(info_flags::numeric)) {
             // series * const (special case, faster)
@@ -696,7 +738,7 @@ ex mul::series(const relational & r, int order) const
             acc = ex_to_pseries(acc).mul_const(ex_to_numeric(f));
             continue;
         } else if (!is_ex_exactly_of_type(op, pseries))
             acc = ex_to_pseries(acc).mul_const(ex_to_numeric(f));
             continue;
         } else if (!is_ex_exactly_of_type(op, pseries))
-            op = op.series(r, order);
+            op = op.series(r, order, branchcut);
         if (!it->coeff.is_equal(_ex1()))
             op = ex_to_pseries(op).power_const(ex_to_numeric(it->coeff), order);
 
         if (!it->coeff.is_equal(_ex1()))
             op = ex_to_pseries(op).power_const(ex_to_numeric(it->coeff), order);
 
@@ -723,9 +765,9 @@ ex pseries::power_const(const numeric &p, int deg) const
     ex co0;
     co.push_back(co0 = power(coeff(*s, ldeg), p));
     bool all_sums_zero = true;
     ex co0;
     co.push_back(co0 = power(coeff(*s, ldeg), p));
     bool all_sums_zero = true;
-    for (i=1; i<deg; i++) {
+    for (i=1; i<deg; ++i) {
         ex sum = _ex0();
         ex sum = _ex0();
-        for (int j=1; j<=i; j++) {
+        for (int j=1; j<=i; ++j) {
             ex c = coeff(*s, j + ldeg);
             if (is_order_function(c)) {
                 co.push_back(Order(_ex1()));
             ex c = coeff(*s, j + ldeg);
             if (is_order_function(c)) {
                 co.push_back(Order(_ex1()));
@@ -741,7 +783,7 @@ ex pseries::power_const(const numeric &p, int deg) const
     // Construct new series (of non-zero coefficients)
     epvector new_seq;
     bool higher_order = false;
     // Construct new series (of non-zero coefficients)
     epvector new_seq;
     bool higher_order = false;
-    for (i=0; i<deg; i++) {
+    for (i=0; i<deg; ++i) {
         if (!co[i].is_zero())
             new_seq.push_back(expair(co[i], numeric(i) + p * ldeg));
         if (is_order_function(co[i])) {
         if (!co[i].is_zero())
             new_seq.push_back(expair(co[i], numeric(i) + p * ldeg));
         if (is_order_function(co[i])) {
@@ -755,23 +797,33 @@ ex pseries::power_const(const numeric &p, int deg) const
 }
 
 
 }
 
 
+/** Return a new pseries object with the powers shifted by deg. */
+pseries pseries::shift_exponents(int deg) const
+{
+    epvector newseq(seq);
+    for (epvector::iterator i=newseq.begin(); i!=newseq.end(); ++i)
+        i->coeff = i->coeff + deg;
+    return pseries(relational(var, point), newseq);
+}
+
+
 /** Implementation of ex::series() for powers. This performs Laurent expansion
  *  of reciprocals of series at singularities.
  *  @see ex::series */
 /** Implementation of ex::series() for powers. This performs Laurent expansion
  *  of reciprocals of series at singularities.
  *  @see ex::series */
-ex power::series(const relational & r, int order) const
+ex power::series(const relational & r, int order, bool branchcut) const
 {
     ex e;
     if (!is_ex_exactly_of_type(basis, pseries)) {
         // Basis is not a series, may there be a singulary?
         if (!exponent.info(info_flags::negint))
 {
     ex e;
     if (!is_ex_exactly_of_type(basis, pseries)) {
         // Basis is not a series, may there be a singulary?
         if (!exponent.info(info_flags::negint))
-            return basic::series(r, order);
+            return basic::series(r, order, branchcut);
         
         // Expression is of type something^(-int), check for singularity
         if (!basis.subs(r).is_zero())
         
         // Expression is of type something^(-int), check for singularity
         if (!basis.subs(r).is_zero())
-            return basic::series(r, order);
+            return basic::series(r, order, branchcut);
         
         // Singularity encountered, expand basis into series
         
         // Singularity encountered, expand basis into series
-        e = basis.series(r, order);
+        e = basis.series(r, order, branchcut);
     } else {
         // Basis is a series
         e = basis;
     } else {
         // Basis is a series
         e = basis;
@@ -783,7 +835,7 @@ ex power::series(const relational & r, int order) const
 
 
 /** Re-expansion of a pseries object. */
 
 
 /** Re-expansion of a pseries object. */
-ex pseries::series(const relational & r, int order) const
+ex pseries::series(const relational & r, int order, bool branchcut) const
 {
     const ex p = r.rhs();
     GINAC_ASSERT(is_ex_exactly_of_type(r.lhs(),symbol));
 {
     const ex p = r.rhs();
     GINAC_ASSERT(is_ex_exactly_of_type(r.lhs(),symbol));
@@ -802,12 +854,12 @@ ex pseries::series(const relational & r, int order) const
                     break;
                 }
                 new_seq.push_back(*it);
                     break;
                 }
                 new_seq.push_back(*it);
-                it++;
+                ++it;
             }
             return pseries(r, new_seq);
         }
     } else
             }
             return pseries(r, new_seq);
         }
     } else
-        return convert_to_poly().series(r, order);
+        return convert_to_poly().series(r, order, branchcut);
 }
 
 
 }
 
 
@@ -818,8 +870,9 @@ ex pseries::series(const relational & r, int order) const
  *
  *  @param r  expansion relation, lhs holds variable and rhs holds point
  *  @param order  truncation order of series calculations
  *
  *  @param r  expansion relation, lhs holds variable and rhs holds point
  *  @param order  truncation order of series calculations
+ *  @param branchcut  when set to false, branch cuts are not honored
  *  @return an expression holding a pseries object */
  *  @return an expression holding a pseries object */
-ex ex::series(const ex & r, int order) const
+ex ex::series(const ex & r, int order, bool branchcut) const
 {
     GINAC_ASSERT(bp!=0);
     ex e;
 {
     GINAC_ASSERT(bp!=0);
     ex e;
@@ -833,9 +886,9 @@ ex ex::series(const ex & r, int order) const
         throw (std::logic_error("ex::series(): expansion point has unknown type"));
     
     try {
         throw (std::logic_error("ex::series(): expansion point has unknown type"));
     
     try {
-        e = bp->series(rel_, order);
-    } catch (exception &x) {
-        throw (std::logic_error(string("unable to compute series (") + x.what() + ")"));
+        e = bp->series(rel_, order, branchcut);
+    } catch (std::exception &x) {
+        throw (std::logic_error(std::string("unable to compute series (") + x.what() + ")"));
     }
     return e;
 }
     }
     return e;
 }
index a0a494ee917a5aa04fad10f6f5cb6b5098417f05..f7c32aa505bfd25423c1bdbb9951bafd50e1902a 100644 (file)
@@ -55,21 +55,22 @@ public:
     // functions overriding virtual functions from base classes
 public:
     basic *duplicate() const;
     // functions overriding virtual functions from base classes
 public:
     basic *duplicate() const;
-    void print(ostream &os, unsigned upper_precedence=0) const;
-    void printraw(ostream &os) const;
-    void printtree(ostream & os, unsigned indent) const;
+    void print(std::ostream &os, unsigned upper_precedence = 0) const;
+    void printraw(std::ostream &os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
     unsigned nops(void) const;
     ex op(int i) const;
     ex &let_op(int i);
     int degree(const symbol &s) const;
     int ldegree(const symbol &s) const;
     unsigned nops(void) const;
     ex op(int i) const;
     ex &let_op(int i);
     int degree(const symbol &s) const;
     int ldegree(const symbol &s) const;
-    ex coeff(const symbol &s, int n=1) const;
+    ex coeff(const symbol &s, int n = 1) const;
     ex collect(const symbol &s) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
     ex collect(const symbol &s) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
-    ex series(const relational & r, int order) const;
-    ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+    ex series(const relational & r, int order, bool branchcut = true) const;
     ex subs(const lst & ls, const lst & lr) const;
     ex subs(const lst & ls, const lst & lr) const;
+    ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const;
+    ex expand(unsigned options = 0) const;
 protected:
     ex derivative(const symbol & s) const;
 
 protected:
     ex derivative(const symbol & s) const;
 
@@ -78,10 +79,12 @@ public:
     ex convert_to_poly(bool no_order = false) const;
     bool is_compatible_to(const pseries &other) const {return var.compare(other.var) == 0 && point.compare(other.point) == 0;}
     bool is_zero(void) const {return seq.size() == 0;}
     ex convert_to_poly(bool no_order = false) const;
     bool is_compatible_to(const pseries &other) const {return var.compare(other.var) == 0 && point.compare(other.point) == 0;}
     bool is_zero(void) const {return seq.size() == 0;}
+    bool is_terminating(void) const;
     ex add_series(const pseries &other) const;
     ex mul_const(const numeric &other) const;
     ex mul_series(const pseries &other) const;
     ex power_const(const numeric &p, int deg) const;
     ex add_series(const pseries &other) const;
     ex mul_const(const numeric &other) const;
     ex mul_series(const pseries &other) const;
     ex power_const(const numeric &p, int deg) const;
+    pseries shift_exponents(int deg) const;
 
 protected:
     /** Vector of {coefficient, power} pairs */
 
 protected:
     /** Vector of {coefficient, power} pairs */
@@ -123,6 +126,11 @@ inline ex series_to_poly(const ex &e)
     return (static_cast<const pseries &>(*e.bp).convert_to_poly(true));
 }
 
     return (static_cast<const pseries &>(*e.bp).convert_to_poly(true));
 }
 
+inline bool is_terminating(const pseries & s)
+{
+    return s.is_terminating();
+}
+
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
 #endif // ndef NO_NAMESPACE_GINAC
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
 #endif // ndef NO_NAMESPACE_GINAC
index f95b20131989c29e26b02366f1c8d62a67308665..2488be5509f2e782d3ad85ac95e99c0d94b2280e 100644 (file)
@@ -32,7 +32,7 @@ namespace GiNaC {
 registered_class_info *first_registered_class = NULL;
 
 /** Find registered_class_info strucure by class name. */
 registered_class_info *first_registered_class = NULL;
 
 /** Find registered_class_info strucure by class name. */
-static inline registered_class_info *find_registered_class_info(const string &class_name)
+static inline registered_class_info *find_registered_class_info(const std::string &class_name)
 {
        registered_class_info *p = first_registered_class;
        while (p) {
 {
        registered_class_info *p = first_registered_class;
        while (p) {
@@ -43,13 +43,13 @@ static inline registered_class_info *find_registered_class_info(const string &cl
        throw (std::runtime_error("class '" + class_name + "' not registered"));
 }
 
        throw (std::runtime_error("class '" + class_name + "' not registered"));
 }
 
-unsigned int find_tinfo_key(const string &class_name)
+unsigned int find_tinfo_key(const std::string &class_name)
 {
        registered_class_info *p = find_registered_class_info(class_name);
        return p->tinfo_key;
 }
 
 {
        registered_class_info *p = find_registered_class_info(class_name);
        return p->tinfo_key;
 }
 
-unarch_func find_unarch_func(const string &class_name)
+unarch_func find_unarch_func(const std::string &class_name)
 {
        registered_class_info *p = find_registered_class_info(class_name);
        return p->unarchive;
 {
        registered_class_info *p = find_registered_class_info(class_name);
        return p->unarchive;
index 1473bbb88b26a49d4915ab8e13e1e3cbc5d50e0a..8c2e6d686f031840baaa39ae34818d473373038a 100644 (file)
@@ -79,10 +79,10 @@ private:
 
 
 /** Find TINFO_* key by class name. */
 
 
 /** Find TINFO_* key by class name. */
-extern unsigned int find_tinfo_key(const string &class_name);
+extern unsigned int find_tinfo_key(const std::string &class_name);
 
 /** Find unarchiving function by class name. */
 
 /** Find unarchiving function by class name. */
-extern unarch_func find_unarch_func(const string &class_name);
+extern unarch_func find_unarch_func(const std::string &class_name);
 
 
 #ifndef NO_NAMESPACE_GINAC
 
 
 #ifndef NO_NAMESPACE_GINAC
index 55b705447d7ab254b6aea24ee28dc6e9e4b14036..b2726acd342ff73b3c4cd6f75b5d27434988c46e 100644 (file)
@@ -139,7 +139,7 @@ basic * relational::duplicate() const
     return new relational(*this);
 }
 
     return new relational(*this);
 }
 
-void relational::print(ostream & os, unsigned upper_precedence) const
+void relational::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("relational print",LOGLEVEL_PRINT);
     if (precedence<=upper_precedence) os << "(";
 {
     debugmsg("relational print",LOGLEVEL_PRINT);
     if (precedence<=upper_precedence) os << "(";
@@ -170,7 +170,7 @@ void relational::print(ostream & os, unsigned upper_precedence) const
     if (precedence<=upper_precedence) os << ")";
 }
 
     if (precedence<=upper_precedence) os << ")";
 }
 
-void relational::printraw(ostream & os) const
+void relational::printraw(std::ostream & os) const
 {
     debugmsg("relational printraw",LOGLEVEL_PRINT);
     os << "RELATIONAL(";
 {
     debugmsg("relational printraw",LOGLEVEL_PRINT);
     os << "RELATIONAL(";
@@ -203,7 +203,7 @@ void relational::printraw(ostream & os) const
     os << ")";
 }
 
     os << ")";
 }
 
-void relational::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void relational::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("relational print csrc", LOGLEVEL_PRINT);
     if (precedence<=upper_precedence)
 {
     debugmsg("relational print csrc", LOGLEVEL_PRINT);
     if (precedence<=upper_precedence)
@@ -364,8 +364,6 @@ ex relational::rhs(void) const
 // non-virtual functions in this class
 //////////
 
 // non-virtual functions in this class
 //////////
 
-#include <iostream>
-
 relational::operator bool() const
 {
     // please note that (a<b) == false does not imply (a>=b) == true
 relational::operator bool() const
 {
     // please note that (a<b) == false does not imply (a>=b) == true
index ae78c239bff03d72eed4fbe7ebbe87c3e6364d7e..48b5971996b0182cf148a272641e6dedc4777f2c 100644 (file)
@@ -65,9 +65,9 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex & let_op(int i);
     bool info(unsigned inf) const;
     unsigned nops() const;
     ex & let_op(int i);
index b3307d3cc168cbe8a1debc1d9bb3eddf476363d2..21e19716ca1f8961fad29fd231c374cf45c04b5a 100644 (file)
@@ -38,7 +38,7 @@ namespace GiNaC {
 remember_table_entry::remember_table_entry(function const & f, ex const & r) :
     hashvalue(f.gethash()), seq(f.seq), result(r)
 {
 remember_table_entry::remember_table_entry(function const & f, ex const & r) :
     hashvalue(f.gethash()), seq(f.seq), result(r)
 {
-    last_access=access_counter++;
+    ++last_access=access_counter;
     successful_hits=0;
 }
 
     successful_hits=0;
 }
 
@@ -49,8 +49,8 @@ bool remember_table_entry::is_equal(function const & f) const
     for (unsigned i=0; i<seq.size(); ++i) {
         if (!seq[i].is_equal(f.seq[i])) return false;
     }
     for (unsigned i=0; i<seq.size(); ++i) {
         if (!seq[i].is_equal(f.seq[i])) return false;
     }
-    last_access=access_counter++;
-    successful_hits++;
+    ++last_access=access_counter;
+    ++successful_hits;
     return true;
 }
 
     return true;
 }
 
@@ -183,9 +183,9 @@ void remember_table::init_table(void)
     }
 }
 
     }
 }
 
-vector<remember_table> & remember_table::remember_tables(void)
+std::vector<remember_table> & remember_table::remember_tables(void)
 {
 {
-    static vector<remember_table> * rt=new vector<remember_table>;
+    static std::vector<remember_table> * rt = new std::vector<remember_table>;
     return *rt;
 }
 
     return *rt;
 }
 
index 403e3edb22229fa58d06782873f5c3cb41f243ab..78ce547e9ebef681c2d699be6826700cd018ce42 100644 (file)
@@ -57,7 +57,7 @@ protected:
 
 /** A list of entries in the remember table having some least
     significant bits of the hashvalue in common. */
 
 /** A list of entries in the remember table having some least
     significant bits of the hashvalue in common. */
-class remember_table_list : public list<remember_table_entry> {
+class remember_table_list : public std::list<remember_table_entry> {
 public:
     remember_table_list(unsigned as, unsigned strat);
     void add_entry(function const & f, ex const & result);
 public:
     remember_table_list(unsigned as, unsigned strat);
     void add_entry(function const & f, ex const & result);
@@ -81,15 +81,15 @@ protected:
     - least recently used (the one with the lowest 'last_access')
     - least frequently used (the one with the lowest 'successful_hits')
     or all entries are kept which means that the table grows indefinitely. */
     - least recently used (the one with the lowest 'last_access')
     - least frequently used (the one with the lowest 'successful_hits')
     or all entries are kept which means that the table grows indefinitely. */
-class remember_table : public vector<remember_table_list> {
+class remember_table : public std::vector<remember_table_list> {
 public:
     remember_table();
     remember_table(unsigned s, unsigned as, unsigned strat);
     bool lookup_entry(function const & f, ex & result) const;
     void add_entry(function const & f, ex const & result);
     void clear_all_entries(void);
 public:
     remember_table();
     remember_table(unsigned s, unsigned as, unsigned strat);
     bool lookup_entry(function const & f, ex & result) const;
     void add_entry(function const & f, ex const & result);
     void clear_all_entries(void);
-    void show_statistics(ostream & os, unsigned level) const;
-    static vector<remember_table> & remember_tables(void);
+    void show_statistics(std::ostream & os, unsigned level) const;
+    static std::vector<remember_table> & remember_tables(void);
 protected:
     void init_table(void);
     unsigned table_size;
 protected:
     void init_table(void);
     unsigned table_size;
index c5d5f9eb92f5b331aa815a143e7b03db1a6c7820..4865561a8cbb9da745b3d9ead3565d7f1ef230a8 100644 (file)
@@ -109,7 +109,7 @@ simp_lor::simp_lor(simp_lor_types const t, const ex & i1, const ex & i2) :
     GINAC_ASSERT(all_of_type_lorentzidx());
 }
 
     GINAC_ASSERT(all_of_type_lorentzidx());
 }
 
-simp_lor::simp_lor(simp_lor_types const t, const string & n, const ex & i1) :
+simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const ex & i1) :
     indexed(i1), type(t), name(n)
 {
     debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT);
     indexed(i1), type(t), name(n)
 {
     debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT);
@@ -117,7 +117,7 @@ simp_lor::simp_lor(simp_lor_types const t, const string & n, const ex & i1) :
     GINAC_ASSERT(all_of_type_lorentzidx());
 }
 
     GINAC_ASSERT(all_of_type_lorentzidx());
 }
 
-simp_lor::simp_lor(simp_lor_types const t, const string & n, const exvector & iv) :
+simp_lor::simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv) :
     indexed(iv), type(t), name(n)
 {
     debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT);
     indexed(iv), type(t), name(n)
 {
     debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT);
@@ -125,7 +125,7 @@ simp_lor::simp_lor(simp_lor_types const t, const string & n, const exvector & iv
     GINAC_ASSERT(all_of_type_lorentzidx());
 }
 
     GINAC_ASSERT(all_of_type_lorentzidx());
 }
 
-simp_lor::simp_lor(simp_lor_types const t, const string & n, exvector * ivp) :
+simp_lor::simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp) :
     indexed(ivp), type(t), name(n)
 {
     debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT);
     indexed(ivp), type(t), name(n)
 {
     debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT);
@@ -145,7 +145,7 @@ basic * simp_lor::duplicate() const
     return new simp_lor(*this);
 }
 
     return new simp_lor(*this);
 }
 
-void simp_lor::printraw(ostream & os) const
+void simp_lor::printraw(std::ostream & os) const
 {
     debugmsg("simp_lor printraw",LOGLEVEL_PRINT);
     os << "simp_lor(type=" << (unsigned)type
 {
     debugmsg("simp_lor printraw",LOGLEVEL_PRINT);
     os << "simp_lor(type=" << (unsigned)type
@@ -154,20 +154,20 @@ void simp_lor::printraw(ostream & os) const
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
     os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void simp_lor::printtree(ostream & os, unsigned indent) const
+void simp_lor::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("simp_lor printtree",LOGLEVEL_PRINT);
 {
     debugmsg("simp_lor printtree",LOGLEVEL_PRINT);
-    os << string(indent,' ') << "simp_lor object: "
+    os << std::string(indent,' ') << "simp_lor object: "
        << "type=" << (unsigned)type
        << ", name=" << name << ", ";
        << "type=" << (unsigned)type
        << ", name=" << name << ", ";
-    os << seq.size() << " indices" << endl;
+    os << seq.size() << " indices" << std::endl;
     printtreeindices(os,indent);
     printtreeindices(os,indent);
-    os << string(indent,' ') << "hash=" << hashvalue
-       << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+    os << std::string(indent,' ') << "hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void simp_lor::print(ostream & os, unsigned upper_precedence) const
+void simp_lor::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("simp_lor print",LOGLEVEL_PRINT);
     switch (type) {
 {
     debugmsg("simp_lor print",LOGLEVEL_PRINT);
     switch (type) {
@@ -185,7 +185,7 @@ void simp_lor::print(ostream & os, unsigned upper_precedence) const
     printindices(os);
 }
 
     printindices(os);
 }
 
-void simp_lor::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void simp_lor::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("simp_lor print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
 {
     debugmsg("simp_lor print csrc",LOGLEVEL_PRINT);
     print(os,upper_precedence);
@@ -314,7 +314,7 @@ bool simp_lor::all_of_type_lorentzidx(void) const
 //////////
 
 const simp_lor some_simp_lor;
 //////////
 
 const simp_lor some_simp_lor;
-const type_info & typeid_simp_lor=typeid(some_simp_lor);
+const type_info & typeid_simp_lor = typeid(some_simp_lor);
 
 //////////
 // friend functions
 
 //////////
 // friend functions
@@ -325,7 +325,7 @@ simp_lor lor_g(const ex & mu, const ex & nu)
     return simp_lor(simp_lor::simp_lor_g,mu,nu);
 }
 
     return simp_lor(simp_lor::simp_lor_g,mu,nu);
 }
 
-simp_lor lor_vec(const string & n, const ex & mu)
+simp_lor lor_vec(const std::string & n, const ex & mu)
 {
     return simp_lor(simp_lor::simp_lor_vec,n,mu);
 }
 {
     return simp_lor(simp_lor::simp_lor_vec,n,mu);
 }
@@ -497,13 +497,13 @@ ex scalar_products::evaluate(const simp_lor & v1, const simp_lor & v2) const
 
 void scalar_products::debugprint(void) const
 {
 
 void scalar_products::debugprint(void) const
 {
-    cerr << "map size=" << spm.size() << endl;
+    std::cerr << "map size=" << spm.size() << std::endl;
     for (spmap::const_iterator cit=spm.begin(); cit!=spm.end(); ++cit) {
         const spmapkey & k=(*cit).first;
     for (spmap::const_iterator cit=spm.begin(); cit!=spm.end(); ++cit) {
         const spmapkey & k=(*cit).first;
-        cerr << "item key=((" << k.first.first
-             << "," << k.first.second << "),";
+        std::cerr << "item key=((" << k.first.first
+                  << "," << k.first.second << "),";
         k.second.printraw(cerr);
         k.second.printraw(cerr);
-        cerr << ") value=" << (*cit).second << endl;
+        cerr << ") value=" << (*cit).second << std::endl;
     }
 }
 
     }
 }
 
index 77e7c4d9f259946693aa7044e722af97833a7478..677a4c251556bc8a187e6bfc04e978a9b1d65db7 100644 (file)
@@ -35,8 +35,8 @@
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
-typedef pair<string,string> strstrpair;
-typedef pair<strstrpair,lorentzidx> spmapkey;
+typedef std::pair<std::string,std::string> strstrpair;
+typedef std::pair<strstrpair,lorentzidx> spmapkey;
 
 class spmapkey_is_less
 {
 
 class spmapkey_is_less
 {
@@ -87,7 +87,7 @@ class simp_lor : public indexed
 
     friend class scalar_products;
     friend simp_lor lor_g(const ex & mu, const ex & nu);
 
     friend class scalar_products;
     friend simp_lor lor_g(const ex & mu, const ex & nu);
-    friend simp_lor lor_vec(const string & n, const ex & mu);
+    friend simp_lor lor_vec(const std::string & n, const ex & mu);
     friend ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
     friend ex simplify_simp_lor(const ex & e, const scalar_products & sp);
     
     friend ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
     friend ex simplify_simp_lor(const ex & e, const scalar_products & sp);
     
@@ -115,17 +115,17 @@ protected:
 protected:
     simp_lor(simp_lor_types const t);
     simp_lor(simp_lor_types const t, const ex & i1, const ex & i2);
 protected:
     simp_lor(simp_lor_types const t);
     simp_lor(simp_lor_types const t, const ex & i1, const ex & i2);
-    simp_lor(simp_lor_types const t, const string & n, const ex & i1);
-    simp_lor(simp_lor_types const t, const string & n, const exvector & iv);
-    simp_lor(simp_lor_types const t, const string & n, exvector * ivp);
+    simp_lor(simp_lor_types const t, const std::string & n, const ex & i1);
+    simp_lor(simp_lor_types const t, const std::string & n, const exvector & iv);
+    simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp);
     
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
     
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
     ex eval(int level=0) const;
 protected:
     bool info(unsigned inf) const;
     ex eval(int level=0) const;
 protected:
@@ -147,7 +147,7 @@ protected:
 
 protected:
     simp_lor_types type;
 
 protected:
     simp_lor_types type;
-    string name;
+    std::string name;
 };
 
 // global constants
 };
 
 // global constants
@@ -167,7 +167,7 @@ inline simp_lor &ex_to_nonconst_simp_lor(const ex &e)
 }
 
 simp_lor lor_g(const ex & mu, const ex & nu);
 }
 
 simp_lor lor_g(const ex & mu, const ex & nu);
-simp_lor lor_vec(const string & n, const ex & mu);
+simp_lor lor_vec(const std::string & n, const ex & mu);
 ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
 ex simplify_simp_lor(const ex & e, const scalar_products & sp=scalar_products());
 ex Dim(void);
 ex simplify_simp_lor_mul(const ex & m, const scalar_products & sp);
 ex simplify_simp_lor(const ex & e, const scalar_products & sp=scalar_products());
 ex Dim(void);
index 4e27c49e1db8fc499f8a190a8fd4db3c82969c6f..50e93a4dbb3fd1c683e84eef7701805b2eebdd8e 100644 (file)
@@ -93,30 +93,31 @@ basic * structure::duplicate() const
     return new structure(*this);
 }
 
     return new structure(*this);
 }
 
-void structure::printraw(ostream & os) const
+void structure::printraw(std::ostream & os) const
 {
     debugmsg("structure printraw",LOGLEVEL_PRINT);
 
     os << "structure(hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
 {
     debugmsg("structure printraw",LOGLEVEL_PRINT);
 
     os << "structure(hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void structure::print(ostream & os, unsigned upper_precedence) const
+void structure::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("structure print",LOGLEVEL_PRINT);
 
     os << "structure()";
 }
 
 {
     debugmsg("structure print",LOGLEVEL_PRINT);
 
     os << "structure()";
 }
 
-void structure::printtree(ostream & os, unsigned indent) const
+void structure::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("structure printtree",LOGLEVEL_PRINT);
 
 {
     debugmsg("structure printtree",LOGLEVEL_PRINT);
 
-    os << string(indent,' ') << "structure "
-       << "hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+    os << std::string(indent,' ') << "structure "
+       << "hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void structure::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void structure::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("structure print csrc",LOGLEVEL_PRINT);
 
 {
     debugmsg("structure print csrc",LOGLEVEL_PRINT);
 
@@ -149,9 +150,9 @@ bool structure::is_equal_same_type(const basic & other) const
 
 // protected
 
 
 // protected
 
-vector<registered_structure_info> & structure::registered_structures(void)
+std::vector<registered_structure_info> & structure::registered_structures(void)
 {
 {
-    static vector<registered_structure_info> * rs=new vector<registered_structure_info>;
+    static std::vector<registered_structure_info> * rs = new std::vector<registered_structure_info>;
     return *rs;
 }
 
     return *rs;
 }
 
index 5bd74685a3e8c8eee90bfb22ecf1c40e6526ea6d..358e6ce65a4adb55ac5384172fca39e24cabb7cf 100644 (file)
@@ -59,10 +59,10 @@ protected:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const; 
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void printraw(std::ostream & os) const; 
+    void print(std::ostream & os, unsigned upper_precedence=0) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const;
 protected:
     int compare_same_type(const basic & other) const;
     bool is_equal_same_type(const basic & other) const;
 protected:
     int compare_same_type(const basic & other) const;
     bool is_equal_same_type(const basic & other) const;
@@ -72,7 +72,7 @@ protected:
     
     // non-virtual functions in this class
 protected:
     
     // non-virtual functions in this class
 protected:
-    static vector<registered_structure_info> & registered_structures(void);
+    static std::vector<registered_structure_info> & registered_structures(void);
 public:
     static unsigned register_new(const char * nm);
 
 public:
     static unsigned register_new(const char * nm);
 
index 4f05c6e6957ebf85866a06234242d2023c92515a..b7408fa69653b4a2e08bb9c2e6e74ec8e9064531 100644 (file)
@@ -148,29 +148,30 @@ basic *symbol::duplicate() const
     return new symbol(*this);
 }
 
     return new symbol(*this);
 }
 
-void symbol::print(ostream & os, unsigned upper_precedence) const
+void symbol::print(std::ostream & os, unsigned upper_precedence) const
 {
     debugmsg("symbol print",LOGLEVEL_PRINT);
     os << name;
 }
 
 {
     debugmsg("symbol print",LOGLEVEL_PRINT);
     os << name;
 }
 
-void symbol::printraw(ostream & os) const
+void symbol::printraw(std::ostream & os) const
 {
     debugmsg("symbol printraw",LOGLEVEL_PRINT);
     os << "symbol(" << "name=" << name << ",serial=" << serial
        << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
 {
     debugmsg("symbol printraw",LOGLEVEL_PRINT);
     os << "symbol(" << "name=" << name << ",serial=" << serial
        << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
-void symbol::printtree(ostream & os, unsigned indent) const
+void symbol::printtree(std::ostream & os, unsigned indent) const
 {
     debugmsg("symbol printtree",LOGLEVEL_PRINT);
     os << std::string(indent,' ') << name << " (symbol): "
        << "serial=" << serial
 {
     debugmsg("symbol printtree",LOGLEVEL_PRINT);
     os << std::string(indent,' ') << name << " (symbol): "
        << "serial=" << serial
-       << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
-       << ", flags=" << flags << endl;
+       << ", hash=" << hashvalue
+       << " (0x" << std::hex << hashvalue << std::dec << ")"
+       << ", flags=" << flags << std::endl;
 }
 
 }
 
-void symbol::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+void symbol::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
 {
     debugmsg("symbol print csrc", LOGLEVEL_PRINT);
     os << name;
 {
     debugmsg("symbol print csrc", LOGLEVEL_PRINT);
     os << name;
@@ -349,7 +350,7 @@ std::string & symbol::autoname_prefix(void)
 
 unsigned symbol::next_serial=0;
 
 
 unsigned symbol::next_serial=0;
 
-// string const symbol::autoname_prefix="symbol";
+// std::string const symbol::autoname_prefix="symbol";
 
 //////////
 // global constants
 
 //////////
 // global constants
index 55f204499958984aa636c013d6548a74612d3f75..1a51ffb4dc5f6428b7ff75e0cb1689de3e3b5045 100644 (file)
@@ -70,19 +70,19 @@ public:
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
-    void printraw(ostream & os) const;
-    void printtree(ostream & os, unsigned indent) const;
-    void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+    void print(std::ostream & os, unsigned upper_precedence = 0) const;
+    void printraw(std::ostream & os) const;
+    void printtree(std::ostream & os, unsigned indent) const;
+    void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence = 0) const;
     bool info(unsigned inf) const;
     bool info(unsigned inf) const;
-    ex expand(unsigned options=0) const;
+    ex expand(unsigned options = 0) const;
     bool has(const ex & other) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
     ex coeff(const symbol & s, int n = 1) const;
     ex eval(int level = 0) const;
     bool has(const ex & other) const;
     int degree(const symbol & s) const;
     int ldegree(const symbol & s) const;
     ex coeff(const symbol & s, int n = 1) const;
     ex eval(int level = 0) const;
-    ex series(const relational & s, int order) const;
-    ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+    ex series(const relational & s, int order, bool branchcut = true) const;
+    ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const;
     ex to_rational(lst &repl_lst) const;
     ex subs(const lst & ls, const lst & lr) const;
 protected:
     ex to_rational(lst &repl_lst) const;
     ex subs(const lst & ls, const lst & lr) const;
 protected:
@@ -97,8 +97,8 @@ protected:
 public:
     void assign(const ex & value);
     void unassign(void);
 public:
     void assign(const ex & value);
     void unassign(void);
-    void setname(const std::string & n) {name=n;}
-    std::string getname(void) const {return name;}
+    void setname(const std::string & n) { name = n; }
+    std::string getname(void) const { return name; }
 private:
     std::string & autoname_prefix(void);
 
 private:
     std::string & autoname_prefix(void);
 
index 5a92a31c17b4b879e4ea741f4d5f0ece33ae3726..513b579689480016024eae94b2252aa46a311d3c 100644 (file)
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
+/** ctor for pole_error exception class. */
+pole_error::pole_error(const std::string& what_arg, int degree)
+     : domain_error(what_arg)
+{
+    deg = degree;
+}
+
+/** Return the degree of the pole_error exception class. */
+int pole_error::degree(void) const
+{
+    return deg;
+}
+
+// some compilers (e.g. cygwin) define a macro log2, causing confusion
+#ifndef log2
 /** Integer binary logarithm */
 unsigned log2(unsigned n)
 {
 /** Integer binary logarithm */
 unsigned log2(unsigned n)
 {
@@ -36,6 +51,7 @@ unsigned log2(unsigned n)
     for (k = 0; n > 1; n >>= 1) ++k;
     return k;
 }
     for (k = 0; n > 1; n >>= 1) ++k;
     return k;
 }
+#endif
 
 /** Compare two pointers (just to establish some sort of canonical order).
  *  @return -1, 0, or 1 */
 
 /** Compare two pointers (just to establish some sort of canonical order).
  *  @return -1, 0, or 1 */
index 107a6f5282d6eb15aa500acb7bd893c47e7c6f57..2aff369f9165e3eebbdff17b01f5bb7736463484 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <strstream>
 #include <string>
 
 #include <strstream>
 #include <string>
+#include <stdexcept>
 #include "config.h"
 #include "assertion.h"
 
 #include "config.h"
 #include "assertion.h"
 
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
+// This should be obsoleted once <sstream> is widely available.
 template<class T>
 template<class T>
-string ToString(const T & t)
+std::string ToString(const T & t)
 {
     char buf[256];
 {
     char buf[256];
-    ostrstream(buf,sizeof(buf)) << t << ends;
+    std::ostrstream(buf,sizeof(buf)) << t << std::ends;
     return buf;
 }
 
     return buf;
 }
 
-/** Exception thrown by classes which provide their own series expansion to
- *  signal that ordinary Taylor expansion is safe. */
+/** Exception class thrown by classes which provide their own series expansion
+ *  to signal that ordinary Taylor expansion is safe. */
 class do_taylor {};
 
 class do_taylor {};
 
-// cygwin defines a macro log2, causing confusion
+/** Exception class thrown when a singularity is encountered. */
+class pole_error : public std::domain_error {
+public:
+    explicit pole_error(const std::string& what_arg, int degree);
+    int degree(void) const;
+private:
+    int deg;
+};
+
+// some compilers (e.g. cygwin) define a macro log2, causing confusion
 #ifndef log2
 unsigned log2(unsigned n);
 #endif
 #ifndef log2
 unsigned log2(unsigned n);
 #endif
@@ -143,13 +154,13 @@ OutputIterator mymerge3(InputIterator1 first1, InputIterator1 last1,
 
 // Compute the sign of a permutation of a vector of things.
 template <typename T>
 
 // Compute the sign of a permutation of a vector of things.
 template <typename T>
-int permutation_sign(vector<T> s)
+int permutation_sign(std::vector<T> s)
 {
     if (s.size() < 2)
         return 0;
     int sigma = 1;
 {
     if (s.size() < 2)
         return 0;
     int sigma = 1;
-    for (typename vector<T>::iterator i=s.begin(); i!=s.end()-1; ++i) {
-        for (typename vector<T>::iterator j=i+1; j!=s.end(); ++j) {
+    for (typename std::vector<T>::iterator i=s.begin(); i!=s.end()-1; ++i) {
+        for (typename std::vector<T>::iterator j=i+1; j!=s.end(); ++j) {
             if (*i == *j)
                 return 0;
             if (*i > *j) {
             if (*i == *j)
                 return 0;
             if (*i > *j) {
index 385b35de89099e6fea071a6604feb653dfbff38a..35801017b943d60d1f5b253b6797efc0817bde76 100644 (file)
@@ -26,6 +26,6 @@
 /* Major, minor, and micro version number of the GiNaC library. */
 #define GINACLIB_MAJOR_VERSION 0
 #define GINACLIB_MINOR_VERSION 6
 /* Major, minor, and micro version number of the GiNaC library. */
 #define GINACLIB_MAJOR_VERSION 0
 #define GINACLIB_MINOR_VERSION 6
-#define GINACLIB_MICRO_VERSION 2
+#define GINACLIB_MICRO_VERSION 3
 
 #endif // ndef __GINAC_VERSION_H__
 
 #endif // ndef __GINAC_VERSION_H__
index 2ab86bd07784138d4d559109c12e32bbbc680edd..c1f82be49ed2983a613615d4897cc2c98f706f08 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -94,6 +95,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
@@ -453,11 +455,11 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
 # files created by sed scripts
 
 
 # files created by sed scripts
-ginsh_fcn_help.c: ginsh.1 ginsh_fcn_help.sed
-       sed -n -f ginsh_fcn_help.sed <$< >$@
+ginsh_fcn_help.c: ginsh.1 $(srcdir)/ginsh_fcn_help.sed
+       sed -n -f $(srcdir)/ginsh_fcn_help.sed <$< >$@
 
 
-ginsh_op_help.c: ginsh.1 ginsh_op_help.sed
-       sed -n -f ginsh_op_help.sed <$< >$@
+ginsh_op_help.c: ginsh.1 $(srcdir)/ginsh_op_help.sed
+       sed -n -f $(srcdir)/ginsh_op_help.sed <$< >$@
 
 ginsh_parser.o: ginsh_fcn_help.c ginsh_op_help.c
 
 
 ginsh_parser.o: ginsh_fcn_help.c ginsh_op_help.c
 
index 646cb020b2094283823319764d591830557c50bc..d792a242f9c498a788fbf1e9ecf5523945e4a6e5 100644 (file)
@@ -176,6 +176,13 @@ line       : ';'
                cout << (syms.size() > 350 ? 350 : syms.size());
                cout << " out of a possible 350.\n";
        }
                cout << (syms.size() > 350 ? 350 : syms.size());
                cout << " out of a possible 350.\n";
        }
+       | T_TIME {getrusage(RUSAGE_SELF, &start_time);} '(' exp ')' {
+               getrusage(RUSAGE_SELF, &end_time);
+               cout << (end_time.ru_utime.tv_sec - start_time.ru_utime.tv_sec) +
+                       (end_time.ru_stime.tv_sec - start_time.ru_stime.tv_sec) +
+                        double(end_time.ru_utime.tv_usec - start_time.ru_utime.tv_usec) / 1e6 +
+                        double(end_time.ru_stime.tv_usec - start_time.ru_stime.tv_usec) / 1e6 << 's' << endl;
+       }
        | error ';'             {yyclearin; yyerrok;}
        | error ':'             {yyclearin; yyerrok;}
        ;
        | error ';'             {yyclearin; yyerrok;}
        | error ':'             {yyclearin; yyerrok;}
        ;
@@ -188,13 +195,6 @@ exp        : T_NUMBER              {$$ = $1;}
        | T_QUOTE               {$$ = exstack[0];}
        | T_QUOTE2              {$$ = exstack[1];}
        | T_QUOTE3              {$$ = exstack[2];}
        | T_QUOTE               {$$ = exstack[0];}
        | T_QUOTE2              {$$ = exstack[1];}
        | T_QUOTE3              {$$ = exstack[2];}
-       | T_TIME {getrusage(RUSAGE_SELF, &start_time);} '(' exp ')' {
-               getrusage(RUSAGE_SELF, &end_time);
-               $$ = (end_time.ru_utime.tv_sec - start_time.ru_utime.tv_sec) +
-                    (end_time.ru_stime.tv_sec - start_time.ru_stime.tv_sec) +
-                    double(end_time.ru_utime.tv_usec - start_time.ru_utime.tv_usec) / 1e6 +
-                    double(end_time.ru_stime.tv_usec - start_time.ru_stime.tv_usec) / 1e6;
-       }
        | T_SYMBOL '(' exprseq ')' {
                fcn_tab::const_iterator i = find_function($1, $3.nops());
                if (i->second.is_ginac) {
        | T_SYMBOL '(' exprseq ')' {
                fcn_tab::const_iterator i = find_function($1, $3.nops());
                if (i->second.is_ginac) {
index e12b3036dc1c4d440a8090ba8a496af710f23bf8..f6c3caf0cb1c83d98fcf9f306241fa364b785e9c 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
 LEX = @LEX@
 LIBTERMCAP = @LIBTERMCAP@
 LIBTOOL = @LIBTOOL@
@@ -94,6 +95,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index 5568c51e5bc01d9dd7df7ced05b2bb725b138d19..cd8921fd72cf71530d23b55844586ce15893ffb7 100644 (file)
@@ -1,7 +1,8 @@
 /** @file viewgar.cpp
  *
 /** @file viewgar.cpp
  *
- *  GiNaC archive file viewer
- *
+ *  GiNaC archive file viewer. */
+
+/*
  *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -36,7 +37,7 @@ int main(int argc, char **argv)
                fprintf(stderr, "Usage: %s [-d] file...\n", argv[0]);
                exit(1);
        }
                fprintf(stderr, "Usage: %s [-d] file...\n", argv[0]);
                exit(1);
        }
-       argc--; argv++;
+       --argc; ++argv;
 
        bool dump_mode = false;
        try {
 
        bool dump_mode = false;
        try {
@@ -44,24 +45,24 @@ int main(int argc, char **argv)
                while (argc) {
                        if (strcmp(*argv, "-d") == 0) {
                                dump_mode = true;
                while (argc) {
                        if (strcmp(*argv, "-d") == 0) {
                                dump_mode = true;
-                               argc--; argv++;
+                               --argc; ++argv;
                        }
                        }
-                       ifstream f(*argv);
+                       std::ifstream f(*argv);
                        archive ar;
                        f >> ar;
                        if (dump_mode) {
                        archive ar;
                        f >> ar;
                        if (dump_mode) {
-                               ar.printraw(cout);
-                               cout << endl;
+                               ar.printraw(std::cout);
+                               std::cout << std::endl;
                        } else {
                        } else {
-                               for (unsigned int i=0; i<ar.num_expressions(); i++) {
-                                       string name;
+                               for (unsigned int i=0; i<ar.num_expressions(); ++i) {
+                                       std::string name;
                                        ex e = ar.unarchive_ex(l, name, i);
                                        ex e = ar.unarchive_ex(l, name, i);
-                                       cout << name << " = " << e << endl;
+                                       std::cout << name << " = " << e << std::endl;
                                }
                        }
                                }
                        }
-                       argc--; argv++;
+                       --argc; ++argv;
                }
                }
-       } catch (exception &e) {
-               cerr << *argv << ": " << e.what() << endl;
+       } catch (std::exception &e) {
+               std::cerr << *argv << ": " << e.what() << std::endl;
        }
 }
        }
 }