• Jason Rhinelander's avatar
    Stop forcing c-contiguous in py::vectorize · ae5a8f7e
    Jason Rhinelander authored
    The only part of the vectorize code that actually needs c-contiguous is
    the "trivial" broadcast; for non-trivial arguments, the code already
    uses strides properly (and so handles C-style, F-style, neither, slices,
    etc.)
    
    This commit rewrites `broadcast` to additionally check for C-contiguous
    storage, then takes off the `c_style` flag for the arguments, which
    will keep the functionality more or less the same, except for no longer
    requiring an array copy for non-c-contiguous input arrays.
    
    Additionally, if we're given a singleton slice (e.g. a[0::4, 0::4] for a
    4x4 or smaller array), we no longer fail triviality because the trivial
    code path never actually uses the strides on a singleton.
    ae5a8f7e
test_numpy_vectorize.cpp 2.13 KB