Hello, I have developed a class to produce optimized C output. As example, symbol x ("x"), y ("y"), z ("z"); ex A = sin (x * y * z*z) + x * x * y * z; ex B = x*x*y*y*z; Optimized_ex_output aw; aw.add ("A", A); aw.add ("B", B); aw.write(cout); gives double tmp0 = z; double tmp1 = y; double tmp2 = x; double tmp_gcd9 = tmp2*tmp1; double tmp_gcd8 = tmp_gcd9*tmp0; double A = tmp2*tmp_gcd8+sin(tmp0*tmp_gcd8); double B = tmp_gcd9*tmp_gcd8; It produce "already" optmized code (factorization, gcd, less use of /). It seems that g++ can produce similar code but these optimizations are already done in the code and the code is faster to compile. Nevertheless, there are cases where the produced code make faster results than g++ -O2 -ffast-math -fexpensive-optimizations... As I don't know how CVS works, I send you the sources. If you think that It is pertinent I would be happy to see this class (with corrections if necessary) in the GiNaC code. PS: many many thanks for your library and your humor. It's great.. -- Hugo LECLERC Applied Mechanics Laborator UMR CNRS 6604 UFR Sciences et Techniques 24, chemin de l'Epitaphe 25000 BESANCON - FRANCE
participants (1)
-
Hugo LECLERC