def initialize(self): Algorithm.initialize(self) # to store results # tridiagonal matrix coefficients self.alpha = np.zeros(self.maxiter + 1) self.beta = np.zeros(self.maxiter) self.vectors = np.zeros((self.maxiter + 1, self.n)) self.w = np.zeros(self.n) # starting point self.vectors[0] = np.random.randn(self.n) self.vectors[0] /= np.sqrt(norm2(self.vectors[0]))
def update_gradient_norm(self): self.last_gradient_norm = copy(self.current_gradient_norm) self.current_gradient_norm = norm2(self.current_gradient)
def update_beta(self): self.beta[self.iter_] = np.sqrt(norm2(self.w))