From cda817faf97d33556d89d8b497e19bd00ac06644 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 07:02:09 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibotn/mps_contraction_helper.py | 2 +- src/qibotn/mps_utils.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/qibotn/mps_contraction_helper.py b/src/qibotn/mps_contraction_helper.py index a3dc32d..3cfdf60 100644 --- a/src/qibotn/mps_contraction_helper.py +++ b/src/qibotn/mps_contraction_helper.py @@ -7,7 +7,7 @@ class MPSContractionHelper: """A helper class to compute various quantities for a given MPS. Interleaved format is used to construct the input args for `cuquantum.contract`. - + Reference: https://github.com/NVIDIA/cuQuantum/blob/main/python/samples/cutensornet/tn_algorithms/mps_algorithms.ipynb The follwing compute quantities are supported: diff --git a/src/qibotn/mps_utils.py b/src/qibotn/mps_utils.py index 62c3f93..f37f1df 100644 --- a/src/qibotn/mps_utils.py +++ b/src/qibotn/mps_utils.py @@ -3,9 +3,8 @@ from cuquantum import contract from cuquantum.cutensornet.experimental import contract_decompose - def initial(num_qubits, dtype): - """Generate the MPS with an initial state of :math:`\ket{00...00}`""" + r"""Generate the MPS with an initial state of :math:`\ket{00...00}`""" state_tensor = cp.asarray([1, 0], dtype=dtype).reshape(1, 2, 1) mps_tensors = [state_tensor] * num_qubits return mps_tensors @@ -26,9 +25,9 @@ def mps_site_right_swap(mps_tensors, i, **kwargs): def apply_gate(mps_tensors, gate, qubits, **kwargs): """Apply the gate operand to the MPS tensors in-place. - + # Reference: https://github.com/NVIDIA/cuQuantum/blob/main/python/samples/cutensornet/tn_algorithms/mps_algorithms.ipynb - + Args: mps_tensors: A list of rank-3 ndarray-like tensor objects. The indices of the ith tensor are expected to be the bonding index to the i-1 tensor,