Skip to content

Commit 234833b

Browse files
committed
Correct code that was outdated from paper
1 parent 30ee963 commit 234833b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dfols/controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def initialise_coordinate_directions(self, number_of_samples, num_directions, pa
144144
while k < self.n():
145145
ek = np.zeros(self.n())
146146
ek[k] = 1
147-
p = np.dot(ek,self.delta)
147+
p = np.dot(ek,min(1,self.delta))
148148
yk = dykstra(self.model.projections, self.model.xbase + p, max_iter=params("dykstra.max_iters"), tol=params("dykstra.d_tol"))
149149
D[k,:] = yk - self.model.xbase
150150

@@ -158,7 +158,7 @@ def initialise_coordinate_directions(self, number_of_samples, num_directions, pa
158158
if diag[k] < mr_tol:
159159
ek = np.zeros(self.n())
160160
ek[k] = 1
161-
p = -np.dot(ek,self.delta)
161+
p = -np.dot(ek,min(1,self.delta))
162162
yk = dykstra(self.model.projections, self.model.xbase + p, max_iter=params("dykstra.max_iters"), tol=params("dykstra.d_tol"))
163163
dk = D[k,:].copy()
164164
D[k,:] = yk - self.model.xbase
@@ -178,7 +178,7 @@ def initialise_coordinate_directions(self, number_of_samples, num_directions, pa
178178
if slctr[k%self.n()] == 1: # if selector says make -ve, make -ve
179179
ek = np.zeros(self.n())
180180
ek[k%self.n()] = 1
181-
p = -np.dot(ek,self.delta)
181+
p = -np.dot(ek,min(1,self.delta))
182182
yk = dykstra(self.model.projections, self.model.xbase + p, max_iter=params("dykstra.max_iters"), tol=params("dykstra.d_tol"))
183183
dk = D[k%self.n(),:].copy()
184184
D[k%self.n(),:] = yk - self.model.xbase
@@ -202,7 +202,7 @@ def initialise_coordinate_directions(self, number_of_samples, num_directions, pa
202202
if diag[k] < mr_tol:
203203
p = np.random.normal(size=self.n())
204204
p = p/np.linalg.norm(p)
205-
p = np.dot(p,self.delta)
205+
p = np.dot(p,min(1,self.delta))
206206
yk = dykstra(self.model.projections, self.model.xbase + p, max_iter=params("dykstra.max_iters"), tol=params("dykstra.d_tol"))
207207
dk = D[k,:].copy()
208208
D[k,:] = yk - self.model.xbase

0 commit comments

Comments
 (0)