File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -1212,22 +1212,30 @@ def meshgrid(*arrays, indexing="xy"):
1212
1212
If vectors are not of the same data type,
1213
1213
or are not one-dimensional, raises `ValueError.`
1214
1214
indexing: Cartesian (`xy`) or matrix (`ij`) indexing of output.
1215
- For a set of `n` vectors with lengths X0, X1, X2 , ...
1215
+ For a set of `n` vectors with lengths N0, N1, N2 , ...
1216
1216
Cartesian indexing results in arrays of shape
1217
- (X1, X0, X2 , ...)
1217
+ (N1, N0, N2 , ...)
1218
1218
matrix indexing results in arrays of shape
1219
- (X0, X1, X2 , ...)
1219
+ (n0, N1, N2 , ...)
1220
1220
Default: `xy`.
1221
1221
"""
1222
+ ref_dt = None
1223
+ ref_unset = True
1222
1224
for array in arrays :
1223
1225
if not isinstance (array , dpt .usm_ndarray ):
1224
1226
raise TypeError (
1225
1227
f"Expected instance of dpt.usm_ndarray, got { type (array )} ."
1226
1228
)
1227
1229
if array .ndim != 1 :
1228
1230
raise ValueError ("All arrays must be one-dimensional." )
1229
- if len (set ([array .dtype for array in arrays ])) > 1 :
1230
- raise ValueError ("All arrays must be of the same numeric data type." )
1231
+ if ref_unset :
1232
+ ref_unset = False
1233
+ ref_dt = array .dtype
1234
+ else :
1235
+ if not ref_dt == array .dtype :
1236
+ raise ValueError (
1237
+ "All arrays must be of the same numeric data type."
1238
+ )
1231
1239
if indexing not in ["xy" , "ij" ]:
1232
1240
raise ValueError (
1233
1241
"Unrecognized indexing keyword value, expecting 'xy' or 'ij.'"
You can’t perform that action at this time.
0 commit comments