Skip to content

Commit

Permalink
Fixed non-integer array indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
marinkaz committed Sep 22, 2017
1 parent be02737 commit fa0f3d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nimfa/methods/factorization/psmf.py
Expand Up @@ -336,8 +336,8 @@ def _update_lamb(self):
locs = sub2ind(
(self.V.shape[0], self.rank), locs, self.s[locs, n])
for l in locs:
self.W[l % self.V.shape[0], l / self.V.shape[0]] = self.lamb[
l % self.V.shape[0], l / self.V.shape[0]]
self.W[l % self.V.shape[0], l // self.V.shape[0]] = self.lamb[
l % self.V.shape[0], l // self.V.shape[0]]
self.W = self.W.tocsr()
self._cross_terms()

Expand Down
2 changes: 1 addition & 1 deletion nimfa/methods/factorization/snmf.py
Expand Up @@ -403,7 +403,7 @@ def _spfcnnls(self, C, A):
tmp_f[i, h_set[j]] = True
idx_f = find(tmp_f[:, h_set])
i_f = [l % p_set.shape[0] for l in idx_f]
j_f = [l / p_set.shape[0] for l in idx_f]
j_f = [l // p_set.shape[0] for l in idx_f]
if len(i_f) == 0:
break
if n_h_set == 1:
Expand Down
4 changes: 2 additions & 2 deletions nimfa/utils/linalg.py
Expand Up @@ -279,7 +279,7 @@ def _naxis(row, col):
else:
idxX = np.asmatrix(X).argmax(axis)
if axis is None:
eX = X[idxX / X.shape[1], idxX % X.shape[1]]
eX = X[idxX // X.shape[1], idxX % X.shape[1]]
elif axis == 0:
eX = [X[idxX[0, idx], col]
for idx, col in zip(range(X.shape[1]), range(X.shape[1]))]
Expand Down Expand Up @@ -333,7 +333,7 @@ def _naxis(row, col):
else:
idxX = np.asmatrix(X).argmin(axis)
if axis is None:
eX = X[idxX / X.shape[1], idxX % X.shape[1]]
eX = X[idxX // X.shape[1], idxX % X.shape[1]]
elif axis == 0:
eX = [X[idxX[0, idx], col]
for idx, col in zip(range(X.shape[1]), range(X.shape[1]))]
Expand Down

0 comments on commit fa0f3d2

Please sign in to comment.