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]:

\[\sum_{d_{j,1}, d_{j,2}} A^{(j)}_{d_{j, 0}, d_{j, 1}, d_{j, 2}} \left( A^{(j)}_{d'_{j, 0}, d_{j, 1}, d_{j, 2}} \right)^* = \delta_{d_{j, 0}, d'_{j, 0}},\]

where \(d_{i,j}\) denotes the \(j\) dimension of the \(i\) tensor and \(\delta\) 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

import numpy as np

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^{(n-1)}]\) with shapes \(d_0, ..., d_{n-1}\), respectively. The first and last tensors have rank \(2\) while the intermediate tensors have rank \(3\).

The first tensor must have the shape \(d_0 = (d_{0,0}, d_{0,1})\) where \(d_{0,0}\) and \(d_{0,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 \(d_{n-1} = (d_{n-1,0}, d_{n-1,1})\) where \(d_{n-1,0}\) and \(d_{n-1,1}\) represent the auxiliary dimension from the previous site and the physical dimension of the site, respectively.

The intermediate tensors must have the shape \(d_j = (d_{j,0}, d_{j,1}, d_{j,2})\), where:

  • \(d_{j,0}\) is the bond dimension connecting to the previous tensor

  • \(d_{j,1}\) is the physical dimension of the site

  • \(d_{j,2}\) is the bond dimension connecting to the next tensor

Note that the bond dimensions must match between adjacent tensors such that \(d_{j-1,2} = d_{j,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