Skip to content

Commit 133a276

Browse files
committed
BUG: Fixed issue with older versions of numpy.
1 parent e8f710b commit 133a276

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

OnPLS/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def leastNonZero(A):
3030

3131
def normaliseColumns(A):
3232

33-
norms = np.linalg.norm(A, axis=0)
33+
try:
34+
norms = np.linalg.norm(A, axis=0)
35+
except TypeError:
36+
norms = np.sqrt(np.sum(A**2.0, axis=0))
3437
# Avoid division by zero: Define 0 / 0 = 0.
3538
norms[np.abs(norms) < consts.TOLERANCE] = 1.0
3639
A = A / norms

0 commit comments

Comments
 (0)