[GiNaC-list] Term ordering and compiling C++ code

jros jros at unavarra.es
Fri May 28 18:38:33 CEST 2010


Would this make sense:

For class GiNaCPrint if

std::map<std::string, std::string> m_symbols;

is changed to

std::map<ex, std::string, ex_is_less> m_symbols;

And the rest of the code accordingly, we will:

1) Leave GiNaC improve future performance whenever ex_is_less  is improved

2) I think that whenever a comparison of two different (as in memory)
expresions gives true (they are the same symbolically), then GiNaC will
automatically eliminate from memory one of the instances. This will
probably improve memory allocation within GiNaC symbolic expresions as
well as speed further comparisons.

I suppose that even ex_is_less can be substituted by a custom function
that compares pointers or something similar, if GiNaC implementation is
not quick enough for the purposes of accessing the map. So having an
implementation as efficient as the one of the ex::gethash(), but
avoiding the conflicts due to not uniqueness referred by Doug.

As with std::map, that function can have a default of ex_is_less, and
if using templates, that function can be overridden when constructing
the class.

I hope this helps,

Javier



On Fri, 2010-05-28 at 09:21 +0200, Martin Ettl wrote:
> Hello all,
> 
> i have extended the GinacPrint about following functions:
> 
>     /**
>      * With this function the default variable name can be changed.
>      * By default it is "e"; Passing an empty string resets
>      * to default.
>      * 
>      * @param newVarName the new variable name
>      * 
>      */
>      void setVarName(const std::string &newVarName);
> 
>     /**
>      * This functions returns the current variable name.
>      * By default it is "e";
>      * 
>      * @return the current variable name
>      * 
>      */
>      const std::string & getVarName() const;
> 
>     /**
>      * Clears all internal variables. This is a reset to default function.
>      * 
>      */
>      void clear();
> 
> I have attached the modified version.
> 
> Best regards from Germany
> 
> Martin
> 
> -------- Original-Nachricht --------
> > Datum: Wed, 26 May 2010 17:55:19 -0700 (PDT)
> > Von: Doug <cape1232 at yahoo.com>
> > An: GiNaC discussion list <ginac-list at ginac.de>
> > Betreff: Re: [GiNaC-list] Term ordering and compiling C++ code
> 
> > Beautiful.  Thanks!
> > 
> > 
> > --- On Wed, 5/26/10, Martin Ettl <ettl.martin at gmx.de> wrote:
> > 
> > From: Martin Ettl <ettl.martin at gmx.de>
> > 
> > ...
> > What do you think about my modifications (see attachment)?
> > 
> > 
> > 
> > 
> >       
> 
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list



More information about the GiNaC-list mailing list