Optimize matrix constructor to avoid extra array allocation, and other more trivial quick ones like not compiling regexes repeatedly in loops.
Merge pull request #39 from srowen/RecursionAndHashCodeIssues

Recursion, hashCode issue and a few other suggestions