Toolbox for converting matrix product states to Qiskit quantum circuits.
Assuming you have a Quimb MatrixProductState
object, you can
extract the individual tensors as three-dimensional NumPy arrays using the snippet below.
mps_arrays = mps.arrays
You can now convert the list of tensors to a Qiskit QuantumCircuit
using the mps_to_circuit
interface function, specifying the shape as shape
).
For example, using the "exact" method [Shoen2006]:
qc = mps_to_circuit(mps_arrays, method="exact", shape="lrp")
Or using the "approximate" method [Ran2019]:
qc = mps_to_circuit(mps_arrays, method="approximate", shape="lrp", num_layers=3)
Assuming you have a TenPy MPS
object, you can extract the
individual tensors as three-dimensional NumPy arrays using the snippet below.
mps_arrays = [mps.get_B(i).to_ndarray() for i in range(L)]
You can now convert the list of tensors to a Qiskit QuantumCircuit
using the mps_to_circuit
interface function, specifying the shape as
For example, using the "exact" method [Shoen2006]:
qc = mps_to_circuit(mps_arrays, method="exact", shape="lpr")
Or using the "approximate" method [Ran2019]:
qc = mps_to_circuit(mps_arrays, method="approximate", shape="lpr", num_layers=3)
This package and all dependencies can be installed using uv.
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install 3.12
uv venv --python 3.12
uv python pin 3.12
uv pip install -e .
One can test the code using pytest .
uv run pytest
One can lint the code using the Ruff Linter.
uv run ruff check
One can format the code using the Ruff Formatter.
uv run ruff format
In order to both sort imports and format, call the Ruff linter and then the formatter:
uv run ruff check --select I --fix
uv run ruff format
All members of this project agree to adhere to the Qiskit Code of Conduct listed here.
This work was supported by the Hartree National Centre for Digital Innovation, a collaboration between the Science and Technology Facilities Council and IBM.