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)