def test_complex_dims(self): a = np.random.rand(4, 3, 2, 2, 4, 3) atr = qu.itrace(a, ((0, 1, 2), (4, 5, 3))) btr = np.trace( np.trace(np.trace(a, axis1=1, axis2=5), axis1=1, axis2=2)) assert_allclose(atr, btr)
def test_axes_types(self, axes): a = qu.rand_matrix(4) b = qu.itrace(a, axes) assert_allclose(b, np.trace(a))