Lines Matching refs:np

7     import numpy as np
11 assert np.isclose(m.vectorized_func3(np.array(3 + 7j)), [6 + 14j])
15 assert np.isclose(f(1, 2, 3), 6)
18 assert np.isclose(f(np.array(1), np.array(2), 3), 6)
21 assert np.allclose(f(np.array([1, 3]), np.array([2, 4]), 3), [6, 36])
27 a = np.array([[1, 2], [3, 4]], order='F')
28 b = np.array([[10, 20], [30, 40]], order='F')
31 assert np.allclose(result, a * b * c)
41 a, b, c = np.array([[1, 3, 5], [7, 9, 11]]), np.array([[2, 4, 6], [8, 10, 12]]), 3
42 assert np.allclose(f(a, b, c), a * b * c)
52 a, b, c = np.array([[1, 2, 3], [4, 5, 6]]), np.array([2, 3, 4]), 2
53 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]]), 2
64 assert np.allclose(f(a, b, c), a * b * c)
74 a, b, c = np.array([[1, 2, 3], [4, 5, 6]], order='F'), np.array([[2], [3]]), 2
75 assert np.allclose(f(a, b, c), a * b * c)
85 a, b, c = np.array([[1, 2, 3], [4, 5, 6]])[::, ::2], np.array([[2], [3]]), 2
86 assert np.allclose(f(a, b, c), a * b * c)
94 a, b, c = np.array([[1, 2, 3], [4, 5, 6]], order='F')[::, ::2], np.array([[2], [3]]), 2
95 assert np.allclose(f(a, b, c), a * b * c)
105 assert m.selective_func(np.array([1], dtype=np.int32)) == "Int branch taken."
106 assert m.selective_func(np.array([1.0], dtype=np.float32)) == "Float branch taken."
107 assert m.selective_func(np.array([1.0j], dtype=np.complex64)) == "Complex float branch taken."
120 assert vectorized_is_trivial(np.array(1), np.array(2), 3) == trivial.c_trivial
121 assert vectorized_is_trivial(np.array([1, 3]), np.array([2, 4]), 3) == trivial.c_trivial
123 np.array([[1, 3, 5], [7, 9, 11]]), np.array([[2, 4, 6], [8, 10, 12]]), 3)
125 np.array([[1, 2, 3], [4, 5, 6]]), np.array([2, 3, 4]), 2) == trivial.non_trivial
127 np.array([[1, 2, 3], [4, 5, 6]]), np.array([[2], [3]]), 2) == trivial.non_trivial
128 z1 = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype='int32')
129 z2 = np.array(z1, dtype='float32')
130 z3 = np.array(z1, dtype='float64')
140 y1 = np.array(z1, order='F')
141 y2 = np.array(y1)
142 y3 = np.array(y1)
170 b = np.array([[10, 20, 30]], dtype='float64')
171 c = np.array([100, 200]) # NOT a vectorized argument
172 d = np.array([[1000], [2000], [3000]], dtype='int')
173 g = np.array([[1000000, 2000000, 3000000]], dtype='int') # requires casting
174 assert np.all(
176 np.array([[1111111, 2111121, 3111131],
183 x = np.array([1, 2], dtype='int')
184 y = np.array([[10], [20]], dtype='float32')
185 assert np.all(o.method(x, y) == [[14, 15], [24, 25]])
189 assert not isinstance(m.vectorized_func(1, 2, 3), np.ndarray)
190 assert not isinstance(m.vectorized_func(np.array(1), 2, 3), np.ndarray)
192 assert isinstance(z, np.ndarray)
195 assert isinstance(z, np.ndarray)