More Julian code

This is a rough draft of your code rewritten to work more than a standard Julia library. The code is a little harder to read (and has a lot of comments meant just to communicate the rationale for my changes), but it runs roughly 100x faster than the original code because it avoids almost all of the memory allocation steps that your original code performed.

I'm going to make another round of changes because I get slightly different results than in your example. I'm trying to figure out if this is a result of switching to the backslash solver instead of `pinv`, which should be avoided when possible. This case might be one where calling `pinv` might be unavoidable.