def store(self, new_s, new_y): """ Store a new (s,y) pair. This method takes "small" vectors as input, i.e., corresponding to the variables participating in the quasi-Newton update. """ InverseLBFGS.store(self, new_y, new_s)
def matvec(self, v): """ Take a small vector and return a small vector giving the contribution of the Hessian approximation to the matrix-vector product. """ return InverseLBFGS.matvec(self, v)
def __init__(self, n, npairs=5, **kwargs): """ See the documentation of `InverseLBFGS` for complete information. :keywords: :vars: List of variables participating in the quasi-Newton update. If `None`, all variables participate. """ self.on = n # Original value of n. self.vars = kwargs.get('vars', None) # None means all variables. if self.vars is None: nvars = n else: nvars = len(self.vars) # This next initialization will set self.n to nvars. # The original value of n was saved in self.on. InverseLBFGS.__init__(self, nvars, npairs, **kwargs)
def store(self, new_s, new_y): # Simply swap s and y. InverseLBFGS.store(self, new_y, new_s)
def __init__(self, n, npairs=5, **kwargs): InverseLBFGS.__init__(self, n, npairs, **kwargs)