Skip to content

Commit

Permalink
fix logic errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
saransh13 committed Jan 5, 2024
1 parent a94d5cd commit 7101380
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions hexrd/matrixutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ def findDuplicateVectors(vec, tol=vTol, equivPM=False):
idx = eqv[mask].astype(np.int64)
uid2 = list(np.delete(uid, idx))
eqv2 = []
for ii in range(eqv.shape[1]):
for ii in range(eqv.shape[0]):
v = eqv[ii, mask[ii, :]]
if v.shape[0] > 0:
eqv2.append([ii] + list(v.astype(np.int64)))
Expand Down Expand Up @@ -737,7 +737,7 @@ def _findduplicatevectors(vec, tol, equivPM):
"""

if equivPM:
vec2 = np.abs(vec.copy())
vec2 = -vec.copy()

n = vec.shape[0]
m = vec.shape[1]
Expand All @@ -753,13 +753,16 @@ def _findduplicatevectors(vec, tol, equivPM):
if jj > ii:

if equivPM:
diff = np.sum(np.abs(vec[:, ii]-vec2[:, jj]))
diff = np.sum(np.abs(vec[:, ii]-vec2[:, jj]))
diff2 = np.sum(np.abs(vec[:, ii]-vec[:, jj]))
if diff < tol or diff2 < tol:
eqv_elem[ctr] = jj
ctr += 1
else:
diff = np.sum(np.abs(vec[:, ii]-vec[:, jj]))

if diff < tol:
eqv_elem[ctr] = jj
ctr += 1
if diff < tol:
eqv_elem[ctr] = jj
ctr += 1

for kk in range(ctr):
eqv[ii, kk] = eqv_elem[kk]
Expand Down

0 comments on commit 7101380

Please sign in to comment.