def hessian_dfp(self, c, delta_w, delta_g, epsilon):
n = delta_w.size
d = delta_g.dot(delta_w)
if fabs(d) < epsilon:
return np.identity(n)
a = np.zeros((n, n))
a = delta_w.dot(delta_w)
a /= d
b = np.zeros((n, n))
w2 = c.dot(delta_g)
b = w2.dot(w2)
d = delta_g.dot(w2)
if fabs(d) < epsilon:
return np.identity(n)
b /= d
return c+a-b
评论列表
文章目录