[GiNaC-devel] new function system

Jens Vollinga vollinga at physik.uni-wuppertal.de
Fri Nov 25 15:25:25 CET 2005


Hi,

here now a small code example to make clear what I was taking about when 
  I mentioned class-functions.
A log10 function is declared as an example. The fclass (-> function) 
class basically installs some default printing and has some convenience 
ctors.
I know there are some issues about the macros (fixed archiving defaults, 
naming, ...), some print stuff is missing in fclass, and there is no 
special code for log10 (series, ...) yet, but the main concept should 
become clear.

Eval:
- compatibility is severly broken
   (but maybe we should break it anyhow: why not rename tgamma to Gamma,
    beta to Beta, lgamma to logGamma?)
+ logic like
   if (is_a<function>(e)) {
     std::string name = ex_to<function>(e).get_name();
     if (name == "H") {
       ...
   can be replaced by more efficient code
+ hierarchies like polylog->nielsen_polylog->multiple_polylog possible
+ function.pl is no longer needed
+ eval/evalf slightly faster (?)
+ non-ex arguments for ctors (and eval, ...) possible
+ extra methods/logic/data can be included in the function class
   (projects like nestedsums, xloops suffer from not being able to do
    this at the moment)
+ more OOP like (disputable, but we will never hear the often raised
   question 'why didn't you just define the functions as classes?' again
+ better (OOP-like) handling of look-up tables (as static data or maybe
   the function might become a singleton)
- no nice separation of cln and GiNaC code possible
+ print-Methods can also be changed at runtime for functions
- archiving slightly slower because of longer reg_info list

Regards,
Jens
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fclass.cpp
Url: http://www.cebix.net/pipermail/ginac-devel/attachments/20051125/c30f47cd/fclass.cpp


More information about the GiNaC-devel mailing list