From 01f23d67ca91dfa8ec72a0e545ab2e58912ddaa6 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Mon, 11 Mar 2024 23:08:51 -0400 Subject: [PATCH] Update indexing eigenvectors --- quaternionic/converters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quaternionic/converters.py b/quaternionic/converters.py index bd3b8ee..b601a09 100644 --- a/quaternionic/converters.py +++ b/quaternionic/converters.py @@ -249,7 +249,7 @@ def from_rotation_matrix(cls, rot, nonorthogonal=True): if not shape: q = np.empty((4,), dtype=rot.dtype) eigvals, eigvecs = linalg.eigh(K3.T, subset_by_index=(3, 3)) - q[0] = eigvecs[-1] + q[0] = eigvecs[-1, 0] q[1:] = -eigvecs[:-1].flatten() return cls(q) else: @@ -257,7 +257,7 @@ def from_rotation_matrix(cls, rot, nonorthogonal=True): for flat_index in range(reduce(mul, shape)): multi_index = np.unravel_index(flat_index, shape) eigvals, eigvecs = linalg.eigh(K3[multi_index], subset_by_index=(3, 3)) - q[multi_index+(0,)] = eigvecs[-1] + q[multi_index+(0,)] = eigvecs[-1, 0] q[multi_index+(slice(1,None),)] = -eigvecs[:-1].flatten() return cls(q)