@@ -229,6 +229,52 @@ def fun(*args, func_str=func_str, units=None, **kwargs):
229
229
230
230
setattr (mod , func_str , fun )
231
231
232
+ ## Manipulation Functions ##
233
+ # first_arg_arrays = {'broadcast_arrays', 'concat', 'stack', 'meshgrid'}
234
+ # output_arrays = {'broadcast_arrays', 'unstack', 'meshgrid'}
235
+
236
+ # def get_manip_fun(name):
237
+ # def manip_fun(x, *args, **kwargs):
238
+ # x = (asarray(x) if name not in first_arg_arrays
239
+ # else [asarray(xi) for xi in x])
240
+ # mask = (x.mask if name not in first_arg_arrays
241
+ # else [xi.mask for xi in x])
242
+ # data = (x.data if name not in first_arg_arrays
243
+ # else [xi.data for xi in x])
244
+
245
+ # fun = getattr(xp, name)
246
+
247
+ # if name == "repeat":
248
+ # args = list(args)
249
+ # repeats = args[0]
250
+ # if hasattr(repeats, 'mask') and xp.any(repeats.mask):
251
+ # message = (
252
+ # "Correct behavior when `repeats` is a masked array is "
253
+ # "ambiguous, and no convention is supported at this time.")
254
+ # raise NotImplementedError(message)
255
+ # elif hasattr(repeats, 'mask'):
256
+ # repeats = repeats.data
257
+ # args[0] = repeats
258
+
259
+ # if name in {'broadcast_arrays', 'meshgrid'}:
260
+ # res = fun(*data, *args, **kwargs)
261
+ # mask = fun(*mask, *args, **kwargs)
262
+ # else:
263
+ # res = fun(data, *args, **kwargs)
264
+ # mask = fun(mask, *args, **kwargs)
265
+
266
+ # out = (MArray(res, mask) if name not in output_arrays
267
+ # else tuple(MArray(resi, maski) for resi, maski in zip(res, mask)))
268
+ # return out
269
+ # return manip_fun
270
+
271
+ # creation_manip_functions = ['tril', 'triu', 'meshgrid']
272
+ # manip_names = ['broadcast_arrays', 'broadcast_to', 'concat', 'expand_dims',
273
+ # 'flip', 'moveaxis', 'permute_dims', 'repeat', 'reshape',
274
+ # 'roll', 'squeeze', 'stack', 'tile', 'unstack']
275
+ # for name in manip_names + creation_manip_functions:
276
+ # setattr(mod, name, get_manip_fun(name))
277
+
232
278
## Data Type Functions and Data Types ##
233
279
dtype_fun_names = ["can_cast" , "finfo" , "iinfo" , "isdtype" ]
234
280
dtype_names = [
0 commit comments