Exemplo n.º 1
0
 def convex(self, vals):
   J = jacobian(self.u_vars, self.eps_x, self.eps_y)
   out = 0
   for i in range(J.shape[0]):
     for j in range(J.shape[1]):
       for k in range(J.shape[2]):
         for l in range(J.shape[3]):
           term = J[i,j,k,l] + J[i,j,l,k]
           out += term*term
   out *= self.coeff
   return out
Exemplo n.º 2
0
 def eval(self, vals):
   J = jacobian(vals, self.eps_x, self.eps_y)
   JT = J.transpose((0, 1, 3, 2))
   return self.coeff * sumsq(J + JT)