qiu_mps_initializer.mps
¶
Matrix product states (MPS) of bond dimension 2 and the layers of gates preparing them.
A state of bond dimension at most 2 is prepared exactly by one layer of gates: a
two-qubit gate on each pair of neighboring qubits, from the most significant qubit
down, followed by a single-qubit gate on the least significant one (Ran, "Encoding of
matrix product states into quantum circuits of one- and two-qubit gates", Phys. Rev. A
101, 032310, 2020). Site i of an MPS is the qubit n - 1 - i, i.e. the MPS lists the
qubits from the most significant one, as the amplitudes of a Qiskit statevector do.
Functions:
-
bond2_mps_approximation–Return the MPS of bond dimension at most 2 approximating a state of 2 qubits or more.
-
disentangler_matrices–Return the unitaries of the layer preparing an MPS of bond dimension at most 2.
-
mps_layer–Return the layer of gates preparing an MPS of bond dimension at most 2.
bond2_mps_approximation
¶
bond2_mps_approximation(state: Statevector | ArrayLike) -> MatrixProductState
Return the MPS of bond dimension at most 2 approximating a state of 2 qubits or more.
The MPS is truncated from the state by successive singular value decompositions, normalized, right-canonical, and has its indices in the order left, physical, right.
Parameters:
-
state(Statevector | ArrayLike) –The normalized state.
Returns:
-
MatrixProductState–The approximating MPS.
Raises:
-
ValueError–If the state is not a normalized state of 2 qubits or more.
Source code in packages/qiu-mps-initializer/src/qiu_mps_initializer/mps.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
disentangler_matrices
¶
disentangler_matrices(mps: MatrixProductState) -> list[NDArray[complex128]]
Return the unitaries of the layer preparing an MPS of bond dimension at most 2.
The unitaries complete the tensors of the right-canonical MPS to unitary matrices:
one 4 x 4 matrix per site but the last, acting on the qubits of the site and the
next one, and a 2 x 2 matrix for the last site.
Parameters:
-
mps(MatrixProductState) –A right-canonical MPS of 2 sites or more, of bond dimension at most 2, with its indices in the order left, physical, right, e.g. of
bond2_mps_approximation. It is expanded to bond dimension 2 in place.
Returns:
-
list[NDArray[complex128]]–The unitaries, from the first site to the last.
Raises:
-
ValueError–If the MPS has fewer than 2 sites, or if its bond dimension is larger than 2.
Source code in packages/qiu-mps-initializer/src/qiu_mps_initializer/mps.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
mps_layer
¶
mps_layer(mps: MatrixProductState) -> QuantumCircuit
Return the layer of gates preparing an MPS of bond dimension at most 2.
Parameters:
-
mps(MatrixProductState) –The MPS, see
disentangler_matrices.
Returns:
-
QuantumCircuit–The circuit
Uon one qubit per site withU|0...0>the state of the MPS.
Source code in packages/qiu-mps-initializer/src/qiu_mps_initializer/mps.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |