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

[re_with_feedback] Deprecation Issue in Numpy #428

Closed
mmcky opened this issue Dec 4, 2024 · 3 comments · Fixed by #435
Closed

[re_with_feedback] Deprecation Issue in Numpy #428

mmcky opened this issue Dec 4, 2024 · 3 comments · Fixed by #435
Assignees

Comments

@mmcky
Copy link
Contributor

mmcky commented Dec 4, 2024

/tmp/ipykernel_4089/4040936680.py:9: 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.)
  m_seq[0] = G @ x0
/tmp/ipykernel_4089/4040936680.py:10: 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.)
  p_seq[0] = F @ x0
/tmp/ipykernel_4089/4040936680.py:18: 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.)
  m_seq[t+1] = G @ x
/tmp/ipykernel_4089/4040936680.py:19: 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.)
  p_seq[t+1] = F @ x
@mmcky
Copy link
Contributor Author

mmcky commented Dec 5, 2024

@HumphreyYang not sure why this error is coming up

<ipython-input-7-ab9e2905e28b>:9: 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.)
  m_seq[0] = G @ x0

To me this code looks like matrix multiplication between two vectors where both G and x0 have dimension of 3. Any ideas? What am I missing here.

@HumphreyYang
Copy link
Collaborator

I think G @ x0 gives a nested array so it has ndim > 0 (e.g. [[0]]), but it is assigned to m_seq[0] as a scalar. So we can probably fix this by [m_seq[0]] = G @ x0.

I can have a go tomorrow once I finish my presentation.

@mmcky
Copy link
Contributor Author

mmcky commented Dec 5, 2024

Ah! smart.

We could also try the RHS as (G @ x0)[0] but it's pretty ugly notation.

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 a pull request may close this issue.

2 participants