next up previous contents
Next: Interval evaluation and Taylor Up: Generating code Previous: Generating code   Contents

Transforming expressions into C++ code

The BIAS/Profil C++ version of an arbitrary Maple expression may be obtained by using the procedure Code that will display on the standard output the C++ equivalent of the Maple expression. The syntax of this command is:

 
Code(eq);
Code([eq1,eq2,eq3]);
In the later case the components of the interval vector v_IS will be affected to each component in the list.

If this procedure has a second argument which is a list of variable the procedure will provide a C++ evaluation formula where the unknown has been substituted by the element of the interval vector v_IS (which the name of the interval vector used internally by ALIAS):

 
Code(x^2+2*x+1,[x]);      
               Sqr(v_IS(1)) + 2 v_IS(1) + 1

An optional last argument, the string "minimal" may be added: in that case the procedure will try to produce a compact form for the expression that may be more appropriate for interval evaluation and is the result of the procedure MinimalCout:

 
Code(x^2+2*x+1);
v_IS=Sqr(x)+2*x+1;
Code(x^2+2*x+1,"minimal");  
v_IS=1+(2+x)*x;



Jean-Pierre Merlet 2012-12-20