MCPcopy Create free account
hub / github.com/pydata/numexpr / test_broadcasting_with_strides

Method test_broadcasting_with_strides

numexpr3/tests/test_numexpr.py:174–186  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

172 npt.assert_array_almost_equal( out, a-b )
173
174 def test_broadcasting_with_strides(self):
175 logger.info( 'Test broadcasting with strides' )
176 a = np.arange(100).reshape(10,10)[::2]
177 c = np.arange(10)
178 d = np.arange(5).reshape(5,1)
179 # Test with just arrays
180 neObj1 = ne3.NumExpr('a + c')
181 npt.assert_array_equal( neObj1(), a + c )
182 neObj2 = ne3.NumExpr('a + d')
183 npt.assert_array_equal( neObj2(), a + d )
184 # And with scalars
185 neObj3 = ne3.NumExpr( '2*a + 3*c' )
186 npt.assert_array_equal( neObj3(), 2*a + 3*c )
187
188 def test_all_scalar(self):
189 logger.info( 'Test all scalar: DEBUG' )

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected