def _hessian_wrapper(hess, x, z, k_params):
 x_arr = np.asarray(x)
 params = x_arr[:k_params].ravel()
 zh_x = (np.asarray(z[0]) * hess(params))
 zero_mat = np.zeros(zh_x.shape)
 A = np.concatenate((zh_x, zero_mat), axis=1)
 B = np.concatenate((zero_mat, zero_mat), axis=1)
 zh_x_ext = np.concatenate((A, B), axis=0)
 return matrix(zh_x_ext, ((2 * k_params), (2 * k_params)))

def _hessian_wrapper ( hess , x , z , k_params ) : x_arr = np . asarray ( x ) params = x_arr [ : k_params ] . ravel ( ) zh_x = ( np . asarray ( z [ 0 ] ) * hess ( params ) ) zero_mat = np . zeros ( zh_x . shape ) A = np . concatenate ( ( zh_x , zero_mat ) , axis = 1 ) B = np . concatenate ( ( zero_mat , zero_mat ) , axis = 1 ) zh_x_ext = np . concatenate ( ( A , B ) , axis = 0 ) return matrix ( zh_x_ext , ( ( 2 * k_params ) , ( 2 * k_params ) ) )
wraps the hessian up in the form for cvxopt .