Add the closure conversion functions

In order to utilize the general minimization functions of scipy,
conversion routines are added to convert the previous residue and
Jacobian closure to be used with the general function.