From 4ff52acf5ba16a275585a8174ec65cc5aee3cf40 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 1 Mar 2024 22:42:44 +0100 Subject: [PATCH] docs: Fix markup in docstrings --- src/qibotn/mps_contraction_helper.py | 17 +++++++++-------- src/qibotn/mps_utils.py | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/qibotn/mps_contraction_helper.py b/src/qibotn/mps_contraction_helper.py index 1c004de..e4d827a 100644 --- a/src/qibotn/mps_contraction_helper.py +++ b/src/qibotn/mps_contraction_helper.py @@ -7,15 +7,16 @@ 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`. - A concrete example on how the modes are populated for a 7-site MPS is provided below: + A concrete example on how the modes are populated for a 7-site MPS is provided + below:: - 0 2 4 6 8 10 12 14 - bra -----A-----B-----C-----D-----E-----F-----G----- - | | | | | | | - 1| 3| 5| 7| 9| 11| 13| - | | | | | | | - ket -----a-----b-----c-----d-----e-----f-----g----- - 15 16 17 18 19 20 21 22 + 0 2 4 6 8 10 12 14 + bra -----A-----B-----C-----D-----E-----F-----G----- + | | | | | | | + 1| 3| 5| 7| 9| 11| 13| + | | | | | | | + ket -----a-----b-----c-----d-----e-----f-----g----- + 15 16 17 18 19 20 21 22 The follwing compute quantities are supported: diff --git a/src/qibotn/mps_utils.py b/src/qibotn/mps_utils.py index e8068f7..f0fa811 100644 --- a/src/qibotn/mps_utils.py +++ b/src/qibotn/mps_utils.py @@ -6,7 +6,7 @@ from cuquantum.cutensornet.experimental import contract_decompose def initial(num_qubits, dtype): - """Generate the MPS with an initial state of |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 @@ -19,7 +19,7 @@ def mps_site_right_swap(mps_tensors, i, **kwargs): "ipj,jqk->iqj,jpk", *mps_tensors[i : i + 2], algorithm=kwargs.get("algorithm", None), - options=kwargs.get("options", None) + options=kwargs.get("options", None), ) mps_tensors[i : i + 2] = (a, b) return mps_tensors @@ -64,7 +64,7 @@ def apply_gate(mps_tensors, gate, qubits, **kwargs): *mps_tensors[i : i + 2], gate, algorithm=kwargs.get("algorithm", None), - options=kwargs.get("options", None) + options=kwargs.get("options", None), ) mps_tensors[i : i + 2] = (a, b) # in-place update else: