[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2024-03-04 07:49:20 +00:00
parent 07f433f24e
commit 014a39c006
2 changed files with 20 additions and 20 deletions

View File

@@ -28,10 +28,10 @@ class QiboCircuitToEinsum:
def state_vector_operands(self): def state_vector_operands(self):
"""Create the operands for dense vector computation in the interleave """Create the operands for dense vector computation in the interleave
format. format.
Parameters: Parameters:
None None
Returns: Returns:
Operands for the contraction in the interleave format. Operands for the contraction in the interleave format.
""" """
@@ -88,11 +88,11 @@ class QiboCircuitToEinsum:
return mode_labels, operands return mode_labels, operands
def op_shape_from_qubits(self, nqubits): def op_shape_from_qubits(self, nqubits):
"""Modify tensor to cuQuantum shape """Modify tensor to cuQuantum shape.
Parameters: Parameters:
nqubits (int): The number of qubits in quantum circuit. nqubits (int): The number of qubits in quantum circuit.
Returns: Returns:
(qubit_states,input_output) * nqubits (qubit_states,input_output) * nqubits
""" """

View File

@@ -10,7 +10,7 @@ from qibotn.mps_contraction_helper import MPSContractionHelper
def dense_vector_tn(qibo_circ, datatype): def dense_vector_tn(qibo_circ, datatype):
"""Convert qibo circuit to tensornet (TN) format and perform contraction to """Convert qibo circuit to tensornet (TN) format and perform contraction to
dense vector. dense vector.
Parameters: Parameters:
qibo_circ: The quantum circuit object. qibo_circ: The quantum circuit object.
datatype (str): Either single ("complex64") or double (complex128) precision. 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): def expectation_pauli_tn(qibo_circ, datatype, pauli_string_pattern):
"""Convert qibo circuit to tensornet (TN) format and perform contraction to """Convert qibo circuit to tensornet (TN) format and perform contraction to
expectation of given Pauli string. expectation of given Pauli string.
Parameters: Parameters:
qibo_circ: The quantum circuit object. qibo_circ: The quantum circuit object.
datatype (str): Either single ("complex64") or double (complex128) precision. datatype (str): Either single ("complex64") or double (complex128) precision.
pauli_string_pattern(str): pauli string pattern. pauli_string_pattern(str): pauli string pattern.
Returns: Returns:
Expectation of quantum circuit due to pauli string. 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 the least costly contraction path. This is sped up with multi
thread. After pathfinding the optimal path is used in the actual thread. After pathfinding the optimal path is used in the actual
contraction to give a dense vector representation of the TN. contraction to give a dense vector representation of the TN.
Parameters: Parameters:
qibo_circ: The quantum circuit object. qibo_circ: The quantum circuit object.
datatype (str): Either single ("complex64") or double (complex128) precision. datatype (str): Either single ("complex64") or double (complex128) precision.
n_samples(int): Number of samples for pathfinding. n_samples(int): Number of samples for pathfinding.
Returns: Returns:
Dense vector of quantum circuit. 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 the least costly contraction path. This is sped up with multi
thread. After pathfinding the optimal path is used in the actual thread. After pathfinding the optimal path is used in the actual
contraction to give a dense vector representation of the TN. contraction to give a dense vector representation of the TN.
Parameters: Parameters:
qibo_circ: The quantum circuit object. qibo_circ: The quantum circuit object.
datatype (str): Either single ("complex64") or double (complex128) precision. datatype (str): Either single ("complex64") or double (complex128) precision.
n_samples(int): Number of samples for pathfinding. n_samples(int): Number of samples for pathfinding.
Returns: Returns:
Dense vector of quantum circuit. 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 select the least costly contraction path. This is sped up with multi
thread. After pathfinding the optimal path is used in the actual thread. After pathfinding the optimal path is used in the actual
contraction to give an expectation value. contraction to give an expectation value.
Parameters: Parameters:
qibo_circ: The quantum circuit object. qibo_circ: The quantum circuit object.
datatype (str): Either single ("complex64") or double (complex128) precision. datatype (str): Either single ("complex64") or double (complex128) precision.
pauli_string_pattern(str): pauli string pattern. pauli_string_pattern(str): pauli string pattern.
n_samples(int): Number of samples for pathfinding. n_samples(int): Number of samples for pathfinding.
Returns: Returns:
Expectation of quantum circuit due to pauli string. 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 select the least costly contraction path. This is sped up with multi
thread. After pathfinding the optimal path is used in the actual thread. After pathfinding the optimal path is used in the actual
contraction to give an expectation value. contraction to give an expectation value.
Parameters: Parameters:
qibo_circ: The quantum circuit object. qibo_circ: The quantum circuit object.
datatype (str): Either single ("complex64") or double (complex128) precision. datatype (str): Either single ("complex64") or double (complex128) precision.
pauli_string_pattern(str): pauli string pattern. pauli_string_pattern(str): pauli string pattern.
n_samples(int): Number of samples for pathfinding. n_samples(int): Number of samples for pathfinding.
Returns: Returns:
Expectation of quantum circuit due to pauli string. 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): def dense_vector_mps(qibo_circ, gate_algo, datatype):
"""Convert qibo circuit to matrix product state (MPS) format and perform """Convert qibo circuit to matrix product state (MPS) format and perform
contraction to dense vector. contraction to dense vector.
Parameters: Parameters:
qibo_circ: The quantum circuit object. qibo_circ: The quantum circuit object.
gate_algo(dict): Dictionary for SVD and QR settings. gate_algo(dict): Dictionary for SVD and QR settings.
datatype (str): Either single ("complex64") or double (complex128) precision. datatype (str): Either single ("complex64") or double (complex128) precision.
Returns: Returns:
Dense vector of quantum circuit. Dense vector of quantum circuit.
""" """
@@ -402,10 +402,10 @@ def pauli_string_gen(nqubits, pauli_string_pattern):
Parameters: Parameters:
nqubits(int): Number of qubits of Quantum Circuit nqubits(int): Number of qubits of Quantum Circuit
pauli_string_pattern(str): Strings representing sequence of pauli gates. pauli_string_pattern(str): Strings representing sequence of pauli gates.
Returns: Returns:
String representation of the actual pauli string from the pattern. String representation of the actual pauli string from the pattern.
Example: pattern: "XZ", number of qubit: 7, output = XZXZXZX Example: pattern: "XZ", number of qubit: 7, output = XZXZXZX
""" """
if nqubits <= 0: if nqubits <= 0: