def _setup(lb=None, ub=None, G=None, h=None, A=None, b=None): if lb is not None and ub is not None: if lb is None: lb = numpy.nan_to_num(numpy.ones(ub.shape) * - numpy.inf) if ub is None: ub = numpy.nan_to_num(numpy.ones(lb.shape) * numpy.inf) G, h = addLBUBToInequality(lb,ub,G,h) if G is not None: m,p = G.shape z = numpy.ones((m,1)) h = h.reshape(len(h),1) else: m = 1.0 z = None if A is not None: y = numpy.ones((A.shape[0],1)) b = b.reshape(len(b),1) else: y = None return z, G, h, y, A, b
xhat,output = ip(objFH.cost, objFH.gradient, hessian=objFH.jtj, x0=[0.5,0.5,0.5], lb=lb, ub=ub, method='bar', disp=3, full_output=True) xhat,output = ip(objFH.cost, objFH.gradient, hessian=None, x0=[0.5,0.5,0.5], lb=lb, ub=ub,disp=3,full_output=True) xhat,output = ipD(objFH.cost, objFH.gradient, hessian=objFH.jtj, x0=[0.5,0.5,0.5], lb=lb, ub=ub,disp=3,full_output=True) xhat,output = ipD(objFH.cost, objFH.gradient, hessian=None, x0=[0.5,0.5,0.5], lb=lb, ub=ub,disp=3,full_output=True) from pygotools.optutils.consMani import addLBUBToInequality G,h = addLBUBToInequality(lb,ub) G = matrix(G) h = matrix(h) z = qpOut['z'] numpy.einsum('ji,ik->jk',G.T, G*z ) print mul(matrix(G),matrix(z)[:,matrix(0,(1,len(G[0])))]) numpy.einsum('ji,ik->jk',G.T, mul(matrix(G),matrix(z)[:,matrix(0,(1,G.size[1]))])) from cvxopt import blas y = matrix(0.0,(G.size[1],1)) blas.gemv(Gs, matrix(1.0,(G.size[0],1)),y,'T') C = numpy.zeros((4,4)) for i in range(3):