def test_TMeigs_pm_float(direction): D, d, dtype = 10, 2, tf.float64 tensors = [tf.random_uniform(shape=[D, d, D], dtype=dtype)] eta, x, _, _ = misc_mps.TMeigs_power_method( tensors=tensors, direction=direction) out = misc_mps.transfer_op(tensors, tensors, direction, x) np.testing.assert_allclose(out, eta * x)
def test_TMeigs_complex(direction): D, d, dtype = 10, 2, tf.float64 tensors = [ tf.complex(tf.random_uniform(shape=[D, d, D], dtype=dtype), tf.random_uniform(shape=[D, d, D], dtype=dtype)) ] eta, x = misc_mps.TMeigs(tensors=tensors, direction=direction) out = misc_mps.transfer_op(tensors, tensors, direction, x) np.testing.assert_allclose(out, eta * x)