The Ritz Adjoint Method for MRI Pulse Design