@@ -5406,6 +5406,10 @@ def arange_fill(inputs, output, offset):
54065406 else : # use linspace to have finer control over exclusion of endpoint for float types
54075407 output [:] = np .linspace (start , stop , lout , endpoint = False , dtype = output .dtype )
54085408
5409+ @blosc2 .dsl_kernel
5410+ def kernel_ramp (start , step ):
5411+ return start + _global_linear_idx * step # noqa: F821 # DSL index/shape symbols resolved by miniexpr
5412+
54095413 if step is None : # not array-api compliant but for backwards compatibility
54105414 step = 1
54115415 if stop is None :
@@ -5430,14 +5434,18 @@ def arange_fill(inputs, output, offset):
54305434 # We already have the dtype and shape, so return immediately
54315435 return blosc2 .zeros (shape , dtype = dtype , ** kwargs )
54325436
5433- lshape = (math .prod (shape ),)
5434- lazyarr = blosc2 .lazyudf (arange_fill , (start , stop , step ), dtype = dtype , shape = lshape )
5437+ if False :
5438+ lshape = (math .prod (shape ),)
5439+ lazyarr = blosc2 .lazyudf (arange_fill , (start , stop , step ), dtype = dtype , shape = lshape )
54355440
5436- if len (shape ) == 1 :
5437- # C order is guaranteed, and no reshape is needed
5438- return lazyarr .compute (** kwargs )
5441+ if len (shape ) == 1 :
5442+ # C order is guaranteed, and no reshape is needed
5443+ return lazyarr .compute (** kwargs )
54395444
5440- return reshape (lazyarr , shape , c_order = c_order , ** kwargs )
5445+ return reshape (lazyarr , shape , c_order = c_order , ** kwargs )
5446+ else :
5447+ lazyarr = blosc2 .lazyudf (kernel_ramp , (start , step ), dtype = dtype , shape = shape )
5448+ return lazyarr .compute (** kwargs )
54415449
54425450
54435451# Define a numpy linspace-like function
0 commit comments