Static Public Member Functions | |
static StkConst | reuseConst (List< StkConst > nums, String name, double value) |
Tries to reuse an already existing constant. | |
static void | performAll (List< StkOp > program, List< StkConst > nums, double[] stack, StkOpRepository rep) |
Performs all optimizations. | |
static void | inlineExprs (List< StkOp > program) |
Make everything inline if possible. | |
static void | precalc (List< StkOp > program, List< StkConst > nums, double[] stack) |
Precalculates constant subexpressions. | |
static void | optimizePow (List< StkOp > program, StkOpRepository rep) |
Replaces x^(+-y) by one-argument functions. | |
static void | optimizeMult (List< StkOp > program, StkOpRepository rep) |
Replaces (. | |
static void | optimizeDiv (List< StkOp > program, StkOpRepository rep) |
Replaces const/(. | |
static void | optimizePlus (List< StkOp > program, StkOpRepository rep) |
Replaces const+(. | |
static void | optimizeMinus (List< StkOp > program, StkOpRepository rep) |
Replaces const-(. | |
Classes | |
class | Fdivx |
class | Fminusx |
class | Fpowx |
class | Fxdiv |
class | Fxminus |
class | Fxmult |
class | Fxplus |
class | Fxpow |
static StkConst gridripper::math::expr::ExprOptimizer::reuseConst | ( | List< StkConst > | nums, | |
String | name, | |||
double | value | |||
) | [inline, static] |
Tries to reuse an already existing constant.
It creates a new object only if the constant is not found in the repository.
nums | a repository of existing constants | |
name | the constant name | |
value | the constant value |
static void gridripper::math::expr::ExprOptimizer::inlineExprs | ( | List< StkOp > | program | ) | [inline, static] |
Make everything inline if possible.
static void gridripper::math::expr::ExprOptimizer::precalc | ( | List< StkOp > | program, | |
List< StkConst > | nums, | |||
double[] | stack | |||
) | [inline, static] |
Precalculates constant subexpressions.
static void gridripper::math::expr::ExprOptimizer::optimizePow | ( | List< StkOp > | program, | |
StkOpRepository | rep | |||
) | [inline, 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 | ( | List< StkOp > | program, | |
StkOpRepository | rep | |||
) | [inline, static] |
Replaces (.
..)*(...), const*(...), and (...)*const by one-argument functions.
static void gridripper::math::expr::ExprOptimizer::optimizeDiv | ( | List< StkOp > | program, | |
StkOpRepository | rep | |||
) | [inline, static] |
Replaces const/(.
..) and (...)/const by one-argument functions, 1/(...) by (...)^-1.
static void gridripper::math::expr::ExprOptimizer::optimizePlus | ( | List< StkOp > | program, | |
StkOpRepository | rep | |||
) | [inline, static] |
Replaces const+(.
..) and (...)+const by one-argument functions.
static void gridripper::math::expr::ExprOptimizer::optimizeMinus | ( | List< StkOp > | program, | |
StkOpRepository | rep | |||
) | [inline, static] |
Replaces const-(.
..) and (...)-const by one-argument functions.