def test_innerwt(self): a = np.arange(6).reshape((2, 3)) b = np.arange(10, 16).reshape((2, 3)) w = np.arange(20, 26).reshape((2, 3)) assert_array_equal(umt.innerwt(a, b, w), np.sum(a * b * w, axis=-1)) a = np.arange(100, 124).reshape((2, 3, 4)) b = np.arange(200, 224).reshape((2, 3, 4)) w = np.arange(300, 324).reshape((2, 3, 4)) assert_array_equal(umt.innerwt(a, b, w), np.sum(a * b * w, axis=-1))
def test_innerwt(self): a = np.arange(6).reshape((2, 3)) b = np.arange(10, 16).reshape((2, 3)) w = np.arange(20, 26).reshape((2, 3)) assert_array_equal(umt.innerwt(a, b, w), np.sum(a*b*w, axis=-1)) a = np.arange(100, 124).reshape((2, 3, 4)) b = np.arange(200, 224).reshape((2, 3, 4)) w = np.arange(300, 324).reshape((2, 3, 4)) assert_array_equal(umt.innerwt(a, b, w), np.sum(a*b*w, axis=-1))
def check_innerwt_t( self, tp ): a = np.arange(6, dtype=tp).reshape((2,3)) b = np.arange(10,16, dtype=tp).reshape((2,3)) w = np.arange(20,26, dtype=tp).reshape((2,3)) assert_array_equal(umt.innerwt(a,b,w), np.sum(a*b*w,axis=-1)) a = np.arange(100,124, dtype=tp).reshape((2,3,4)) b = np.arange(200,224, dtype=tp).reshape((2,3,4)) w = np.arange(300,324, dtype=tp).reshape((2,3,4)) assert_array_equal(umt.innerwt(a,b,w), np.sum(a*b*w,axis=-1))
def check_innerwt_t(self, tp): a = np.arange(6, dtype=tp).reshape((2, 3)) b = np.arange(10, 16, dtype=tp).reshape((2, 3)) w = np.arange(20, 26, dtype=tp).reshape((2, 3)) assert_array_equal(umt.innerwt(a, b, w), np.sum(a * b * w, axis=-1)) a = np.arange(100, 124, dtype=tp).reshape((2, 3, 4)) b = np.arange(200, 224, dtype=tp).reshape((2, 3, 4)) w = np.arange(300, 324, dtype=tp).reshape((2, 3, 4)) assert_array_equal(umt.innerwt(a, b, w), np.sum(a * b * w, axis=-1))
def test_innerwt_empty(self): """Test generalized ufunc with zero-sized operands""" a = np.array([], dtype='f8') b = np.array([], dtype='f8') w = np.array([], dtype='f8') assert_array_equal(umt.innerwt(a, b, w), np.sum(a * b * w, axis=-1))
def test_innerwt_empty(self): """Test generalized ufunc with zero-sized operands""" a = np.array([], dtype='f8') b = np.array([], dtype='f8') w = np.array([], dtype='f8') assert_array_equal(umt.innerwt(a, b, w), np.sum(a*b*w, axis=-1))