Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indexing of eigen vector #227

Merged
merged 3 commits into from
Mar 12, 2024
Merged

Fix indexing of eigen vector #227

merged 3 commits into from
Mar 12, 2024

Conversation

unnonouno
Copy link
Contributor

from_rotation_matrix causes deprecation warning. It is because linalg.eigh returns a 2D ndarray. I fixed its indexing.

The simplest code to check is below:

import warnings
import numpy as np
import quaternion

warnings.simplefilter("default")                                                                                                                                                                                   
quaternion.from_rotation_matrix(np.eye(3))

And the warning message:

/home/unno/git/quaternion/src/quaternion/__init__.py:357: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  q.components[0] = eigvecs[-1]

@moble moble merged commit 0a6019f into moble:main Mar 12, 2024
@moble
Copy link
Owner

moble commented Mar 12, 2024

Thanks very much!

@unnonouno unnonouno deleted the fix-index branch March 12, 2024 13:29
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants