gridripper::math::expr::ExprOptimizer Class Reference

Optimizes the internal code of an expression. More...

#include <ExprOptimizer.h>

List of all members.

Static Public Member Functions

static StkConstreuseConst (tvector< StkConst * > &nums, const string &name, GReal_t value)
 Tries to reuse an already existing constant.
static void performAll (tvector< StkOp * > &program, tvector< StkConst * > &nums, GReal_t *stack, StkOpRepository &rep)
 Performs all optimizations.
static void inlineExprs (tvector< StkOp * > &program)
 Make everything inline if possible.
static void precalc (tvector< StkOp * > &program, tvector< StkConst * > &nums, GReal_t *stack)
 Precalculates constant subexpressions.
static void optimizePow (tvector< StkOp * > &program, StkOpRepository &rep)
 Replaces x^(+-y) by one-argument functions.
static void optimizeMult (tvector< StkOp * > &program, StkOpRepository &rep)
 Replaces (.
static void optimizeDiv (tvector< StkOp * > &program, StkOpRepository &rep)
 Replaces const/(.
static void optimizePlus (tvector< StkOp * > &program, StkOpRepository &rep)
 Replaces const+(.
static void optimizeMinus (tvector< StkOp * > &program, StkOpRepository &rep)
 Replaces const-(.


Detailed Description

Optimizes the internal code of an expression.

Version:
GridRipper 0.5, 11/15/2008
Since:
GROMIT 0.2 (2001)
Author:
Peter Csizmadia

Member Function Documentation

static StkConst* gridripper::math::expr::ExprOptimizer::reuseConst ( tvector< StkConst * > &  nums,
const string &  name,
GReal_t  value 
) [static]

Tries to reuse an already existing constant.

It creates a new object only if the constant is not found in the repository.

Parameters:
nums a repository of existing constants
name the constant name
value the constant value
Returns:
the constant

static void gridripper::math::expr::ExprOptimizer::inlineExprs ( tvector< StkOp * > &  program  )  [static]

Make everything inline if possible.

static void gridripper::math::expr::ExprOptimizer::precalc ( tvector< StkOp * > &  program,
tvector< StkConst * > &  nums,
GReal_t stack 
) [static]

Precalculates constant subexpressions.

static void gridripper::math::expr::ExprOptimizer::optimizePow ( tvector< StkOp * > &  program,
StkOpRepository rep 
) [static]

Replaces x^(+-y) by one-argument functions.

Optimized y values: 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8.

static void gridripper::math::expr::ExprOptimizer::optimizeMult ( tvector< StkOp * > &  program,
StkOpRepository rep 
) [static]

Replaces (.

..)*(...), const*(...), and (...)*const by one-argument functions.

static void gridripper::math::expr::ExprOptimizer::optimizeDiv ( tvector< StkOp * > &  program,
StkOpRepository rep 
) [static]

Replaces const/(.

..) and (...)/const by one-argument functions, 1/(...) by (...)^-1.

static void gridripper::math::expr::ExprOptimizer::optimizePlus ( tvector< StkOp * > &  program,
StkOpRepository rep 
) [static]

Replaces const+(.

..) and (...)+const by one-argument functions.

static void gridripper::math::expr::ExprOptimizer::optimizeMinus ( tvector< StkOp * > &  program,
StkOpRepository rep 
) [static]

Replaces const-(.

..) and (...)-const by one-argument functions.


The documentation for this class was generated from the following file:

Generated on Wed Jun 17 18:46:55 2009 for GridRipper by  doxygen 1.5.6