Skip to content

Commit d6975a1

Browse files
committed
Fixes to linspace and optimization of arange
1 parent 630d437 commit d6975a1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/blosc2/ndarray.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,11 +3810,14 @@ def linspace_fill(inputs, output, offset):
38103810
shape = (num,)
38113811
else:
38123812
num = math.prod(shape) if num is None else num
3813-
# check compatibility of shape and num
3814-
if math.prod(shape) != num:
3815-
raise ValueError("The specified shape is not consistent with the specified num value")
3816-
if num < 0:
3817-
raise ValueError("num must be nonnegative.")
3813+
3814+
# check compatibility of shape and num
3815+
if math.prod(shape) != num or num < 0:
3816+
raise ValueError(
3817+
f"Shape is not consistent with the specified num value {num}." + "num must be nonnegative."
3818+
if num < 0
3819+
else ""
3820+
)
38183821

38193822
if dtype is None:
38203823
dtype = (

0 commit comments

Comments
 (0)