Previous Page Next Page Contents

generate::Macrofort::setOptimizedOption -- sets optimization

Introduction

Mac::setOptimizedOption (where Mac:=generate::Macrofort) is a switch which allows MuPAD's optimizer generate::optimize to be applied to the expressions and arrays of the FORTRAN code generated by Mac::genFor.

Call(s)

generate::Macrofort::setOptimizedOption(b)

Parameters

b - TRUE or FALSE.

Returns

the void object of domain type DOM_NULL

Side Effects

Optimized FORTRAN code if the setting is TRUE.

Related Functions

generate::optimize, generate::Macrofort::init, generate::Macrofort::genFor

Details

Example 1

>> Mac := generate::Macrofort:
   Mac::init():

Note that the default mode for the optimizer set by generate::Macrofort::init is FALSE (meaning off).

>> Mac::openOutputFile("test.f"):
   Mac::genFor(["equal", [[a, 1 + sin(t)],
                          [b, cos(t) + sin(t)], [c, 1 + cos(t)]]]):
   Mac::closeOutputFile();
   delete a,b,c,t:

Switch the optimizer and send output to a different file.

>> Mac::openOutputFile("test2.f"):
   Mac::setOptimizedOption(TRUE):
   Mac::genFor(["equal", [[a, 1 + sin(t)], 
                          [b, cos(t) + sin(t)], [c, 1 + cos(t)]]]):
   Mac::closeOutputFile():
   delete a, b, c, t:

The output file test.f is:

            a = sin(t)+1
            b = cos(t)+sin(t)
            c = cos(t)+1

The ``optimized'' output file test2.f is:

            t1 = sin(t)
            a = t1+1
            t2 = cos(t)
            b = t1+t2
            c = t2+1

This example only shows how to call Mac::setOptimizedOption but does not show the advantages given by optimization. To appreciate these advantages, see the help-files of generate::optimize and Mac::genFor for a more comprehensive list of examples.




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000