MOAL.maths.applied.optimization package

Submodules

MOAL.maths.applied.optimization.memoization module

MOAL.maths.applied.optimization.memoization.dolongthing(*args, **kwargs)[source]

Does a nested loop - running time is O(n^2)

Args:
max_x (int) - An integer for max outer loop max_y (int) - An integer for max inner loop
Returns:
res (int) - The resultant calculation
MOAL.maths.applied.optimization.memoization.dolongthing2(*args, **kwargs)[source]
MOAL.maths.applied.optimization.memoization.memoize(func, *args, **kwargs)[source]

A decorator that memoizes the results of a decorated function.

MOAL.maths.applied.optimization.memoization.memoize_lookuptable(func, *args, **kwargs)[source]

A decorator that memoizes the results of a decorated function. Instead of checking if key is in keys, it attempts to access the property directly, like a typical lookup table.

MOAL.maths.applied.optimization.strength_reduction module

MOAL.maths.applied.optimization.strength_reduction.DEBUG = False

Strength reduction is an optimization technique that involves taking a more ‘advanced’ math technique and breaking it down into simple ‘dumb’ tasks that can be repeated.

For example, multiplication can be converted to lots of addition.

MOAL.maths.applied.optimization.strength_reduction.exp(*args, **kwargs)[source]
MOAL.maths.applied.optimization.strength_reduction.mult(*args, **kwargs)[source]
MOAL.maths.applied.optimization.strength_reduction.strengthreduced_exp(*args, **kwargs)[source]
MOAL.maths.applied.optimization.strength_reduction.strengthreduced_mult(*args, **kwargs)[source]