Hi, I have the impression that I hit on an internal religous war on the evilness of certain files. This was not my intention. To avoid other misunderstandings, I did not propose to replace standard print_csrc output by something else. This should remain as it is. But I would like to see that GiNaC offers the opportunity that C code is generated in an additional different way with temporary variables. (I carefully try to avoid the word "optimized code" here, but that's what I mean.) The decision which output format to use should be put into the hands of the user, he or she will know best what suits here needs. I will have a look at the excompiler.cpp file and see how it fits together. There are also several good points which Alexei mentioned: If expressions of type add and mul should be substituted or rather calculated on the fly is certainly worth a discussion. My experience would lead me towards substitution, but I admit that in different circumstances the conclusion could be the opposite. Maybe flags or a visitor object could fine-tune this behaviour on an individual basis. Collecting and running normal() on the coefficients is also something I do privately on expressions where I excpect improvements. As normal() involves a gcd computation I did not include it in the code generation routine. Best wishes, Stefan On Wed, 21 Mar 2007, Jens Vollinga wrote:
Dear Stefan,
Stefan Weinzierl schrieb:
I believe an efficient way to do this is to write the expression as C code into a file, compile and reload the compiled function into memory.
Sheplyakov Alexei schrieb:
However, GiNaC does support code generation, and even got that evil GiNaC::excompiler thing...
The evil thing Alexei mentioned is part of CVS HEAD. Maybe you can have a look at it (it is in the files excompiler.* mostly). Most parts of it are unscrupulously stolen from your code in gtybalt ... Maybe we can combine/improve that code with your patch. What do you think?
Regards, Jens _______________________________________________ GiNaC-devel mailing list GiNaC-devel@ginac.de https://www.cebix.net/mailman/listinfo/ginac-devel