sympy/sympy — pull request #7881 by jcrist (2014-08-16 22:40:15+00:00)
Title: Autowrap improvements

This PR is intended to get autowrap to work over a larger set of inputs for both backends.

Changes:

- `ccode` has new kwarg `dereference` which prints symbols as dereferenced variables (i.e. `(*a)` not `a`). This is used for code that has pass-by-address arguments.

- Switched C indexing to use index math rather than multiple indices. This allows the code to work with Cython.

- All C functions that have a return variable now create a local var `"{function_name}_result"` that the result is stored in, and then returned at the end of the function. This allows for return values to be allocated in multiline statements, which was impossible before. This allows all the looping code to be used with scalar accumulators, as seen in the autowrap_trace test. While the printed code isn't as pretty, it covers more cases, will always compile, and modern compilers should remove the unneeded allocation if possible.

- Cython autowrap now works. All the time. I'm not sure if it ever did before, as it never allocated arrays or removed inferred variables. Looking at the tests in external/tests/test_autowrap I don't think these ever passed with Cython, but they all do now. Once a minimum version is identified, I think the Xfails can be removed.

- autowrap now supports matrix inputs.