Skip to content

Fix crash due to new Numpy 2.x version#48

Open
ppjosip wants to merge 1 commit intomasterfrom
pr-numpy-update-error
Open

Fix crash due to new Numpy 2.x version#48
ppjosip wants to merge 1 commit intomasterfrom
pr-numpy-update-error

Conversation

@ppjosip
Copy link

@ppjosip ppjosip commented Feb 13, 2026

The script crashed on Python 3.13.7 with NumPy 2.4.2. The crash was caused by stricter rules introduced for scalar promotion and array indexing.

NumPy 2.0 removed the legacy behavior that allowed "Rank-1" arrays (e.g., the result of indexing into a column vector) to be implicitly cast as scalars during assignment to a single matrix index.

y = np.asarray(y).flatten()

n_steps = len(u)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

no need for this new line

Comment on lines +119 to +120
theta_hat = rls._theta_hat
theta_hat = np.array(theta_hat).flatten()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
theta_hat = rls._theta_hat
theta_hat = np.array(theta_hat).flatten()
theta_hat = np.array(rls._theta_hat).flatten()

@bresch
Copy link
Collaborator

bresch commented Feb 18, 2026

Could you try this instead?

@ppjosip ppjosip force-pushed the pr-numpy-update-error branch from 36742d6 to 514c987 Compare February 18, 2026 15:44
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