halide/Halide — pull request #540 by kree-colemcalughlin (2014-11-04 21:18:14+00:00)
Title: Added a linear solver mutator.

This PR has been split out of the specialize_branched_loops branch for easier review. I have added a class that implements a linear solver mutation on expressions. The idea is that you provide an equality or inequality expression, a variable you want to solve for, and a list of free variables that may appear in the expression. The solver then attempts to mutate the expression such that the variable you are solving for appears alone on the left hand side of the equation. If the solve does not succeed, e.g. because the expression was not linear, then the expression is returned unmutated. This solver is used extensively in the specialize_branched_loops optimization pass.