예제 #1
0
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)
예제 #2
0
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)