Mathematica 9 is now available

Wolfram Library Archive


All Collections Articles Books Conference Proceedings
Courseware Demos MathSource Technical Notes
Title Downloads

A Package For Code Optimization Using Mathematica
Author

Mark Sofroniou
Organization: Wolfram Research, Inc.
Department: Kernel Technology
Old MathSource #

0206-592
Revision date

2004-09-21
Description

The package Optimize.m provides an efficient (linear time) means of expression optimization for Mathematica. The term "optimization" is used in the sense of reducing the arithmetic operation count. For the most part only exact, or syntactic, sub-expressions are matched. For example: the x+y in (x+y)*f(x+y) is considered as common, but not in x+y+f(x+y). Code optimization has many applications including speeding up numerics and graphics, improving the performance of canonical simplification and reducing the memory required to represent/store an expression. Optimized procedures and compiled procedures are possible. The procedure Horner factors polynomials in Horner form, an efficient form for numerical evaluation. The procedure Cost gives a count of the operators present in an expression. Optimize.m can also be used in conjunction with the auxiliary package Format.m (item 60) to produce optimized C and FORTRAN statement sequences.

The package Optimize.m is now obsolete and has be replaced by the built-in function Experimental`OptimizeExpression since version 4.1 of Mathematica. The package Format.m no longer needs Optimize.m to create an optimized expression sequence.
Subject

*Mathematica Technology > Programming
Keywords

Conversion, C, code optimization, fortran, sub-expressions
Related items

*C, FORTRAN77, Maple and TeX Code Generation Package   [in MathSource: Packages and Programs]
URL

http://www.wolfram.com/products/applications/mathcode/
Downloads Download Wolfram CDF Player

Download
Optimize.m (22.8 KB) - Mathematica Package