There is a lot of code here that can be heavily optimized for performance, and restructured a little (e.g. to remove globals) But we really need tests for each function to be able to do that easily. Are there any tests of the original MATLAB?