Skip to content

Numba symmetrical solve prints spurious ill-conditioned matrix #1271

@ricardoV94

Description

@ricardoV94

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions