Skip to content

Figure out all remaining ArrFunc slots on the dtype #11

@seberg

Description

@seberg

Moves/partially moved (defined defintely on DType)

  • Get/Set item
  • copyswap(n) --> part of CastingImpl
  • cast functions --> part of CastingImpl

Needs decision

  • compare: also defined as ufunc, mostly needed for sorting.
    UFunc usage seems likely best, but could be better if
    UFunc can return n=0 specialized inner-loop
    implementation.

  • nonzero(char *element, PyArrayObject *arr): Currently method (byte swaps
    if needed). Could also be a get_nonzero_func method?
    Also plausible as a ufunc?! (if we allow tagging on scalar specializations)

  • fill (arange): Replace with better arange slot/method-like and
    move the weirder legacy behaviour through that?
    Problem: Either it needs to allocate, or getting the length needs to
    happen before somehow? A get_arange slot could also pass out the length
    although it is a bit absurd for such a simple function?

Deprecated or Unused

  • clip # Internal usage deprecated
  • fillwithscalar # Not used in NumPy

Should probably move to DType

  • scanfunc, fromstr # As methods (get in the dtype?)

  • dotfunc: Used for vector * (!matrix). Actually used to ensure that the
    32bit limit of standard BLAS is not hit.
    Needs decision whether to use get_dotfunc type slot, or just a single
    slot.

  • sort, argsort: Needs new solution to avoid array of funcs.
    Should we change the sorting signature (aside from array->dtype change)?
    Could create a NPY_dt_get_sortfunction slot. That could return
    NotImplemented if the sortkind is not recognized. DType could be passed
    in any case (but dtype instance specialization would be possible).

Simply Remove

  • take, putmask: Always NULL and never use within NumPy (done outside of this branch/work).

Move to GUFunc

  • argmax/min: Should these be gufuncs simply? (although the gufunc may not be
    able to do the "ravel" logic, meaning it would be a wrapped gufunc).
    We can automatically do this for legacy types in the resolver.
    Since it can return a UFuncImpl which uses the dtypes function (if it
    exists). Only issue: That is typically only contiguously defined, but
    that is merely a performance issue, that only matters for types that
    probably do not even exist?

To Deprecate?

  • scalarkind: Used only in PyArray_ScalarKind (which is public API).
    Nobody probably actually uses this (really). The public API
    function converts signed integers to unsigned integers.
    User dtypes could say they are integers/floats for scalar
    casting purposes.
    Scalarkind will probably just silently phase out with new dtypes and
    is never actually used by any extension dtypes.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions