Skip to content

[re_with_feedback] Deprecation Issue in Numpy #428

Closed

Description

@mmcky
/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

Activity

  1. mmcky commented on Dec 5, 2024

    @mmcky
    ContributorAuthor

    @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.

  2. HumphreyYang commented on Dec 5, 2024

    @HumphreyYang
    Member

    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.

  3. mmcky commented on Dec 5, 2024

    @mmcky
    ContributorAuthor

    Ah! smart.

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

  4. self-assigned this
    on Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions