simplify_indexed() didn't fully simplify the expressions

Richard B. Kreckel kreckel at
Mon Jun 9 14:00:32 CEST 2003


On Mon, 9 Jun 2003, Yong Xiao wrote:
> It seems that for some expression(suppose it's defined as e1)
> simplify_indexed() doesn't do simplification fully. However, if I define
> another ex objec tmp = e1, and e1.simplify_indexed() will give a more
> simple expression which, although, is still not of the simplest form.
> Anyone knows a more efficient way?

Can you provide a definition of "simple"?

No kidding, an example of what you have and what you want to get would be
really helpful.  Without that nobody can help you, I'm afraid.

> Another problem I met is that when I simplify an expression which is
> composed of 240 terms, where every term is a simple product of indexed
> objects, the complilation will stop, saying "out of memory". I don't
> think that GiNaC can't handle such expressions. Anything wrong?

Your compiler optimizing too aggressivly.  Try this ctor instead:

/** Construct ex from string and a list of symbols. The input grammar is
 *  similar to the GiNaC output format. All symbols and indices to be used
 *  in the expression must be specified in a lst in the second argument.
 *  Undefined symbols and other parser errors will throw an exception. */
GiNaC::ex::ex(const std::string &s, const GiNaC::ex &l);

Richard B. Kreckel
<Richard.Kreckel at GiNaC.DE>

More information about the GiNaC-list mailing list