Skip to content

C implementation of psi doesn't handle negative inputs #1444

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

Open
ricardoV94 opened this issue Jun 5, 2025 · 0 comments
Open

C implementation of psi doesn't handle negative inputs #1444

ricardoV94 opened this issue Jun 5, 2025 · 0 comments

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Jun 5, 2025

It simply returns 0

Test added in #1443

pytest.mark.parametrize(
    "linker",
    [
        "py",
        pytest.param(
            "c",
            marks=pytest.mark.xfail(
                reason="C implementation does not support negative inputs"
            ),
        ),
    ],
)
def test_psi(linker):
    x = float64("x")
    out = psi(x)

    fn = function([x], out, mode=Mode(linker=linker, optimizer="fast_run"))
    fn.dprint()

    x_test = np.float64(0.5)
    np.testing.assert_allclose(
        fn(x_test),
        scipy.special.psi(x_test),
        strict=True,
    )
    np.testing.assert_allclose(
        fn(-x_test),
        scipy.special.psi(-x_test),
        strict=True,
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant