27
27
'assert_negative_mathematical_sign' , 'same_sign' ,
28
28
'assert_same_sign' , 'ndindex' , 'promote_dtypes' , 'float64' ,
29
29
'asarray' , 'is_integer_dtype' , 'is_float_dtype' , 'dtype_ranges' ,
30
- 'full' ]
30
+ 'full' , 'true' , 'false' ]
31
31
32
32
def zero (shape , dtype ):
33
33
"""
34
- Returns a scalar 0 of the given dtype.
34
+ Returns a full 0 array of the given dtype.
35
35
36
36
This should be used in place of the literal "0" in the test suite, as the
37
37
spec does not require any behavior with Python literals (and in
@@ -45,7 +45,7 @@ def zero(shape, dtype):
45
45
46
46
def one (shape , dtype ):
47
47
"""
48
- Returns a scalar 1 of the given dtype.
48
+ Returns a full 1 array of the given dtype.
49
49
50
50
This should be used in place of the literal "1" in the test suite, as the
51
51
spec does not require any behavior with Python literals (and in
@@ -58,7 +58,7 @@ def one(shape, dtype):
58
58
59
59
def NaN (shape , dtype ):
60
60
"""
61
- Returns a scalar nan of the given dtype.
61
+ Returns a full nan array of the given dtype.
62
62
63
63
Note that this is only defined for floating point dtypes.
64
64
"""
@@ -68,7 +68,7 @@ def NaN(shape, dtype):
68
68
69
69
def infinity (shape , dtype ):
70
70
"""
71
- Returns a scalar positive infinity of the given dtype.
71
+ Returns a full positive infinity array of the given dtype.
72
72
73
73
Note that this is only defined for floating point dtypes.
74
74
@@ -81,7 +81,7 @@ def infinity(shape, dtype):
81
81
82
82
def π (shape , dtype ):
83
83
"""
84
- Returns a scalar π .
84
+ Returns a full π array of the given dtype .
85
85
86
86
Note that this function is only defined for floating point dtype.
87
87
@@ -92,6 +92,18 @@ def π(shape, dtype):
92
92
raise RuntimeError (f"Unexpected dtype { dtype } in π()." )
93
93
return full (shape , pi , dtype = dtype )
94
94
95
+ def true (shape ):
96
+ """
97
+ Returns a full True array with dtype=bool.
98
+ """
99
+ return full (shape , True , dtype = bool )
100
+
101
+ def false (shape ):
102
+ """
103
+ Returns a full False array with dtype=bool.
104
+ """
105
+ return full (shape , False , dtype = bool )
106
+
95
107
def isnegzero (x ):
96
108
"""
97
109
Returns a mask where x is -0.
0 commit comments