Add docstrings

This commit is contained in:
tankya2
2024-03-04 15:01:53 +08:00
parent 823e16d4b7
commit 8c164707b7
2 changed files with 6 additions and 18 deletions

View File

@@ -2,11 +2,10 @@ import cupy as cp
from cuquantum import contract
from cuquantum.cutensornet.experimental import contract_decompose
# Reference: https://github.com/NVIDIA/cuQuantum/blob/main/python/samples/cutensornet/tn_algorithms/mps_algorithms.ipynb
def initial(num_qubits, dtype):
r"""Generate the MPS with an initial state of :math:`\ket{00...00}`"""
"""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
@@ -27,7 +26,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,