From 9e6095549bfe9ee2188a5702a4b04ee244d87fd9 Mon Sep 17 00:00:00 2001 From: Alexander Frink Date: Thu, 17 Feb 2000 01:43:26 +0000 Subject: [PATCH] new conversion functions basic -> ex in dummies.h needed for cint 5.14.x with x>26 until the derived->basic->ex conversion bug is fixed --- cint/dummies.h | 753 +++++++++++++++++++++++++++-------------- cint/dummies.pl | 173 ++++++++-- cint/ginaccint.bin.cpp | 30 +- 3 files changed, 675 insertions(+), 281 deletions(-) diff --git a/cint/dummies.h b/cint/dummies.h index 3f017b46..a616740d 100644 --- a/cint/dummies.h +++ b/cint/dummies.h @@ -5,71 +5,103 @@ * Please do not modify it directly, edit the perl script instead! */ -// fixes for sin(x) -inline ex sin(symbol const & x) { return sin(ex(x)); } -inline ex sin(function const & x) { return sin(ex(x)); } -inline ex sin(constant const & x) { return sin(ex(x)); } -inline ex sin(idx const & x) { return sin(ex(x)); } -inline ex sin(lorentzidx const & x) { return sin(ex(x)); } -inline ex sin(coloridx const & x) { return sin(ex(x)); } +// fixes for function sin(x) +inline function sin(symbol const & x) { return sin(ex(x)); } +inline function sin(function const & x) { return sin(ex(x)); } +inline function sin(constant const & x) { return sin(ex(x)); } +inline function sin(idx const & x) { return sin(ex(x)); } +inline function sin(lorentzidx const & x) { return sin(ex(x)); } +inline function sin(coloridx const & x) { return sin(ex(x)); } -// fixes for cos(x) -inline ex cos(symbol const & x) { return cos(ex(x)); } -inline ex cos(function const & x) { return cos(ex(x)); } -inline ex cos(constant const & x) { return cos(ex(x)); } -inline ex cos(idx const & x) { return cos(ex(x)); } -inline ex cos(lorentzidx const & x) { return cos(ex(x)); } -inline ex cos(coloridx const & x) { return cos(ex(x)); } +// fixes for function cos(x) +inline function cos(symbol const & x) { return cos(ex(x)); } +inline function cos(function const & x) { return cos(ex(x)); } +inline function cos(constant const & x) { return cos(ex(x)); } +inline function cos(idx const & x) { return cos(ex(x)); } +inline function cos(lorentzidx const & x) { return cos(ex(x)); } +inline function cos(coloridx const & x) { return cos(ex(x)); } -// fixes for tan(x) -inline ex tan(symbol const & x) { return tan(ex(x)); } -inline ex tan(function const & x) { return tan(ex(x)); } -inline ex tan(constant const & x) { return tan(ex(x)); } -inline ex tan(idx const & x) { return tan(ex(x)); } -inline ex tan(lorentzidx const & x) { return tan(ex(x)); } -inline ex tan(coloridx const & x) { return tan(ex(x)); } +// fixes for function tan(x) +inline function tan(symbol const & x) { return tan(ex(x)); } +inline function tan(function const & x) { return tan(ex(x)); } +inline function tan(constant const & x) { return tan(ex(x)); } +inline function tan(idx const & x) { return tan(ex(x)); } +inline function tan(lorentzidx const & x) { return tan(ex(x)); } +inline function tan(coloridx const & x) { return tan(ex(x)); } -// fixes for asin(x) -inline ex asin(symbol const & x) { return asin(ex(x)); } -inline ex asin(function const & x) { return asin(ex(x)); } -inline ex asin(constant const & x) { return asin(ex(x)); } -inline ex asin(idx const & x) { return asin(ex(x)); } -inline ex asin(lorentzidx const & x) { return asin(ex(x)); } -inline ex asin(coloridx const & x) { return asin(ex(x)); } +// fixes for function asin(x) +inline function asin(symbol const & x) { return asin(ex(x)); } +inline function asin(function const & x) { return asin(ex(x)); } +inline function asin(constant const & x) { return asin(ex(x)); } +inline function asin(idx const & x) { return asin(ex(x)); } +inline function asin(lorentzidx const & x) { return asin(ex(x)); } +inline function asin(coloridx const & x) { return asin(ex(x)); } -// fixes for acos(x) -inline ex acos(symbol const & x) { return acos(ex(x)); } -inline ex acos(function const & x) { return acos(ex(x)); } -inline ex acos(constant const & x) { return acos(ex(x)); } -inline ex acos(idx const & x) { return acos(ex(x)); } -inline ex acos(lorentzidx const & x) { return acos(ex(x)); } -inline ex acos(coloridx const & x) { return acos(ex(x)); } +// fixes for function acos(x) +inline function acos(symbol const & x) { return acos(ex(x)); } +inline function acos(function const & x) { return acos(ex(x)); } +inline function acos(constant const & x) { return acos(ex(x)); } +inline function acos(idx const & x) { return acos(ex(x)); } +inline function acos(lorentzidx const & x) { return acos(ex(x)); } +inline function acos(coloridx const & x) { return acos(ex(x)); } -// fixes for atan(x) -inline ex atan(symbol const & x) { return atan(ex(x)); } -inline ex atan(function const & x) { return atan(ex(x)); } -inline ex atan(constant const & x) { return atan(ex(x)); } -inline ex atan(idx const & x) { return atan(ex(x)); } -inline ex atan(lorentzidx const & x) { return atan(ex(x)); } -inline ex atan(coloridx const & x) { return atan(ex(x)); } +// fixes for function atan(x) +inline function atan(symbol const & x) { return atan(ex(x)); } +inline function atan(function const & x) { return atan(ex(x)); } +inline function atan(constant const & x) { return atan(ex(x)); } +inline function atan(idx const & x) { return atan(ex(x)); } +inline function atan(lorentzidx const & x) { return atan(ex(x)); } +inline function atan(coloridx const & x) { return atan(ex(x)); } -// fixes for exp(x) -inline ex exp(symbol const & x) { return exp(ex(x)); } -inline ex exp(function const & x) { return exp(ex(x)); } -inline ex exp(constant const & x) { return exp(ex(x)); } -inline ex exp(idx const & x) { return exp(ex(x)); } -inline ex exp(lorentzidx const & x) { return exp(ex(x)); } -inline ex exp(coloridx const & x) { return exp(ex(x)); } +// fixes for function exp(x) +inline function exp(symbol const & x) { return exp(ex(x)); } +inline function exp(function const & x) { return exp(ex(x)); } +inline function exp(constant const & x) { return exp(ex(x)); } +inline function exp(idx const & x) { return exp(ex(x)); } +inline function exp(lorentzidx const & x) { return exp(ex(x)); } +inline function exp(coloridx const & x) { return exp(ex(x)); } -// fixes for log(x) -inline ex log(symbol const & x) { return log(ex(x)); } -inline ex log(function const & x) { return log(ex(x)); } -inline ex log(constant const & x) { return log(ex(x)); } -inline ex log(idx const & x) { return log(ex(x)); } -inline ex log(lorentzidx const & x) { return log(ex(x)); } -inline ex log(coloridx const & x) { return log(ex(x)); } +// fixes for function log(x) +inline function log(symbol const & x) { return log(ex(x)); } +inline function log(function const & x) { return log(ex(x)); } +inline function log(constant const & x) { return log(ex(x)); } +inline function log(idx const & x) { return log(ex(x)); } +inline function log(lorentzidx const & x) { return log(ex(x)); } +inline function log(coloridx const & x) { return log(ex(x)); } -// fixes for sqrt(x) +// fixes for function sinh(x) +inline function sinh(symbol const & x) { return sinh(ex(x)); } +inline function sinh(function const & x) { return sinh(ex(x)); } +inline function sinh(constant const & x) { return sinh(ex(x)); } +inline function sinh(idx const & x) { return sinh(ex(x)); } +inline function sinh(lorentzidx const & x) { return sinh(ex(x)); } +inline function sinh(coloridx const & x) { return sinh(ex(x)); } + +// fixes for function cosh(x) +inline function cosh(symbol const & x) { return cosh(ex(x)); } +inline function cosh(function const & x) { return cosh(ex(x)); } +inline function cosh(constant const & x) { return cosh(ex(x)); } +inline function cosh(idx const & x) { return cosh(ex(x)); } +inline function cosh(lorentzidx const & x) { return cosh(ex(x)); } +inline function cosh(coloridx const & x) { return cosh(ex(x)); } + +// fixes for function tanh(x) +inline function tanh(symbol const & x) { return tanh(ex(x)); } +inline function tanh(function const & x) { return tanh(ex(x)); } +inline function tanh(constant const & x) { return tanh(ex(x)); } +inline function tanh(idx const & x) { return tanh(ex(x)); } +inline function tanh(lorentzidx const & x) { return tanh(ex(x)); } +inline function tanh(coloridx const & x) { return tanh(ex(x)); } + +// fixes for function abs(x) +inline function abs(symbol const & x) { return abs(ex(x)); } +inline function abs(function const & x) { return abs(ex(x)); } +inline function abs(constant const & x) { return abs(ex(x)); } +inline function abs(idx const & x) { return abs(ex(x)); } +inline function abs(lorentzidx const & x) { return abs(ex(x)); } +inline function abs(coloridx const & x) { return abs(ex(x)); } + +// fixes for ex sqrt(x) inline ex sqrt(symbol const & x) { return sqrt(ex(x)); } inline ex sqrt(function const & x) { return sqrt(ex(x)); } inline ex sqrt(constant const & x) { return sqrt(ex(x)); } @@ -77,39 +109,243 @@ inline ex sqrt(idx const & x) { return sqrt(ex(x)); } inline ex sqrt(lorentzidx const & x) { return sqrt(ex(x)); } inline ex sqrt(coloridx const & x) { return sqrt(ex(x)); } -// fixes for sinh(x) -inline ex sinh(symbol const & x) { return sinh(ex(x)); } -inline ex sinh(function const & x) { return sinh(ex(x)); } -inline ex sinh(constant const & x) { return sinh(ex(x)); } -inline ex sinh(idx const & x) { return sinh(ex(x)); } -inline ex sinh(lorentzidx const & x) { return sinh(ex(x)); } -inline ex sinh(coloridx const & x) { return sinh(ex(x)); } - -// fixes for cosh(x) -inline ex cosh(symbol const & x) { return cosh(ex(x)); } -inline ex cosh(function const & x) { return cosh(ex(x)); } -inline ex cosh(constant const & x) { return cosh(ex(x)); } -inline ex cosh(idx const & x) { return cosh(ex(x)); } -inline ex cosh(lorentzidx const & x) { return cosh(ex(x)); } -inline ex cosh(coloridx const & x) { return cosh(ex(x)); } - -// fixes for tanh(x) -inline ex tanh(symbol const & x) { return tanh(ex(x)); } -inline ex tanh(function const & x) { return tanh(ex(x)); } -inline ex tanh(constant const & x) { return tanh(ex(x)); } -inline ex tanh(idx const & x) { return tanh(ex(x)); } -inline ex tanh(lorentzidx const & x) { return tanh(ex(x)); } -inline ex tanh(coloridx const & x) { return tanh(ex(x)); } - -// fixes for abs(x) -inline ex abs(symbol const & x) { return abs(ex(x)); } -inline ex abs(function const & x) { return abs(ex(x)); } -inline ex abs(constant const & x) { return abs(ex(x)); } -inline ex abs(idx const & x) { return abs(ex(x)); } -inline ex abs(lorentzidx const & x) { return abs(ex(x)); } -inline ex abs(coloridx const & x) { return abs(ex(x)); } +// fixes for function atan2(x,y) +inline function atan2(symbol const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,numeric const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,int const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(symbol const & x,double const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,numeric const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,int const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(function const & x,double const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,numeric const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,int const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(constant const & x,double const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,numeric const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,int const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(idx const & x,double const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,numeric const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,int const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(lorentzidx const & x,double const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,numeric const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,int const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(coloridx const & x,double const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(numeric const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(numeric const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(numeric const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(numeric const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(numeric const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(numeric const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(int const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(int const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(int const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(int const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(int const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(int const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(double const & x,symbol const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(double const & x,function const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(double const & x,constant const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(double const & x,idx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(double const & x,lorentzidx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(double const & x,coloridx const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(ex const & x,numeric const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(ex const & x,int const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(ex const & x,double const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(numeric const & x,ex const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(int const & x,ex const & y) { + return atan2(ex(x),ex(y)); +} +inline function atan2(double const & x,ex const & y) { + return atan2(ex(x),ex(y)); +} -// fixes for pow(x,y) +// fixes for ex pow(x,y) inline ex pow(symbol const & x,symbol const & y) { return pow(ex(x),ex(y)); } @@ -345,239 +581,244 @@ inline ex pow(double const & x,ex const & y) { return pow(ex(x),ex(y)); } -// fixes for atan2(x,y) -inline ex atan2(symbol const & x,symbol const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(symbol const & x,function const & y) { - return atan2(ex(x),ex(y)); +// fixes for ex operator+(x,y) +inline ex operator+(ex const & x, basic const & y) { + return operator+((x),ex(y)); } -inline ex atan2(symbol const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline ex operator+(basic const & x, ex const & y) { + return operator+(ex(x),(y)); } -inline ex atan2(symbol const & x,idx const & y) { - return atan2(ex(x),ex(y)); +inline ex operator+(basic const & x, basic const & y) { + return operator+(ex(x),ex(y)); } -inline ex atan2(symbol const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(symbol const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(function const & x,symbol const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(function const & x,function const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(function const & x,constant const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(function const & x,idx const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(function const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(function const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); -} -inline ex atan2(constant const & x,symbol const & y) { - return atan2(ex(x),ex(y)); + +// fixes for ex operator-(x,y) +inline ex operator-(ex const & x, basic const & y) { + return operator-((x),ex(y)); } -inline ex atan2(constant const & x,function const & y) { - return atan2(ex(x),ex(y)); +inline ex operator-(basic const & x, ex const & y) { + return operator-(ex(x),(y)); } -inline ex atan2(constant const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline ex operator-(basic const & x, basic const & y) { + return operator-(ex(x),ex(y)); } -inline ex atan2(constant const & x,idx const & y) { - return atan2(ex(x),ex(y)); + +// fixes for ex operator*(x,y) +inline ex operator*(ex const & x, basic const & y) { + return operator*((x),ex(y)); } -inline ex atan2(constant const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); +inline ex operator*(basic const & x, ex const & y) { + return operator*(ex(x),(y)); } -inline ex atan2(constant const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); +inline ex operator*(basic const & x, basic const & y) { + return operator*(ex(x),ex(y)); } -inline ex atan2(idx const & x,symbol const & y) { - return atan2(ex(x),ex(y)); + +// fixes for ex operator/(x,y) +inline ex operator/(ex const & x, basic const & y) { + return operator/((x),ex(y)); } -inline ex atan2(idx const & x,function const & y) { - return atan2(ex(x),ex(y)); +inline ex operator/(basic const & x, ex const & y) { + return operator/(ex(x),(y)); } -inline ex atan2(idx const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline ex operator/(basic const & x, basic const & y) { + return operator/(ex(x),ex(y)); } -inline ex atan2(idx const & x,idx const & y) { - return atan2(ex(x),ex(y)); + +// fixes for ex operator%(x,y) +inline ex operator%(ex const & x, basic const & y) { + return operator%((x),ex(y)); } -inline ex atan2(idx const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); +inline ex operator%(basic const & x, ex const & y) { + return operator%(ex(x),(y)); } -inline ex atan2(idx const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); +inline ex operator%(basic const & x, basic const & y) { + return operator%(ex(x),ex(y)); } -inline ex atan2(lorentzidx const & x,symbol const & y) { - return atan2(ex(x),ex(y)); + +// fixes for relational operator==(x,y) +inline relational operator==(ex const & x, basic const & y) { + return operator==((x),ex(y)); } -inline ex atan2(lorentzidx const & x,function const & y) { - return atan2(ex(x),ex(y)); +inline relational operator==(basic const & x, ex const & y) { + return operator==(ex(x),(y)); } -inline ex atan2(lorentzidx const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline relational operator==(basic const & x, basic const & y) { + return operator==(ex(x),ex(y)); } -inline ex atan2(lorentzidx const & x,idx const & y) { - return atan2(ex(x),ex(y)); + +// fixes for relational operator!=(x,y) +inline relational operator!=(ex const & x, basic const & y) { + return operator!=((x),ex(y)); } -inline ex atan2(lorentzidx const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); +inline relational operator!=(basic const & x, ex const & y) { + return operator!=(ex(x),(y)); } -inline ex atan2(lorentzidx const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); +inline relational operator!=(basic const & x, basic const & y) { + return operator!=(ex(x),ex(y)); } -inline ex atan2(coloridx const & x,symbol const & y) { - return atan2(ex(x),ex(y)); + +// fixes for relational operator<(x,y) +inline relational operator<(ex const & x, basic const & y) { + return operator<((x),ex(y)); } -inline ex atan2(coloridx const & x,function const & y) { - return atan2(ex(x),ex(y)); +inline relational operator<(basic const & x, ex const & y) { + return operator<(ex(x),(y)); } -inline ex atan2(coloridx const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline relational operator<(basic const & x, basic const & y) { + return operator<(ex(x),ex(y)); } -inline ex atan2(coloridx const & x,idx const & y) { - return atan2(ex(x),ex(y)); + +// fixes for relational operator<=(x,y) +inline relational operator<=(ex const & x, basic const & y) { + return operator<=((x),ex(y)); } -inline ex atan2(coloridx const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); +inline relational operator<=(basic const & x, ex const & y) { + return operator<=(ex(x),(y)); } -inline ex atan2(coloridx const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); +inline relational operator<=(basic const & x, basic const & y) { + return operator<=(ex(x),ex(y)); } -inline ex atan2(symbol const & x,numeric const & y) { - return atan2(ex(x),ex(y)); + +// fixes for relational operator>(x,y) +inline relational operator>(ex const & x, basic const & y) { + return operator>((x),ex(y)); } -inline ex atan2(symbol const & x,int const & y) { - return atan2(ex(x),ex(y)); +inline relational operator>(basic const & x, ex const & y) { + return operator>(ex(x),(y)); } -inline ex atan2(symbol const & x,double const & y) { - return atan2(ex(x),ex(y)); +inline relational operator>(basic const & x, basic const & y) { + return operator>(ex(x),ex(y)); } -inline ex atan2(function const & x,numeric const & y) { - return atan2(ex(x),ex(y)); + +// fixes for relational operator>=(x,y) +inline relational operator>=(ex const & x, basic const & y) { + return operator>=((x),ex(y)); } -inline ex atan2(function const & x,int const & y) { - return atan2(ex(x),ex(y)); +inline relational operator>=(basic const & x, ex const & y) { + return operator>=(ex(x),(y)); } -inline ex atan2(function const & x,double const & y) { - return atan2(ex(x),ex(y)); +inline relational operator>=(basic const & x, basic const & y) { + return operator>=(ex(x),ex(y)); } -inline ex atan2(constant const & x,numeric const & y) { - return atan2(ex(x),ex(y)); + +// fixes for ex const & operator+=(x,y) +inline ex const & operator+=(ex & x, basic const & y) { + return operator+=((x),ex(y)); } -inline ex atan2(constant const & x,int const & y) { - return atan2(ex(x),ex(y)); +// fixes for ex const & operator-=(x,y) +inline ex const & operator-=(ex & x, basic const & y) { + return operator-=((x),ex(y)); } -inline ex atan2(constant const & x,double const & y) { - return atan2(ex(x),ex(y)); +// fixes for ex const & operator*=(x,y) +inline ex const & operator*=(ex & x, basic const & y) { + return operator*=((x),ex(y)); } -inline ex atan2(idx const & x,numeric const & y) { - return atan2(ex(x),ex(y)); +// fixes for ex const & operator/=(x,y) +inline ex const & operator/=(ex & x, basic const & y) { + return operator/=((x),ex(y)); } -inline ex atan2(idx const & x,int const & y) { - return atan2(ex(x),ex(y)); +// fixes for other operators +inline ex operator+(basic const & x) { + return operator+(ex(x)); } -inline ex atan2(idx const & x,double const & y) { - return atan2(ex(x),ex(y)); +inline ex operator-(basic const & x) { + return operator-(ex(x)); } -inline ex atan2(lorentzidx const & x,numeric const & y) { - return atan2(ex(x),ex(y)); +inline ostream & operator<<(ostream & os, basic const & x) { + return operator<<(os,ex(x)); } -inline ex atan2(lorentzidx const & x,int const & y) { - return atan2(ex(x),ex(y)); +// fixes for functions +// fixes for bool are_ex_trivially_equal(x,y) +inline bool are_ex_trivially_equal(ex const & x, basic const & y) { + return are_ex_trivially_equal((x),ex(y)); } -inline ex atan2(lorentzidx const & x,double const & y) { - return atan2(ex(x),ex(y)); +inline bool are_ex_trivially_equal(basic const & x, ex const & y) { + return are_ex_trivially_equal(ex(x),(y)); } -inline ex atan2(coloridx const & x,numeric const & y) { - return atan2(ex(x),ex(y)); +inline bool are_ex_trivially_equal(basic const & x, basic const & y) { + return are_ex_trivially_equal(ex(x),ex(y)); } -inline ex atan2(coloridx const & x,int const & y) { - return atan2(ex(x),ex(y)); + +inline unsigned nops(basic const & x) { + return nops(ex(x)); } -inline ex atan2(coloridx const & x,double const & y) { - return atan2(ex(x),ex(y)); +inline ex expand(basic const & x) { + return expand(ex(x)); } -inline ex atan2(numeric const & x,symbol const & y) { - return atan2(ex(x),ex(y)); +// fixes for bool has(x,y) +inline bool has(ex const & x, basic const & y) { + return has((x),ex(y)); } -inline ex atan2(numeric const & x,function const & y) { - return atan2(ex(x),ex(y)); +inline bool has(basic const & x, ex const & y) { + return has(ex(x),(y)); } -inline ex atan2(numeric const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline bool has(basic const & x, basic const & y) { + return has(ex(x),ex(y)); } -inline ex atan2(numeric const & x,idx const & y) { - return atan2(ex(x),ex(y)); + +inline int degree(basic const & x, symbol const & y) { + return degree(ex(x),(y)); } -inline ex atan2(numeric const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); +inline int ldegree(basic const & x, symbol const & y) { + return ldegree(ex(x),(y)); } -inline ex atan2(numeric const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); +inline ex coeff(basic const & x, symbol const & y, int z=1) { + return coeff(ex(x),(y),z); } -inline ex atan2(int const & x,symbol const & y) { - return atan2(ex(x),ex(y)); +inline ex numer(basic const & x) { + return numer(ex(x)); } -inline ex atan2(int const & x,function const & y) { - return atan2(ex(x),ex(y)); +inline ex denom(basic const & x) { + return denom(ex(x)); } -inline ex atan2(int const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline ex normal(basic const & x, int y=0) { + return normal(ex(x),y); } -inline ex atan2(int const & x,idx const & y) { - return atan2(ex(x),ex(y)); +inline ex collect(basic const & x, symbol const & y) { + return collect(ex(x),(y)); } -inline ex atan2(int const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); +inline ex eval(basic const & x, int y=0) { + return eval(ex(x),y); } -inline ex atan2(int const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); +inline ex evalf(basic const & x, int y=0) { + return evalf(ex(x),y); } -inline ex atan2(double const & x,symbol const & y) { - return atan2(ex(x),ex(y)); +inline ex diff(basic const & x, symbol const & y, int z=1) { + return diff(ex(x),(y),z); } -inline ex atan2(double const & x,function const & y) { - return atan2(ex(x),ex(y)); +inline ex series(basic const & x, symbol const & y, ex const & z, int zz=6) { + return series(ex(x),(y),(z),zz); } -inline ex atan2(double const & x,constant const & y) { - return atan2(ex(x),ex(y)); +inline ex series(ex const & x, symbol const & y, basic const & z, int zz=6) { + return series(ex(x),(y),ex(z),zz); } -inline ex atan2(double const & x,idx const & y) { - return atan2(ex(x),ex(y)); +inline ex series(basic const & x, symbol const & y, basic const & z, int zz=6) { + return series(ex(x),(y),ex(z),zz); } -inline ex atan2(double const & x,lorentzidx const & y) { - return atan2(ex(x),ex(y)); +// fixes for ex subs(x,y) +inline ex subs(ex const & x, basic const & y) { + return subs((x),ex(y)); } -inline ex atan2(double const & x,coloridx const & y) { - return atan2(ex(x),ex(y)); +inline ex subs(basic const & x, ex const & y) { + return subs(ex(x),(y)); } -inline ex atan2(ex const & x,numeric const & y) { - return atan2(ex(x),ex(y)); +inline ex subs(basic const & x, basic const & y) { + return subs(ex(x),ex(y)); } -inline ex atan2(ex const & x,int const & y) { - return atan2(ex(x),ex(y)); + +inline ex subs(basic const & x, lst const & y, lst const & z) { + return subs(ex(x),(y),(z)); } -inline ex atan2(ex const & x,double const & y) { - return atan2(ex(x),ex(y)); +inline ex op(basic const & x, int y) { + return op(ex(x),(y)); } -inline ex atan2(numeric const & x,ex const & y) { - return atan2(ex(x),ex(y)); +inline ex lhs(basic const & x) { + return lhs(ex(x)); } -inline ex atan2(int const & x,ex const & y) { - return atan2(ex(x),ex(y)); +inline ex rhs(basic const & x) { + return rhs(ex(x)); } -inline ex atan2(double const & x,ex const & y) { - return atan2(ex(x),ex(y)); +inline bool is_zero(basic const & x) { + return is_zero(ex(x)); } - diff --git a/cint/dummies.pl b/cint/dummies.pl index 86f797a6..8557032c 100644 --- a/cint/dummies.pl +++ b/cint/dummies.pl @@ -17,12 +17,22 @@ $source='dummies.cpp'; @moretypes=('numeric','int','double'); @extype=('ex'); -# functions with one parameter -@functions1p=('sin','cos','tan','asin','acos','atan','exp','log','sqrt', - 'sinh','cosh','tanh','abs'); +# C math library functions with one parameter and return type 'function' +@cfunc_1p_function=('sin','cos','tan','asin','acos','atan','exp','log', + 'sinh','cosh','tanh','abs'); -# functions with two parameters -@functions2p=('pow','atan2'); +# C math library functions with one parameter and return type 'ex' +@cfunc_1p_ex=('sqrt'); + +# C math library functions with two parameters and return type 'function' +@cfunc_2p_function=('atan2'); + +# C math library functions with two parameters and return type 'ex' +@cfunc_2p_ex=('pow'); + +@binops_ex=('+','-','*','/','%'); +@binops_relational=('==','!=','<','<=','>','>='); +@binops_exconstref=('+=','-=','*=','/='); open OUT,">$header"; @@ -38,35 +48,156 @@ END_OF_OPENING print OUT $opening; -foreach $f (@functions1p) { - print OUT "// fixes for $f(x)\n"; - foreach $t (@types) { - print OUT "inline ex $f($t const & x) { return $f(ex(x)); }\n"; +sub inline_cfunc_1p { + my ($rettype,$funcsref)=@_; + foreach $f (@$funcsref) { + print OUT "// fixes for $rettype $f(x)\n"; + foreach $t (@types) { + print OUT "inline $rettype $f($t const & x) { return $f(ex(x)); }\n"; + } + print OUT "\n"; } - print OUT "\n"; } -sub inlines2 { - my ($types1ref,$types2ref)=@_; +inline_cfunc_1p('function',\@cfunc_1p_function); +inline_cfunc_1p('ex',\@cfunc_1p_ex); + +sub inline_single_cfunc_2p { + my ($rettype,$types1ref,$types2ref)=@_; foreach $t1 (@$types1ref) { foreach $t2 (@$types2ref) { - print OUT "inline ex $f($t1 const & x,$t2 const & y) {\n"; + print OUT "inline $rettype $f($t1 const & x,$t2 const & y) {\n"; print OUT " return $f(ex(x),ex(y));\n"; print OUT "}\n"; } } } -foreach $f (@functions2p) { - print OUT "// fixes for $f(x,y)\n"; - inlines2(\@types,\@types); - inlines2(\@types,\@moretypes); - inlines2(\@moretypes,\@types); - inlines2(\@extype,\@moretypes); - inlines2(\@moretypes,\@extype); - print OUT "\n"; +sub inline_cfunc_2p { + my ($rettype,$funcsref)=@_; + foreach $f (@$funcsref) { + print OUT "// fixes for $rettype $f(x,y)\n"; + inline_single_cfunc_2p($rettype,\@types,\@types); + inline_single_cfunc_2p($rettype,\@types,\@moretypes); + inline_single_cfunc_2p($rettype,\@moretypes,\@types); + inline_single_cfunc_2p($rettype,\@extype,\@moretypes); + inline_single_cfunc_2p($rettype,\@moretypes,\@extype); + print OUT "\n"; + } } +inline_cfunc_2p('function',\@cfunc_2p_function); +inline_cfunc_2p('ex',\@cfunc_2p_ex); + +sub inline_function_1p { + my ($rettype,$func)=@_; + print OUT "inline $rettype $func(basic const & x) {\n"; + print OUT " return $func(ex(x));\n"; + print OUT "}\n"; +} + +sub inline_single_function_2p { + my ($rettype,$func,$t1,$cast1,$t2,$cast2)=@_; + print OUT "inline $rettype $func($t1 x, $t2 y) {\n"; + print OUT " return $func($cast1(x),$cast2(y));\n"; + print OUT "}\n"; +} + +sub inline_single_function_2p_with_defarg { + my ($rettype,$func,$t1,$defarg)=@_; + print OUT "inline $rettype $func(basic const & x, $t1 y=$defarg) {\n"; + print OUT " return $func(ex(x),y);\n"; + print OUT "}\n"; +} + +sub inline_single_function_3p { + my ($rettype,$func,$t1,$cast1,$t2,$cast2,$t3,$cast3)=@_; + print OUT "inline $rettype $func($t1 x, $t2 y, $t3 z) {\n"; + print OUT " return $func($cast1(x),$cast2(y),$cast3(z));\n"; + print OUT "}\n"; +} + +sub inline_single_function_3p_with_defarg { + my ($rettype,$func,$t1,$cast1,$t2,$cast2,$t3,$defarg)=@_; + print OUT "inline $rettype $func($t1 x, $t2 y, $t3 z=$defarg) {\n"; + print OUT " return $func($cast1(x),$cast2(y),z);\n"; + print OUT "}\n"; +} + +sub inline_single_function_4p_with_defarg { + my ($rettype,$func,$t1,$cast1,$t2,$cast2,$t3,$cast3,$t4,$defarg)=@_; + print OUT "inline $rettype $func($t1 x, $t2 y, $t3 z, $t4 zz=$defarg) {\n"; + print OUT " return $func($cast1(x),$cast2(y),$cast3(z),zz);\n"; + print OUT "}\n"; +} + +sub inline_single_binop { + my ($rettype,$op,$t1,$cast1,$t2,$cast2)=@_; + inline_single_function_2p($rettype,'operator'.$op,$t1,$cast1,$t2,$cast2); +} + +sub inline_single_unaryop { + my ($rettype,$op)=@_; + print OUT "inline $rettype operator$op(basic const & x) {\n"; + print OUT " return operator$op(ex(x));\n"; + print OUT "}\n"; +} + +sub inline_function_2p { + my ($rettype,$func)=@_; + print OUT "// fixes for $rettype $func(x,y)\n"; + inline_single_function_2p($rettype,$func,'ex const &','','basic const &','ex'); + inline_single_function_2p($rettype,$func,'basic const &','ex','ex const &',''); + inline_single_function_2p($rettype,$func,'basic const &','ex','basic const &','ex'); + print OUT "\n"; +} + +sub inline_binops { + my ($rettype,$opsref)=@_; + foreach $op (@$opsref) { + inline_function_2p($rettype,'operator'.$op); + } +} + +inline_binops('ex',\@binops_ex); +inline_binops('relational',\@binops_relational); +foreach $op (@binops_exconstref) { + print OUT "// fixes for ex const & operator$op(x,y)\n"; + inline_single_binop('ex const &',$op,'ex &','','basic const &','ex'); +} + +print OUT "// fixes for other operators\n"; +inline_single_unaryop('ex','+'); +inline_single_unaryop('ex','-'); +print OUT "inline ostream & operator<<(ostream & os, basic const & x) {\n"; +print OUT " return operator<<(os,ex(x));\n"; +print OUT "}\n"; + +print OUT "// fixes for functions\n"; +inline_function_2p('bool','are_ex_trivially_equal'); +inline_function_1p('unsigned','nops'); +inline_function_1p('ex','expand'); +inline_function_2p('bool','has'); +inline_single_function_2p('int','degree','basic const &','ex','symbol const &',''); +inline_single_function_2p('int','ldegree','basic const &','ex','symbol const &',''); +inline_single_function_3p_with_defarg('ex','coeff','basic const &','ex','symbol const &','','int','1'); +inline_function_1p('ex','numer'); +inline_function_1p('ex','denom'); +inline_single_function_2p_with_defarg('ex','normal','int','0'); +inline_single_function_2p('ex','collect','basic const &','ex','symbol const &',''); +inline_single_function_2p_with_defarg('ex','eval','int','0'); +inline_single_function_2p_with_defarg('ex','evalf','int','0'); +inline_single_function_3p_with_defarg('ex','diff','basic const &','ex','symbol const &','','int','1'); +inline_single_function_4p_with_defarg('ex','series','basic const &','ex','symbol const &','','ex const &','','int','6'); +inline_single_function_4p_with_defarg('ex','series','ex const &','ex','symbol const &','','basic const &','ex','int','6'); +inline_single_function_4p_with_defarg('ex','series','basic const &','ex','symbol const &','','basic const &','ex','int','6'); +inline_function_2p('ex','subs'); +inline_single_function_3p('ex','subs','basic const &','ex','lst const &','','lst const &',''); +inline_single_function_2p('ex','op','basic const &','ex','int',''); +inline_function_1p('ex','lhs'); +inline_function_1p('ex','rhs'); +inline_function_1p('bool','is_zero'); + close OUT; # Create a file containing stubs that may be necessary because Cint always diff --git a/cint/ginaccint.bin.cpp b/cint/ginaccint.bin.cpp index 23cb38bd..b903ca68 100644 --- a/cint/ginaccint.bin.cpp +++ b/cint/ginaccint.bin.cpp @@ -11,6 +11,8 @@ extern "C" G__value G__exec_tempfile G__P((char *file)); extern "C" void G__store_undo_position(void); +#define PROMPT "GiNaC> " + #ifdef OBSCURE_CINT_HACK #include @@ -113,9 +115,11 @@ void process_tempfile(string const & command) { #ifdef OBSCURE_CINT_HACK static G__value ref_symbol = exec_tempfile("symbol ginac_cint_internal_symbol; ginac_cint_internal_symbol;"); - static G__value ref_ex = exec_tempfile("ex ginac_cint_internal_ex; ginac_cint_internal_ex;"); static G__value ref_function = exec_tempfile("sin(ginac_cint_internal_symbol);"); - static G__value ref_power = exec_tempfile("power(ginac_cint_internal_symbol,ginac_cint_internal_symbol);"); + static G__value ref_power = exec_tempfile("power(ex(ginac_cint_internal_symbol),ex(ginac_cint_internal_symbol));"); + static G__value ref_numeric = exec_tempfile("numeric ginac_cint_internal_numeric; ginac_cint_internal_numeric;"); + static G__value ref_ex = exec_tempfile("ex ginac_cint_internal_ex; ginac_cint_internal_ex;"); + static bool basic_type_warning_already_displayed=false; #endif // def OBSCURE_CINT_HACK G__value retval = exec_tempfile(command); @@ -146,6 +150,22 @@ void process_tempfile(string const & command) +"LLAST=LAST;\n" +"LAST="+varname+";\n" +"cout << \""+varname+" = \" << "+varname+" << endl << endl;"); + } else if (TYPES_EQUAL(retval,ref_symbol)|| + TYPES_EQUAL(retval,ref_function)|| + TYPES_EQUAL(retval,ref_power)|| + TYPES_EQUAL(retval,ref_numeric)) { + if (!basic_type_warning_already_displayed) { + cout << "WARNING: The return value of the last expression you entered was a symbol," << endl + << "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 + << PROMPT "ex(x);" << endl + << "OutX = x" << endl << endl + << PROMPT "cout << x << endl;" << endl + << "x" << endl << endl + << "This warning will not be shown again." << endl; + basic_type_warning_already_displayed=true; + } } #endif // def OBSCURE_CINT_HACK } @@ -175,13 +195,15 @@ int main(void) G__init_cint("cint"); /* initialize cint */ - exec_tempfile("#include \n"); + // no longer needed as of cint 5.14.31 + // exec_tempfile("#include \n"); + exec_tempfile("ex LAST,LLAST,LLLAST;\n"); bool quit = false; bool next_command_is_function=false; while (!quit) { - strcpy(prompt,"GiNaC> "); + strcpy(prompt,PROMPT); int open_braces = 0; bool end_of_command = false; string command; -- 2.44.0