DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/differentiation.P .deps/expand_subs.P \
.deps/fcntimer.P .deps/inifcns_consist.P .deps/lsolve_onedim.P \
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
exprseq.h exprseq.cpp: container.pl
perl container.pl exprseq
+
+# Force build of headers before compilation
+add.cpp: function.h lst.h exprseq.h
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/add.P .deps/basic.P .deps/clifford.P .deps/color.P \
.deps/coloridx.P .deps/constant.P .deps/diff.P .deps/ex.P \
exprseq.h exprseq.cpp: container.pl
perl container.pl exprseq
+# Force build of headers before compilation
+add.cpp: function.h lst.h exprseq.h
+
# 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:
+++ /dev/null
-/** @file exprseq.cpp
- *
- * 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
- * $STLHEADER=vector
- * $reserve=1
- * $prepend=0
- * $let_op=0
- * $open_bracket=(
- * $close_bracket=)
- *
- * 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
- */
-
-#include <iostream>
-#include <stdexcept>
-
-#include "exprseq.h"
-#include "ex.h"
-#include "debugmsg.h"
-
-namespace GiNaC {
-
-#define RESERVE(s,size) (s).reserve(size)
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-exprseq::exprseq() : basic(TINFO_exprseq)
-{
- debugmsg("exprseq default constructor",LOGLEVEL_CONSTRUCT);
-}
-
-exprseq::~exprseq()
-{
- debugmsg("exprseq destructor",LOGLEVEL_DESTRUCT);
- destroy(0);
-}
-
-exprseq::exprseq(exprseq const & other)
-{
- debugmsg("exprseq copy constructor",LOGLEVEL_CONSTRUCT);
- copy(other);
-}
-
-exprseq const & exprseq::operator=(exprseq const & other)
-{
- debugmsg("exprseq operator=",LOGLEVEL_ASSIGNMENT);
- if (this != &other) {
- destroy(1);
- copy(other);
- }
- return *this;
-}
-
-// protected
-
-void exprseq::copy(exprseq const & other)
-{
- basic::copy(other);
- seq=other.seq;
-}
-
-void exprseq::destroy(bool call_parent)
-{
- seq.clear();
- if (call_parent) basic::destroy(call_parent);
-}
-
-//////////
-// other constructors
-//////////
-
-// public
-
-exprseq::exprseq(exvector const & s, bool discardable) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from exvector",
- LOGLEVEL_CONSTRUCT);
- if (discardable) {
- seq.swap(const_cast<exvector &>(s));
- } else {
- seq=s;
- }
-}
-
-exprseq::exprseq(exvector * vp) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from exvector *",LOGLEVEL_CONSTRUCT);
- GINAC_ASSERT(vp!=0);
- seq.swap(*vp);
- delete vp;
-}
-
-exprseq::exprseq(ex const & e1) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 1 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,1);
- seq.push_back(e1);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 2 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,2);
- seq.push_back(e1);
- seq.push_back(e2);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3)
- : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 3 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,3);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 4 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,4);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 5 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,5);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6)
- : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 6 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,6);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 7 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,7);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8) : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 8 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,8);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
- seq.push_back(e8);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9)
- : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 9 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,9);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
- seq.push_back(e8);
- seq.push_back(e9);
-}
-
-exprseq::exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9,
- ex const &e10)
- : basic(TINFO_exprseq)
-{
- debugmsg("exprseq constructor from 10 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,10);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
- seq.push_back(e8);
- seq.push_back(e9);
- seq.push_back(e10);
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-basic * exprseq::duplicate() const
-{
- debugmsg("exprseq duplicate",LOGLEVEL_DUPLICATE);
- return new exprseq(*this);
-}
-
-void exprseq::printraw(ostream & os) const
-{
- debugmsg("exprseq printraw",LOGLEVEL_PRINT);
-
- os << "exprseq(";
- for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
- (*cit).bp->printraw(os);
- os << ",";
- }
- os << ")";
-}
-
-void exprseq::print(ostream & os, unsigned upper_precedence) const
-{
- debugmsg("exprseq print",LOGLEVEL_PRINT);
- // always print brackets around seq, ignore upper_precedence
- printseq(os,'(',',',')',precedence,precedence+1);
-}
-
-void exprseq::printtree(ostream & os, unsigned indent) const
-{
- debugmsg("exprseq printtree",LOGLEVEL_PRINT);
-
- os << string(indent,' ') << "type=" << typeid(*this).name()
- << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
- << ", flags=" << flags
- << ", nops=" << nops() << endl;
- for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
- (*cit).printtree(os,indent+delta_indent);
- }
- os << string(indent+delta_indent,' ') << "=====" << endl;
-}
-
-// exprseq::info() will be implemented by user elsewhere";
-
-int exprseq::nops() const
-{
- return seq.size();
-}
-
-// exprseq::let_op() will be implemented by user elsewhere
-
-ex exprseq::expand(unsigned options) const
-{
- exvector s;
- RESERVE(s,seq.size());
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).expand(options));
- }
-
- return thisexprseq(s);
-}
-
-// a exprseq 'has' an expression if it is this expression itself or a child 'has' it
-
-bool exprseq::has(ex const & other) const
-{
- GINAC_ASSERT(other.bp!=0);
- if (is_equal(*other.bp)) return true;
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- if ((*it).has(other)) return true;
- }
- return false;
-}
-
-ex exprseq::eval(int level) const
-{
- if (level==1) {
- return this->hold();
- }
- return thisexprseq(evalchildren(level));
-}
-
-ex exprseq::evalf(int level) const
-{
- return thisexprseq(evalfchildren(level));
-}
-
-/** Implementation of ex::normal() for exprseqs. It normalizes the arguments
- * and replaces the exprseq by a temporary symbol.
- * @see ex::normal */
-ex exprseq::normal(lst &sym_lst, lst &repl_lst, int level) const
-{
- ex n=thisexprseq(normalchildren(level));
- return n.bp->basic::normal(sym_lst,repl_lst,level);
-}
-
-ex exprseq::diff(symbol const & s) const
-{
- return thisexprseq(diffchildren(s));
-}
-
-ex exprseq::subs(lst const & ls, lst const & lr) const
-{
- exvector * vp=subschildren(ls,lr);
- if (vp==0) {
- return *this;
- }
- return thisexprseq(vp);
-}
-
-// protected
-
-int exprseq::compare_same_type(basic const & other) const
-{
- GINAC_ASSERT(is_of_type(other,exprseq));
- exprseq const & o=static_cast<exprseq const &>
- (const_cast<basic &>(other));
- int cmpval;
- exvector::const_iterator it1=seq.begin();
- exvector::const_iterator it2=o.seq.begin();
-
- for (; (it1!=seq.end())&&(it2!=o.seq.end()); ++it1, ++it2) {
- cmpval=(*it1).compare(*it2);
- if (cmpval!=0) return cmpval;
- }
-
- if (it1==seq.end()) {
- return (it2==o.seq.end() ? 0 : -1);
- }
-
- return 1;
-}
-
-bool exprseq::is_equal_same_type(basic const & other) const
-{
- GINAC_ASSERT(is_of_type(other,exprseq));
- exprseq const & o=static_cast<exprseq const &>
- (const_cast<basic &>(other));
- if (seq.size()!=o.seq.size()) return false;
-
- exvector::const_iterator it1=seq.begin();
- exvector::const_iterator it2=o.seq.begin();
-
- for (; it1!=seq.end(); ++it1, ++it2) {
- if (!(*it1).is_equal(*it2)) return false;
- }
-
- return true;
-}
-
-unsigned exprseq::return_type(void) const
-{
- return return_types::noncommutative_composite;
-}
-
-//////////
-// new virtual functions which can be overridden by derived classes
-//////////
-
-// public
-
-exprseq & exprseq::append(ex const & b)
-{
- ensure_if_modifiable();
- seq.push_back(b);
- return *this;
-}
-
-
-
-// protected
-
-void exprseq::printseq(ostream & os, char openbracket, char delim,
- char closebracket, unsigned this_precedence,
- unsigned upper_precedence) const
-{
- if (this_precedence<=upper_precedence) os << openbracket;
- if (seq.size()!=0) {
- exvector::const_iterator it,it_last;
- it=seq.begin();
- it_last=seq.end();
- --it_last;
- for (; it!=it_last; ++it) {
- (*it).bp->print(os,this_precedence);
- os << delim;
- }
- (*it).bp->print(os,this_precedence);
- }
- if (this_precedence<=upper_precedence) os << closebracket;
-}
-
-ex exprseq::thisexprseq(exvector const & v) const
-{
- return exprseq(v);
-}
-
-ex exprseq::thisexprseq(exvector * vp) const
-{
- return exprseq(vp);
-}
-
-//////////
-// non-virtual functions in this class
-//////////
-
-// public
-
-// none
-
-// protected
-
-bool exprseq::is_canonical() const
-{
- if (seq.size()<=1) { return 1; }
-
- exvector::const_iterator it=seq.begin();
- exvector::const_iterator it_last=it;
- for (++it; it!=seq.end(); it_last=it, ++it) {
- if ((*it_last).compare(*it)>0) {
- if ((*it_last).compare(*it)>0) {
- cout << *it_last << ">" << *it << "\n";
- return 0;
- }
- }
- }
- return 1;
-}
-
-
-exvector exprseq::evalchildren(int level) const
-{
- exvector s;
- RESERVE(s,seq.size());
-
- if (level==1) {
- return seq;
- }
- if (level == -max_recursion_level) {
- throw(std::runtime_error("max recursion level reached"));
- }
- --level;
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).eval(level));
- }
- return s;
-}
-
-exvector exprseq::evalfchildren(int level) const
-{
- exvector s;
- RESERVE(s,seq.size());
-
- if (level==1) {
- return seq;
- }
- if (level == -max_recursion_level) {
- throw(std::runtime_error("max recursion level reached"));
- }
- --level;
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).evalf(level));
- }
- return s;
-}
-
-exvector exprseq::normalchildren(int level) const
-{
- exvector s;
- RESERVE(s,seq.size());
-
- if (level==1) {
- return seq;
- }
- if (level == -max_recursion_level) {
- throw(std::runtime_error("max recursion level reached"));
- }
- --level;
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).normal(level));
- }
- return s;
-}
-
-exvector exprseq::diffchildren(symbol const & y) const
-{
- exvector s;
- RESERVE(s,seq.size());
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).diff(y));
- }
- return s;
-}
-
-/* obsolete subschildren
-exvector exprseq::subschildren(lst const & ls, lst const & lr) const
-{
- exvector s;
- RESERVE(s,seq.size());
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).subs(ls,lr));
- }
- return s;
-}
-*/
-
-exvector * exprseq::subschildren(lst const & ls, lst const & lr) const
-{
- // returns a NULL pointer if nothing had to be substituted
- // returns a pointer to a newly created epvector otherwise
- // (which has to be deleted somewhere else)
-
- exvector::const_iterator last=seq.end();
- exvector::const_iterator cit=seq.begin();
- while (cit!=last) {
- ex const & subsed_ex=(*cit).subs(ls,lr);
- if (!are_ex_trivially_equal(*cit,subsed_ex)) {
-
- // something changed, copy seq, subs and return it
- exvector *s=new exvector;
- RESERVE(*s,seq.size());
-
- // copy parts of seq which are known not to have changed
- exvector::const_iterator cit2=seq.begin();
- while (cit2!=cit) {
- s->push_back(*cit2);
- ++cit2;
- }
- // copy first changed element
- s->push_back(subsed_ex);
- ++cit2;
- // copy rest
- while (cit2!=last) {
- s->push_back((*cit2).subs(ls,lr));
- ++cit2;
- }
- return s;
- }
- ++cit;
- }
-
- return 0; // nothing has changed
-}
-
-//////////
-// static member variables
-//////////
-
-// protected
-
-unsigned exprseq::precedence=10;
-
-//////////
-// global constants
-//////////
-
-const exprseq some_exprseq;
-type_info const & typeid_exprseq=typeid(some_exprseq);
-
-} // namespace GiNaC
-
+++ /dev/null
-/** @file exprseq.h
- *
- * 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
- * $STLHEADER=vector
- * $reserve=1
- * $prepend=0
- * $let_op=0
- * $open_bracket=(
- * $close_bracket=)
- *
- * 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_EXPRSEQ_H__
-#define __GINAC_EXPRSEQ_H__
-
-#include <vector>
-#include <ginac/basic.h>
-#include <ginac/ex.h>
-
-namespace GiNaC {
-
-typedef vector<ex> exvector;
-
-class exprseq : public basic
-{
-
-public:
- exprseq();
- ~exprseq();
- exprseq(exprseq const & other);
- exprseq const & operator=(exprseq const & other);
-protected:
- void copy(exprseq const & other);
- void destroy(bool call_parent);
-
-public:
- exprseq(exvector const & s, bool discardable=0);
- exprseq(exvector * vp); // vp will be deleted
- explicit exprseq(ex const & e1);
- explicit exprseq(ex const & e1, ex const & e2);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9);
- explicit exprseq(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9,
- ex const &e10);
-
-public:
- basic * duplicate() const;
- void printraw(ostream & os) const;
- void print(ostream & os, unsigned upper_precedence=0) const;
- void printtree(ostream & os, unsigned indent) const;
- bool info(unsigned inf) const;
- int nops() const;
- ex & let_op(int const i);
- ex expand(unsigned options=0) const;
- bool has(ex const & other) const;
- ex eval(int level=0) const;
- ex evalf(int level=0) const;
- ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
- ex diff(symbol const & s) const;
- ex subs(lst const & ls, lst const & lr) const;
-protected:
- int compare_same_type(basic const & other) const;
- bool is_equal_same_type(basic const & other) const;
- unsigned return_type(void) const;
-
- // new virtual functions which can be overridden by derived classes
-public:
- virtual exprseq & append(ex const & b);
- // no prepend possible for exprseq
-protected:
- virtual void printseq(ostream & os, char openbracket, char delim,
- char closebracket, unsigned this_precedence,
- unsigned upper_precedence=0) const;
- virtual ex thisexprseq(exvector const & v) const;
- virtual ex thisexprseq(exvector * vp) const;
-
-protected:
- bool is_canonical() const;
- exvector evalchildren(int level) const;
- exvector evalfchildren(int level) const;
- exvector normalchildren(int level) const;
- exvector diffchildren(symbol const & s) const;
- exvector * subschildren(lst const & ls, lst const & lr) const;
-
-protected:
- exvector seq;
- static unsigned precedence;
-};
-
-// global constants
-
-extern const exprseq some_exprseq;
-extern type_info const & typeid_exprseq;
-
-// utility functions
-inline const exprseq &ex_to_exprseq(const ex &e)
-{
- return static_cast<const exprseq &>(*e.bp);
-}
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_EXPRSEQ_H__
-
+++ /dev/null
-/** @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
- *
- * 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
- */
-
-#include <string>
-#include <stdexcept>
-
-#include "function.h"
-#include "ex.h"
-#include "debugmsg.h"
-
-namespace GiNaC {
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-function::function() : serial(0)
-{
- debugmsg("function default constructor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-
-function::~function()
-{
- debugmsg("function destructor",LOGLEVEL_DESTRUCT);
- destroy(0);
-}
-
-function::function(function const & other)
-{
- debugmsg("function copy constructor",LOGLEVEL_CONSTRUCT);
- copy(other);
-}
-
-function const & function::operator=(function const & other)
-{
- debugmsg("function operator=",LOGLEVEL_ASSIGNMENT);
- if (this != &other) {
- destroy(1);
- copy(other);
- }
- return *this;
-}
-
-// protected
-
-void function::copy(function const & other)
-{
- exprseq::copy(other);
- serial=other.serial;
-}
-
-void function::destroy(bool call_parent)
-{
- if (call_parent) exprseq::destroy(call_parent);
-}
-
-//////////
-// other constructors
-//////////
-
-// public
-
-function::function(unsigned ser) : serial(ser)
-{
- debugmsg("function constructor from unsigned",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-
-// the following lines have been generated for max. 10 parameters
-function::function(unsigned ser, ex const & param1)
- : exprseq(param1), serial(ser)
-{
- debugmsg("function constructor from unsigned,1*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2)
- : exprseq(param1, param2), serial(ser)
-{
- debugmsg("function constructor from unsigned,2*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3)
- : exprseq(param1, param2, param3), serial(ser)
-{
- debugmsg("function constructor from unsigned,3*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4)
- : exprseq(param1, param2, param3, param4), serial(ser)
-{
- debugmsg("function constructor from unsigned,4*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5)
- : exprseq(param1, param2, param3, param4, param5), serial(ser)
-{
- debugmsg("function constructor from unsigned,5*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6)
- : exprseq(param1, param2, param3, param4, param5, param6), serial(ser)
-{
- debugmsg("function constructor from unsigned,6*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7)
- : exprseq(param1, param2, param3, param4, param5, param6, param7), serial(ser)
-{
- debugmsg("function constructor from unsigned,7*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8)
- : exprseq(param1, param2, param3, param4, param5, param6, param7, param8), serial(ser)
-{
- debugmsg("function constructor from unsigned,8*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8, ex const & param9)
- : exprseq(param1, param2, param3, param4, param5, param6, param7, param8, param9), serial(ser)
-{
- debugmsg("function constructor from unsigned,9*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-function::function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8, ex const & param9, ex const & param10)
- : exprseq(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10), serial(ser)
-{
- debugmsg("function constructor from unsigned,10*ex",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-
-// end of generated lines
-
-function::function(unsigned ser, exprseq const & es) : exprseq(es), serial(ser)
-{
- debugmsg("function constructor from unsigned,exprseq",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-
-function::function(unsigned ser, exvector const & v, bool discardable)
- : exprseq(v,discardable), serial(ser)
-{
- debugmsg("function constructor from string,exvector,bool",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-
-function::function(unsigned ser, exvector * vp)
- : exprseq(vp), serial(ser)
-{
- debugmsg("function constructor from unsigned,exvector *",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_function;
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-basic * function::duplicate() const
-{
- debugmsg("function duplicate",LOGLEVEL_DUPLICATE);
- return new function(*this);
-}
-
-void function::printraw(ostream & os) const
-{
- debugmsg("function printraw",LOGLEVEL_PRINT);
-
- GINAC_ASSERT(serial<registered_functions().size());
-
- os << "function(name=" << registered_functions()[serial].name;
- for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- os << ",";
- (*it).bp->print(os);
- }
- os << ")";
-}
-
-void function::print(ostream & os, unsigned upper_precedence) const
-{
- debugmsg("function print",LOGLEVEL_PRINT);
-
- GINAC_ASSERT(serial<registered_functions().size());
-
- os << registered_functions()[serial].name;
- printseq(os,'(',',',')',exprseq::precedence,function::precedence);
-}
-
-void function::printtree(ostream & os, unsigned indent) const
-{
- debugmsg("function printtree",LOGLEVEL_PRINT);
-
- GINAC_ASSERT(serial<registered_functions().size());
-
- os << string(indent,' ') << "function "
- << registered_functions()[serial].name
- << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
- << ", flags=" << flags
- << ", nops=" << nops() << endl;
- for (int i=0; i<nops(); ++i) {
- seq[i].printtree(os,indent+delta_indent);
- }
- os << string(indent+delta_indent,' ') << "=====" << endl;
-}
-
-void function::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
-{
- debugmsg("function print csrc",LOGLEVEL_PRINT);
-
- GINAC_ASSERT(serial<registered_functions().size());
-
- // Print function name in lowercase
- string lname;
- lname=registered_functions()[serial].name;
- for (unsigned i=0; i<lname.size(); i++)
- lname[i] = tolower(lname[i]);
- os << lname << "(";
-
- // Print arguments, separated by commas
- exvector::const_iterator it = seq.begin();
- exvector::const_iterator itend = seq.end();
- while (it != itend) {
- it->bp->printcsrc(os, type, 0);
- it++;
- if (it != itend)
- os << ",";
- }
- os << ")";
-}
-
-ex function::expand(unsigned options) const
-{
- return this->setflag(status_flags::expanded);
-}
-
-ex function::eval(int level) const
-{
- GINAC_ASSERT(serial<registered_functions().size());
-
- exvector eseq=evalchildren(level);
-
- if (registered_functions()[serial].e==0) {
- return function(serial,eseq).hold();
- }
- switch (registered_functions()[serial].nparams) {
- // the following lines have been generated for max. 10 parameters
- case 1:
- return ((eval_funcp_1)(registered_functions()[serial].e))(eseq[1-1]);
- break;
- case 2:
- return ((eval_funcp_2)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1]);
- break;
- case 3:
- return ((eval_funcp_3)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1]);
- break;
- case 4:
- return ((eval_funcp_4)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1]);
- break;
- case 5:
- return ((eval_funcp_5)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1]);
- break;
- case 6:
- return ((eval_funcp_6)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1]);
- break;
- case 7:
- return ((eval_funcp_7)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1]);
- break;
- case 8:
- return ((eval_funcp_8)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1], eseq[8-1]);
- break;
- case 9:
- return ((eval_funcp_9)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1], eseq[8-1], eseq[9-1]);
- break;
- case 10:
- return ((eval_funcp_10)(registered_functions()[serial].e))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1], eseq[8-1], eseq[9-1], eseq[10-1]);
- break;
-
- // end of generated lines
- }
- throw(std::logic_error("function::eval(): invalid nparams"));
-}
-
-ex function::evalf(int level) const
-{
- GINAC_ASSERT(serial<registered_functions().size());
-
- exvector eseq=evalfchildren(level);
-
- if (registered_functions()[serial].ef==0) {
- return function(serial,eseq).hold();
- }
- switch (registered_functions()[serial].nparams) {
- // the following lines have been generated for max. 10 parameters
- case 1:
- return ((evalf_funcp_1)(registered_functions()[serial].ef))(eseq[1-1]);
- break;
- case 2:
- return ((evalf_funcp_2)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1]);
- break;
- case 3:
- return ((evalf_funcp_3)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1]);
- break;
- case 4:
- return ((evalf_funcp_4)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1]);
- break;
- case 5:
- return ((evalf_funcp_5)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1]);
- break;
- case 6:
- return ((evalf_funcp_6)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1]);
- break;
- case 7:
- return ((evalf_funcp_7)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1]);
- break;
- case 8:
- return ((evalf_funcp_8)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1], eseq[8-1]);
- break;
- case 9:
- return ((evalf_funcp_9)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1], eseq[8-1], eseq[9-1]);
- break;
- case 10:
- return ((evalf_funcp_10)(registered_functions()[serial].ef))(eseq[1-1], eseq[2-1], eseq[3-1], eseq[4-1], eseq[5-1], eseq[6-1], eseq[7-1], eseq[8-1], eseq[9-1], eseq[10-1]);
- break;
-
- // end of generated lines
- }
- throw(std::logic_error("function::evalf(): invalid nparams"));
-}
-
-ex function::thisexprseq(exvector const & v) const
-{
- return function(serial,v);
-}
-
-ex function::thisexprseq(exvector * vp) const
-{
- return function(serial,vp);
-}
-
-/** Implementation of ex::series for functions.
- * @see ex::series */
-ex function::series(symbol const & s, ex const & point, int order) const
-{
- GINAC_ASSERT(serial<registered_functions().size());
-
- if (registered_functions()[serial].s==0) {
- return basic::series(s, point, order);
- }
- switch (registered_functions()[serial].nparams) {
- // the following lines have been generated for max. 10 parameters
- case 1:
- return ((series_funcp_1)(registered_functions()[serial].s))(seq[1-1],s,point,order);
- break;
- case 2:
- return ((series_funcp_2)(registered_functions()[serial].s))(seq[1-1], seq[2-1],s,point,order);
- break;
- case 3:
- return ((series_funcp_3)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1],s,point,order);
- break;
- case 4:
- return ((series_funcp_4)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1], seq[4-1],s,point,order);
- break;
- case 5:
- return ((series_funcp_5)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1],s,point,order);
- break;
- case 6:
- return ((series_funcp_6)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1],s,point,order);
- break;
- case 7:
- return ((series_funcp_7)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1],s,point,order);
- break;
- case 8:
- return ((series_funcp_8)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1], seq[8-1],s,point,order);
- break;
- case 9:
- return ((series_funcp_9)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1], seq[8-1], seq[9-1],s,point,order);
- break;
- case 10:
- return ((series_funcp_10)(registered_functions()[serial].s))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1], seq[8-1], seq[9-1], seq[10-1],s,point,order);
- break;
-
- // end of generated lines
- }
- throw(std::logic_error("function::series(): invalid nparams"));
-}
-
-// protected
-
-int function::compare_same_type(basic const & other) const
-{
- GINAC_ASSERT(is_of_type(other, function));
- function const & o=static_cast<function &>(const_cast<basic &>(other));
-
- if (serial!=o.serial) {
- return serial < o.serial ? -1 : 1;
- }
- return exprseq::compare_same_type(o);
-}
-
-bool function::is_equal_same_type(basic const & other) const
-{
- GINAC_ASSERT(is_of_type(other, function));
- function const & o=static_cast<function &>(const_cast<basic &>(other));
-
- if (serial!=o.serial) return false;
- return exprseq::is_equal_same_type(o);
-}
-
-unsigned function::return_type(void) const
-{
- if (seq.size()==0) {
- return return_types::commutative;
- }
- return (*seq.begin()).return_type();
-}
-
-unsigned function::return_type_tinfo(void) const
-{
- if (seq.size()==0) {
- return tinfo_key;
- }
- return (*seq.begin()).return_type_tinfo();
-}
-
-//////////
-// new virtual functions which can be overridden by derived classes
-//////////
-
-// none
-
-//////////
-// non-virtual functions in this class
-//////////
-
-// protected
-
-ex function::pdiff(unsigned diff_param) const // partial differentiation
-{
- GINAC_ASSERT(serial<registered_functions().size());
-
- if (registered_functions()[serial].d==0) {
- throw(std::logic_error(string("function::pdiff(") + registered_functions()[serial].name + "): no diff function defined"));
- }
- switch (registered_functions()[serial].nparams) {
- // the following lines have been generated for max. 10 parameters
- case 1:
- return ((diff_funcp_1)(registered_functions()[serial].d))(seq[1-1],diff_param);
- break;
- case 2:
- return ((diff_funcp_2)(registered_functions()[serial].d))(seq[1-1], seq[2-1],diff_param);
- break;
- case 3:
- return ((diff_funcp_3)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1],diff_param);
- break;
- case 4:
- return ((diff_funcp_4)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1], seq[4-1],diff_param);
- break;
- case 5:
- return ((diff_funcp_5)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1],diff_param);
- break;
- case 6:
- return ((diff_funcp_6)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1],diff_param);
- break;
- case 7:
- return ((diff_funcp_7)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1],diff_param);
- break;
- case 8:
- return ((diff_funcp_8)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1], seq[8-1],diff_param);
- break;
- case 9:
- return ((diff_funcp_9)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1], seq[8-1], seq[9-1],diff_param);
- break;
- case 10:
- return ((diff_funcp_10)(registered_functions()[serial].d))(seq[1-1], seq[2-1], seq[3-1], seq[4-1], seq[5-1], seq[6-1], seq[7-1], seq[8-1], seq[9-1], seq[10-1],diff_param);
- break;
-
- // end of generated lines
- }
- throw(std::logic_error("function::pdiff(): no diff function defined"));
-}
-
-vector<registered_function_info> & function::registered_functions(void)
-{
- static vector<registered_function_info> * rf=new vector<registered_function_info>;
- return *rf;
-}
-
-// public
-
-// the following lines have been generated for max. 10 parameters
-unsigned function::register_new(char const * nm, eval_funcp_1 e,
- evalf_funcp_1 ef, diff_funcp_1 d, series_funcp_1 s)
-{
- registered_function_info rfi={nm,1,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_2 e,
- evalf_funcp_2 ef, diff_funcp_2 d, series_funcp_2 s)
-{
- registered_function_info rfi={nm,2,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_3 e,
- evalf_funcp_3 ef, diff_funcp_3 d, series_funcp_3 s)
-{
- registered_function_info rfi={nm,3,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_4 e,
- evalf_funcp_4 ef, diff_funcp_4 d, series_funcp_4 s)
-{
- registered_function_info rfi={nm,4,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_5 e,
- evalf_funcp_5 ef, diff_funcp_5 d, series_funcp_5 s)
-{
- registered_function_info rfi={nm,5,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_6 e,
- evalf_funcp_6 ef, diff_funcp_6 d, series_funcp_6 s)
-{
- registered_function_info rfi={nm,6,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_7 e,
- evalf_funcp_7 ef, diff_funcp_7 d, series_funcp_7 s)
-{
- registered_function_info rfi={nm,7,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_8 e,
- evalf_funcp_8 ef, diff_funcp_8 d, series_funcp_8 s)
-{
- registered_function_info rfi={nm,8,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_9 e,
- evalf_funcp_9 ef, diff_funcp_9 d, series_funcp_9 s)
-{
- registered_function_info rfi={nm,9,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-unsigned function::register_new(char const * nm, eval_funcp_10 e,
- evalf_funcp_10 ef, diff_funcp_10 d, series_funcp_10 s)
-{
- registered_function_info rfi={nm,10,0,eval_funcp(e),
- evalf_funcp(ef),diff_funcp(d),series_funcp(s)};
- registered_functions().push_back(rfi);
- return registered_functions().size()-1;
-}
-
-// end of generated lines
-
-//////////
-// static member variables
-//////////
-
-// none
-
-//////////
-// global constants
-//////////
-
-const function some_function;
-type_info const & typeid_function=typeid(some_function);
-
-} // namespace GiNaC
-
+++ /dev/null
-/** @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
- *
- * 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_FUNCTION_H__
-#define __GINAC_FUNCTION_H__
-
-#include <string>
-#include <vector>
-#include <ginac/exprseq.h>
-
-// the following lines have been generated for max. 10 parameters
-#define DECLARE_FUNCTION_1P(NAME) \
-extern unsigned function_index_##NAME; \
-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 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 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 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 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 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 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 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 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 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=GiNaC::function::register_new(#NAME,E,EF,D,S);
-
-#define BEGIN_TYPECHECK \
-bool automatic_typecheck=true;
-
-#define TYPECHECK(VAR,TYPE) \
-if (!is_ex_exactly_of_type(VAR,TYPE)) { \
- automatic_typecheck=false; \
-} else
-
-#define TYPECHECK_INTEGER(VAR) \
-if (!(VAR).info(GiNaC::info_flags::integer)) { \
- automatic_typecheck=false; \
-} else
-
-#define END_TYPECHECK(RV) \
-{} \
-if (!automatic_typecheck) { \
- return RV.hold(); \
-}
-
-namespace GiNaC {
-
-class function;
-
-typedef ex (* eval_funcp)();
-typedef ex (* evalf_funcp)();
-typedef ex (* diff_funcp)();
-typedef ex (* series_funcp)();
-
-// the following lines have been generated for max. 10 parameters
-typedef ex (* eval_funcp_1)(ex const &);
-typedef ex (* eval_funcp_2)(ex const &, ex const &);
-typedef ex (* eval_funcp_3)(ex const &, ex const &, ex const &);
-typedef ex (* eval_funcp_4)(ex const &, ex const &, ex const &, ex const &);
-typedef ex (* eval_funcp_5)(ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* eval_funcp_6)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* eval_funcp_7)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* eval_funcp_8)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* eval_funcp_9)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* eval_funcp_10)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-
-typedef ex (* evalf_funcp_1)(ex const &);
-typedef ex (* evalf_funcp_2)(ex const &, ex const &);
-typedef ex (* evalf_funcp_3)(ex const &, ex const &, ex const &);
-typedef ex (* evalf_funcp_4)(ex const &, ex const &, ex const &, ex const &);
-typedef ex (* evalf_funcp_5)(ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* evalf_funcp_6)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* evalf_funcp_7)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* evalf_funcp_8)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* evalf_funcp_9)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-typedef ex (* evalf_funcp_10)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &);
-
-typedef ex (* diff_funcp_1)(ex const &, unsigned);
-typedef ex (* diff_funcp_2)(ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_3)(ex const &, ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_4)(ex const &, ex const &, ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_5)(ex const &, ex const &, ex const &, ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_6)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_7)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_8)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_9)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, unsigned);
-typedef ex (* diff_funcp_10)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, unsigned);
-
-typedef ex (* series_funcp_1)(ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_2)(ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_3)(ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_4)(ex const &, ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_5)(ex const &, ex const &, ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_6)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_7)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_8)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_9)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-typedef ex (* series_funcp_10)(ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, ex const &, symbol const &, ex const &, int);
-
-// end of generated lines
-
-struct registered_function_info {
- char const * name;
- unsigned nparams;
- unsigned options;
- eval_funcp e;
- evalf_funcp ef;
- diff_funcp d;
- series_funcp s;
-};
-
-/** The class function is used to implement builtin functions like sin, cos...
- and user defined functions */
-class function : public exprseq
-{
- friend void ginsh_get_ginac_functions(void);
-
-// member functions
-
- // default constructor, destructor, copy constructor assignment operator and helpers
-public:
- function();
- ~function();
- function(function const & other);
- function const & operator=(function const & other);
-protected:
- void copy(function const & other);
- void destroy(bool call_parent);
-
- // other constructors
-public:
- function(unsigned ser);
- // the following lines have been generated for max. 10 parameters
- function(unsigned ser, ex const & param1);
- function(unsigned ser, ex const & param1, ex const & param2);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8, ex const & param9);
- function(unsigned ser, ex const & param1, ex const & param2, ex const & param3, ex const & param4, ex const & param5, ex const & param6, ex const & param7, ex const & param8, ex const & param9, ex const & param10);
-
- // end of generated lines
- function(unsigned ser, exprseq const & es);
- function(unsigned ser, exvector const & v, bool discardable=0);
- function(unsigned ser, exvector * vp); // vp will be deleted
-
- // functions overriding virtual functions from bases classes
-public:
- basic * duplicate() const;
- void printraw(ostream & os) const;
- void print(ostream & os, unsigned upper_precedence=0) const;
- void printtree(ostream & os, unsigned indent) const;
- void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
- ex expand(unsigned options=0) const;
- ex eval(int level=0) const;
- ex evalf(int level=0) const;
- ex diff(symbol const & s) const;
- ex series(symbol const & s, ex const & point, int order) const;
- ex thisexprseq(exvector const & v) const;
- ex thisexprseq(exvector * vp) const;
-protected:
- int compare_same_type(basic const & other) const;
- bool is_equal_same_type(basic const & other) const;
- unsigned return_type(void) const;
- unsigned return_type_tinfo(void) const;
-
- // new virtual functions which can be overridden by derived classes
- // none
-
- // non-virtual functions in this class
-protected:
- ex pdiff(unsigned diff_param) const; // partial differentiation
- static vector<registered_function_info> & registered_functions(void);
-public:
- // the following lines have been generated for max. 10 parameters
- static unsigned register_new(char const * nm, eval_funcp_1 e,
- evalf_funcp_1 ef=0, diff_funcp_1 d=0, series_funcp_1 s=0);
- static unsigned register_new(char const * nm, eval_funcp_2 e,
- evalf_funcp_2 ef=0, diff_funcp_2 d=0, series_funcp_2 s=0);
- static unsigned register_new(char const * nm, eval_funcp_3 e,
- evalf_funcp_3 ef=0, diff_funcp_3 d=0, series_funcp_3 s=0);
- static unsigned register_new(char const * nm, eval_funcp_4 e,
- evalf_funcp_4 ef=0, diff_funcp_4 d=0, series_funcp_4 s=0);
- static unsigned register_new(char const * nm, eval_funcp_5 e,
- evalf_funcp_5 ef=0, diff_funcp_5 d=0, series_funcp_5 s=0);
- static unsigned register_new(char const * nm, eval_funcp_6 e,
- evalf_funcp_6 ef=0, diff_funcp_6 d=0, series_funcp_6 s=0);
- static unsigned register_new(char const * nm, eval_funcp_7 e,
- evalf_funcp_7 ef=0, diff_funcp_7 d=0, series_funcp_7 s=0);
- static unsigned register_new(char const * nm, eval_funcp_8 e,
- evalf_funcp_8 ef=0, diff_funcp_8 d=0, series_funcp_8 s=0);
- static unsigned register_new(char const * nm, eval_funcp_9 e,
- evalf_funcp_9 ef=0, diff_funcp_9 d=0, series_funcp_9 s=0);
- static unsigned register_new(char const * nm, eval_funcp_10 e,
- evalf_funcp_10 ef=0, diff_funcp_10 d=0, series_funcp_10 s=0);
-
- // end of generated lines
- unsigned getserial(void) const {return serial;}
-
-// member variables
-
-protected:
- unsigned serial;
-};
-
-// utility macros
-
-#define is_ex_the_function(OBJ, 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__
-
+++ /dev/null
-/** @file lst.cpp
- *
- * 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
- * $STLHEADER=list
- * $reserve=0
- * $prepend=1
- * $let_op=1
- * $open_bracket=[
- * $close_bracket=]
- *
- * 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
- */
-
-#include <iostream>
-#include <stdexcept>
-
-#include "lst.h"
-#include "ex.h"
-#include "debugmsg.h"
-
-namespace GiNaC {
-
-#define RESERVE(s,size) // no reserve needed for list
-
-//////////
-// default constructor, destructor, copy constructor assignment operator and helpers
-//////////
-
-// public
-
-lst::lst() : basic(TINFO_lst)
-{
- debugmsg("lst default constructor",LOGLEVEL_CONSTRUCT);
-}
-
-lst::~lst()
-{
- debugmsg("lst destructor",LOGLEVEL_DESTRUCT);
- destroy(0);
-}
-
-lst::lst(lst const & other)
-{
- debugmsg("lst copy constructor",LOGLEVEL_CONSTRUCT);
- copy(other);
-}
-
-lst const & lst::operator=(lst const & other)
-{
- debugmsg("lst operator=",LOGLEVEL_ASSIGNMENT);
- if (this != &other) {
- destroy(1);
- copy(other);
- }
- return *this;
-}
-
-// protected
-
-void lst::copy(lst const & other)
-{
- basic::copy(other);
- seq=other.seq;
-}
-
-void lst::destroy(bool call_parent)
-{
- seq.clear();
- if (call_parent) basic::destroy(call_parent);
-}
-
-//////////
-// other constructors
-//////////
-
-// public
-
-lst::lst(exlist const & s, bool discardable) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from exlist",
- LOGLEVEL_CONSTRUCT);
- if (discardable) {
- seq.swap(const_cast<exlist &>(s));
- } else {
- seq=s;
- }
-}
-
-lst::lst(exlist * vp) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from exlist *",LOGLEVEL_CONSTRUCT);
- GINAC_ASSERT(vp!=0);
- seq.swap(*vp);
- delete vp;
-}
-
-lst::lst(ex const & e1) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 1 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,1);
- seq.push_back(e1);
-}
-
-lst::lst(ex const & e1, ex const & e2) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 2 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,2);
- seq.push_back(e1);
- seq.push_back(e2);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3)
- : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 3 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,3);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 4 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,4);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 5 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,5);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6)
- : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 6 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,6);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 7 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,7);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8) : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 8 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,8);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
- seq.push_back(e8);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9)
- : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 9 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,9);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
- seq.push_back(e8);
- seq.push_back(e9);
-}
-
-lst::lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9,
- ex const &e10)
- : basic(TINFO_lst)
-{
- debugmsg("lst constructor from 10 ex",
- LOGLEVEL_CONSTRUCT);
- RESERVE(seq,10);
- seq.push_back(e1);
- seq.push_back(e2);
- seq.push_back(e3);
- seq.push_back(e4);
- seq.push_back(e5);
- seq.push_back(e6);
- seq.push_back(e7);
- seq.push_back(e8);
- seq.push_back(e9);
- seq.push_back(e10);
-}
-
-//////////
-// functions overriding virtual functions from bases classes
-//////////
-
-// public
-
-basic * lst::duplicate() const
-{
- debugmsg("lst duplicate",LOGLEVEL_DUPLICATE);
- return new lst(*this);
-}
-
-void lst::printraw(ostream & os) const
-{
- debugmsg("lst printraw",LOGLEVEL_PRINT);
-
- os << "lst(";
- for (exlist::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
- (*cit).bp->printraw(os);
- os << ",";
- }
- os << ")";
-}
-
-void lst::print(ostream & os, unsigned upper_precedence) const
-{
- debugmsg("lst print",LOGLEVEL_PRINT);
- // always print brackets around seq, ignore upper_precedence
- printseq(os,'[',',',']',precedence,precedence+1);
-}
-
-void lst::printtree(ostream & os, unsigned indent) const
-{
- debugmsg("lst printtree",LOGLEVEL_PRINT);
-
- os << string(indent,' ') << "type=" << typeid(*this).name()
- << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
- << ", flags=" << flags
- << ", nops=" << nops() << endl;
- for (exlist::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
- (*cit).printtree(os,indent+delta_indent);
- }
- os << string(indent+delta_indent,' ') << "=====" << endl;
-}
-
-// lst::info() will be implemented by user elsewhere";
-
-int lst::nops() const
-{
- return seq.size();
-}
-
-ex & lst::let_op(int const i)
-{
- GINAC_ASSERT(i>=0);
- GINAC_ASSERT(i<nops());
-
- exlist::iterator it=seq.begin();
- for (int j=0; j<i; j++) {
- ++it;
- }
- return *it;
-}
-
-
-ex lst::expand(unsigned options) const
-{
- exlist s;
- RESERVE(s,seq.size());
- for (exlist::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).expand(options));
- }
-
- return thislst(s);
-}
-
-// a lst 'has' an expression if it is this expression itself or a child 'has' it
-
-bool lst::has(ex const & other) const
-{
- GINAC_ASSERT(other.bp!=0);
- if (is_equal(*other.bp)) return true;
- for (exlist::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- if ((*it).has(other)) return true;
- }
- return false;
-}
-
-ex lst::eval(int level) const
-{
- if (level==1) {
- return this->hold();
- }
- return thislst(evalchildren(level));
-}
-
-ex lst::evalf(int level) const
-{
- return thislst(evalfchildren(level));
-}
-
-/** Implementation of ex::normal() for lsts. It normalizes the arguments
- * and replaces the lst by a temporary symbol.
- * @see ex::normal */
-ex lst::normal(lst &sym_lst, lst &repl_lst, int level) const
-{
- ex n=thislst(normalchildren(level));
- return n.bp->basic::normal(sym_lst,repl_lst,level);
-}
-
-ex lst::diff(symbol const & s) const
-{
- return thislst(diffchildren(s));
-}
-
-ex lst::subs(lst const & ls, lst const & lr) const
-{
- exlist * vp=subschildren(ls,lr);
- if (vp==0) {
- return *this;
- }
- return thislst(vp);
-}
-
-// protected
-
-int lst::compare_same_type(basic const & other) const
-{
- GINAC_ASSERT(is_of_type(other,lst));
- lst const & o=static_cast<lst const &>
- (const_cast<basic &>(other));
- int cmpval;
- exlist::const_iterator it1=seq.begin();
- exlist::const_iterator it2=o.seq.begin();
-
- for (; (it1!=seq.end())&&(it2!=o.seq.end()); ++it1, ++it2) {
- cmpval=(*it1).compare(*it2);
- if (cmpval!=0) return cmpval;
- }
-
- if (it1==seq.end()) {
- return (it2==o.seq.end() ? 0 : -1);
- }
-
- return 1;
-}
-
-bool lst::is_equal_same_type(basic const & other) const
-{
- GINAC_ASSERT(is_of_type(other,lst));
- lst const & o=static_cast<lst const &>
- (const_cast<basic &>(other));
- if (seq.size()!=o.seq.size()) return false;
-
- exlist::const_iterator it1=seq.begin();
- exlist::const_iterator it2=o.seq.begin();
-
- for (; it1!=seq.end(); ++it1, ++it2) {
- if (!(*it1).is_equal(*it2)) return false;
- }
-
- return true;
-}
-
-unsigned lst::return_type(void) const
-{
- return return_types::noncommutative_composite;
-}
-
-//////////
-// new virtual functions which can be overridden by derived classes
-//////////
-
-// public
-
-lst & lst::append(ex const & b)
-{
- ensure_if_modifiable();
- seq.push_back(b);
- return *this;
-}
-
-lst & lst::prepend(ex const & b)
-{
- ensure_if_modifiable();
- seq.push_front(b);
- return *this;
-}
-
-
-// protected
-
-void lst::printseq(ostream & os, char openbracket, char delim,
- char closebracket, unsigned this_precedence,
- unsigned upper_precedence) const
-{
- if (this_precedence<=upper_precedence) os << openbracket;
- if (seq.size()!=0) {
- exlist::const_iterator it,it_last;
- it=seq.begin();
- it_last=seq.end();
- --it_last;
- for (; it!=it_last; ++it) {
- (*it).bp->print(os,this_precedence);
- os << delim;
- }
- (*it).bp->print(os,this_precedence);
- }
- if (this_precedence<=upper_precedence) os << closebracket;
-}
-
-ex lst::thislst(exlist const & v) const
-{
- return lst(v);
-}
-
-ex lst::thislst(exlist * vp) const
-{
- return lst(vp);
-}
-
-//////////
-// non-virtual functions in this class
-//////////
-
-// public
-
-// none
-
-// protected
-
-bool lst::is_canonical() const
-{
- if (seq.size()<=1) { return 1; }
-
- exlist::const_iterator it=seq.begin();
- exlist::const_iterator it_last=it;
- for (++it; it!=seq.end(); it_last=it, ++it) {
- if ((*it_last).compare(*it)>0) {
- if ((*it_last).compare(*it)>0) {
- cout << *it_last << ">" << *it << "\n";
- return 0;
- }
- }
- }
- return 1;
-}
-
-
-exlist lst::evalchildren(int level) const
-{
- exlist s;
- RESERVE(s,seq.size());
-
- if (level==1) {
- return seq;
- }
- if (level == -max_recursion_level) {
- throw(std::runtime_error("max recursion level reached"));
- }
- --level;
- for (exlist::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).eval(level));
- }
- return s;
-}
-
-exlist lst::evalfchildren(int level) const
-{
- exlist s;
- RESERVE(s,seq.size());
-
- if (level==1) {
- return seq;
- }
- if (level == -max_recursion_level) {
- throw(std::runtime_error("max recursion level reached"));
- }
- --level;
- for (exlist::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).evalf(level));
- }
- return s;
-}
-
-exlist lst::normalchildren(int level) const
-{
- exlist s;
- RESERVE(s,seq.size());
-
- if (level==1) {
- return seq;
- }
- if (level == -max_recursion_level) {
- throw(std::runtime_error("max recursion level reached"));
- }
- --level;
- for (exlist::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).normal(level));
- }
- return s;
-}
-
-exlist lst::diffchildren(symbol const & y) const
-{
- exlist s;
- RESERVE(s,seq.size());
- for (exlist::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).diff(y));
- }
- return s;
-}
-
-/* obsolete subschildren
-exlist lst::subschildren(lst const & ls, lst const & lr) const
-{
- exlist s;
- RESERVE(s,seq.size());
- for (exlist::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back((*it).subs(ls,lr));
- }
- return s;
-}
-*/
-
-exlist * lst::subschildren(lst const & ls, lst const & lr) const
-{
- // returns a NULL pointer if nothing had to be substituted
- // returns a pointer to a newly created epvector otherwise
- // (which has to be deleted somewhere else)
-
- exlist::const_iterator last=seq.end();
- exlist::const_iterator cit=seq.begin();
- while (cit!=last) {
- ex const & subsed_ex=(*cit).subs(ls,lr);
- if (!are_ex_trivially_equal(*cit,subsed_ex)) {
-
- // something changed, copy seq, subs and return it
- exlist *s=new exlist;
- RESERVE(*s,seq.size());
-
- // copy parts of seq which are known not to have changed
- exlist::const_iterator cit2=seq.begin();
- while (cit2!=cit) {
- s->push_back(*cit2);
- ++cit2;
- }
- // copy first changed element
- s->push_back(subsed_ex);
- ++cit2;
- // copy rest
- while (cit2!=last) {
- s->push_back((*cit2).subs(ls,lr));
- ++cit2;
- }
- return s;
- }
- ++cit;
- }
-
- return 0; // nothing has changed
-}
-
-//////////
-// static member variables
-//////////
-
-// protected
-
-unsigned lst::precedence=10;
-
-//////////
-// global constants
-//////////
-
-const lst some_lst;
-type_info const & typeid_lst=typeid(some_lst);
-
-} // namespace GiNaC
-
+++ /dev/null
-/** @file lst.h
- *
- * 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
- * $STLHEADER=list
- * $reserve=0
- * $prepend=1
- * $let_op=1
- * $open_bracket=[
- * $close_bracket=]
- *
- * 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_LST_H__
-#define __GINAC_LST_H__
-
-#include <list>
-#include <ginac/basic.h>
-#include <ginac/ex.h>
-
-namespace GiNaC {
-
-typedef list<ex> exlist;
-
-class lst : public basic
-{
-
-public:
- lst();
- ~lst();
- lst(lst const & other);
- lst const & operator=(lst const & other);
-protected:
- void copy(lst const & other);
- void destroy(bool call_parent);
-
-public:
- lst(exlist const & s, bool discardable=0);
- lst(exlist * vp); // vp will be deleted
- explicit lst(ex const & e1);
- explicit lst(ex const & e1, ex const & e2);
- explicit lst(ex const & e1, ex const & e2, ex const & e3);
- explicit lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4);
- explicit lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5);
- explicit lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6);
- explicit lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7);
- explicit lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8);
- explicit lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9);
- explicit lst(ex const & e1, ex const & e2, ex const & e3,
- ex const & e4, ex const & e5, ex const & e6,
- ex const & e7, ex const & e8, ex const & e9,
- ex const &e10);
-
-public:
- basic * duplicate() const;
- void printraw(ostream & os) const;
- void print(ostream & os, unsigned upper_precedence=0) const;
- void printtree(ostream & os, unsigned indent) const;
- bool info(unsigned inf) const;
- int nops() const;
- ex & let_op(int const i);
- ex expand(unsigned options=0) const;
- bool has(ex const & other) const;
- ex eval(int level=0) const;
- ex evalf(int level=0) const;
- ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
- ex diff(symbol const & s) const;
- ex subs(lst const & ls, lst const & lr) const;
-protected:
- int compare_same_type(basic const & other) const;
- bool is_equal_same_type(basic const & other) const;
- unsigned return_type(void) const;
-
- // new virtual functions which can be overridden by derived classes
-public:
- virtual lst & append(ex const & b);
- virtual lst & prepend(ex const & b);
-
-protected:
- virtual void printseq(ostream & os, char openbracket, char delim,
- char closebracket, unsigned this_precedence,
- unsigned upper_precedence=0) const;
- virtual ex thislst(exlist const & v) const;
- virtual ex thislst(exlist * vp) const;
-
-protected:
- bool is_canonical() const;
- exlist evalchildren(int level) const;
- exlist evalfchildren(int level) const;
- exlist normalchildren(int level) const;
- exlist diffchildren(symbol const & s) const;
- exlist * subschildren(lst const & ls, lst const & lr) const;
-
-protected:
- exlist seq;
- static unsigned precedence;
-};
-
-// global constants
-
-extern const lst some_lst;
-extern type_info const & typeid_lst;
-
-// utility functions
-inline const lst &ex_to_lst(const ex &e)
-{
- return static_cast<const lst &>(*e.bp);
-}
-
-} // namespace GiNaC
-
-#endif // ndef __GINAC_LST_H__
-
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/ginsh_lexer.P .deps/ginsh_parser.P
SOURCES = $(ginsh_SOURCES)