Refactoring ProjectedQuasiNewton and SpectralProjectedGradient

Hi David,

here comes a bigger bugfix/refactoring of ProjectedQuasiNewton and SpectralProjectedGradient.
There is an additional test that fails with the current version of PQN and works with the version from this PR.
Also, the code now is more vectorized and reuses more of the existing functionality.

Best
  Martin