/** @file check.h
*
- * Prototypes for all individual checks.
- *
+ * Prototypes for all individual checks. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
/** @file differentiation.cpp
*
- * Tests for symbolic differentiation, including various functions.
- *
+ * Tests for symbolic differentiation, including various functions. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
static unsigned check_diff(const ex &e, const symbol &x,
const ex &d, unsigned nth=1)
* e = (a0 + a1)^200
* expand e
* substitute a0 by -a1 in e
- * after which e should return 0 (without expanding).
- *
+ * after which e should return 0 (without expanding). */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include <ginac/ginac.h>
+using namespace GiNaC;
#define VECSIZE 100
/** @file fcntimer.cpp
*
- * Function execution timer.
- *
+ * Function execution timer. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
/** @file inifcns_consist.cpp
*
* This test routine applies assorted tests on initially known higher level
- * functions.
- *
+ * functions. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
/* Simple tests on the sine trigonometric function. */
static unsigned inifcns_consist_sin(void)
/** @file lsolve_onedim.cpp
*
* This test routine does some simple checks on solving a polynomial for a
- * variable.
- *
+ * variable. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
unsigned lsolve_onedim(void)
{
/** @file main.cpp
*
- * Main program that calls all individual tests.
- *
+ * Main program that calls all individual tests. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
/** @file matrix_checks.cpp
*
- * Here we test manipulations on GiNaC's symbolic matrices.
- *
+ * Here we test manipulations on GiNaC's symbolic matrices. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include <stdexcept>
#include <ginac/ginac.h>
+using namespace GiNaC;
static unsigned matrix_determinants(void)
{
/** @file normalization.cpp
*
- * Rational function normalization test suite.
- *
+ * Rational function normalization test suite. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
static symbol x("x"), y("y"), z("z");
/** @file numeric_consist.cpp
*
* This test routine creates some numbers and check the result of several
- * boolean tests on these numbers like is_integer() etc...
- *
+ * boolean tests on these numbers like is_integer() etc... */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include <stdlib.h>
#include <ginac/ginac.h>
+using namespace GiNaC;
/* Simple and maybe somewhat pointless consistency tests of assorted tests and
* conversions. */
/** @file numeric_output.cpp
*
- * Test output of numeric types.
- *
+ * Test output of numeric types. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
unsigned numeric_output(void)
{
* This set of tests checks for some of GiNaC's oopses which showed up during
* development. Things were evaluated wrongly and so. It should not find such
* a sick behaviour again. But since we are paranoic and we want to exclude
- * that behaviour for good...
- *
+ * that behaviour for good... */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
// The very first pair of historic problems had its roots in power.cpp and was
// finally resolved on April 27th. (Fixing the first on April 23rd actually
/** @file poly_gcd.cpp
*
* Some test with polynomial GCD calculations. See also the checks for
- * rational function normalization in normalization.cpp.
- *
+ * rational function normalization in normalization.cpp. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
const int MAX_VARIABLES = 5;
/** @file powerlaws.cpp
*
* Tests for power laws. You shouldn't try to draw much inspiration from
- * this code, it is a sanity check rather deeply rooted in GiNaC's classes.
- *
+ * this code, it is a sanity check rather deeply rooted in GiNaC's classes. */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
static unsigned powerlaws1(void)
{
/** @file series_expansion.cpp
*
- * Series expansion test (Laurent and Taylor series).
- *
+ * Series expansion test (Laurent and Taylor series). */
+
+/*
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
*/
#include <ginac/ginac.h>
+using namespace GiNaC;
static symbol x("x");
done
+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
+echo "configure:1870: 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
+#line 1875 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1880: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+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
+echo "configure:1910: 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
+#line 1915 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
+echo "configure:1947: 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
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lreadline $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1955 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char readline();
+
+int main() {
+readline()
+; return 0; }
+EOF
+if { (eval echo configure:1969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo readline | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lreadline $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
for ac_hdr in CLN/cln.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1871: checking for $ac_hdr" >&5
+echo "configure:2002: 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
-#line 1876 "configure"
+#line 2007 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1908: checking for $ac_hdr" >&5
+echo "configure:2039: 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
-#line 1913 "configure"
+#line 2044 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1918: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking how to link with libcln""... $ac_c" 1>&6
-echo "configure:1953: checking how to link with libcln" >&5
+echo "configure:2084: checking how to link with libcln" >&5
saved_LIBS="${LIBS}"
if eval "test \"`echo '$''{'ginac_cv_lib_cln_link'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
case "${ac_cv_header_CLN_cln_h}" in
"yes")
cat > conftest.$ac_ext <<EOF
-#line 1962 "configure"
+#line 2093 "configure"
#include "confdefs.h"
#include <CLN/cln.h>
int main() {
factorial(1);
; return 0; }
EOF
-if { (eval echo configure:1969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ginac_cv_lib_cln_link="-lcln"
else
;;
*)
cat > conftest.$ac_ext <<EOF
-#line 1982 "configure"
+#line 2113 "configure"
#include "confdefs.h"
#include <cln.h>
int main() {
factorial(1);
; return 0; }
EOF
-if { (eval echo configure:1989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ginac_cv_lib_cln_link="-lcln"
else
echo "$ac_t""-lcln" 1>&6
echo $ac_n "checking whether libcln behaves sane""... $ac_c" 1>&6
-echo "configure:2010: checking whether libcln behaves sane" >&5
+echo "configure:2141: checking whether libcln behaves sane" >&5
if eval "test \"`echo '$''{'ginac_cv_lib_cln_integrity'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ginac_cv_lib_cln_integrity="guessing sane"
else
cat > conftest.$ac_ext <<EOF
-#line 2021 "configure"
+#line 2152 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit(int);
if (q+p != 3) return 1; else return 0;
}
EOF
-if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ginac_cv_lib_cln_integrity="sane"
else
ginac_cv_lib_cln_integrity="guessing sane"
else
cat > conftest.$ac_ext <<EOF
-#line 2050 "configure"
+#line 2181 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit(int);
if (q+p != 3) return 1; else return 0;
}
EOF
-if { (eval echo configure:2061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ginac_cv_lib_cln_integrity="sane"
else
esac
-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
-echo "configure:2110: 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
-#line 2115 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2120: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-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
-echo "configure:2150: 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
-#line 2155 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:2187: 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
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lreadline $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2195 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char readline();
-
-int main() {
-readline()
-; return 0; }
-EOF
-if { (eval echo configure:2209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo readline | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lreadline $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
# 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
AC_CHECK_HEADERS(iostream vector map string list typeinfo iterator strstream stdexcept algorithm, ,
AC_MSG_ERROR(need to have ANSI compliant headers))
-dnl We need to have Bruno Haible's CLN installed (macros are in aclocal.m4):
-GINAC_CHECK_CLN_H
-GINAC_CHECK_LIBCLN
-
dnl Check for stuff needed for building the GiNaC interactive shell (ginsh):
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(readline/readline.h readline/history.h)
AC_CHECK_LIB(readline, readline)
+dnl We need to have Bruno Haible's CLN installed (macros are in acinclude.m4):
+GINAC_CHECK_CLN_H
+GINAC_CHECK_LIBCLN
+
dnl Check for utilities needed by the different kinds of documentation.
dnl Documantation needs only be built when extending it, so never mind if it
dnl cannot find those helpers:
printcsrc.cpp relational.cpp symbol.cpp utils.cpp series.cpp ncmul.cpp \
clifford.cpp structure.cpp color.cpp indexed.cpp idx.cpp isospin.cpp \
exprseq_suppl.cpp lst.cpp lst_suppl.cpp simp_lor.cpp coloridx.cpp \
- lorentzidx.cpp utils.h
+ lorentzidx.cpp debugmsg.h utils.h
libginac_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
ginacincludedir = $(includedir)/ginac
ginacinclude_HEADERS = ginac.h add.h basic.h clifford.h color.h coloridx.h \
- constant.h debugmsg.h ex.h expair.h expairseq.h exprseq.h fail.h flags.h \
- function.h idx.h indexed.h inifcns.h isospin.h lorentzidx.h lst.h matrix.h \
- mul.h ncmul.h normal.h numeric.h operators.h power.h relational.h series.h \
- simp_lor.h structure.h symbol.h tinfos.h
+ constant.h ex.h expair.h expairseq.h exprseq.h fail.h flags.h function.h \
+ idx.h indexed.h inifcns.h isospin.h lorentzidx.h lst.h matrix.h mul.h \
+ ncmul.h normal.h numeric.h operators.h power.h relational.h series.h \
+ simp_lor.h structure.h symbol.h tinfos.h assertion.h
+
+# Files which are generated by perl scripts
+function.h function.cpp: function.pl
+ perl function.pl
+
+lst.h lst.cpp: container.pl
+ perl container.pl lst
+
+exprseq.h exprseq.cpp: container.pl
+ perl container.pl exprseq
printcsrc.cpp relational.cpp symbol.cpp utils.cpp series.cpp ncmul.cpp \
clifford.cpp structure.cpp color.cpp indexed.cpp idx.cpp isospin.cpp \
exprseq_suppl.cpp lst.cpp lst_suppl.cpp simp_lor.cpp coloridx.cpp \
- lorentzidx.cpp utils.h
+ lorentzidx.cpp debugmsg.h utils.h
libginac_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
ginacincludedir = $(includedir)/ginac
ginacinclude_HEADERS = ginac.h add.h basic.h clifford.h color.h coloridx.h \
- constant.h debugmsg.h ex.h expair.h expairseq.h exprseq.h fail.h flags.h \
- function.h idx.h indexed.h inifcns.h isospin.h lorentzidx.h lst.h matrix.h \
- mul.h ncmul.h normal.h numeric.h operators.h power.h relational.h series.h \
- simp_lor.h structure.h symbol.h tinfos.h
+ constant.h ex.h expair.h expairseq.h exprseq.h fail.h flags.h function.h \
+ idx.h indexed.h inifcns.h isospin.h lorentzidx.h lst.h matrix.h mul.h \
+ ncmul.h normal.h numeric.h operators.h power.h relational.h series.h \
+ simp_lor.h structure.h symbol.h tinfos.h assertion.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+# Files which are generated by perl scripts
+function.h function.cpp: function.pl
+ perl function.pl
+
+lst.h lst.cpp: container.pl
+ perl container.pl lst
+
+exprseq.h exprseq.cpp: container.pl
+ perl container.pl exprseq
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#include "add.h"
#include "mul.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
exvector add::get_indices(void) const
{
- // all terms in the sum should have the same indices (compatible tensors)
- // however this is not checked, since there is no function yet which
- // compares indices (idxvector can be unsorted) !!!!!!!!!!!
+ // FIXME: all terms in the sum should have the same indices (compatible
+ // tensors) however this is not checked, since there is no function yet
+ // which compares indices (idxvector can be unsorted)
if (seq.size()==0) {
return exvector();
}
const add some_add;
type_info const & typeid_add=typeid(some_add);
-
-
+} // namespace GiNaC
#include <ginac/expairseq.h>
+namespace GiNaC {
+
/** Sum of expressions. */
class add : public expairseq
{
extern const add some_add;
extern type_info const & typeid_add;
-#define ex_to_add(X) static_cast<add const &>(*(X).bp)
+// utility functions
+inline const add &ex_to_add(const ex &e)
+{
+ return static_cast<const add &>(*e.bp);
+}
+
+} // namespace GiNaC
#endif // ndef __GINAC_ADD_H__
--- /dev/null
+/** @file assertion.h
+ *
+ * Assertion macro definition. */
+
+/*
+ * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __GINAC_ASSERTION_H__
+#define __GINAC_ASSERTION_H__
+
+#include <assert.h>
+
+#if defined(DO_GINAC_ASSERT) && !defined(ASSERT)
+#define ASSERT(X) assert(X)
+#else
+#define ASSERT(X) ((void)0)
+#endif
+
+#endif // ndef __GINAC_ASSERTION_H__
#include "lst.h"
#include "ncmul.h"
#include "utils.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
//////////
int max_recursion_level=1024;
+
+} // namespace GiNaC
#include <ginac/flags.h>
#include <ginac/tinfos.h>
-#include <ginac/debugmsg.h>
+#include <ginac/assertion.h>
+
+namespace GiNaC {
class basic;
class ex;
#ifdef INLINE_BASIC_CONSTRUCTORS
: tinfo_key(TINFO_basic), flags(0), refcount(0)
{
- debugmsg("basic default constructor",LOGLEVEL_CONSTRUCT);
- // nothing to do
}
#else
;
virtual ~basic()
#ifdef INLINE_BASIC_CONSTRUCTORS
{
- debugmsg("basic destructor",LOGLEVEL_DESTRUCT);
destroy(0);
ASSERT((!(flags & status_flags::dynallocated))||(refcount==0));
}
basic(basic const & other)
#ifdef INLINE_BASIC_CONSTRUCTORS
{
- debugmsg("basic copy constructor",LOGLEVEL_CONSTRUCT);
copy(other);
}
#else
#ifdef INLINE_BASIC_CONSTRUCTORS
: tinfo_key(ti), flags(0), refcount(0)
{
- debugmsg("basic constructor with tinfo_key",LOGLEVEL_CONSTRUCT);
- // nothing to do
}
#else
;
extern int max_recursion_level;
// convenience macros
-
#define is_of_type(OBJ,TYPE) \
- (dynamic_cast<TYPE *>(const_cast<basic *>(&OBJ))!=0)
+ (dynamic_cast<TYPE *>(const_cast<GiNaC::basic *>(&OBJ))!=0)
#define is_exactly_of_type(OBJ,TYPE) \
- ((OBJ).tinfo()==TINFO_##TYPE)
+ ((OBJ).tinfo()==GiNaC::TINFO_##TYPE)
#define is_ex_of_type(OBJ,TYPE) \
- (dynamic_cast<TYPE *>(const_cast<basic *>((OBJ).bp))!=0)
+ (dynamic_cast<TYPE *>(const_cast<GiNaC::basic *>((OBJ).bp))!=0)
#define is_ex_exactly_of_type(OBJ,TYPE) \
- ((*(OBJ).bp).tinfo()==TINFO_##TYPE)
+ ((*(OBJ).bp).tinfo()==GiNaC::TINFO_##TYPE)
-#define are_ex_trivially_equal(EX1,EX2) \
- ((EX1).bp==(EX2).bp)
// global functions
#endif
}
+} // namespace GiNaC
+
#endif // ndef __GINAC_BASIC_H__
#include "ex.h"
#include "ncmul.h"
#include "utils.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const clifford some_clifford;
type_info const & typeid_clifford=typeid(some_clifford);
+} // namespace GiNaC
#include <string>
#include <ginac/indexed.h>
+#include <ginac/ex.h>
+
+namespace GiNaC {
/** Base class for clifford object */
class clifford : public indexed
extern const clifford some_clifford;
extern type_info const & typeid_clifford;
-// macros
+// utility functions
+inline const clifford &ex_to_clifford(const ex &e)
+{
+ return static_cast<const clifford &>(*e.bp);
+}
-#define ex_to_clifford(X) static_cast<clifford const &>(*(X).bp)
+} // namespace GiNaC
#endif // ndef __GINAC_CLIFFORD_H__
-
-
#include "ncmul.h"
#include "numeric.h"
#include "relational.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
v2.push_back(color_T(summation_index)); // don't care about the representation_label
- // check this formula for SU(N) with N!=3 !!!!!!!!!
+ // FIXME: check this formula for SU(N) with N!=3
return numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
% color_trace_of_one_representation_label(v1)
+numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
}
}
- // TODO: higher contractions!!!!!!!!!!!!!
+ // FIXME: higher contractions
return e;
}
}
}
-
-
-
-
-
-
-
-
-
-
-
-
+} // namespace GiNaC
#include <string>
#include <vector>
#include <ginac/indexed.h>
+#include <ginac/ex.h>
-#define MAX_REPRESENTATION_LABELS 4
-#define COLOR_EIGHT 8 // N*N-1
-#define COLOR_THREE 3 // N
+namespace GiNaC {
+
+const int MAX_REPRESENTATION_LABELS = 4;
+const int COLOR_EIGHT = 8; // N*N-1
+const int COLOR_THREE = 3; // N
/** Base class for color object */
class color : public indexed
extern const color some_color;
extern type_info const & typeid_color;
-// macros
+// global functions
+inline const color &ex_to_color(const ex &e)
+{
+ return static_cast<const color &>(*e.bp);
+}
-#define ex_to_color(X) static_cast<color const &>(*(X).bp)
-#define ex_to_nonconst_color(X) static_cast<color &>(*(X).bp)
+inline color &ex_to_nonconst_color(const ex &e)
+{
+ return static_cast<color &>(*e.bp);
+}
color color_ONE(unsigned const rl=0);
color color_T(ex const & a, unsigned const rl=0);
void append_exvector_to_exvector(exvector & dest, exvector const & source);
-#endif // ndef __GINAC_COLOR_H__
-
+} // namespace GiNaC
+#endif // ndef __GINAC_COLOR_H__
#include "coloridx.h"
#include "utils.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const coloridx some_coloridx;
type_info const & typeid_coloridx=typeid(some_coloridx);
-
-
+} // namespace GiNaC
#include <string>
#include <vector>
#include <ginac/idx.h>
+#include <ginac/ex.h>
+
+namespace GiNaC {
class coloridx : public idx
{
extern const coloridx some_coloridx;
extern type_info const & typeid_coloridx;
-// macros
+// utility functions
+inline const coloridx &ex_to_coloridx(const ex &e)
+{
+ return static_cast<const coloridx &>(*e.bp);
+}
-#define ex_to_coloridx(X) (static_cast<coloridx const &>(*(X).bp))
+} // namespace GiNaC
#endif // ndef __GINAC_COLORIDX_H__
#include "constant.h"
#include "numeric.h"
#include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
/** Euler's constant. (0.57721...) Sometimes called Euler-Mascheroni constant.
* Diverts straight into CLN for evalf(). */
const constant Catalan("Catalan", CatalanEvalf);
+
+} // namespace GiNaC
#include <string>
#include <ginac/basic.h>
+namespace GiNaC {
+
/** This class holds constants, symbols with specific numerical value. Each
* object of this class must either provide their own function to evaluate it
* to class numeric or provide the constant as a numeric (if it's an exact
extern const constant Catalan;
extern const constant EulerGamma;
+} // namespace GiNaC
+
#endif // ndef __GINAC_CONSTANT_H__
$interface=<<END_OF_INTERFACE;
/** \@file ${CONTAINER}.h
*
- * Definition of GiNaC's ${CONTAINER}.
+ * Definition of GiNaC's ${CONTAINER}. */
+
+/*
* This file was generated automatically by container.pl.
* Please do not modify it directly, edit the perl script instead!
* container.pl options: \$CONTAINER=${CONTAINER}
#include <${STLHEADER}>
#include <ginac/basic.h>
+#include <ginac/ex.h>
+
+namespace GiNaC {
typedef ${STLHEADER}<ex> ${STLT};
extern const ${CONTAINER} some_${CONTAINER};
extern type_info const & typeid_${CONTAINER};
-// macros
+// utility functions
+inline const ${CONTAINER} &ex_to_${CONTAINER}(const ex &e)
+{
+ return static_cast<const ${CONTAINER} &>(*e.bp);
+}
-#define ex_to_${CONTAINER}(X) (static_cast<${CONTAINER} const &>(*(X).bp))
+} // namespace GiNaC
#endif // ndef __GINAC_${CONTAINER_UC}_H__
$implementation=<<END_OF_IMPLEMENTATION;
/** \@file ${CONTAINER}.cpp
*
- * Implementation of GiNaC's ${CONTAINER}.
+ * Implementation of GiNaC's ${CONTAINER}. */
+
+/*
* This file was generated automatically by container.pl.
* Please do not modify it directly, edit the perl script instead!
* container.pl options: \$CONTAINER=${CONTAINER}
#include "${CONTAINER}.h"
#include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
${RESERVE_IMPLEMENTATION}
const ${CONTAINER} some_${CONTAINER};
type_info const & typeid_${CONTAINER}=typeid(some_${CONTAINER});
+} // namespace GiNaC
+
END_OF_IMPLEMENTATION
print "Creating interface file ${CONTAINER}.h...";
#ifndef __GINAC_DEBUGMSG_H__
#define __GINAC_DEBUGMSG_H__
+#include <iostream>
+
#ifdef _DEBUG
#define VERBOSE
#define DOASSERT (VERBOSE||DEBUG)
#define LOGLEVEL_ALL 0xffff
#define LOGMASK (LOGLEVEL_PRINT)
-// #define LOGMASK (LOGLEVEL_PRINT | LOGLEVEL_ASSIGNMENT | LOGLEVEL_OPERATOR | LOGLEVEL_DUPLICATE | LOGLEVEL_OPERATOR | LOGLEVEL_MEMBER_FUNCTION | LOGLEVEL_NONMEMBER_FUNCTION )
-
-#include <assert.h>
-#include <iostream>
+// #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)
#endif // def VERBOSE
-#ifdef DOASSERT
-#define ASSERT(X) assert(X)
-#else
-#define ASSERT(X) ((void)0)
-#endif
-
#endif // ndef __GINAC_DEBUGMSG_H__
#include "series.h"
#include "symbol.h"
+namespace GiNaC {
+
/** Default implementation of ex::diff(). It prints and error message and returns a fail object.
* @see ex::diff */
ex basic::diff(symbol const & s) const
epvector new_seq;
epvector::const_iterator it = seq.begin(), itend = seq.end();
- //!! coeff might depend on var
+ // FIXME: coeff might depend on var
while (it != itend) {
if (is_order_function(it->rest)) {
new_seq.push_back(expair(it->rest, it->coeff - 1));
}
return ndiff;
}
+
+} // namespace GiNaC
#include "ncmul.h"
#include "numeric.h"
#include "power.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
return *eMINUSHALF;
}
+} // namespace GiNaC
#include <ginac/basic.h>
#include <ginac/operators.h>
+namespace GiNaC {
+
class ex;
class expand_options;
class status_flags;
#ifdef INLINE_EX_CONSTRUCTORS
: bp(exZERO().bp)
{
- debugmsg("ex default constructor",LOGLEVEL_CONSTRUCT);
ASSERT(exZERO().bp!=0);
ASSERT(exZERO().bp->flags & status_flags::dynallocated);
ASSERT(bp!=0);
~ex()
#ifdef INLINE_EX_CONSTRUCTORS
{
- debugmsg("ex destructor",LOGLEVEL_DESTRUCT);
ASSERT(bp!=0);
ASSERT(bp->flags & status_flags::dynallocated);
if (--bp->refcount == 0) {
#ifdef INLINE_EX_CONSTRUCTORS
: bp(other.bp)
{
- debugmsg("ex copy constructor",LOGLEVEL_CONSTRUCT);
ASSERT(bp!=0);
ASSERT((bp->flags) & status_flags::dynallocated);
++bp->refcount;
ex const & operator=(ex const & other)
#ifdef INLINE_EX_CONSTRUCTORS
{
- debugmsg("ex operator=",LOGLEVEL_ASSIGNMENT);
ASSERT(bp!=0);
ASSERT(bp->flags & status_flags::dynallocated);
ASSERT(other.bp!=0);
ex(basic const & other)
#ifdef INLINE_EX_CONSTRUCTORS
{
- debugmsg("ex constructor from basic",LOGLEVEL_CONSTRUCT);
construct_from_basic(other);
}
#else
public:
basic *bp;
-
};
+// utility functions
+inline bool are_ex_trivially_equal(const ex &e1, const ex &e2)
+{
+ return e1.bp == e2.bp;
+}
+
// wrapper functions around member functions
inline int nops(ex const & thisex)
{ return thisex.nops(); }
inline void swap(ex & e1, ex & e2)
{ e1.swap(e2); }
+} // namespace GiNaC
+
#endif // ndef __GINAC_EX_H__
#include <ginac/ex.h>
#include <ginac/numeric.h>
+namespace GiNaC {
+
/** A pair of expressions.
* This similar to, but slightly extended STL's pair<> but we need to account
* for methods like .compare() */
}
};
+} // namespace GiNaC
+
#endif // ndef __GINAC_EXPAIR_H__
#include "expairseq.h"
#include "lst.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
#ifdef EXPAIRSEQ_USE_HASHTAB
-#error "!!!!!!!!TODO: expair_needs_further_processing not yet implemented for hashtabs, sorry. A.F."
+#error "FIXME: expair_needs_further_processing not yet implemented for hashtabs, sorry. A.F."
#endif // def EXPAIRSEQ_USE_HASHTAB
//////////
const expairseq some_expairseq;
type_info const & typeid_expairseq=typeid(some_expairseq);
+} // namespace GiNaC
#include <list>
#include <ginac/expair.h>
+namespace GiNaC {
+
//#define EXPAIRSEQ_USE_HASHTAB
typedef vector<expair> epvector;
inline void iter_swap(epvector::iterator it1, epvector::iterator it2)
{
- debugmsg("iter_swap epvector",LOGLEVEL_NONMEMBER_FUNCTION);
(*it1).rest.swap((*it2).rest);
(*it1).coeff.swap((*it2).coeff);
}
, hashtabsize(0)
#endif // def EXPAIRSEQ_USE_HASHTAB
{
- debugmsg("expairseq default constructor",LOGLEVEL_CONSTRUCT);
}
~expairseq()
{
- debugmsg("expairseq destructor",LOGLEVEL_DESTRUCT);
destroy(0);
}
expairseq(expairseq const & other);
extern const expairseq some_expairseq;
extern type_info const & typeid_expairseq;
-#define ex_to_expairseq(X) static_cast<expairseq const &>(*(X).bp)
+// utility functions
+inline const expairseq &ex_to_expairseq(const ex &e)
+{
+ return static_cast<const expairseq &>(*e.bp);
+}
+
+} // namespace GiNaC
#endif // ndef __GINAC_EXPAIRSEQ_H__
/** @file exprseq.cpp
*
- * Implementation of GiNaC's exprseq.
+ * Implementation of GiNaC's exprseq. */
+
+/*
* This file was generated automatically by container.pl.
* Please do not modify it directly, edit the perl script instead!
* container.pl options: $CONTAINER=exprseq
* $prepend=0
* $let_op=0
* $open_bracket=(
- * $close_bracket=) */
-
-/*
+ * $close_bracket=)
+ *
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include "exprseq.h"
#include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
#define RESERVE(s,size) (s).reserve(size)
const exprseq some_exprseq;
type_info const & typeid_exprseq=typeid(some_exprseq);
+} // namespace GiNaC
+
/** @file exprseq.h
*
- * Definition of GiNaC's exprseq.
+ * Definition of GiNaC's exprseq. */
+
+/*
* This file was generated automatically by container.pl.
* Please do not modify it directly, edit the perl script instead!
* container.pl options: $CONTAINER=exprseq
* $prepend=0
* $let_op=0
* $open_bracket=(
- * $close_bracket=) */
-
-/*
+ * $close_bracket=)
+ *
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include <vector>
#include <ginac/basic.h>
+#include <ginac/ex.h>
+
+namespace GiNaC {
typedef vector<ex> exvector;
extern const exprseq some_exprseq;
extern type_info const & typeid_exprseq;
-// macros
+// utility functions
+inline const exprseq &ex_to_exprseq(const ex &e)
+{
+ return static_cast<const exprseq &>(*e.bp);
+}
-#define ex_to_exprseq(X) (static_cast<exprseq const &>(*(X).bp))
+} // namespace GiNaC
#endif // ndef __GINAC_EXPRSEQ_H__
#include "exprseq.h"
#include "ex.h"
+namespace GiNaC {
+
bool exprseq::info(unsigned inf) const
{
if (inf==info_flags::exprseq) return 1;
return seq[i];
}
+} // namespace GiNaC
*/
#include "fail.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const fail some_fail;
type_info const & typeid_fail=typeid(some_fail);
+} // namespace GiNaC
#include <ginac/basic.h>
+namespace GiNaC {
+
class fail : public basic
{
// member functions
extern const fail some_fail;
extern type_info const & typeid_fail;
-#endif // ndef __GINAC_FAIL_H__
-
+} // namespace GiNaC
+#endif // ndef __GINAC_FAIL_H__
#ifndef __GINAC_FLAGS_H__
#define __GINAC_FLAGS_H__
+namespace GiNaC {
+
class expand_options {
public:
enum { expand_trigonometric = 0x0001
};
};
+} // namespace GiNaC
+
#endif // ndef __GINAC_FLAGS_H__
/** @file function.cpp
*
- * Implementation of class function.
- *
- * This file was generated automatically by function.pl.
- * Please do not modify it directly, edit the perl script instead!
- * function.pl options: $maxargs=10 */
+ * Implementation of class function. */
/*
+ * This file was generated automatically by function.pl.
+ * Please do not modify it directly, edit the perl script instead!
+ * function.pl options: $maxargs=10
+ *
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include "function.h"
#include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const function some_function;
type_info const & typeid_function=typeid(some_function);
+} // namespace GiNaC
+
/** @file function.h
*
- * Interface to abstract class function (new function concept).
- *
- * This file was generated automatically by function.pl.
- * Please do not modify it directly, edit the perl script instead!
- * function.pl options: $maxargs=10 */
+ * Interface to abstract class function (new function concept). */
/*
+ * This file was generated automatically by function.pl.
+ * Please do not modify it directly, edit the perl script instead!
+ * function.pl options: $maxargs=10
+ *
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include <vector>
#include <ginac/exprseq.h>
-class function;
-
// the following lines have been generated for max. 10 parameters
#define DECLARE_FUNCTION_1P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1) { \
- return function(function_index_##NAME, p1); \
+inline GiNaC::function NAME(GiNaC::ex const & p1) { \
+ return GiNaC::function(function_index_##NAME, p1); \
}
#define DECLARE_FUNCTION_2P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2) { \
- return function(function_index_##NAME, p1, p2); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2) { \
+ return GiNaC::function(function_index_##NAME, p1, p2); \
}
#define DECLARE_FUNCTION_3P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3) { \
- return function(function_index_##NAME, p1, p2, p3); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3); \
}
#define DECLARE_FUNCTION_4P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3, ex const & p4) { \
- return function(function_index_##NAME, p1, p2, p3, p4); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3, GiNaC::ex const & p4) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3, p4); \
}
#define DECLARE_FUNCTION_5P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3, ex const & p4, ex const & p5) { \
- return function(function_index_##NAME, p1, p2, p3, p4, p5); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3, GiNaC::ex const & p4, GiNaC::ex const & p5) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3, p4, p5); \
}
#define DECLARE_FUNCTION_6P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3, ex const & p4, ex const & p5, ex const & p6) { \
- return function(function_index_##NAME, p1, p2, p3, p4, p5, p6); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3, GiNaC::ex const & p4, GiNaC::ex const & p5, GiNaC::ex const & p6) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3, p4, p5, p6); \
}
#define DECLARE_FUNCTION_7P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3, ex const & p4, ex const & p5, ex const & p6, ex const & p7) { \
- return function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3, GiNaC::ex const & p4, GiNaC::ex const & p5, GiNaC::ex const & p6, GiNaC::ex const & p7) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7); \
}
#define DECLARE_FUNCTION_8P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3, ex const & p4, ex const & p5, ex const & p6, ex const & p7, ex const & p8) { \
- return function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7, p8); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3, GiNaC::ex const & p4, GiNaC::ex const & p5, GiNaC::ex const & p6, GiNaC::ex const & p7, GiNaC::ex const & p8) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7, p8); \
}
#define DECLARE_FUNCTION_9P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3, ex const & p4, ex const & p5, ex const & p6, ex const & p7, ex const & p8, ex const & p9) { \
- return function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7, p8, p9); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3, GiNaC::ex const & p4, GiNaC::ex const & p5, GiNaC::ex const & p6, GiNaC::ex const & p7, GiNaC::ex const & p8, GiNaC::ex const & p9) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7, p8, p9); \
}
#define DECLARE_FUNCTION_10P(NAME) \
extern unsigned function_index_##NAME; \
-inline function NAME(ex const & p1, ex const & p2, ex const & p3, ex const & p4, ex const & p5, ex const & p6, ex const & p7, ex const & p8, ex const & p9, ex const & p10) { \
- return function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \
+inline GiNaC::function NAME(GiNaC::ex const & p1, GiNaC::ex const & p2, GiNaC::ex const & p3, GiNaC::ex const & p4, GiNaC::ex const & p5, GiNaC::ex const & p6, GiNaC::ex const & p7, GiNaC::ex const & p8, GiNaC::ex const & p9, GiNaC::ex const & p10) { \
+ return GiNaC::function(function_index_##NAME, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \
}
// end of generated lines
#define REGISTER_FUNCTION(NAME,E,EF,D,S) \
-unsigned function_index_##NAME=function::register_new(#NAME,E,EF,D,S);
+unsigned function_index_##NAME=GiNaC::function::register_new(#NAME,E,EF,D,S);
#define BEGIN_TYPECHECK \
bool automatic_typecheck=true;
} else
#define TYPECHECK_INTEGER(VAR) \
-if (!(VAR).info(info_flags::integer)) { \
+if (!(VAR).info(GiNaC::info_flags::integer)) { \
automatic_typecheck=false; \
} else
return RV.hold(); \
}
+namespace GiNaC {
+
+class function;
+
typedef ex (* eval_funcp)();
typedef ex (* evalf_funcp)();
typedef ex (* diff_funcp)();
// utility macros
#define is_ex_the_function(OBJ, FUNCNAME) \
- (is_ex_exactly_of_type(OBJ, function) && static_cast<function *>(OBJ.bp)->getserial() == function_index_##FUNCNAME)
+ (is_ex_exactly_of_type(OBJ, function) && static_cast<GiNaC::function *>(OBJ.bp)->getserial() == function_index_##FUNCNAME)
// global constants
extern const function some_function;
extern type_info const & typeid_function;
+} // namespace GiNaC
+
#endif // ndef __GINAC_FUNCTION_H__
+
}
$declare_function_macro=generate(
- <<'END_OF_DECLARE_FUNCTION_MACRO','ex const & p${N}','p${N}');
+ <<'END_OF_DECLARE_FUNCTION_MACRO','GiNaC::ex const & p${N}','p${N}');
#define DECLARE_FUNCTION_${N}P(NAME) \\
extern unsigned function_index_##NAME; \\
-inline function NAME(${SEQ1}) { \\
- return function(function_index_##NAME, ${SEQ2}); \\
+inline GiNaC::function NAME(${SEQ1}) { \\
+ return GiNaC::function(function_index_##NAME, ${SEQ2}); \\
}
END_OF_DECLARE_FUNCTION_MACRO
$interface=<<END_OF_INTERFACE;
/** \@file function.h
*
- * Interface to abstract class function (new function concept).
- *
+ * Interface to abstract class function (new function concept). */
+
+/*
* This file was generated automatically by function.pl.
* Please do not modify it directly, edit the perl script instead!
* function.pl options: \$maxargs=${maxargs}
#include <vector>
#include <ginac/exprseq.h>
-class function;
-
// the following lines have been generated for max. ${maxargs} parameters
$declare_function_macro
// end of generated lines
#define REGISTER_FUNCTION(NAME,E,EF,D,S) \\
-unsigned function_index_##NAME=function::register_new(#NAME,E,EF,D,S);
+unsigned function_index_##NAME=GiNaC::function::register_new(#NAME,E,EF,D,S);
#define BEGIN_TYPECHECK \\
bool automatic_typecheck=true;
} else
#define TYPECHECK_INTEGER(VAR) \\
-if (!(VAR).info(info_flags::integer)) { \\
+if (!(VAR).info(GiNaC::info_flags::integer)) { \\
automatic_typecheck=false; \\
} else
return RV.hold(); \\
}
+namespace GiNaC {
+
+class function;
+
typedef ex (* eval_funcp)();
typedef ex (* evalf_funcp)();
typedef ex (* diff_funcp)();
// utility macros
#define is_ex_the_function(OBJ, FUNCNAME) \\
- (is_ex_exactly_of_type(OBJ, function) && static_cast<function *>(OBJ.bp)->getserial() == function_index_##FUNCNAME)
+ (is_ex_exactly_of_type(OBJ, function) && static_cast<GiNaC::function *>(OBJ.bp)->getserial() == function_index_##FUNCNAME)
// global constants
extern const function some_function;
extern type_info const & typeid_function;
+} // namespace GiNaC
+
#endif // ndef __GINAC_FUNCTION_H__
END_OF_INTERFACE
$implementation=<<END_OF_IMPLEMENTATION;
/** \@file function.cpp
*
- * Implementation of class function.
- *
+ * Implementation of class function. */
+
+/*
* This file was generated automatically by function.pl.
* Please do not modify it directly, edit the perl script instead!
* function.pl options: \$maxargs=${maxargs}
#include "function.h"
#include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const function some_function;
type_info const & typeid_function=typeid(some_function);
+} // namespace GiNaC
+
END_OF_IMPLEMENTATION
print "Creating interface file function.h...";
#include <ginac/isospin.h>
#include <ginac/lorentzidx.h>
#include <ginac/simp_lor.h>
-#endif /* ndef GINAC_BASE_ONLY */
+#endif // ndef GINAC_BASE_ONLY
-#endif /* ndef __GINAC_H__ */
+#endif // ndef __GINAC_H__
#include "lst.h"
#include "relational.h"
#include "utils.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
return res;
}
-
-
-
+} // namespace GiNaC
#include <string>
#include <vector>
#include <ginac/basic.h>
+#include <ginac/ex.h>
+
+namespace GiNaC {
class idx : public basic
{
extern const idx some_idx;
extern type_info const & typeid_idx;
-// macros
-
-#define ex_to_idx(X) (static_cast<idx const &>(*(X).bp))
+// utility functions
+inline const idx &ex_to_idx(const ex &e)
+{
+ return static_cast<const idx &>(*e.bp);
+}
-// other functions
+// global functions
typedef vector<ex> exvector;
exvector const & idxv_co);
unsigned count_index(ex const & e, ex const & i);
+} // namespace GiNaC
+
#endif // ndef __GINAC_IDX_H__
#include "indexed.h"
#include "ex.h"
#include "idx.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const indexed some_indexed;
type_info const & typeid_indexed=typeid(some_indexed);
+} // namespace GiNaC
#include <string>
#include <ginac/exprseq.h>
+namespace GiNaC {
+
/** Base class for non-commutative indexed objects */
class indexed : public exprseq
{
extern const indexed some_indexed;
extern type_info const & typeid_indexed;
-// macros
+// utility functions
+inline const indexed &ex_to_indexed(const ex &e)
+{
+ return static_cast<const indexed &>(*e.bp);
+}
-#define ex_to_indexed(X) static_cast<indexed const &>(*(X).bp)
+} // namespace GiNaC
#endif // ndef __GINAC_INDEXED_H__
-
-
#include "series.h"
#include "symbol.h"
+namespace GiNaC {
+
//////////
// dilogarithm
//////////
return ncmul(v,1);
}
+
+} // namespace GiNaC
#include <ginac/function.h>
#include <ginac/ex.h>
+namespace GiNaC {
+
/** Sine. */
DECLARE_FUNCTION_1P(sin)
return is_ex_the_function(e, Order);
}
+} // namespace GiNaC
+
#endif // ndef __GINAC_INIFCNS_H__
#include "power.h"
#include "symbol.h"
+namespace GiNaC {
+
//////////
// gamma function
//////////
{
ASSERT(diff_param==0);
- return power(x, -1); //!!
+ return power(x, -1); // FIXME
}
ex gamma_series(ex const & x, symbol const & s, ex const & point, int order)
{
- //!! Only handle one special case for now...
+ // FIXME: Only handle one special case for now...
if (x.is_equal(s) && point.is_zero()) {
ex e = 1 / s - EulerGamma + s * (power(Pi, 2) / 12 + power(EulerGamma, 2) / 2) + Order(power(s, 2));
return e.series(s, point, order);
}
REGISTER_FUNCTION(gamma, gamma_eval, gamma_evalf, gamma_diff, gamma_series);
+
+} // namespace GiNaC
#include "numeric.h"
#include "power.h"
+namespace GiNaC {
+
//////////
// exponential function
//////////
}
REGISTER_FUNCTION(atanh, atanh_eval, atanh_evalf, atanh_diff, NULL);
+
+} // namespace GiNaC
#include "ex.h"
#include "ncmul.h"
#include "utils.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const isospin some_isospin;
type_info const & typeid_isospin=typeid(some_isospin);
+} // namespace GiNaC
#include <string>
#include <ginac/indexed.h>
+namespace GiNaC {
+
/** Base class for isospin object */
class isospin : public indexed
{
extern const isospin some_isospin;
extern type_info const & typeid_isospin;
-// macros
+// utility functions
+inline const isospin &ex_to_isospin(const ex &e)
+{
+ return static_cast<const isospin &>(*e.bp);
+}
-#define ex_to_isospin(X) static_cast<isospin const &>(*(X).bp)
+} // namespace GiNaC
#endif // ndef __GINAC_ISOSPIN_H__
-
-
#include "lorentzidx.h"
#include "utils.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const lorentzidx some_lorentzidx;
type_info const & typeid_lorentzidx=typeid(some_lorentzidx);
-
-
+} // namespace GiNaC
#include <vector>
#include <ginac/idx.h>
+namespace GiNaC {
+
class lorentzidx : public idx
{
friend class simp_lor;
extern const lorentzidx some_lorentzidx;
extern type_info const & typeid_lorentzidx;
-// macros
+// utility functions
+inline const lorentzidx &ex_to_lorentzidx(const ex &e)
+{
+ return static_cast<const lorentzidx &>(*e.bp);
+}
-#define ex_to_lorentzidx(X) (static_cast<lorentzidx const &>(*(X).bp))
+} // namespace GiNaC
#endif // ndef __GINAC_LORENTZIDX_H__
/** @file lst.cpp
*
- * Implementation of GiNaC's lst.
+ * Implementation of GiNaC's lst. */
+
+/*
* This file was generated automatically by container.pl.
* Please do not modify it directly, edit the perl script instead!
* container.pl options: $CONTAINER=lst
* $prepend=1
* $let_op=1
* $open_bracket=[
- * $close_bracket=] */
-
-/*
+ * $close_bracket=]
+ *
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include "lst.h"
#include "ex.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
#define RESERVE(s,size) // no reserve needed for list
const lst some_lst;
type_info const & typeid_lst=typeid(some_lst);
+} // namespace GiNaC
+
/** @file lst.h
*
- * Definition of GiNaC's lst.
+ * Definition of GiNaC's lst. */
+
+/*
* This file was generated automatically by container.pl.
* Please do not modify it directly, edit the perl script instead!
* container.pl options: $CONTAINER=lst
* $prepend=1
* $let_op=1
* $open_bracket=[
- * $close_bracket=] */
-
-/*
+ * $close_bracket=]
+ *
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
#include <list>
#include <ginac/basic.h>
+#include <ginac/ex.h>
+
+namespace GiNaC {
typedef list<ex> exlist;
extern const lst some_lst;
extern type_info const & typeid_lst;
-// macros
+// utility functions
+inline const lst &ex_to_lst(const ex &e)
+{
+ return static_cast<const lst &>(*e.bp);
+}
-#define ex_to_lst(X) (static_cast<lst const &>(*(X).bp))
+} // namespace GiNaC
#endif // ndef __GINAC_LST_H__
#include "lst.h"
+namespace GiNaC {
+
bool lst::info(unsigned inf) const
{
if (inf==info_flags::list) return 1;
return basic::info(inf);
}
-
+} // namespace GiNaC
#include <stdexcept>
#include "matrix.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor, assignment operator
const matrix some_matrix;
type_info const & typeid_matrix=typeid(some_matrix);
+
+} // namespace GiNaC
#include <ginac/basic.h>
#include <ginac/ex.h>
+namespace GiNaC {
+
/** Symbolic matrices. */
class matrix : public basic
{
inline matrix inverse(matrix const & m)
{ return m.inverse(); }
-// macros
+// utility functions
+inline const matrix &ex_to_matrix(const ex &e)
+{
+ return static_cast<const matrix &>(*e.bp);
+}
-#define ex_to_matrix(X) (static_cast<matrix const &>(*(X).bp))
+} // namespace GiNaC
#endif // ndef __GINAC_MATRIX_H__
#include "mul.h"
#include "add.h"
#include "power.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const mul some_mul;
type_info const & typeid_mul=typeid(some_mul);
-
+} // namespace GiNaC
#include <ginac/expairseq.h>
+namespace GiNaC {
+
/** Product of expressions. */
class mul : public expairseq
{
extern const mul some_mul;
extern type_info const & typeid_mul;
-#define ex_to_mul(X) static_cast<mul const &>(*(X).bp)
+// utility functions
+inline const mul &ex_to_mul(const ex &e)
+{
+ return static_cast<const mul &>(*e.bp);
+}
+
+} // namespace GiNaC
#endif // ndef __GINAC_MUL_H__
#include "ex.h"
#include "add.h"
#include "mul.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
status_flags::evaluated);
}
-
+} // namespace GiNaC
#include <ginac/exprseq.h>
+namespace GiNaC {
+
/** Non-commutative product of expressions. */
class ncmul : public exprseq
{
ex nonsimplified_ncmul(exvector const & v);
ex simplified_ncmul(exvector const & v);
-#define ex_to_ncmul(X) static_cast<ncmul const &>(*(X).bp)
+// utility functions
+inline const ncmul &ex_to_ncmul(const ex &e)
+{
+ return static_cast <const ncmul &>(*e.bp);
+}
+
+} // namespace GiNaC
#endif // ndef __GINAC_NCMUL_H__
-
*/
#include <stdexcept>
+#include <algorithm>
+#include <map>
#include "normal.h"
#include "basic.h"
#include "series.h"
#include "symbol.h"
+namespace GiNaC {
+
// If comparing expressions (ex::compare()) is fast, you can set this to 1.
// Some routines like quo(), rem() and gcd() will then return a quick answer
// when they are called with two identical arguments.
* Statistical information about symbols in polynomials
*/
-#include <algorithm>
-
/** This structure holds information about the highest and lowest degrees
* in which a symbol appears in two multivariate polynomials "a" and "b".
* A vector of these structures with information about all symbols in
* Remembering
*/
-#include <map>
-
typedef pair<ex, ex> ex2;
typedef pair<ex, bool> exbool;
ex numeric::smod(const numeric &xi) const
{
- return ::smod(*this, xi);
+ return GiNaC::smod(*this, xi);
}
ex add::smod(const numeric &xi) const
epvector::const_iterator itend = seq.end();
while (it != itend) {
ASSERT(!is_ex_exactly_of_type(it->rest,numeric));
- numeric coeff = ::smod(ex_to_numeric(it->coeff), xi);
+ numeric coeff = GiNaC::smod(ex_to_numeric(it->coeff), xi);
if (!coeff.is_zero())
newseq.push_back(expair(it->rest, coeff));
it++;
}
ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
- numeric coeff = ::smod(ex_to_numeric(overall_coeff), xi);
+ numeric coeff = GiNaC::smod(ex_to_numeric(overall_coeff), xi);
return (new add(newseq,coeff))->setflag(status_flags::dynallocated);
}
#endif // def DOASSERT
mul * mulcopyp=new mul(*this);
ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
- mulcopyp->overall_coeff=::smod(ex_to_numeric(overall_coeff),xi);
+ mulcopyp->overall_coeff = GiNaC::smod(ex_to_numeric(overall_coeff),xi);
mulcopyp->clearflag(status_flags::evaluated);
mulcopyp->clearflag(status_flags::hash_calculated);
return mulcopyp->setflag(status_flags::dynallocated);
else
return e;
}
+
+} // namespace GiNaC
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef NORMAL_H
-#define NORMAL_H
+#ifndef __GINAC_NORMAL_H__
+#define __GINAC_NORMAL_H__
+
+namespace GiNaC {
class ex;
class symbol;
// Square-free factorization of a polynomial a(x)
extern ex sqrfree(const ex &a, const symbol &x);
-#endif
+} // namespace GiNaC
+
+#endif // ndef __GINAC_NORMAL_H__
#include "numeric.h"
#include "ex.h"
#include "config.h"
+#include "debugmsg.h"
// CLN should not pollute the global namespace, hence we include it here
// instead of in some header file where it would propagate to other parts:
#include <cln.h>
#endif
+namespace GiNaC {
+
// linker has no problems finding text symbols for numerator or denominator
//#define SANE_LINKER
type_info const & typeid_numeric=typeid(some_numeric);
/** Imaginary unit. This is not a constant but a numeric since we are
* natively handing complex numbers anyways. */
-const numeric I = (complex(cl_I(0),cl_I(1)));
+const numeric I = numeric(complex(cl_I(0),cl_I(1)));
//////////
// global functions
* @return arbitrary precision numerical exp(x). */
numeric exp(numeric const & x)
{
- return exp(*x.value); // -> CLN
+ return ::exp(*x.value); // -> CLN
}
/** Natural logarithm.
{
if (z.is_zero())
throw (std::overflow_error("log(): logarithmic singularity"));
- return log(*z.value); // -> CLN
+ return ::log(*z.value); // -> CLN
}
/** Numeric sine (trigonometric function).
* @return arbitrary precision numerical sin(x). */
numeric sin(numeric const & x)
{
- return sin(*x.value); // -> CLN
+ return ::sin(*x.value); // -> CLN
}
/** Numeric cosine (trigonometric function).
* @return arbitrary precision numerical cos(x). */
numeric cos(numeric const & x)
{
- return cos(*x.value); // -> CLN
+ return ::cos(*x.value); // -> CLN
}
/** Numeric tangent (trigonometric function).
* @return arbitrary precision numerical tan(x). */
numeric tan(numeric const & x)
{
- return tan(*x.value); // -> CLN
+ return ::tan(*x.value); // -> CLN
}
/** Numeric inverse sine (trigonometric function).
* @return arbitrary precision numerical asin(x). */
numeric asin(numeric const & x)
{
- return asin(*x.value); // -> CLN
+ return ::asin(*x.value); // -> CLN
}
/** Numeric inverse cosine (trigonometric function).
* @return arbitrary precision numerical acos(x). */
numeric acos(numeric const & x)
{
- return acos(*x.value); // -> CLN
+ return ::acos(*x.value); // -> CLN
}
/** Arcustangents.
x.real().is_zero() &&
!abs(x.imag()).is_equal(numONE()))
throw (std::overflow_error("atan(): logarithmic singularity"));
- return atan(*x.value); // -> CLN
+ return ::atan(*x.value); // -> CLN
}
/** Arcustangents.
numeric atan(numeric const & y, numeric const & x)
{
if (x.is_real() && y.is_real())
- return atan(realpart(*x.value), realpart(*y.value)); // -> CLN
+ return ::atan(realpart(*x.value), realpart(*y.value)); // -> CLN
else
throw (std::invalid_argument("numeric::atan(): complex argument"));
}
* @return arbitrary precision numerical sinh(x). */
numeric sinh(numeric const & x)
{
- return sinh(*x.value); // -> CLN
+ return ::sinh(*x.value); // -> CLN
}
/** Numeric hyperbolic cosine (trigonometric function).
* @return arbitrary precision numerical cosh(x). */
numeric cosh(numeric const & x)
{
- return cosh(*x.value); // -> CLN
+ return ::cosh(*x.value); // -> CLN
}
/** Numeric hyperbolic tangent (trigonometric function).
* @return arbitrary precision numerical tanh(x). */
numeric tanh(numeric const & x)
{
- return tanh(*x.value); // -> CLN
+ return ::tanh(*x.value); // -> CLN
}
/** Numeric inverse hyperbolic sine (trigonometric function).
* @return arbitrary precision numerical asinh(x). */
numeric asinh(numeric const & x)
{
- return asinh(*x.value); // -> CLN
+ return ::asinh(*x.value); // -> CLN
}
/** Numeric inverse hyperbolic cosine (trigonometric function).
* @return arbitrary precision numerical acosh(x). */
numeric acosh(numeric const & x)
{
- return acosh(*x.value); // -> CLN
+ return ::acosh(*x.value); // -> CLN
}
/** Numeric inverse hyperbolic tangent (trigonometric function).
* @return arbitrary precision numerical atanh(x). */
numeric atanh(numeric const & x)
{
- return atanh(*x.value); // -> CLN
+ return ::atanh(*x.value); // -> CLN
}
/** The gamma function.
throw (std::range_error("numeric::factorial(): argument must be integer >= 0"));
}
- return numeric(factorial(nn.to_int())); // -> CLN
+ return numeric(::factorial(nn.to_int())); // -> CLN
}
/** The double factorial combinatorial function. (Scarcely used, but still
numeric binomial(numeric const & n, numeric const & k)
{
if (n.is_nonneg_integer() && k.is_nonneg_integer()) {
- return numeric(binomial(n.to_int(),k.to_int())); // -> CLN
+ return numeric(::binomial(n.to_int(),k.to_int())); // -> CLN
} else {
// should really be gamma(n+1)/(gamma(r+1)/gamma(n-r+1)
return numeric(0);
/** Absolute value. */
numeric abs(numeric const & x)
{
- return abs(*x.value); // -> CLN
+ return ::abs(*x.value); // -> CLN
}
/** Modulus (in positive representation).
numeric mod(numeric const & a, numeric const & b)
{
if (a.is_integer() && b.is_integer()) {
- return mod(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
+ return ::mod(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
}
else {
return numZERO(); // Throw?
{
if (a.is_integer() && b.is_integer()) {
cl_I b2 = The(cl_I)(ceiling1(The(cl_I)(*b.value) / 2)) - 1;
- return mod(The(cl_I)(*a.value) + b2, The(cl_I)(*b.value)) - b2;
+ return ::mod(The(cl_I)(*a.value) + b2, The(cl_I)(*b.value)) - b2;
} else {
return numZERO(); // Throw?
}
numeric irem(numeric const & a, numeric const & b)
{
if (a.is_integer() && b.is_integer()) {
- return rem(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
+ return ::rem(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
}
else {
return numZERO(); // Throw?
* where imag(z)>0. */
numeric sqrt(numeric const & z)
{
- return sqrt(*z.value); // -> CLN
+ return ::sqrt(*z.value); // -> CLN
}
/** Integer numeric square root. */
{
if (x.is_integer()) {
cl_I root;
- isqrt(The(cl_I)(*x.value), &root); // -> CLN
+ ::isqrt(The(cl_I)(*x.value), &root); // -> CLN
return root;
} else
return numZERO(); // Throw?
numeric gcd(numeric const & a, numeric const & b)
{
if (a.is_integer() && b.is_integer())
- return gcd(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
+ return ::gcd(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
else
return numONE();
}
numeric lcm(numeric const & a, numeric const & b)
{
if (a.is_integer() && b.is_integer())
- return lcm(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
+ return ::lcm(The(cl_I)(*a.value), The(cl_I)(*b.value)); // -> CLN
else
return *a.value * *b.value;
}
/** Accuracy in decimal digits. Only object of this type! Can be set using
* assignment from C++ unsigned ints and evaluated like any built-in type. */
_numeric_digits Digits;
+
+} // namespace GiNaC
#include <strstream>
#include <ginac/basic.h>
-
-#define HASHVALUE_NUMERIC 0x80000001U
+#include <ginac/ex.h>
class cl_N; // We want to include cln.h only in numeric.cpp in order to
// avoid namespace pollution and keep compile-time low.
+namespace GiNaC {
+
+#define HASHVALUE_NUMERIC 0x80000001U
+
/** This class is used to instantiate a global object Digits which
* behaves just like Maple's Digits. We need an object rather than a
* dumber basic type since as a side-effect we let it change
ex EulerGammaEvalf(void);
ex CatalanEvalf(void);
-#define ex_to_numeric(X) static_cast<numeric const &>(*(X).bp)
+// utility functions
+inline const numeric &ex_to_numeric(const ex &e)
+{
+ return static_cast<const numeric &>(*e.bp);
+}
+} // namespace GiNaC
#endif // ndef __GINAC_NUMERIC_H__
#include "numeric.h"
#include "power.h"
#include "relational.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
// binary arithmetic operators ex with ex
throw(std::logic_error("input from streams not yet implemented"));
}
+} // namespace GiNaC
#include <iostream>
+namespace GiNaC {
+
class ex;
class numeric;
class relational;
ostream & operator<<(ostream & os, ex const & e);
istream & operator>>(istream & is, ex & e);
+} // namespace GiNaC
+
#endif // ndef __GINAC_OPERATORS_H__
#include "numeric.h"
#include "relational.h"
#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
typedef vector<int> intvector;
cout << "end term" << endl;
*/
- // TODO: optimize!!!!!!!!
+ // TODO: optimize this
sum.push_back((new mul(term))->setflag(status_flags::dynallocated));
// increment k[]
const power some_power;
type_info const & typeid_power=typeid(some_power);
+
+} // namespace GiNaC
#include <ginac/basic.h>
#include <ginac/ex.h>
+namespace GiNaC {
+
class numeric;
class add;
extern const power some_power;
extern type_info const & typeid_power;
-#define ex_to_power(X) static_cast<power const &>(*(X).bp)
+// utility functions
+inline const power &ex_to_power(const ex &e)
+{
+ return static_cast<const power &>(*e.bp);
+}
// wrapper functions
inline ex sqrt(ex const & a)
{ return power(a,exHALF()); }
-#endif // ndef __GINAC_POWER_H__
+} // namespace GiNaC
+#endif // ndef __GINAC_POWER_H__
#include "relational.h"
#include "series.h"
#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
void ex::print(ostream & os, unsigned upper_precedence) const
{
}
os << m[row*col-1] << "]] ]]";
}
+
+} // namespace GiNaC
#include "relational.h"
#include "series.h"
#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
/** Print expression as a C++ statement. The output looks like
* "<type> <var_name> = <expression>;". The "type" parameter has an effect
if (precedence <= upper_precedence)
os << ")";
}
+
+} // namespace GiNaC
#include "relational.h"
#include "series.h"
#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
void ex::printraw(ostream & os) const
{
}
os << m[row*col-1] << "))";
}
+
+} // namespace GiNaC
#include "relational.h"
#include "series.h"
#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
void ex::printtree(ostream & os, unsigned indent) const
{
#endif // def EXPAIRSEQ_USE_HASHTAB
}
+} // namespace GiNaC
#include "relational.h"
#include "numeric.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const relational some_relational;
type_info const & typeid_relational=typeid(some_relational);
+} // namespace GiNaC
#include <ginac/basic.h>
#include <ginac/ex.h>
+namespace GiNaC {
+
/** This class holds a relation consisting of two expressions and a logical
* relation between them. */
class relational : public basic
extern const relational some_relational;
extern type_info const & typeid_relational;
-#define ex_to_relational(X) static_cast<relational const &>(*(X).bp)
-
-#endif // ndef __GINAC_RELATIONAL_H__
+// utility functions
+inline const relational &ex_to_relational(const ex &e)
+{
+ return static_cast<const relational &>(*e.bp);
+}
+} // namespace GiNaC
+#endif // ndef __GINAC_RELATIONAL_H__
#include "power.h"
#include "relational.h"
#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
/*
// Global constants
const series some_series;
type_info const & typeid_series = typeid(some_series);
+
+} // namespace GiNaC
#include <ginac/basic.h>
#include <ginac/expairseq.h>
+namespace GiNaC {
+
/** This class holds a extended truncated power series (positive and negative
* integer powers). It consists of expression coefficients (only non-zero
* coefficients are stored), an expansion variable and an expansion point.
extern const series some_series;
extern type_info const & typeid_series;
-#define ex_to_series(X) (static_cast<class series const &>(*(X).bp))
-#define series_to_poly(X) (static_cast<series const &>(*(X).bp).convert_to_poly(true))
+// utility functions
+inline const series &ex_to_series(const ex &e)
+{
+ return static_cast<const series &>(*e.bp);
+}
+
+inline ex series_to_poly(const ex &e)
+{
+ return (static_cast<const series &>(*e.bp).convert_to_poly(true));
+}
+
+} // namespace GiNaC
#endif // ndef __GINAC_SERIES_H__
#include "ex.h"
#include "mul.h"
#include "symbol.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
return spmapkey(strstrpair(v1.name,v2.name),anon);
}
-
-
+} // namespace GiNaC
#include <ginac/indexed.h>
#include <ginac/lorentzidx.h>
+namespace GiNaC {
+
typedef pair<string,string> strstrpair;
typedef pair<strstrpair,lorentzidx> spmapkey;
extern const simp_lor some_simp_lor;
extern type_info const & typeid_simp_lor;
-// macros
+// utility functions
+inline const simp_lor &ex_to_simp_lor(const ex &e)
+{
+ return static_cast<const simp_lor &>(*e.bp);
+}
-#define ex_to_simp_lor(X) static_cast<simp_lor const &>(*(X).bp)
-#define ex_to_nonconst_simp_lor(X) static_cast<simp_lor &>(*(X).bp)
+inline simp_lor &ex_to_nonconst_simp_lor(const ex &e)
+{
+ return static_cast<simp_lor &>(*e.bp);
+}
simp_lor lor_g(ex const & mu, ex const & nu);
simp_lor lor_vec(string const & n, ex const & mu);
ex simplify_simp_lor(ex const & e, scalar_products const & sp);
ex Dim(void);
-#endif // ndef _SIMP__GINAC_LOR_H__
-
+} // namespace GiNaC
+#endif // ndef _SIMP__GINAC_LOR_H__
#include <string>
#include "structure.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
const structure some_structure;
type_info const & typeid_structure=typeid(some_structure);
+} // namespace GiNaC
#include <ginac/basic.h>
+namespace GiNaC {
+
struct registered_structure_info {
char const * name;
};
extern const structure some_structure;
extern type_info const & typeid_structure;
-#endif // ndef __GINAC_STRUCTURE_H__
+} // namespace GiNaC
+#endif // ndef __GINAC_STRUCTURE_H__
$interface=<<END_OF_INTERFACE;
/** \@file ${STRUCTURE}.h
*
- * Definition of GiNaC's user defined structure ${STRUCTURE}.
+ * Definition of GiNaC's user defined structure ${STRUCTURE}. */
+
+/*
* This file was generated automatically by structure.pl.
* Please do not modify it directly, edit the perl script instead!
*
#ifndef __GINAC_${STRUCTURE_UC}_H__
#define __GINAC_${STRUCTURE_UC}_H__
-#include <ginac/ginac.h>
+#include <ginac/structure.h>
+
+namespace GiNaC {
class ${STRUCTURE} : public structure
{
#define ex_to_${STRUCTURE}(X) (static_cast<${STRUCTURE} const &>(*(X).bp))
+} // namespace GiNaC
+
#endif // ndef _${STRUCTURE_UC}_H_
END_OF_INTERFACE
$implementation=<<END_OF_IMPLEMENTATION;
/** \@file ${STRUCTURE}.cpp
*
- * Implementation of GiNaC's user defined structure ${STRUCTURE}.
+ * Implementation of GiNaC's user defined structure ${STRUCTURE}. */
+
+/*
* This file was generated automatically by STRUCTURE.pl.
* Please do not modify it directly, edit the perl script instead!
*
#include <iostream>
-#include "ginac.h"
+#include "${STRUCTURE}.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
type_info const & typeid_${STRUCTURE}=typeid(some_${STRUCTURE});
const unsigned tinfo_${STRUCTURE}=structure::register_new("${STRUCTURE}");
+} // namespace GiNaC
+
END_OF_IMPLEMENTATION
print "Creating interface file ${STRUCTURE}.h...";
#include "lst.h"
#include "utils.h"
#include "idx.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
symbol::assigned_ex_info::assigned_ex_info(void) : is_assigned(0), refcount(1)
{
}
+
+} // namespace GiNaC
#include <ginac/basic.h>
#include <ginac/ex.h>
+namespace GiNaC {
+
/** Basic CAS symbol. It has a name because it must know how to output itself.
* It may be assigned an expression, but this feature is only intended for
* programs like 'ginsh' that want to associate symbols with expressions.
extern const symbol some_symbol;
extern type_info const & typeid_symbol;
-// macros
-
-#define ex_to_symbol(X) static_cast<symbol const &>(*(X).bp)
+// utility functions
+inline const symbol &ex_to_symbol(const ex &e)
+{
+ return static_cast<const symbol &>(*e.bp);
+}
// wrapper functions around member functions
inline void unassign(symbol & symarg)
inline int ldegree(symbol const & a, symbol const & s)
{ return a.ldegree(s); }
+} // namespace GiNaC
+
#endif // ndef __GINAC_SYMBOL_H__
#ifndef __GINAC_TINFOS_H__
#define __GINAC_TINFOS_H__
-#define TINFO_basic 0x00000001U
+namespace GiNaC {
-#define TINFO_expairseq 0x00010001U
-#define TINFO_add 0x00011001U
-#define TINFO_mul 0x00011002U
+const unsigned TINFO_basic = 0x00000001U;
-#define TINFO_symbol 0x00020001U
-#define TINFO_constant 0x00021001U
+const unsigned TINFO_expairseq = 0x00010001U;
+const unsigned TINFO_add = 0x00011001U;
+const unsigned TINFO_mul = 0x00011002U;
-#define TINFO_exprseq 0x00030001U
-#define TINFO_function 0x00031001U
-#define TINFO_ncmul 0x00031002U
+const unsigned TINFO_symbol = 0x00020001U;
+const unsigned TINFO_constant = 0x00021001U;
-#define TINFO_lst 0x00040001U
+const unsigned TINFO_exprseq = 0x00030001U;
+const unsigned TINFO_function = 0x00031001U;
+const unsigned TINFO_ncmul = 0x00031002U;
-#define TINFO_matrix 0x00050001U
+const unsigned TINFO_lst = 0x00040001U;
-#define TINFO_power 0x00060001U
+const unsigned TINFO_matrix = 0x00050001U;
-#define TINFO_relational 0x00070001U
+const unsigned TINFO_power = 0x00060001U;
-#define TINFO_fail 0x00080001U
+const unsigned TINFO_relational = 0x00070001U;
-#define TINFO_numeric 0x00090001U
+const unsigned TINFO_fail = 0x00080001U;
-#define TINFO_series 0x000a0001U
+const unsigned TINFO_numeric = 0x00090001U;
-#define TINFO_indexed 0x000b0001U
-#define TINFO_algebra 0x000b1001U
-#define TINFO_clifford 0x000b1101U
-#define TINFO_color 0x000b1201U
-#define TINFO_isospin 0x000b1301U
-#define TINFO_simp_lor 0x000b1401U
+const unsigned TINFO_series = 0x000a0001U;
-#define TINFO_structure 0x000c0001U
-// reserved up to 0x000cffffU
+const unsigned TINFO_indexed = 0x000b0001U;
+const unsigned TINFO_algebra = 0x000b1001U;
+const unsigned TINFO_clifford = 0x000b1101U;
+const unsigned TINFO_color = 0x000b1201U;
+const unsigned TINFO_isospin = 0x000b1301U;
+const unsigned TINFO_simp_lor = 0x000b1401U;
+
+const unsigned TINFO_structure = 0x000c0001U;
+// reserved up to 0x000cffffU
// for user defined structures
-#define TINFO_idx 0x000d0001U
-#define TINFO_coloridx 0x000d1001U
-#define TINFO_lorentzidx 0x000d1002U
+const unsigned TINFO_idx = 0x000d0001U;
+const unsigned TINFO_coloridx = 0x000d1001U;
+const unsigned TINFO_lorentzidx = 0x000d1002U;
+
+} // namespace GiNaC
#endif // ndef __GINAC_TINFOS_H__
#include "utils.h"
+namespace GiNaC {
+
unsigned log2(unsigned n)
{
unsigned k;
// private
// none
-
-
-
+} // namespace GiNaC
#include <string>
#include "config.h"
+namespace GiNaC {
+
template<class T>
string ToString(T const & t)
{
int compare_pointers(void const * a, void const * b);
-#define DYNCONSTCAST(FINALTYPE,BASICTYPE,EXPRESSION) \
- dynamic_cast<FINALTYPE>(const_cast<BASICTYPE>(EXPRESSION))
-
// modified from stl_algo.h: always do com(*first1,*first2) instead of comp(*first2,*first1)
template <class InputIterator1, class InputIterator2, class OutputIterator,
class Compare>
}
}
+} // namespace GiNaC
+
#endif // ndef __GINAC_UTILS_H__