Skip to content

Commit af925ff

Browse files
committed
Fixes sign bug in max-based normalization
- Fixes bug in coupled factor normalization that could invert sign on some factors
1 parent e7edcc1 commit af925ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tensorpack/coupled.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def normalize_factors(self, method="max"):
253253
for mmode in self.modes:
254254
sol = self.x["_" + mmode]
255255
if method == "max": # the one with maximum absolute value
256-
norm_vec = np.array([max(sol[:, ii].min(), sol[:, ii].max(), key=abs) for ii in range(sol.shape[1])])
256+
norm_vec = abs(sol).max(axis=0).to_numpy()
257257
elif method == "norm":
258258
norm_vec = norm(sol, axis=0)
259259
else:

0 commit comments

Comments
 (0)