예제 #1
0
 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]))
예제 #2
0
 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]))
예제 #3
0
 def update_gradient_norm(self):
     self.last_gradient_norm = copy(self.current_gradient_norm)
     self.current_gradient_norm = norm2(self.current_gradient)
예제 #4
0
 def update_beta(self):
     self.beta[self.iter_] = np.sqrt(norm2(self.w))
예제 #5
0
 def update_beta(self):
     self.beta[self.iter_] = np.sqrt(norm2(self.w))