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

Numba symmetrical solve prints spurious ill-conditioned matrix #1271

Open
ricardoV94 opened this issue Mar 6, 2025 · 0 comments · May be fixed by #1273
Open

Numba symmetrical solve prints spurious ill-conditioned matrix #1271

ricardoV94 opened this issue Mar 6, 2025 · 0 comments · May be fixed by #1273
Assignees

Comments

@ricardoV94
Copy link
Member

Description

import pytensor
import pytensor.tensor as pt
import numpy as np

b = pt.vector("b", shape=(None,))
A = pt.matrix("A", shape=(None, None))
out = pt.linalg.solve(A, b, assume_a="sym")
fn = pytensor.function([A, b], out, mode="numba")

A_test = np.eye(10) * 25.2
A_test[np.arange(0, 9), np.arange(1, 10)] = -12.1  # UD
A_test[np.arange(1, 10), np.arange(0, 9)] = -12.1  # LD

b_test = np.array([
    0.28173256, 0.54064082, 0.75574957, 0.909632, 0.98982144,
    0.98982144, 0.909632  , 0.75574957, 0.54064082, 0.28173256,
])
fn(A_test, b_test)  # Ill-conditioned matrix, rcond= [1.50348143e-20] , result may not be accurate.

The rcond is wrong should be rcond=0.033783751012653636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants