Loading [MathJax]/jax/output/HTML-CSS/jax.js

qml.right_canonicalize_mps

right_canonicalize_mps(mps)[source]

Transform a matrix product state (MPS) into its right-canonical form.

A right-canonicalized MPS is a matrix product state in which the constituent tensors, A(j), satisfy the following orthonormality condition [Eq. (21) of arXiv:2310.18410]:

dj,1,dj,2A(j)dj,0,dj,1,dj,2(A(j)dj,0,dj,1,dj,2)=δdj,0,dj,0,

where di,j denotes the j dimension of the i tensor and δ is the Kronecker delta.

Parameters

mps (list[TensorLike]) – List of tensors representing the MPS.

Returns

List of tensors representing the MPS in right-canonical form with the same dimensions as the initial MPS.

See also

MPSPrep.

Example

n_sites = 4

mps = ([np.ones((2, 4))] +
       [np.ones((4, 2, 4)) for _ in range(1, n_sites - 1)] +
       [np.ones((4, 2))])

mps_rc = qml.right_canonicalize_mps(mps)

# Check that the right-canonical definition is fulfilled
for i in range(1, n_sites - 1):
    tensor = mps_rc[i]
    contraction_matrix = np.tensordot(tensor, tensor.conj(), axes=([1, 2], [1, 2]))
    assert np.allclose(contraction_matrix, np.eye(tensor.shape[0]))

The input MPS must be a list of n tensors [A(0),...,A(n1)] with shapes d0,...,dn1, respectively. The first and last tensors have rank 2 while the intermediate tensors have rank 3.

The first tensor must have the shape d0=(d0,0,d0,1) where d0,0 and d0,1 correspond to the physical dimension of the site and an auxiliary bond dimension connecting it to the next tensor, respectively.

The last tensor must have the shape dn1=(dn1,0,dn1,1) where dn1,0 and dn1,1 represent the auxiliary dimension from the previous site and the physical dimension of the site, respectively.

The intermediate tensors must have the shape dj=(dj,0,dj,1,dj,2), where:

  • dj,0 is the bond dimension connecting to the previous tensor

  • dj,1 is the physical dimension for the site

  • dj,2 is the bond dimension connecting to the next tensor

Note that the bond dimensions must match between adjacent tensors such that dj1,2=dj,0.

Additionally, the physical dimension of the site should always be fixed at 2 (since the dimension of a qubit is 2), while the other dimensions must be powers of two.

The following example shows a valid MPS input containing four tensors with dimensions [(2,2),(2,2,4),(4,2,2),(2,2)] which satisfy the criteria described above.

mps = [
    np.array([[0.0, 0.107], [0.994, 0.0]]),
    np.array(
        [
            [[0.0, 0.0, 0.0, -0.0], [1.0, 0.0, 0.0, -0.0]],
            [[0.0, 1.0, 0.0, -0.0], [0.0, 0.0, 0.0, -0.0]],
        ]
    ),
    np.array(
        [
            [[-1.0, 0.0], [0.0, 0.0]],
            [[0.0, 0.0], [0.0, 1.0]],
            [[0.0, -1.0], [0.0, 0.0]],
            [[0.0, 0.0], [1.0, 0.0]],
        ]
    ),
    np.array([[-1.0, -0.0], [-0.0, -1.0]]),
]

Contents

Using PennyLane

Release news

Development

API

Internals