Lines Matching refs:np
5 np = pytest.importorskip("numpy") variable
9 assert np.isclose(m.vectorized_func3(np.array(3 + 7j)), [6 + 14j])
13 assert np.isclose(f(1, 2, 3), 6)
16 assert np.isclose(f(np.array(1), np.array(2), 3), 6)
19 assert np.allclose(f(np.array([1, 3]), np.array([2, 4]), 3), [6, 36])
28 a = np.array([[1, 2], [3, 4]], order="F")
29 b = np.array([[10, 20], [30, 40]], order="F")
32 assert np.allclose(result, a * b * c)
46 np.array([[1, 3, 5], [7, 9, 11]]),
47 np.array([[2, 4, 6], [8, 10, 12]]),
50 assert np.allclose(f(a, b, c), a * b * c)
63 a, b, c = np.array([[1, 2, 3], [4, 5, 6]]), np.array([2, 3, 4]), 2
64 assert np.allclose(f(a, b, c), a * b * c)
77 a, b, c = np.array([[1, 2, 3], [4, 5, 6]]), np.array([[2], [3]]), 2
78 assert np.allclose(f(a, b, c), a * b * c)
92 np.array([[1, 2, 3], [4, 5, 6]], order="F"),
93 np.array([[2], [3]]),
96 assert np.allclose(f(a, b, c), a * b * c)
109 a, b, c = np.array([[1, 2, 3], [4, 5, 6]])[::, ::2], np.array([[2], [3]]), 2
110 assert np.allclose(f(a, b, c), a * b * c)
122 np.array([[1, 2, 3], [4, 5, 6]], order="F")[::, ::2],
123 np.array([[2], [3]]),
126 assert np.allclose(f(a, b, c), a * b * c)
139 assert m.selective_func(np.array([1], dtype=np.int32)) == "Int branch taken."
140 assert m.selective_func(np.array([1.0], dtype=np.float32)) == "Float branch taken."
142 m.selective_func(np.array([1.0j], dtype=np.complex64))
160 assert vectorized_is_trivial(np.array(1), np.array(2), 3) == trivial.c_trivial
162 vectorized_is_trivial(np.array([1, 3]), np.array([2, 4]), 3)
166 np.array([[1, 3, 5], [7, 9, 11]]), np.array([[2, 4, 6], [8, 10, 12]]), 3
169 vectorized_is_trivial(np.array([[1, 2, 3], [4, 5, 6]]), np.array([2, 3, 4]), 2)
173 vectorized_is_trivial(np.array([[1, 2, 3], [4, 5, 6]]), np.array([[2], [3]]), 2)
176 z1 = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype="int32")
177 z2 = np.array(z1, dtype="float32")
178 z3 = np.array(z1, dtype="float64")
188 y1 = np.array(z1, order="F")
189 y2 = np.array(y1)
190 y3 = np.array(y1)
224 b = np.array([[10, 20, 30]], dtype="float64")
225 c = np.array([100, 200]) # NOT a vectorized argument
226 d = np.array([[1000], [2000], [3000]], dtype="int")
227 g = np.array([[1000000, 2000000, 3000000]], dtype="int") # requires casting
228 assert np.all(
230 == np.array(
242 x = np.array([1, 2], dtype="int")
243 y = np.array([[10], [20]], dtype="float32")
244 assert np.all(o.method(x, y) == [[14, 15], [24, 25]])
248 assert not isinstance(m.vectorized_func(1, 2, 3), np.ndarray)
249 assert not isinstance(m.vectorized_func(np.array(1), 2, 3), np.ndarray)
251 assert isinstance(z, np.ndarray)
254 assert isinstance(z, np.ndarray)