Skip to content

argsort: default value of stable not tested #389

@cakedev0

Description

@cakedev0

See issue: data-apis/array-api-compat#354

This section of the test:

    kw = data.draw(
        hh.kwargs(
            axis=st.integers(-x.ndim, x.ndim - 1),
            descending=st.booleans(),
            stable=st.booleans(),
        ),
        label="kw",
    )

Probably enforces there are always kwargs, so we don't test default values to behave as expected...

Edit: this isn't true, missing kwargs are tested by hypothesis.

The problem comes from the fact that tested arrays are too small.

It's a common optimization in sorting algorithms to switch to insertion sort for small arrays, and insertion sort is inherently stable. See #define SMALL_QUICKSORT 15 constant in numpy's code for instance.

More generally, it's common to switch strategy for small arrays in sorting algorithm, so it's good to test long enough arrays when testing sort/argsort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions