Error-calculating code

I added new code that computes average error and
mean-squared-displacement for general pulse sequences. Also a couple of
changes to make all outputs consistently column vectors, and assorted
minor changes to the optimization algorithm.