Add preconditioning and improved descent for conjugate-gradient algorithm

This also substantially enhances the constrained optimization routines.