From 014a39c006cfa50cbb9b3d0ce2b942e75c0ad414 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:49:20 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibotn/circuit_convertor.py | 10 +++++----- src/qibotn/eval.py | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/qibotn/circuit_convertor.py b/src/qibotn/circuit_convertor.py index f05eb499..441273e9 100644 --- a/src/qibotn/circuit_convertor.py +++ b/src/qibotn/circuit_convertor.py @@ -28,10 +28,10 @@ def __init__(self, circuit, dtype="complex128"): def state_vector_operands(self): """Create the operands for dense vector computation in the interleave format. - + Parameters: None - + Returns: Operands for the contraction in the interleave format. """ @@ -88,11 +88,11 @@ def _parse_gates_to_mode_labels_operands( return mode_labels, operands def op_shape_from_qubits(self, nqubits): - """Modify tensor to cuQuantum shape - + """Modify tensor to cuQuantum shape. + Parameters: nqubits (int): The number of qubits in quantum circuit. - + Returns: (qubit_states,input_output) * nqubits """ diff --git a/src/qibotn/eval.py b/src/qibotn/eval.py index 42d5ec85..245aa5ea 100644 --- a/src/qibotn/eval.py +++ b/src/qibotn/eval.py @@ -10,7 +10,7 @@ def dense_vector_tn(qibo_circ, datatype): """Convert qibo circuit to tensornet (TN) format and perform contraction to dense vector. - + Parameters: qibo_circ: The quantum circuit object. datatype (str): Either single ("complex64") or double (complex128) precision. @@ -25,12 +25,12 @@ def dense_vector_tn(qibo_circ, datatype): def expectation_pauli_tn(qibo_circ, datatype, pauli_string_pattern): """Convert qibo circuit to tensornet (TN) format and perform contraction to expectation of given Pauli string. - + Parameters: qibo_circ: The quantum circuit object. datatype (str): Either single ("complex64") or double (complex128) precision. pauli_string_pattern(str): pauli string pattern. - + Returns: Expectation of quantum circuit due to pauli string. """ @@ -52,12 +52,12 @@ def dense_vector_tn_MPI(qibo_circ, datatype, n_samples=8): the least costly contraction path. This is sped up with multi thread. After pathfinding the optimal path is used in the actual contraction to give a dense vector representation of the TN. - + Parameters: qibo_circ: The quantum circuit object. datatype (str): Either single ("complex64") or double (complex128) precision. n_samples(int): Number of samples for pathfinding. - + Returns: Dense vector of quantum circuit. """ @@ -127,12 +127,12 @@ def dense_vector_tn_nccl(qibo_circ, datatype, n_samples=8): the least costly contraction path. This is sped up with multi thread. After pathfinding the optimal path is used in the actual contraction to give a dense vector representation of the TN. - + Parameters: qibo_circ: The quantum circuit object. datatype (str): Either single ("complex64") or double (complex128) precision. n_samples(int): Number of samples for pathfinding. - + Returns: Dense vector of quantum circuit. """ @@ -216,13 +216,13 @@ def expectation_pauli_tn_nccl(qibo_circ, datatype, pauli_string_pattern, n_sampl select the least costly contraction path. This is sped up with multi thread. After pathfinding the optimal path is used in the actual contraction to give an expectation value. - + Parameters: qibo_circ: The quantum circuit object. datatype (str): Either single ("complex64") or double (complex128) precision. pauli_string_pattern(str): pauli string pattern. n_samples(int): Number of samples for pathfinding. - + Returns: Expectation of quantum circuit due to pauli string. """ @@ -308,13 +308,13 @@ def expectation_pauli_tn_MPI(qibo_circ, datatype, pauli_string_pattern, n_sample select the least costly contraction path. This is sped up with multi thread. After pathfinding the optimal path is used in the actual contraction to give an expectation value. - + Parameters: qibo_circ: The quantum circuit object. datatype (str): Either single ("complex64") or double (complex128) precision. pauli_string_pattern(str): pauli string pattern. n_samples(int): Number of samples for pathfinding. - + Returns: Expectation of quantum circuit due to pauli string. """ @@ -378,12 +378,12 @@ def expectation_pauli_tn_MPI(qibo_circ, datatype, pauli_string_pattern, n_sample def dense_vector_mps(qibo_circ, gate_algo, datatype): """Convert qibo circuit to matrix product state (MPS) format and perform contraction to dense vector. - + Parameters: qibo_circ: The quantum circuit object. gate_algo(dict): Dictionary for SVD and QR settings. datatype (str): Either single ("complex64") or double (complex128) precision. - + Returns: Dense vector of quantum circuit. """ @@ -402,10 +402,10 @@ def pauli_string_gen(nqubits, pauli_string_pattern): Parameters: nqubits(int): Number of qubits of Quantum Circuit pauli_string_pattern(str): Strings representing sequence of pauli gates. - + Returns: String representation of the actual pauli string from the pattern. - + Example: pattern: "XZ", number of qubit: 7, output = XZXZXZX """ if nqubits <= 0: