Package PyDSTool :: Package Toolbox :: Package optimizers :: Package step :: Module newton_step
[hide private]
[frames] | no frames]

Source Code for Module PyDSTool.Toolbox.optimizers.step.newton_step

 1   
 2  # Matthieu Brucher 
 3  # Last Change : 2007-08-29 15:48 
 4   
 5  """ 
 6  Computes a Newton step for a specific function at a specific point 
 7  """ 
 8   
 9  import numpy 
10  import numpy.linalg 
11   
12 -class NewtonStep(object):
13 """ 14 The Newton step 15 """
16 - def __call__(self, function, point, state):
17 """ 18 Computes a Newton step based on a function and a point 19 """ 20 hessian = function.hessian(point) 21 gradient = function.gradient(point) 22 step = (-numpy.linalg.solve(hessian, gradient)).reshape(point.shape) 23 state['hessian'] = hessian 24 state['gradient'] = gradient 25 state['direction'] = step 26 return step
27