Skip to content

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

Open
@ricardoV94

Description

@ricardoV94

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,
    )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions