More efficient updates in BFGS

I revised the update of B matrix according to Wikipedia's formula (it is now O(n^2), and it was O(n^3) in original code). The revised code also takes care of storage reuse.

This may be related to part of issue #26.

The updated code passes your current test of BFGS.