pyqpanda.pyQPanda ================= .. py:module:: pyqpanda.pyQPanda Classes ------- .. autoapisummary:: pyqpanda.pyQPanda.AbstractOptimizer pyqpanda.pyQPanda.AdaGradOptimizer pyqpanda.pyQPanda.AdamOptimizer pyqpanda.pyQPanda.Ansatz pyqpanda.pyQPanda.AnsatzGate pyqpanda.pyQPanda.AnsatzGateType pyqpanda.pyQPanda.BackendType pyqpanda.pyQPanda.CBit pyqpanda.pyQPanda.CPUQVM pyqpanda.pyQPanda.CPUSingleThreadQVM pyqpanda.pyQPanda.ChipID pyqpanda.pyQPanda.ClassicalCondition pyqpanda.pyQPanda.ClassicalProg pyqpanda.pyQPanda.CommProtocolConfig pyqpanda.pyQPanda.ComplexVertexSplitMethod pyqpanda.pyQPanda.DAGNodeType pyqpanda.pyQPanda.DecompositionMode pyqpanda.pyQPanda.DensityMatrixSimulator pyqpanda.pyQPanda.DoubleGateTransferType pyqpanda.pyQPanda.Encode pyqpanda.pyQPanda.ErrorCode pyqpanda.pyQPanda.Fusion pyqpanda.pyQPanda.GateType pyqpanda.pyQPanda.HHLAlg pyqpanda.pyQPanda.LATEX_GATE_TYPE pyqpanda.pyQPanda.LatexMatrix pyqpanda.pyQPanda.MPSQVM pyqpanda.pyQPanda.MomentumOptimizer pyqpanda.pyQPanda.NodeInfo pyqpanda.pyQPanda.NodeIter pyqpanda.pyQPanda.NodeType pyqpanda.pyQPanda.Noise pyqpanda.pyQPanda.NoiseModel pyqpanda.pyQPanda.NoiseQVM pyqpanda.pyQPanda.Optimizer pyqpanda.pyQPanda.OptimizerFactory pyqpanda.pyQPanda.OptimizerMode pyqpanda.pyQPanda.OptimizerType pyqpanda.pyQPanda.OriginCMem pyqpanda.pyQPanda.OriginCollection pyqpanda.pyQPanda.OriginQubitPool pyqpanda.pyQPanda.PartialAmpQVM pyqpanda.pyQPanda.PhysicalQubit pyqpanda.pyQPanda.PilotNoiseParams pyqpanda.pyQPanda.ProgCount pyqpanda.pyQPanda.QCircuit pyqpanda.pyQPanda.QCircuitOPtimizerMode pyqpanda.pyQPanda.QError pyqpanda.pyQPanda.QGate pyqpanda.pyQPanda.QITE pyqpanda.pyQPanda.QIfProg pyqpanda.pyQPanda.QMachineType pyqpanda.pyQPanda.QMeasure pyqpanda.pyQPanda.QOperator pyqpanda.pyQPanda.QOptimizationResult pyqpanda.pyQPanda.QPilotOSService pyqpanda.pyQPanda.QProg pyqpanda.pyQPanda.QProgDAG pyqpanda.pyQPanda.QProgDAGEdge pyqpanda.pyQPanda.QProgDAGVertex pyqpanda.pyQPanda.QReset pyqpanda.pyQPanda.QResult pyqpanda.pyQPanda.QVec pyqpanda.pyQPanda.QWhileProg pyqpanda.pyQPanda.QuantumMachine pyqpanda.pyQPanda.QuantumStateTomography pyqpanda.pyQPanda.Qubit pyqpanda.pyQPanda.RMSPropOptimizer pyqpanda.pyQPanda.SingleAmpQVM pyqpanda.pyQPanda.SingleGateTransferType pyqpanda.pyQPanda.SparseQVM pyqpanda.pyQPanda.Stabilizer pyqpanda.pyQPanda.UpdateMode pyqpanda.pyQPanda.VanillaGradientDescentOptimizer pyqpanda.pyQPanda.VariationalQuantumCircuit pyqpanda.pyQPanda.VariationalQuantumGate pyqpanda.pyQPanda.VariationalQuantumGate_CNOT pyqpanda.pyQPanda.VariationalQuantumGate_CR pyqpanda.pyQPanda.VariationalQuantumGate_CRX pyqpanda.pyQPanda.VariationalQuantumGate_CRY pyqpanda.pyQPanda.VariationalQuantumGate_CRZ pyqpanda.pyQPanda.VariationalQuantumGate_CU pyqpanda.pyQPanda.VariationalQuantumGate_CZ pyqpanda.pyQPanda.VariationalQuantumGate_H pyqpanda.pyQPanda.VariationalQuantumGate_I pyqpanda.pyQPanda.VariationalQuantumGate_RX pyqpanda.pyQPanda.VariationalQuantumGate_RY pyqpanda.pyQPanda.VariationalQuantumGate_RZ pyqpanda.pyQPanda.VariationalQuantumGate_S pyqpanda.pyQPanda.VariationalQuantumGate_SWAP pyqpanda.pyQPanda.VariationalQuantumGate_SqiSWAP pyqpanda.pyQPanda.VariationalQuantumGate_T pyqpanda.pyQPanda.VariationalQuantumGate_U1 pyqpanda.pyQPanda.VariationalQuantumGate_U2 pyqpanda.pyQPanda.VariationalQuantumGate_U3 pyqpanda.pyQPanda.VariationalQuantumGate_U4 pyqpanda.pyQPanda.VariationalQuantumGate_X pyqpanda.pyQPanda.VariationalQuantumGate_X1 pyqpanda.pyQPanda.VariationalQuantumGate_Y pyqpanda.pyQPanda.VariationalQuantumGate_Y1 pyqpanda.pyQPanda.VariationalQuantumGate_Z pyqpanda.pyQPanda.VariationalQuantumGate_Z1 pyqpanda.pyQPanda.VariationalQuantumGate_iSWAP pyqpanda.pyQPanda.em_method pyqpanda.pyQPanda.expression pyqpanda.pyQPanda.hadamard_circuit pyqpanda.pyQPanda.real_chip_type pyqpanda.pyQPanda.var Functions --------- .. autoapisummary:: pyqpanda.pyQPanda.BARRIER pyqpanda.pyQPanda.CNOT pyqpanda.pyQPanda.CP pyqpanda.pyQPanda.CR pyqpanda.pyQPanda.CU pyqpanda.pyQPanda.CZ pyqpanda.pyQPanda.CreateEmptyCircuit pyqpanda.pyQPanda.CreateEmptyQProg pyqpanda.pyQPanda.CreateIfProg pyqpanda.pyQPanda.CreateWhileProg pyqpanda.pyQPanda.Grover pyqpanda.pyQPanda.Grover_search pyqpanda.pyQPanda.H pyqpanda.pyQPanda.HHL_solve_linear_equations pyqpanda.pyQPanda.I pyqpanda.pyQPanda.MAJ pyqpanda.pyQPanda.MAJ2 pyqpanda.pyQPanda.MS pyqpanda.pyQPanda.Measure pyqpanda.pyQPanda.OBMT_mapping pyqpanda.pyQPanda.P pyqpanda.pyQPanda.PMeasure pyqpanda.pyQPanda.PMeasure_no_index pyqpanda.pyQPanda.QAdd pyqpanda.pyQPanda.QAdder pyqpanda.pyQPanda.QAdderIgnoreCarry pyqpanda.pyQPanda.QComplement pyqpanda.pyQPanda.QDiv pyqpanda.pyQPanda.QDivWithAccuracy pyqpanda.pyQPanda.QDivider pyqpanda.pyQPanda.QDividerWithAccuracy pyqpanda.pyQPanda.QDouble pyqpanda.pyQPanda.QFT pyqpanda.pyQPanda.QMul pyqpanda.pyQPanda.QMultiplier pyqpanda.pyQPanda.QOracle pyqpanda.pyQPanda.QPE pyqpanda.pyQPanda.QSub pyqpanda.pyQPanda.RX pyqpanda.pyQPanda.RXX pyqpanda.pyQPanda.RY pyqpanda.pyQPanda.RYY pyqpanda.pyQPanda.RZ pyqpanda.pyQPanda.RZX pyqpanda.pyQPanda.RZZ pyqpanda.pyQPanda.Reset pyqpanda.pyQPanda.S pyqpanda.pyQPanda.SWAP pyqpanda.pyQPanda.Shor_factorization pyqpanda.pyQPanda.SqiSWAP pyqpanda.pyQPanda.T pyqpanda.pyQPanda.Toffoli pyqpanda.pyQPanda.U1 pyqpanda.pyQPanda.U2 pyqpanda.pyQPanda.U3 pyqpanda.pyQPanda.U4 pyqpanda.pyQPanda.UMA pyqpanda.pyQPanda.VQG_CNOT_batch pyqpanda.pyQPanda.VQG_CU_batch pyqpanda.pyQPanda.VQG_CZ_batch pyqpanda.pyQPanda.VQG_H_batch pyqpanda.pyQPanda.VQG_I_batch pyqpanda.pyQPanda.VQG_SWAP_batch pyqpanda.pyQPanda.VQG_S_batch pyqpanda.pyQPanda.VQG_SqiSWAP_batch pyqpanda.pyQPanda.VQG_T_batch pyqpanda.pyQPanda.VQG_U1_batch pyqpanda.pyQPanda.VQG_U2_batch pyqpanda.pyQPanda.VQG_U3_batch pyqpanda.pyQPanda.VQG_U4_batch pyqpanda.pyQPanda.VQG_X1_batch pyqpanda.pyQPanda.VQG_X_batch pyqpanda.pyQPanda.VQG_Y1_batch pyqpanda.pyQPanda.VQG_Y_batch pyqpanda.pyQPanda.VQG_Z1_batch pyqpanda.pyQPanda.VQG_Z_batch pyqpanda.pyQPanda.VQG_iSWAP_batch pyqpanda.pyQPanda.X pyqpanda.pyQPanda.X1 pyqpanda.pyQPanda.Y pyqpanda.pyQPanda.Y1 pyqpanda.pyQPanda.Z pyqpanda.pyQPanda.Z1 pyqpanda.pyQPanda.accumulateProbability pyqpanda.pyQPanda.accumulate_probabilities pyqpanda.pyQPanda.accumulate_probability pyqpanda.pyQPanda.acos pyqpanda.pyQPanda.add pyqpanda.pyQPanda.all_cut_of_graph pyqpanda.pyQPanda.amplitude_encode pyqpanda.pyQPanda.apply_QGate pyqpanda.pyQPanda.asin pyqpanda.pyQPanda.assign pyqpanda.pyQPanda.atan pyqpanda.pyQPanda.average_gate_fidelity pyqpanda.pyQPanda.bin_to_prog pyqpanda.pyQPanda.bind_data pyqpanda.pyQPanda.bind_nonnegative_data pyqpanda.pyQPanda.build_HHL_circuit pyqpanda.pyQPanda.cAlloc pyqpanda.pyQPanda.cAlloc_many pyqpanda.pyQPanda.cFree pyqpanda.pyQPanda.cFree_all pyqpanda.pyQPanda.cast_qprog_qcircuit pyqpanda.pyQPanda.cast_qprog_qgate pyqpanda.pyQPanda.cast_qprog_qmeasure pyqpanda.pyQPanda.circuit_layer pyqpanda.pyQPanda.circuit_optimizer pyqpanda.pyQPanda.circuit_optimizer_by_config pyqpanda.pyQPanda.comm_protocol_decode pyqpanda.pyQPanda.comm_protocol_encode pyqpanda.pyQPanda.constModAdd pyqpanda.pyQPanda.constModExp pyqpanda.pyQPanda.constModMul pyqpanda.pyQPanda.convert_binary_data_to_qprog pyqpanda.pyQPanda.convert_originir_str_to_qprog pyqpanda.pyQPanda.convert_originir_to_qprog pyqpanda.pyQPanda.convert_qasm_string_to_qprog pyqpanda.pyQPanda.convert_qasm_to_qprog pyqpanda.pyQPanda.convert_qprog_to_binary pyqpanda.pyQPanda.convert_qprog_to_originir pyqpanda.pyQPanda.convert_qprog_to_qasm pyqpanda.pyQPanda.convert_qprog_to_quil pyqpanda.pyQPanda.cos pyqpanda.pyQPanda.count_gate pyqpanda.pyQPanda.count_prog_info pyqpanda.pyQPanda.count_qgate_num pyqpanda.pyQPanda.create_empty_circuit pyqpanda.pyQPanda.create_empty_qprog pyqpanda.pyQPanda.create_if_prog pyqpanda.pyQPanda.create_while_prog pyqpanda.pyQPanda.crossEntropy pyqpanda.pyQPanda.decompose_multiple_control_qgate pyqpanda.pyQPanda.deep_copy pyqpanda.pyQPanda.del_weak_edge pyqpanda.pyQPanda.del_weak_edge2 pyqpanda.pyQPanda.del_weak_edge3 pyqpanda.pyQPanda.destroy_quantum_machine pyqpanda.pyQPanda.directly_run pyqpanda.pyQPanda.div pyqpanda.pyQPanda.dot pyqpanda.pyQPanda.draw_qprog_latex pyqpanda.pyQPanda.draw_qprog_latex_with_clock pyqpanda.pyQPanda.draw_qprog_text pyqpanda.pyQPanda.draw_qprog_text_with_clock pyqpanda.pyQPanda.dropout pyqpanda.pyQPanda.equal pyqpanda.pyQPanda.estimate_topology pyqpanda.pyQPanda.eval pyqpanda.pyQPanda.exp pyqpanda.pyQPanda.expMat pyqpanda.pyQPanda.expand_linear_equations pyqpanda.pyQPanda.fill_qprog_by_I pyqpanda.pyQPanda.finalize pyqpanda.pyQPanda.fit_to_gbk pyqpanda.pyQPanda.flatten pyqpanda.pyQPanda.getAllocateCMem pyqpanda.pyQPanda.getAllocateQubitNum pyqpanda.pyQPanda.get_adjacent_qgate_type pyqpanda.pyQPanda.get_all_used_qubits pyqpanda.pyQPanda.get_all_used_qubits_to_int pyqpanda.pyQPanda.get_allocate_cbits pyqpanda.pyQPanda.get_allocate_cmem_num pyqpanda.pyQPanda.get_allocate_qubit_num pyqpanda.pyQPanda.get_allocate_qubits pyqpanda.pyQPanda.get_bin_data pyqpanda.pyQPanda.get_bin_str pyqpanda.pyQPanda.get_circuit_optimal_topology pyqpanda.pyQPanda.get_clock_cycle pyqpanda.pyQPanda.get_complex_points pyqpanda.pyQPanda.get_double_gate_block_topology pyqpanda.pyQPanda.get_matrix pyqpanda.pyQPanda.get_prob_dict pyqpanda.pyQPanda.get_prob_list pyqpanda.pyQPanda.get_qgate_num pyqpanda.pyQPanda.get_qprog_clock_cycle pyqpanda.pyQPanda.get_qstate pyqpanda.pyQPanda.get_sub_graph pyqpanda.pyQPanda.get_tuple_list pyqpanda.pyQPanda.get_unitary pyqpanda.pyQPanda.get_unsupport_qgate_num pyqpanda.pyQPanda.getstat pyqpanda.pyQPanda.iSWAP pyqpanda.pyQPanda.init pyqpanda.pyQPanda.init_quantum_machine pyqpanda.pyQPanda.inverse pyqpanda.pyQPanda.isCarry pyqpanda.pyQPanda.is_match_topology pyqpanda.pyQPanda.is_supported_qgate_type pyqpanda.pyQPanda.is_swappable pyqpanda.pyQPanda.iterative_amplitude_estimation pyqpanda.pyQPanda.ldd_decompose pyqpanda.pyQPanda.log pyqpanda.pyQPanda.matrix_decompose pyqpanda.pyQPanda.matrix_decompose_paulis pyqpanda.pyQPanda.measure_all pyqpanda.pyQPanda.mul pyqpanda.pyQPanda.originir_to_qprog pyqpanda.pyQPanda.pauli_combination_replace pyqpanda.pyQPanda.planarity_testing pyqpanda.pyQPanda.pmeasure pyqpanda.pyQPanda.pmeasure_no_index pyqpanda.pyQPanda.poly pyqpanda.pyQPanda.print_matrix pyqpanda.pyQPanda.prob_run_dict pyqpanda.pyQPanda.prob_run_list pyqpanda.pyQPanda.prob_run_tuple_list pyqpanda.pyQPanda.prog_layer pyqpanda.pyQPanda.prog_to_dag pyqpanda.pyQPanda.qAlloc pyqpanda.pyQPanda.qAlloc_many pyqpanda.pyQPanda.qFree pyqpanda.pyQPanda.qFree_all pyqpanda.pyQPanda.qop pyqpanda.pyQPanda.qop_pmeasure pyqpanda.pyQPanda.quantum_chip_adapter pyqpanda.pyQPanda.quantum_walk_alg pyqpanda.pyQPanda.quantum_walk_search pyqpanda.pyQPanda.quick_measure pyqpanda.pyQPanda.random_qcircuit pyqpanda.pyQPanda.random_qprog pyqpanda.pyQPanda.recover_edges pyqpanda.pyQPanda.remap pyqpanda.pyQPanda.replace_complex_points pyqpanda.pyQPanda.run_with_configuration pyqpanda.pyQPanda.sabre_mapping pyqpanda.pyQPanda.sigmoid pyqpanda.pyQPanda.sin pyqpanda.pyQPanda.softmax pyqpanda.pyQPanda.split_complex_points pyqpanda.pyQPanda.stack pyqpanda.pyQPanda.state_fidelity pyqpanda.pyQPanda.sub pyqpanda.pyQPanda.sum pyqpanda.pyQPanda.tan pyqpanda.pyQPanda.to_Quil pyqpanda.pyQPanda.to_originir pyqpanda.pyQPanda.topology_match pyqpanda.pyQPanda.transform_binary_data_to_qprog pyqpanda.pyQPanda.transform_originir_to_qprog pyqpanda.pyQPanda.transform_qprog_to_binary pyqpanda.pyQPanda.transform_qprog_to_originir pyqpanda.pyQPanda.transform_qprog_to_quil pyqpanda.pyQPanda.transform_to_base_qgate pyqpanda.pyQPanda.transfrom_pauli_operator_to_matrix pyqpanda.pyQPanda.transpose pyqpanda.pyQPanda.validate_double_qgate_type pyqpanda.pyQPanda.validate_single_qgate_type pyqpanda.pyQPanda.vector_dot pyqpanda.pyQPanda.virtual_z_transform Module Contents --------------- .. py:class:: AbstractOptimizer(*args, **kwargs) quantum AbstractOptimizer class .. py:method:: exec() -> None Execute the optimization process. Args: None: This method takes no parameters. Returns: result: The result of the optimization process. .. py:method:: getResult(*args, **kwargs) -> Any Retrieve the result of the last optimization. Args: None: This method takes no parameters. Returns: result: The result of the last optimization. .. py:method:: registerFunc(arg0: Callable[[List[float], List[float], int, int], Tuple[str, float]], arg1: List[float]) -> None Register an optimization function. Args: func: The optimization function to be registered. Returns: None .. py:method:: setAdaptive(arg0: bool) -> None Set whether the optimizer should use adaptive methods. Args: adaptive: A boolean indicating whether to enable adaptive optimization. Returns: None .. py:method:: setCacheFile(arg0: str) -> None Set the path for the cache file used in optimization. Args: cache_file: A string representing the path to the cache file. Returns: None .. py:method:: setDisp(arg0: bool) -> None Set the display flag for the optimizer. Args: disp: A boolean indicating whether to display optimization progress. Returns: None .. py:method:: setFatol(arg0: float) -> None Set the function absolute tolerance for optimization. Args: fatol: The function absolute tolerance value to be set. Returns: None .. py:method:: setMaxFCalls(arg0: int) -> None Set the maximum number of function calls allowed during optimization. Args: max_calls: The maximum number of function calls to be set. Returns: None .. py:method:: setMaxIter(arg0: int) -> None Set the maximum number of iterations allowed during optimization. Args: max_iter: The maximum number of iterations to be set. Returns: None .. py:method:: setRestoreFromCacheFile(arg0: bool) -> None Set whether to restore the optimization state from a cache file. Args: cache_file: A string representing the path to the cache file. Returns: None .. py:method:: setXatol(arg0: float) -> None Set the absolute tolerance for optimization. Args: atol: The absolute tolerance value to be set. Returns: None .. py:class:: AdaGradOptimizer(arg0: var, arg1: float, arg2: float, arg3: float) variational quantum AdaGradOptimizer .. py:method:: get_loss() -> float .. py:method:: get_variables() -> List[var] .. py:method:: minimize(arg0: float, arg1: float, arg2: float) -> Optimizer .. py:method:: run(arg0: List[var], arg1: int) -> bool .. py:class:: AdamOptimizer(arg0: var, arg1: float, arg2: float, arg3: float, arg4: float) variational quantum AdamOptimizer .. py:method:: get_loss() -> float .. py:method:: get_variables() -> List[var] .. py:method:: minimize(arg0: float, arg1: float, arg2: float, arg3: float) -> Optimizer .. py:method:: run(arg0: List[var], arg1: int) -> bool .. py:class:: Ansatz Ansatz(arg0: QGate) Ansatz(arg0: AnsatzGate) Ansatz(ansatz: List[AnsatzGate], thetas: List[float] = []) Ansatz(ansatz_circuit: Ansatz, thetas: List[float] = []) Ansatz(circuit: QCircuit, thetas: List[float] = []) quantum ansatz class .. py:method:: get_ansatz_list() -> List[AnsatzGate] .. py:method:: get_thetas_list() -> List[float] .. py:method:: insert(gate: QGate) -> None insert(gate: AnsatzGate) -> None insert(gate: List[AnsatzGate]) -> None insert(gate: QCircuit) -> None insert(gate: Ansatz, thetas: List[float] = []) -> None .. py:method:: set_thetas(thetas: List[float]) -> None .. py:class:: AnsatzGate(arg0: AnsatzGateType, arg1: int) AnsatzGate(arg0: AnsatzGateType, arg1: int, arg2: float) AnsatzGate(arg0: AnsatzGateType, arg1: int, arg2: float, arg3: int) ansatz gate struct .. py:attribute:: control :type: int .. py:attribute:: target :type: int .. py:attribute:: theta :type: float .. py:attribute:: type :type: AnsatzGateType .. py:class:: AnsatzGateType(value: int) Quantum ansatz gate type Members: AGT_X AGT_H AGT_RX AGT_RY AGT_RZ .. py:attribute:: AGT_H :type: ClassVar[AnsatzGateType] :value: Ellipsis .. py:attribute:: AGT_RX :type: ClassVar[AnsatzGateType] :value: Ellipsis .. py:attribute:: AGT_RY :type: ClassVar[AnsatzGateType] :value: Ellipsis .. py:attribute:: AGT_RZ :type: ClassVar[AnsatzGateType] :value: Ellipsis .. py:attribute:: AGT_X :type: ClassVar[AnsatzGateType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: BackendType(value: int) Quantum machine backend type Members: CPU GPU CPU_SINGLE_THREAD NOISE MPS .. py:attribute:: CPU :type: ClassVar[BackendType] :value: Ellipsis .. py:attribute:: CPU_SINGLE_THREAD :type: ClassVar[BackendType] :value: Ellipsis .. py:attribute:: GPU :type: ClassVar[BackendType] :value: Ellipsis .. py:attribute:: MPS :type: ClassVar[BackendType] :value: Ellipsis .. py:attribute:: NOISE :type: ClassVar[BackendType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: CBit(*args, **kwargs) quantum classical bit .. py:method:: getName() -> str Retrieve the name of the classical bit. Args: None Returns: The name of the CBit as a string. .. py:class:: CPUQVM Bases: :py:obj:`QuantumMachine` quantum machine cpu .. py:method:: get_prob_dict(qubit_list: QVec, select_max: int = -1) -> Dict[str, float] Get a dictionary of probabilities for the specified qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of entries to return (default: -1). Returns: Dictionary of probabilities as a reference. .. py:method:: get_prob_list(qubit_list: QVec, select_max: int = -1) -> List[float] Get a list of probabilities for the specified qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of probabilities to return (default: -1). Returns: List of probabilities as a reference. .. py:method:: get_prob_tuple_list(qubit_list: QVec, select_max: int = -1) -> List[Tuple[int, float]] Get a list of probability tuples for the specified qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of tuples to return (default: -1). Returns: List of probability tuples as a reference. .. py:method:: init_qvm(arg0: bool) -> None init_qvm() -> None Initialize the quantum virtual machine (QVM). This method sets up the necessary environment for the QVM to execute quantum programs. Returns: None: This method does not return a value. .. py:method:: pmeasure(qubit_list: QVec, select_max: int = -1) -> List[Tuple[int, float]] Get the probability distribution over qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of results to select (default: -1). Returns: Probability distribution as a reference. .. py:method:: pmeasure_no_index(qubit_list: QVec) -> List[float] Get the probability distribution over qubits without index. Args: qubit_list: List of qubits to measure. Returns: Probability distribution as a reference. .. py:method:: prob_run_dict(program: QProg, qubit_list: QVec, select_max: int = -1) -> Dict[str, float] prob_run_dict(program: QProg, qubit_addr_list: List[int], select_max: int = -1) -> Dict[str, float] Execute a quantum program and retrieve a dictionary of probabilities using qubit addresses. Args: program: The quantum program to execute. qubit_addr_list: List of qubit addresses to measure. select_max: int, optional, maximum number of entries in the dictionary to return (default: -1). Returns: Dictionary of probabilities. .. py:method:: prob_run_list(program: QProg, qubit_list: QVec, select_max: int = -1) -> List[float] prob_run_list(program: QProg, qubit_addr_list: List[int], select_max: int = -1) -> List[float] Execute a quantum program and retrieve a list of probabilities using qubit addresses. Args: program: The quantum program to execute. qubit_addr_list: List of qubit addresses to measure. select_max: int, optional, maximum number of probabilities to return (default: -1). Returns: List of probabilities. .. py:method:: prob_run_tuple_list(program: QProg, qubit_list: QVec, select_max: int = -1) -> List[Tuple[int, float]] prob_run_tuple_list(program: QProg, qubit_addr_list: List[int], select_max: int = -1) -> List[Tuple[int, float]] Execute a quantum program and get a list of probability tuples using qubit addresses. Args: program: The quantum program to execute. qubit_addr_list: List of qubit addresses to measure. select_max: int, optional, maximum number of tuples to return (default: -1). Returns: List of probability tuples. .. py:method:: quick_measure(qubit_list: QVec, shots: int) -> Dict[str, int] Perform a quick measurement on the specified qubits. Args: qubit_list: List of qubits to measure. shots: Number of measurement shots to perform. Returns: Reference to the measurement results. .. py:method:: set_max_threads(size: int) -> None Set the maximum number of threads for the CPU quantum virtual machine (QVM). Args: size: The maximum number of threads to use. Returns: None: This method does not return a value. .. py:class:: CPUSingleThreadQVM Bases: :py:obj:`QuantumMachine` quantum machine class for cpu single thread .. py:method:: get_prob_dict(qubit_list: QVec, select_max: int = -1) -> Dict[str, float] Get a dictionary of probabilities for the specified qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of entries to return (default: -1). Returns: Dictionary of probabilities as a reference. .. py:method:: get_prob_list(qubit_list: QVec, select_max: int = -1) -> List[float] Get a list of probabilities for the specified qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of probabilities to return (default: -1). Returns: List of probabilities as a reference. .. py:method:: get_prob_tuple_list(qubit_list: QVec, select_max: int = -1) -> List[Tuple[int, float]] Get a list of probability tuples for the specified qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of tuples to return (default: -1). Returns: List of probability tuples as a reference. .. py:method:: pmeasure(qubit_list: QVec, select_max: int = -1) -> List[Tuple[int, float]] Get the probability distribution over qubits. Args: qubit_list: List of qubits to measure. select_max: int, optional, maximum number of results to select (default: -1). Returns: Probability distribution as a reference. .. py:method:: pmeasure_no_index(qubit_list: QVec) -> List[float] Get the probability distribution over qubits without index. Args: qubit_list: List of qubits to measure. Returns: Probability distribution as a reference. .. py:method:: prob_run_dict(program: QProg, qubit_list: QVec, select_max: int = -1) -> Dict[str, float] prob_run_dict(program: QProg, qubit_addr_list: List[int], select_max: int = -1) -> Dict[str, float] Execute a quantum program and retrieve a dictionary of probabilities using qubit addresses. Args: program: The quantum program to execute. qubit_addr_list: List of qubit addresses to measure. select_max: int, optional, maximum number of entries in the dictionary to return (default: -1). Returns: Dictionary of probabilities. .. py:method:: prob_run_list(program: QProg, qubit_list: QVec, select_max: int = -1) -> List[float] prob_run_list(program: QProg, qubit_addr_list: List[int], select_max: int = -1) -> List[float] Execute a quantum program and retrieve a list of probabilities using qubit addresses. Args: program: The quantum program to execute. qubit_addr_list: List of qubit addresses to measure. select_max: int, optional, maximum number of probabilities to return (default: -1). Returns: List of probabilities. .. py:method:: prob_run_tuple_list(program: QProg, qubit_list: QVec, select_max: int = -1) -> List[Tuple[int, float]] prob_run_tuple_list(program: QProg, qubit_addr_list: List[int], select_max: int = -1) -> List[Tuple[int, float]] Execute a quantum program and get a list of probability tuples using qubit addresses. Args: program: The quantum program to execute. qubit_addr_list: List of qubit addresses to measure. select_max: int, optional, maximum number of tuples to return (default: -1). Returns: List of probability tuples. .. py:method:: quick_measure(qubit_list: QVec, shots: int) -> Dict[str, int] Perform a quick measurement on the specified qubits. Args: qubit_list: List of qubits to measure. shots: Number of measurement shots to perform. Returns: Reference to the measurement results. .. py:class:: ChipID(value: int) origin quantum real chip type Members: Simulation WUYUAN_1 WUYUAN_2 WUYUAN_3 .. py:attribute:: Simulation :type: ClassVar[ChipID] :value: Ellipsis .. py:attribute:: WUYUAN_1 :type: ClassVar[ChipID] :value: Ellipsis .. py:attribute:: WUYUAN_2 :type: ClassVar[ChipID] :value: Ellipsis .. py:attribute:: WUYUAN_3 :type: ClassVar[ChipID] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: ClassicalCondition(*args, **kwargs) Classical condition class Proxy class of cexpr class .. py:method:: c_and(arg0: int) -> ClassicalCondition c_and(arg0: ClassicalCondition) -> ClassicalCondition Perform a logical AND operation with another ClassicalCondition. Args: other: Another ClassicalCondition to perform AND with. Returns: The result of the AND operation. .. py:method:: c_not() -> ClassicalCondition Perform a logical NOT operation on the classical condition. Args: None Returns: The result of the NOT operation. .. py:method:: c_or(arg0: int) -> ClassicalCondition c_or(arg0: ClassicalCondition) -> ClassicalCondition Perform a logical OR operation with another ClassicalCondition. Args: other: Another ClassicalCondition to perform OR with. Returns: The result of the OR operation. .. py:method:: get_val() -> int Retrieve the current value of the classical condition. Args: None Returns: The value of the ClassicalCondition. .. py:method:: set_val(arg0: int) -> None Set a new value for the classical condition. Args: value: The new value to set. Returns: None .. py:class:: ClassicalProg(arg0: ClassicalCondition) quantum ClassicalProg .. py:class:: CommProtocolConfig .. py:attribute:: circuits_num :type: int .. py:attribute:: open_error_mitigation :type: bool .. py:attribute:: open_mapping :type: bool .. py:attribute:: optimization_level :type: int .. py:attribute:: shots :type: int .. py:class:: ComplexVertexSplitMethod(value: int) quantum complex vertex split method Members: METHOD_UNDEFINED LINEAR RING .. py:attribute:: LINEAR :type: ClassVar[ComplexVertexSplitMethod] :value: Ellipsis .. py:attribute:: METHOD_UNDEFINED :type: ClassVar[ComplexVertexSplitMethod] :value: Ellipsis .. py:attribute:: RING :type: ClassVar[ComplexVertexSplitMethod] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: DAGNodeType(value: int) Quantum dag node type Members: NUKNOW_SEQ_NODE_TYPE MAX_GATE_TYPE MEASURE QUBIT RESET .. py:attribute:: MAX_GATE_TYPE :type: ClassVar[DAGNodeType] :value: Ellipsis .. py:attribute:: MEASURE :type: ClassVar[DAGNodeType] :value: Ellipsis .. py:attribute:: NUKNOW_SEQ_NODE_TYPE :type: ClassVar[DAGNodeType] :value: Ellipsis .. py:attribute:: QUBIT :type: ClassVar[DAGNodeType] :value: Ellipsis .. py:attribute:: RESET :type: ClassVar[DAGNodeType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: DecompositionMode(value: int) Quantum matrix decomposition mode Members: QR HOUSEHOLDER_QR QSDecomposition CSDecomposition .. py:attribute:: CSDecomposition :type: ClassVar[DecompositionMode] :value: Ellipsis .. py:attribute:: HOUSEHOLDER_QR :type: ClassVar[DecompositionMode] :value: Ellipsis .. py:attribute:: QR :type: ClassVar[DecompositionMode] :value: Ellipsis .. py:attribute:: QSDecomposition :type: ClassVar[DecompositionMode] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: DensityMatrixSimulator Bases: :py:obj:`QuantumMachine` simulator for density matrix .. py:method:: get_density_matrix(prog: QProg) -> numpy.ndarray[numpy.complex128[m, n]] Run quantum program and get the full density matrix. Args: prog: The quantum program to execute. Returns: The full density matrix. .. py:method:: get_expectation(prog: QProg, hamiltonian: List[Tuple[Dict[int, str], float]], qubits: QVec) -> float get_expectation(prog: QProg, hamiltonian: List[Tuple[Dict[int, str], float]], qubits: List[int]) -> float Run the quantum program and calculate the Hamiltonian expectation for the specified qubits. Args: prog: The quantum program to execute. hamiltonian: The QHamiltonian to use for the expectation value. qubits: The selected qubits for measurement. Returns: The Hamiltonian expectation for the specified qubits. .. py:method:: get_probabilities(prog: QProg) -> List[float] get_probabilities(prog: QProg, qubits: QVec) -> List[float] get_probabilities(prog: QProg, qubits: List[int]) -> List[float] get_probabilities(prog: QProg, indices: List[str]) -> List[float] Run the quantum program and get the probabilities for the specified binary indices. Args: prog: The quantum program to execute. indices: The selected binary indices for measurement. Returns: The probabilities result of the quantum program. .. py:method:: get_probability(prog: QProg, index: int) -> float get_probability(prog: QProg, index: str) -> float Run the quantum program and get the probability for the specified index. Args: prog: The quantum program to execute. index: The measurement index in [0, 2^N 1]. Returns: The probability result of the quantum program. .. py:method:: get_reduced_density_matrix(prog: QProg, qubits: QVec) -> numpy.ndarray[numpy.complex128[m, n]] get_reduced_density_matrix(prog: QProg, qubits: List[int]) -> numpy.ndarray[numpy.complex128[m, n]] Run quantum program and get the density matrix for current qubits. Args: prog: The quantum program to execute. qubits: The selected qubits from the quantum program. Returns: The density matrix for the specified qubits. .. py:method:: init_qvm(is_double_precision: bool = True) -> None .. py:method:: set_noise_model(arg0: numpy.ndarray[numpy.complex128[m, n]]) -> None set_noise_model(arg0: numpy.ndarray[numpy.complex128[m, n]], arg1: List[GateType]) -> None set_noise_model(arg0: List[numpy.ndarray[numpy.complex128[m, n]]]) -> None set_noise_model(arg0: List[numpy.ndarray[numpy.complex128[m, n]]], arg1: List[GateType]) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float, arg3: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: List[QVec]) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float, arg3: float, arg4: float) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float, arg5: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float, arg3: float, arg4: float, arg5: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float, arg5: List[QVec]) -> None Set a specific noise model for the density matrix simulator with a given gate type, probability, duration, temperature, and multiple target qubits. Args: noise_model: The noise model to apply. gate_type: The specific gate type associated with the noise model. probability: The probability of the noise occurring. duration: The duration for which the noise model is applied. temperature: The temperature affecting the noise characteristics. target_qubits: A vector of qubits targeted by the noise model. Returns: None. .. py:class:: DoubleGateTransferType(value: int) Quantum double gate transfer type Members: DOUBLE_GATE_INVALID DOUBLE_BIT_GATE .. py:attribute:: DOUBLE_BIT_GATE :type: ClassVar[DoubleGateTransferType] :value: Ellipsis .. py:attribute:: DOUBLE_GATE_INVALID :type: ClassVar[DoubleGateTransferType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: Encode quantum amplitude encode .. py:method:: amplitude_encode(qubit: QVec, data: List[float]) -> None amplitude_encode(qubit: QVec, data: List[complex]) -> None Perform amplitude encoding using complex numbers on the given qubits. Args: qubit: The quantum vector to be encoded. data: The classical complex data to be encoded. Returns: An encoded quantum state. .. py:method:: amplitude_encode_recursive(qubit: QVec, data: List[float]) -> None amplitude_encode_recursive(qubit: QVec, data: List[complex]) -> None Encode by amplitude recursively. Args: QVec: qubits QStat: amplitude Returns: circuit .. py:method:: angle_encode(qubit: QVec, data: List[float], gate_type: GateType = GateType.RY_GATE) -> None Encode by angle. Args: QVec: qubits prob_vec: data Returns: circuit. .. py:method:: approx_mps(qubit: QVec, data: List[float], layers: int = 3, sweeps: int = 100, double2float: bool = False) -> None approx_mps(qubit: QVec, data: List[complex], layers: int = 3, sweeps: int = 100) -> None Approximate Matrix Product State encoding. Args: QVec: qubits std::vector: input data int: number of layers (default: 3) int: number of steps (default: 100) Returns: Encoded circuit. .. py:method:: basic_encode(qubit: QVec, data: str) -> None Basic encoding. Args: QVec: qubits string: data Returns: circuit .. py:method:: bid_amplitude_encode(qubit: QVec, data: List[float], split: int = 0) -> None Encode by bid. Args: QVec: qubits QStat: amplitude split: int Returns: circuit .. py:method:: dc_amplitude_encode(qubit: QVec, data: List[float]) -> None Encode by DC amplitude. Args: QVec: qubits QStat: amplitude Returns: circuit .. py:method:: dense_angle_encode(qubit: QVec, data: List[float]) -> None Encode by dense angle. Args: QVec: qubits prob_vec: data Returns: circuit .. py:method:: ds_quantum_state_preparation(qubit: QVec, data: Dict[str, float]) -> None ds_quantum_state_preparation(qubit: QVec, data: Dict[str, complex]) -> None ds_quantum_state_preparation(qubit: QVec, data: List[float]) -> None ds_quantum_state_preparation(qubit: QVec, data: List[complex]) -> None Prepare a quantum state. Args: QVec: qubits std::vector>: state parameters Returns: circuit .. py:method:: efficient_sparse(qubit: QVec, data: Dict[str, float]) -> None efficient_sparse(qubit: QVec, data: Dict[str, complex]) -> None efficient_sparse(qubit: QVec, data: List[float]) -> None efficient_sparse(qubit: QVec, data: List[complex]) -> None Perform an efficient sparse operation. Args: QVec: qubits std::vector>: parameters for the operation Returns: circuit .. py:method:: get_circuit() -> QCircuit Retrieve the circuit from the encoder. Returns: The corresponding circuit object. .. py:method:: get_fidelity(data: List[float]) -> float get_fidelity(data: List[complex]) -> float get_fidelity(data: List[float]) -> float Calculate the fidelity based on the provided float data. Args: data: A vector of floats representing the input data. Returns: The calculated fidelity value. .. py:method:: get_out_qubits() -> QVec Retrieve the output qubits from the encoder. Returns: A vector of output qubits. .. py:method:: iqp_encode(qubit: QVec, data: List[float], control_list: List[Tuple[int, int]] = [], bool_inverse: bool = False, repeats: int = 1) -> None Encode by IQP. Args: QVec: qubits prob_vec: data list: control_list bool: bool_inverse int: repeats Returns: circuit. .. py:method:: schmidt_encode(qubit: QVec, data: List[float], cutoff: float) -> None Encode by schmidt. Args: QVec: qubits QStat: amplitude double: cutoff Returns: circuit .. py:method:: sparse_isometry(qubit: QVec, data: Dict[str, float]) -> None sparse_isometry(qubit: QVec, data: Dict[str, complex]) -> None sparse_isometry(qubit: QVec, data: List[float]) -> None sparse_isometry(qubit: QVec, data: List[complex]) -> None Perform a sparse isometry operation. Args: QVec: qubits std::vector>: parameters for the isometry Returns: circuit .. py:class:: ErrorCode(value: int) pliot error code Members: NO_ERROR_FOUND DATABASE_ERROR ORIGINIR_ERROR JSON_FIELD_ERROR BACKEND_CALC_ERROR ERR_TASK_BUF_OVERFLOW EXCEED_MAX_QUBIT ERR_UNSUPPORT_BACKEND_TYPE EXCEED_MAX_CLOCK ERR_UNKNOW_TASK_TYPE ERR_QVM_INIT_FAILED ERR_QCOMPILER_FAILED ERR_PRE_ESTIMATE ERR_MATE_GATE_CONFIG ERR_FIDELITY_MATRIX ERR_QST_PROG ERR_EMPTY_PROG ERR_QUBIT_SIZE ERR_QUBIT_TOPO ERR_QUANTUM_CHIP_PROG ERR_REPEAT_MEASURE ERR_OPERATOR_DB ERR_TASK_STATUS_BUF_OVERFLOW ERR_BACKEND_CHIP_TASK_SOCKET_WRONG CLUSTER_SIMULATE_CALC_ERR ERR_SCHEDULE_CHIP_TOPOLOGY_SUPPORTED ERR_TASK_CONFIG ERR_NOT_FOUND_APP_ID ERR_NOT_FOUND_TASK_ID ERR_PARSER_SUB_TASK_RESULT ERR_SYS_CALL_TIME_OUT ERR_TASK_TERMINATED ERR_INVALID_URL ERR_PARAMETER ERR_QPROG_LENGTH ERR_CHIP_OFFLINE UNDEFINED_ERROR ERR_SUB_GRAPH_OUT_OF_RANGE ERR_TCP_INIT_FATLT ERR_TCP_SERVER_HALT CLUSTER_BASE .. py:attribute:: BACKEND_CALC_ERROR :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: CLUSTER_BASE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: CLUSTER_SIMULATE_CALC_ERR :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: DATABASE_ERROR :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_BACKEND_CHIP_TASK_SOCKET_WRONG :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_CHIP_OFFLINE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_EMPTY_PROG :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_FIDELITY_MATRIX :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_INVALID_URL :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_MATE_GATE_CONFIG :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_NOT_FOUND_APP_ID :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_NOT_FOUND_TASK_ID :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_OPERATOR_DB :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_PARAMETER :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_PARSER_SUB_TASK_RESULT :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_PRE_ESTIMATE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_QCOMPILER_FAILED :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_QPROG_LENGTH :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_QST_PROG :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_QUANTUM_CHIP_PROG :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_QUBIT_SIZE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_QUBIT_TOPO :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_QVM_INIT_FAILED :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_REPEAT_MEASURE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_SCHEDULE_CHIP_TOPOLOGY_SUPPORTED :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_SUB_GRAPH_OUT_OF_RANGE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_SYS_CALL_TIME_OUT :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_TASK_BUF_OVERFLOW :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_TASK_CONFIG :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_TASK_STATUS_BUF_OVERFLOW :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_TASK_TERMINATED :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_TCP_INIT_FATLT :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_TCP_SERVER_HALT :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_UNKNOW_TASK_TYPE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ERR_UNSUPPORT_BACKEND_TYPE :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: EXCEED_MAX_CLOCK :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: EXCEED_MAX_QUBIT :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: JSON_FIELD_ERROR :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: NO_ERROR_FOUND :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: ORIGINIR_ERROR :type: ClassVar[ErrorCode] :value: Ellipsis .. py:attribute:: UNDEFINED_ERROR :type: ClassVar[ErrorCode] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: Fusion quantum fusion operation .. py:method:: aggregate_operations(circuit: QCircuit) -> None aggregate_operations(qprog: QProg) -> None Aggregate operations into the provided quantum program. Args: qprog: The quantum program to which operations will be added. Returns: A reference to the modified program. .. py:class:: GateType(value: int) quantum gate type Members: GATE_NOP GATE_UNDEFINED P0_GATE P1_GATE PAULI_X_GATE PAULI_Y_GATE PAULI_Z_GATE X_HALF_PI Y_HALF_PI Z_HALF_PI HADAMARD_GATE T_GATE S_GATE P_GATE CP_GATE RX_GATE RY_GATE RZ_GATE RXX_GATE RYY_GATE RZZ_GATE RZX_GATE U1_GATE U2_GATE U3_GATE U4_GATE CU_GATE CNOT_GATE CZ_GATE MS_GATE CPHASE_GATE ISWAP_THETA_GATE ISWAP_GATE SQISWAP_GATE SWAP_GATE TWO_QUBIT_GATE P00_GATE P11_GATE TOFFOLI_GATE ORACLE_GATE I_GATE BARRIER_GATE RPHI_GATE .. py:attribute:: BARRIER_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: CNOT_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: CPHASE_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: CP_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: CU_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: CZ_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: GATE_NOP :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: GATE_UNDEFINED :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: HADAMARD_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: ISWAP_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: ISWAP_THETA_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: I_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: MS_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: ORACLE_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: P00_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: P0_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: P11_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: P1_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: PAULI_X_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: PAULI_Y_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: PAULI_Z_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: P_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RPHI_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RXX_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RX_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RYY_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RY_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RZX_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RZZ_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: RZ_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: SQISWAP_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: SWAP_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: S_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: TOFFOLI_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: TWO_QUBIT_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: T_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: U1_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: U2_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: U3_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: U4_GATE :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: X_HALF_PI :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: Y_HALF_PI :type: ClassVar[GateType] :value: Ellipsis .. py:attribute:: Z_HALF_PI :type: ClassVar[GateType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: HHLAlg(arg0: QuantumMachine) quantum hhl algorithm class .. py:method:: check_QPE_result() -> str check QPE result .. py:method:: get_amplification_factor() -> float get_amplification_factor .. py:method:: get_ancillary_qubit() -> QVec get_ancillary_qubit .. py:method:: get_hhl_circuit(matrix_A: List[complex], data_b: List[float], precision_cnt: int = 0) -> QCircuit .. py:method:: get_qubit_for_QFT() -> List[Qubit] get_qubit_for_QFT .. py:method:: get_qubit_for_b() -> List[Qubit] get_qubit_for_b .. py:method:: query_uesed_qubit_num() -> int query_uesed_qubit_num .. py:class:: LATEX_GATE_TYPE(value: int) Quantum latex gate type Members: GENERAL_GATE CNOT_GATE SWAP_GATE .. py:attribute:: CNOT_GATE :type: ClassVar[LATEX_GATE_TYPE] :value: Ellipsis .. py:attribute:: GENERAL_GATE :type: ClassVar[LATEX_GATE_TYPE] :value: Ellipsis .. py:attribute:: SWAP_GATE :type: ClassVar[LATEX_GATE_TYPE] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: LatexMatrix Generate quantum circuits latex src code can be compiled on latex package 'qcircuit' circuits element treated as matrix element in latex syntax qcircuit package tutorial [https://physics.unm.edu/CQuIC/Qcircuit/Qtutorial.pdf] .. py:method:: insert_barrier(rows: List[int], from_col: int) -> int Insert a barrier into the circuit. Args: rows: The rows of the LaTeX matrix where the barrier is applied. from_col: Desired column position for the barrier; if space is insufficient, a suitable column will be found. Returns: int: Actual column number where the barrier is placed. .. py:method:: insert_gate(target_rows: List[int], ctrl_rows: List[int], from_col: int, gate_type: LATEX_GATE_TYPE, gate_name: str = '', dagger: bool = False, param: str = '') -> int Insert a gate into the circuit. Args: target_rows: Gate target rows of the LaTeX matrix. ctrl_rows: Control rows for the gate. from_col: Desired column position for the gate; if space is insufficient, a suitable column will be found. gate_type: Enum type of LATEX_GATE_TYPE. gate_name: Name of the gate (default: ''). dagger: Flag indicating if the gate is a dagger (default: false). param: Parameter string for the gate (default: ''). Returns: int: Actual column number where the gate is placed. .. py:method:: insert_measure(q_row: int, c_row: int, from_col: int) -> int Insert a measurement operation into the circuit. Args: q_row: The row of the qubit being measured. c_row: The row of the classical bit that will store the measurement result. from_col: The desired column position for the measurement. Returns: None, as the function modifies the matrix in place. .. py:method:: insert_reset(q_row: int, from_col: int) -> int Insert a reset operation into the circuit. Args: q_row: The row of the qubit to be reset. from_col: The desired column position for the reset. Returns: None, as the function modifies the matrix in place. .. py:method:: insert_timeseq(t_col: int, time_seq: int) -> None Insert a time sequence into the circuit. Args: t_col: The column position where the time sequence will be inserted. time_seq: The time sequence data to be inserted. Warning: This function does not check for column number validity, which may cause overwriting. Users must ensure the column number is managed correctly to avoid conflicts. .. py:method:: set_label(qubit_label: Dict[int, str], cbit_label: Dict[int, str] = {}, time_seq_label: str = '', head: bool = True) -> None Set label at the leftmost head column or rightmost tail column. Labels can be reset at any time. Args: qubit_label: Label for the qubit wire's leftmost head label, specified in LaTeX syntax.If not given, the row will remain empty (e.g., {0: 'q_{1}', 2:'q_{2}'}). cbit_label: Classic label string, supports LaTeX formatting. time_seq_label: If given, sets the time sequence label. head: If true, appends the label at the head; if false, appends at the tail. Returns: None, as the function modifies the matrix in place. .. py:method:: set_logo(logo: str = '') -> None Add a logo string. Args: logo: The logo string to be added. If not provided, the logo will be set to an empty string. Returns: None, as the function modifies the matrix in place. .. py:method:: str(with_time: bool = False) -> str Return the final LaTeX source code representation of the matrix. Args: with_time: A boolean flag indicating whether to include timing information in the output. Returns: str: The LaTeX source code as a string. This method can be called at any time to obtain the current state of the matrix. .. py:class:: MPSQVM Bases: :py:obj:`QuantumMachine` quantum matrix product state machine class .. py:method:: add_single_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float) -> None add_single_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float) -> None Add a noise model to a specific gate with multiple error rates. Args: noise_model: NOISE_MODEL, the type of noise model to apply. gate_type: GateType, the type of gate affected by the noise. error_rate_1: float, the first error rate. error_rate_2: float, the second error rate. error_rate_3: float, the third error rate. Returns: None. .. py:method:: get_prob_dict(qubit_list: QVec, select_max: int = -1) -> Dict[str, float] Get pmeasure result as dict. Args: qubit_list: List of qubits for pmeasure. select_max: Maximum number of returned elements in the result tuple; should be in [-1, 1< List[float] Get pmeasure result as list. Args: qubit_list: List of qubits for pmeasure. select_max: Maximum number of returned elements in the result tuple; should be in [-1, 1< List[Tuple[int, float]] Get pmeasure result as list. Args: qubit_list: List of qubits for pmeasure. select_max: Maximum number of returned elements in the result tuple; should be in [-1, 1< List[Tuple[int, float]] Get the probability distribution over qubits. Args: qubit_list: List of qubits to measure. select_max: Maximum number of returned elements in the result tuple; should be in [-1, 1< complex Get pmeasure bin index quantum state amplitude. Args: string: Bin string. Returns: Complex: Bin amplitude. .. py:method:: pmeasure_bin_subset(program: QProg, string_list: List[str]) -> List[complex] Get pmeasure quantum state amplitude subset. Args: list: List of bin state strings. Returns: List: Bin amplitude result list. .. py:method:: pmeasure_dec_index(program: QProg, string: str) -> complex Get pmeasure decimal index quantum state amplitude. Args: string: Decimal string. Returns: Complex: Decimal amplitude. .. py:method:: pmeasure_dec_subset(program: QProg, string_list: List[str]) -> List[complex] Get pmeasure quantum state amplitude subset. Args: list: List of decimal state strings. Returns: List: Decimal amplitude result list. .. py:method:: pmeasure_no_index(qubit_list: QVec) -> List[float] Get the probability distribution over qubits. Args: qubit_list: List of qubits to measure. Returns: Measure result of the quantum machine in list form. .. py:method:: prob_run_dict(program: QProg, qubit_list: QVec, select_max: int = -1) -> Dict[str, float] Run quantum program and get pmeasure result as dict. Args: program: Quantum program to run. qubit_list: List of qubits for pmeasure. select_max: Maximum number of returned elements in the result; should be in [-1, 1< List[float] Run quantum program and get pmeasure result as list. Args: program: Quantum program to run. qubit_list: List of qubits for pmeasure. select_max: Maximum number of returned elements in the result; should be in [-1, 1< List[Tuple[int, float]] Run quantum program and get pmeasure result as tuple list. Args: program: Quantum program to run. qubit_list: List of qubits for pmeasure. select_max: Maximum number of returned elements in the result tuple; should be in [-1, 1< Dict[str, int] Quick measure. Args: qubit_list: List of qubits to measure. shots: The number of repetitions for the measurement operation. Returns: Result of the quantum program. .. py:method:: set_measure_error(arg0: NoiseModel, arg1: float) -> None set_measure_error(arg0: NoiseModel, arg1: float, arg2: float, arg3: float) -> None Set the measurement error with multiple error rates for the specified noise model. Args: noise_model: The type of noise model to apply. error_rate1: First error rate. error_rate2: Second error rate. error_rate3: Third error rate. .. py:method:: set_mixed_unitary_error(arg0: GateType, arg1: List[List[complex]], arg2: List[QVec]) -> None set_mixed_unitary_error(arg0: GateType, arg1: List[List[complex]], arg2: List[float], arg3: List[QVec]) -> None set_mixed_unitary_error(arg0: GateType, arg1: List[List[complex]]) -> None set_mixed_unitary_error(arg0: GateType, arg1: List[List[complex]], arg2: List[float]) -> None Set mixed unitary errors with associated probabilities for the specified gate type. Args: gate_type: Type of gate affected by the error. unitary_errors: List of unitary error matrices. probabilities: Probabilities associated with each unitary error. .. py:method:: set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: List[QVec]) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float, arg5: List[QVec]) -> None Set the noise model for the quantum simulation with specific noise levels and qubits. Args: noise_model: Type of noise model (bit-flip, phase-flip, etc.). gate_type: Type of gate affected by the noise. noise_level_1: First noise level to apply. noise_level_2: Second noise level to apply. noise_level_3: Third noise level to apply. qubits: List of qubits to which the noise model will be applied. .. py:method:: set_readout_error(readout_params: List[List[float]], qubits: QVec) -> None Set readout error parameters for the specified qubits. Args: readout_params: Parameters defining the readout errors. qubits: List of qubits to which the readout errors apply. .. py:method:: set_reset_error(reset_0_param: float, reset_1_param: float) -> None Set the reset error for the quantum state. Args: reset_0_param: float, error probability for resetting qubit to 0. reset_1_param: float, error probability for resetting qubit to 1. Returns: None. .. py:method:: set_rotation_error(param: float) -> None Set the rotation error parameters. Args: param: The parameters defining the rotation error. Returns: A reference to the updated instance of the class. .. py:class:: MomentumOptimizer(arg0: var, arg1: float, arg2: float) variational quantum MomentumOptimizer .. py:method:: get_loss() -> float .. py:method:: get_variables() -> List[var] .. py:method:: minimize(arg0: float, arg1: float) -> Optimizer .. py:method:: run(arg0: List[var], arg1: int) -> bool .. py:class:: NodeInfo NodeInfo(iter: NodeIter, target_qubits: QVec, control_qubits: QVec, type: int, dagger: bool) Detailed information of a QProg node .. py:attribute:: m_cbits :type: List[int] .. py:attribute:: m_control_qubits :type: QVec .. py:attribute:: m_gate_type :type: GateType .. py:attribute:: m_is_dagger :type: bool .. py:attribute:: m_iter :type: NodeIter .. py:attribute:: m_name :type: str .. py:attribute:: m_node_type :type: NodeType .. py:attribute:: m_params :type: List[float] .. py:attribute:: m_target_qubits :type: QVec .. py:method:: reset() -> None Reset the NodeInfo instance to its initial state. This function clears any current data in the NodeInfo and prepares it for reuse. Args: None Returns: None .. py:class:: NodeIter quantum node iter .. py:method:: get_next() -> NodeIter Get the next node iterator. Args: None Returns: The next NodeIter instance. .. py:method:: get_node_type() -> NodeType Retrieve the type of the current node. Args: None Returns: The type of the node. .. py:method:: get_pre() -> NodeIter Get the previous node iterator. Args: None Returns: The previous NodeIter instance. .. py:class:: NodeType(value: int) quantum node type Members: NODE_UNDEFINED GATE_NODE CIRCUIT_NODE PROG_NODE MEASURE_GATE WHILE_START_NODE QIF_START_NODE CLASS_COND_NODE RESET_NODE .. py:attribute:: CIRCUIT_NODE :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: CLASS_COND_NODE :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: GATE_NODE :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: MEASURE_GATE :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: NODE_UNDEFINED :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: PROG_NODE :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: QIF_START_NODE :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: RESET_NODE :type: ClassVar[NodeType] :value: Ellipsis .. py:attribute:: WHILE_START_NODE :type: ClassVar[NodeType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: Noise Quantum machine for noise simulation .. py:method:: add_mixed_unitary_error(gate_types: GateType, unitary_matrices: List[List[complex]], probs: List[float]) -> None add_mixed_unitary_error(gate_types: GateType, unitary_matrices: List[List[complex]], probs: List[float], qubits: QVec) -> None add_mixed_unitary_error(gate_types: GateType, unitary_matrices: List[List[complex]], probs: List[float], qubits: List[QVec]) -> None Add mixed unitary errors to specified gate types for multiple qubits. Args: gate_types: The type of gates to which the mixed unitary errors apply. unitary_matrices: A vector of unitary matrices representing the errors. probs: A vector of probabilities corresponding to each unitary matrix. qubits: A vector of QVec instances indicating which qubits the errors affect. Returns: None. .. py:method:: add_noise_model(noise_model: NoiseModel, gate_type: GateType, prob: float) -> None add_noise_model(noise_model: NoiseModel, gate_types: List[GateType], prob: float) -> None add_noise_model(noise_model: NoiseModel, gate_type: GateType, prob: float, qubits: QVec) -> None add_noise_model(noise_model: NoiseModel, gate_types: List[GateType], prob: float, qubits: QVec) -> None add_noise_model(noise_model: NoiseModel, gate_type: GateType, prob: float, qubits: List[QVec]) -> None add_noise_model(noise_model: NoiseModel, gate_type: GateType, t1: float, t2: float, t_gate: float) -> None add_noise_model(noise_model: NoiseModel, gate_types: List[GateType], t1: float, t2: float, t_gate: float) -> None add_noise_model(noise_model: NoiseModel, gate_type: GateType, t1: float, t2: float, t_gate: float, qubits: QVec) -> None add_noise_model(noise_model: NoiseModel, gate_types: List[GateType], t1: float, t2: float, t_gate: float, qubits: QVec) -> None add_noise_model(noise_model: NoiseModel, gate_type: GateType, t1: float, t2: float, t_gate: float, qubits: List[QVec]) -> None Add a noise model to a specific gate with specified time parameters and targeted qubits. Args: noise_model: An instance of NOISE_MODEL to be added. gate_type: The type of gate to which the noise model applies. t1: The time constant for relaxation (T1). t2: The time constant for dephasing (T2). t_gate: The duration of the gate operation. qubits: A vector of vectors of qubit indices that the noise affects. Returns: None. .. py:method:: set_measure_error(noise_model: NoiseModel, prob: float, qubits: QVec = ...) -> None set_measure_error(noise_model: NoiseModel, t1: float, t2: float, t_gate: float, qubits: QVec = ...) -> None Set the measurement error using time parameters for the specified qubits. Args: noise_model: An instance of NOISE_MODEL to be used. t1: The time constant for relaxation (T1). t2: The time constant for dephasing (T2). t_gate: The duration of the gate operation. qubits: A vector of qubit indices to which the measurement error applies. Defaults to an empty QVec. Returns: None. .. py:method:: set_readout_error(prob_list: List[List[float]], qubits: QVec = ...) -> None Set readout errors for specified qubits. Args: prob_list: A list of probabilities for readout errors. qubits: A vector of qubit indices that the readout errors apply to (default is all qubits). Returns: None. .. py:method:: set_reset_error(p0: float, p1: float, qubits: QVec) -> None Set reset errors for specified qubits. Args: p0: The probability of resetting to state |0>. p1: The probability of resetting to state |1>. qubits: A vector of qubit indices that the reset errors apply to. Returns: None. .. py:method:: set_rotation_error(error: float) -> None Set rotation error for gates. Args: error: The error model for rotation operations. Returns: None. .. py:class:: NoiseModel(value: int) noise model type Members: DAMPING_KRAUS_OPERATOR DECOHERENCE_KRAUS_OPERATOR DEPHASING_KRAUS_OPERATOR PAULI_KRAUS_MAP BITFLIP_KRAUS_OPERATOR DEPOLARIZING_KRAUS_OPERATOR BIT_PHASE_FLIP_OPRATOR PHASE_DAMPING_OPRATOR .. py:attribute:: BITFLIP_KRAUS_OPERATOR :type: ClassVar[NoiseModel] :value: Ellipsis .. py:attribute:: BIT_PHASE_FLIP_OPRATOR :type: ClassVar[NoiseModel] :value: Ellipsis .. py:attribute:: DAMPING_KRAUS_OPERATOR :type: ClassVar[NoiseModel] :value: Ellipsis .. py:attribute:: DECOHERENCE_KRAUS_OPERATOR :type: ClassVar[NoiseModel] :value: Ellipsis .. py:attribute:: DEPHASING_KRAUS_OPERATOR :type: ClassVar[NoiseModel] :value: Ellipsis .. py:attribute:: DEPOLARIZING_KRAUS_OPERATOR :type: ClassVar[NoiseModel] :value: Ellipsis .. py:attribute:: PAULI_KRAUS_MAP :type: ClassVar[NoiseModel] :value: Ellipsis .. py:attribute:: PHASE_DAMPING_OPRATOR :type: ClassVar[NoiseModel] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: NoiseQVM Bases: :py:obj:`QuantumMachine` quantum machine class for simulate noise prog .. py:method:: initQVM(arg0: dict) -> None init quantum virtual machine .. py:method:: init_qvm(json_config: dict) -> None init_qvm() -> None init quantum virtual machine .. py:method:: set_max_threads(size: int) -> None Set the maximum number of threads for the noise quantum virtual machine (NoiseQVM). Args: size: The maximum number of threads to utilize. Returns: None: This method does not return a value. .. py:method:: set_measure_error(model: NoiseModel, prob: float, qubits: QVec = ...) -> None set_measure_error(model: NoiseModel, T1: float, T2: float, t_gate: float, qubits: QVec = ...) -> None Set the measurement error model in the quantum virtual machine with specific error parameters. Args: model: The noise model to be applied for measurement errors. T1: A double representing the relaxation time constant for the qubits. T2: A double representing the dephasing time constant for the qubits. t_gate: A double representing the time duration of the gate operation. qubits: A specific qubit vector (QVec) for which the measurement error applies (default is an empty QVec). Returns: None, as the function configures the measurement error model in place for the specified qubit vector. .. py:method:: set_mixed_unitary_error(arg0: GateType, arg1: List[List[complex]], arg2: List[float]) -> None set_mixed_unitary_error(arg0: GateType, arg1: List[List[complex]], arg2: List[float], arg3: QVec) -> None set_mixed_unitary_error(arg0: GateType, arg1: List[List[complex]], arg2: List[float], arg3: List[QVec]) -> None Set a mixed unitary error model for a specific gate type in the quantum virtual machine, targeting multiple qubits. Args: gate_type: The type of gate for which the mixed unitary error model applies. unitary_ops: A vector of unitary operations (QStat) representing the error model. probabilities: A vector of doubles representing the probabilities associated with each unitary operation. qubit_groups: A vector of qubit vectors (QVec) specifying the qubits affected by the error model. Returns: None, as the function configures the mixed unitary error model in place for the specified gate type and qubit groups. .. py:method:: set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float, arg3: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: List[QVec]) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float, arg3: float, arg4: float) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float, arg5: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float, arg3: float, arg4: float, arg5: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: float, arg4: float, arg5: List[QVec]) -> None Set the noise model for a specific gate type with multiple noise parameters affecting a vector of qubit vectors in the quantum virtual machine. Args: noise_model: The noise model to be applied. gate_type: The type of gate for which the noise model is relevant. noise_level1: A double representing the first level of noise to apply. noise_level2: A double representing the second level of noise to apply. noise_level3: A double representing the third level of noise to apply. qubits_list: A vector of qubit vectors (QVec) affected by the noise model. Returns: None, as the function configures the noise model in place for the specified gate type and qubit vectors. .. py:method:: set_readout_error(probs_list: List[List[float]], qubits: QVec = ...) -> None Set a readout error model for the quantum virtual machine. Args: probs_list: A list of probabilities for readout errors associated with each qubit. qubits: A vector of qubits (QVec) for which the readout error model applies. Defaults to all qubits if not specified. Returns: None, as this function configures the readout error model in place for the specified qubits. .. py:method:: set_reset_error(p0: float, p1: float, qubits: QVec = ...) -> None Set a reset error model for the quantum virtual machine. Args: p0: Probability of the qubit resetting to state 0. p1: Probability of the qubit resetting to state 1. qubits: A vector of qubits (QVec) for which the reset error model applies. Defaults to all qubits if not specified. Returns: None, as this function configures the reset error model in place for the specified qubits. .. py:method:: set_rotation_error(arg0: float) -> None Set a rotation error model for the quantum virtual machine. Args: None specified in the function signature, but typically would include error parameters for the rotation. Returns: None, as this function configures the rotation error model in place for the quantum operations. .. py:class:: Optimizer(*args, **kwargs) variational quantum Optimizer class .. py:method:: get_loss() -> float .. py:method:: get_variables() -> List[var] .. py:method:: run(arg0: List[var], arg1: int) -> bool .. py:class:: OptimizerFactory quantum OptimizerFactory class .. py:method:: makeOptimizer() -> AbstractOptimizer makeOptimizer() -> AbstractOptimizer Create an optimizer using its name. Args: optimizer_name: A string representing the name of the desired optimizer. Returns: An instance of the created optimizer. .. py:class:: OptimizerMode(value: int) variational quantum OptimizerMode Members: .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: OptimizerType(value: int) quantum OptimizerType Members: NELDER_MEAD POWELL GRADIENT .. py:attribute:: GRADIENT :type: ClassVar[OptimizerType] :value: Ellipsis .. py:attribute:: NELDER_MEAD :type: ClassVar[OptimizerType] :value: Ellipsis .. py:attribute:: POWELL :type: ClassVar[OptimizerType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: OriginCMem origin quantum cmem .. py:method:: Allocate_CBit() -> CBit Allocate_CBit(cbit_num: int) -> CBit Allocate a specified number of classical bits. Args: cbit_num: The number of classical bits to allocate. Returns: A reference to the allocated classical bits. .. py:method:: Free_CBit(cbit: CBit) -> None Free a previously allocated classical bit. Args: cbit: The classical bit to be freed. .. py:method:: cAlloc() -> CBit cAlloc(arg0: int) -> CBit Allocate memory for classical bits. This method initializes or resets the memory allocation for classical bits. .. py:method:: cAlloc_many(count: int) -> List[ClassicalCondition] Allocate memory for multiple classical bits. Args: count: The number of classical bits to allocate. .. py:method:: cFree(classical_cond: ClassicalCondition) -> None Free the allocated memory for a classical condition. Args: classical_cond: The classical condition to be freed. .. py:method:: cFree_all(classical_cond_list: List[ClassicalCondition]) -> None cFree_all() -> None Free all allocated classical memory. This method releases all memory associated with classical conditions. .. py:method:: clearAll() -> None Clear all allocated classical bits. This method releases all resources associated with classical bits. .. py:method:: getIdleMem() -> int Get the amount of idle memory currently available. Returns: The amount of idle memory in terms of qubits. .. py:method:: getMaxMem() -> int Get the maximum memory capacity. Returns: The maximum memory capacity in terms of qubits. .. py:method:: get_allocate_cbits() -> List[ClassicalCondition] Retrieve allocated classical bits. Returns a vector of ClassicalCondition representing the allocated cbits. .. py:method:: get_capacity() -> int Get the capacity of the memory. Returns: The total capacity of the memory in terms of qubits. .. py:method:: get_cbit_by_addr(cbit_addr: int) -> CBit Get a classical bit by its address. Args: cbit_addr: The address of the classical bit. Returns: A reference to the classical bit associated with the given address . .. py:method:: set_capacity(arg0: int) -> None Set the capacity of the memory. Args: capacity: The new capacity for the memory in terms of qubits. .. py:class:: OriginCollection OriginCollection(file_name: str) OriginCollection(arg0: OriginCollection) A relatively free data collection class for saving data .. py:method:: getFilePath() -> str Retrieve the file path associated with the OriginCollection. This function returns the path to the file linked to the collection. Returns: A string containing the file path. .. py:method:: getJsonString() -> str Retrieve the JSON string representation of the OriginCollection. This function converts the collection's data into a JSON format string. Returns: A string containing the JSON representation of the collection. .. py:method:: getKeyVector() -> List[str] Retrieve the vector of keys associated with the OriginCollection. This function returns a vector containing all the keys in the collection. Returns: A vector of keys. .. py:method:: getValue(key_name: str) -> List[str] Get the value associated with the specified key name. This function retrieves the value stored in the OriginCollection for the given key. Args: key_name: The name of the key whose value is to be retrieved. Returns: The value associated with the specified key. .. py:method:: getValueByKey(key_value: str) -> str getValueByKey(key_value: int) -> str Retrieve the value associated with a specified key. This function returns the value that corresponds to the given key. Args: key_value: The key for which to retrieve the associated value. Returns: The value associated with the specified key. .. py:method:: insertValue(key: str, *args) -> None Insert values into the OriginCollection under the specified key. This function adds the first value associated with the provided key and then inserts additional values from the provided arguments. Args: key: The key under which to insert the values. args: A variable number of values to be inserted. Returns: None. .. py:method:: open(file_name: str) -> bool Open and read the JSON file at the specified path. This function reads the contents of the JSON file provided. Args: file_name: The path to the JSON file to be read. Returns: None. .. py:method:: setNames(*args) -> None Set names in the OriginCollection. This function accepts a variable number of name arguments and sets them in the OriginCollection. Args: args: A variable number of name strings to be set. Returns: None. .. py:method:: write() -> bool Write the current data to a JSON file. This function saves the current contents to a specified JSON file. Args: None. Returns: None. .. py:class:: OriginQubitPool quantum qubit pool .. py:method:: allocateQubitThroughPhyAddress(qubit_addr: int) -> Qubit Allocate a qubit using its physical address. Args: qubit_addr: The physical address of the qubit to allocate. Returns: A reference to the allocated qubit. .. py:method:: allocateQubitThroughVirAddress(qubit_num: int) -> Qubit Allocate a qubit using its virtual address. Args: qubit_num: The virtual address of the qubit to allocate. Returns: A reference to the allocated qubit. .. py:method:: clearAll() -> None Clear all qubits from the OriginQubitPool. This method removes all qubits, resetting the pool to its initial state. .. py:method:: getIdleQubit() -> int Retrieve an idle qubit from the OriginQubitPool. Returns: An idle qubit if available, otherwise may return a null reference or indicate no idle qubits. .. py:method:: getMaxQubit() -> int Retrieve the maximum qubit from the OriginQubitPool. Returns: The maximum qubit available in the pool. .. py:method:: getPhysicalQubitAddr(qubit: Qubit) -> int Retrieve the physical address of a specified qubit. Args: qubit: The qubit for which to retrieve the physical address. Returns: The physical address of the specified qubit. .. py:method:: getVirtualQubitAddress(qubit: Qubit) -> int Retrieve the virtual address of a specified qubit. Args: qubit: The qubit for which to retrieve the virtual address. Returns: The virtual address of the specified qubit. .. py:method:: get_allocate_qubits() -> QVec Retrieve currently allocated qubits. Returns: A reference to the vector of currently allocated qubits. .. py:method:: get_capacity() -> int Get the capacity of the OriginQubitPool. Returns: An integer representing the capacity of the pool. .. py:method:: get_max_usedqubit_addr() -> int Retrieve the address of the maximum used qubit in the OriginQubitPool. Returns: The address of the maximum used qubit, or an indication if no qubits are in use. .. py:method:: get_qubit_by_addr(qubit_addr: int) -> Qubit Retrieve a qubit from the pool using its address. Args: qubit_addr: The address of the qubit to retrieve. Returns: A reference to the requested qubit. .. py:method:: qAlloc() -> Qubit Allocate a qubit. Returns: A reference to the allocated qubit. .. py:method:: qAlloc_many(qubit_num: int) -> List[Qubit] Allocate a list of qubits. Args: qubit_num: The number of qubits to allocate. Returns: A reference to the vector of allocated qubits. .. py:method:: qFree(arg0: Qubit) -> None Free a previously allocated qubit. Args: qubit: The qubit to be freed. .. py:method:: qFree_all(arg0: QVec) -> None qFree_all() -> None Free all allocated qubits in the pool. This method releases all qubits that have been allocated previously. .. py:method:: set_capacity(arg0: int) -> None Set the capacity of the OriginQubitPool. Args: capacity: An integer representing the new capacity to be set. .. py:class:: PartialAmpQVM Bases: :py:obj:`QuantumMachine` quantum partial amplitude machine class .. py:method:: get_prob_dict(arg0: QVec) -> Dict[str, float] Get the measurement results as a dictionary. Args: qubit_list: A list of qubits to measure. Returns: A dictionary containing the measurement results of the quantum machine. .. py:method:: init_qvm(backend_type: int = 0) -> None .. py:method:: pmeasure_bin_index(bin_index: str) -> complex Get the amplitude of the quantum state for the specified bin index. Args: bin_index: A string representing the bin. Returns: A complex number representing the amplitude of the bin. .. py:method:: pmeasure_dec_index(dec_index: str) -> complex Get the amplitude of the quantum state for the specified decimal index. Args: dec_index: A string representing the decimal. Returns: A complex number representing the amplitude of the decimal. .. py:method:: pmeasure_subset(index_list: List[str]) -> Dict[str, complex] Get the amplitudes of the quantum state for a subset of indices. Args: index_list: A list of strings representing decimal states. Returns: A list of complex numbers representing the amplitude results. .. py:method:: prob_run_dict(arg0: QProg, arg1: QVec) -> Dict[str, float] Run the quantum program and get the measurement results as a dictionary. Args: qprog: The quantum program to execute. qubit_list: A list of qubits to measure. Returns: A dictionary containing the measurement results of the quantum machine. .. py:method:: run(qprog: QProg, noise_model: Noise = NoiseModel()) -> None run(qprog: QCircuit, noise_model: Noise = NoiseModel()) -> None Run the quantum program. Args: qprog: The quantum circuit to execute. noise_model: An optional noise model (default is NoiseModel()). Returns: None. .. py:class:: PhysicalQubit(*args, **kwargs) Physical Qubit abstract class .. py:method:: getQubitAddr() -> int Retrieve the address of the physical qubit. This function returns the address of the physical qubit associated with the instance. Args: None Returns: The address of the physical qubit. .. py:class:: PilotNoiseParams(*args, **kwargs) pliot noise simulate params .. py:attribute:: double_gate_param :type: float .. py:attribute:: double_p2 :type: float .. py:attribute:: double_pgate :type: float .. py:attribute:: noise_model :type: str .. py:attribute:: single_gate_param :type: float .. py:attribute:: single_p2 :type: float .. py:attribute:: single_pgate :type: float .. py:class:: ProgCount .. py:attribute:: double_gate_layer_num :type: int .. py:attribute:: double_gate_num :type: int .. py:attribute:: gate_num :type: int .. py:attribute:: layer_num :type: int .. py:attribute:: multi_control_gate_num :type: int .. py:attribute:: node_num :type: int .. py:attribute:: selected_gate_nums :type: Dict[GateType, int] .. py:attribute:: single_gate_layer_num :type: int .. py:attribute:: single_gate_num :type: int .. py:class:: QCircuit QCircuit(arg0: NodeIter) quantum circuit node .. py:method:: begin() -> NodeIter Get an iterator to the first node in the circuit. Returns: Iterator: An iterator pointing to the first node. .. py:method:: control(control_qubits: QVec) -> QCircuit Apply a control operation to the circuit. Args: control_qubits (list): A list of qubits that will act as control qubits. Returns: QCircuit: The circuit with the control operation applied. .. py:method:: dagger() -> QCircuit Compute the adjoint (dagger) of the circuit. Returns: QCircuit: The adjoint of this circuit. .. py:method:: end() -> NodeIter Get an iterator to the end of the circuit. Returns: Iterator: An iterator pointing to the end of the nodes. .. py:method:: head() -> NodeIter Get an iterator to the head of the circuit. Returns: Iterator: An iterator pointing to the head node. .. py:method:: insert(arg0: QCircuit) -> QCircuit insert(arg0: QGate) -> QCircuit Insert a QGate into this circuit. Args: gate (QGate): The gate to be inserted. Returns: QCircuit: A reference to this circuit after the gate insertion. .. py:method:: is_empty() -> bool Check if the circuit is empty. Returns: bool: True if the circuit has no gates; otherwise, False. .. py:method:: last() -> NodeIter Get an iterator to the last node in the circuit. Returns: Iterator: An iterator pointing to the last node. .. py:method:: set_control(control_qubits: QVec) -> None Set control qubits for the circuit. Args: control_qubits (list): A list of qubits to be set as control qubits. .. py:method:: set_dagger(arg0: bool) -> None Set the dagger property of the circuit. This method modifies the circuit to represent its adjoint. .. py:class:: QCircuitOPtimizerMode(value: int) Quantum circuit optimize mode Members: Merge_H_X Merge_U3 Merge_RX Merge_RY Merge_RZ .. py:attribute:: Merge_H_X :type: ClassVar[QCircuitOPtimizerMode] :value: Ellipsis .. py:attribute:: Merge_RX :type: ClassVar[QCircuitOPtimizerMode] :value: Ellipsis .. py:attribute:: Merge_RY :type: ClassVar[QCircuitOPtimizerMode] :value: Ellipsis .. py:attribute:: Merge_RZ :type: ClassVar[QCircuitOPtimizerMode] :value: Ellipsis .. py:attribute:: Merge_U3 :type: ClassVar[QCircuitOPtimizerMode] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: QError(value: int) Quantum QError Type Members: UndefineError qErrorNone qParameterError qubitError loadFileError initStateError destroyStateError setComputeUnitError runProgramError getResultError getQStateError .. py:attribute:: UndefineError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: destroyStateError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: getQStateError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: getResultError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: initStateError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: loadFileError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: qErrorNone :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: qParameterError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: qubitError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: runProgramError :type: ClassVar[QError] :value: Ellipsis .. py:attribute:: setComputeUnitError :type: ClassVar[QError] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: QGate(arg0: NodeIter) quantum gate node .. py:method:: control(control_qubits: QVec) -> QGate Get a controlled quantum gate based on the current QGate instance. This function creates a control version of the quantum gate using the specified control qubits. Args: control_qubits: A list of qubits that serve as control qubits for the gate. Returns: A new QGate instance representing the controlled gate. .. py:method:: dagger() -> QGate dagger() -> Any .. py:method:: gate_matrix() -> List[complex] Get the matrix representation of the quantum gate. Args: qgate: The quantum gate instance. Returns: QStat: The matrix representation of the quantum gate. .. py:method:: gate_type() -> int Get the type of the quantum gate. Args: qgate: The quantum gate instance. Returns: The type of the quantum gate. .. py:method:: get_control_qubit_num() -> int Retrieve the number of control qubits for the QGate instance. This function returns the count of qubits that act as control qubits for the gate. Args: None Returns: An integer representing the number of control qubits. .. py:method:: get_control_qubits(control_qubits: QVec) -> int Get the control vector from the current quantum gate node. Args: control_qubits: The control qubits output vector. Returns: int: Size of the control qubits. .. py:method:: get_qubits(qubits: QVec) -> int Get the qubit vector inside this quantum gate. Args: qubits: The qubits output vector. Returns: int: Size of the qubits. .. py:method:: get_target_qubit_num() -> int Retrieve the number of target qubits for the QGate instance. This function returns the count of qubits that the quantum gate affects. Args: None Returns: An integer representing the number of target qubits. .. py:method:: is_dagger() -> bool Check if the QGate instance is a dagger (Hermitian conjugate) of another gate. This function determines whether the current gate is the adjoint of its corresponding gate. Args: None Returns: A boolean indicating whether the current gate is a dagger. .. py:method:: set_control(arg0: QVec) -> bool Set the control qubits for the QGate instance. This function specifies which qubits will act as control qubits for the gate. Args: control_qubits: A list of qubits that will serve as control qubits. Returns: None .. py:method:: set_dagger(arg0: bool) -> bool Set the QGate instance to be a dagger (Hermitian conjugate) of another gate. This function configures the current gate to represent its adjoint. Args: None Returns: None .. py:class:: QITE quantum imaginary time evolution .. py:method:: exec(is_optimization: bool = True) -> int .. py:method:: get_all_exec_result(reverse: bool = False, sort: bool = False) -> List[List[Tuple[int, float]]] .. py:method:: get_ansatz_list(*args, **kwargs) -> Any .. py:method:: get_ansatz_theta_list() -> List[List[float]] .. py:method:: get_arbitary_cofficient(arg0: float) -> None .. py:method:: get_exec_result(reverse: bool = False, sort: bool = False) -> List[Tuple[int, float]] .. py:method:: get_result() -> List[Tuple[int, float]] .. py:method:: set_Hamiltonian(arg0) -> None .. py:method:: set_ansatz_gate(arg0) -> None .. py:method:: set_convergence_factor_Q(arg0: float) -> None .. py:method:: set_delta_tau(arg0: float) -> None .. py:method:: set_iter_num(arg0: int) -> None .. py:method:: set_log_file(arg0: str) -> None .. py:method:: set_para_update_mode(arg0: UpdateMode) -> None .. py:method:: set_pauli_matrix(arg0: QuantumMachine, arg1: numpy.ndarray[numpy.float64[m, n]]) -> None .. py:method:: set_quantum_machine_type(arg0: QMachineType) -> None .. py:method:: set_upthrow_num(arg0: int) -> None .. py:class:: QIfProg(arg0: NodeIter) QIfProg(classical_cond: ClassicalCondition, true_branch_qprog: QProg) QIfProg(classical_cond: ClassicalCondition, true_branch_qprog: QProg, false_branch_qprog: QProg) quantum if prog node .. py:method:: get_classical_condition() -> ClassicalCondition Retrieve the classical condition associated with the quantum if program. Returns: The classical condition object used in the if statement. .. py:method:: get_false_branch() -> QProg Get the quantum program corresponding to the false branch. Returns: QProg: The quantum program for the false branch, or an empty QProg if null. Raises: runtime_error: If the false branch has an incorrect node type. .. py:method:: get_true_branch() -> QProg Get the quantum program corresponding to the true branch. Returns: QProg: The quantum program for the true branch. Raises: runtime_error: If the true branch is null or has an incorrect node type. .. py:class:: QMachineType(value: int) Quantum machine type Members: CPU GPU CPU_SINGLE_THREAD NOISE .. py:attribute:: CPU :type: ClassVar[QMachineType] :value: Ellipsis .. py:attribute:: CPU_SINGLE_THREAD :type: ClassVar[QMachineType] :value: Ellipsis .. py:attribute:: GPU :type: ClassVar[QMachineType] :value: Ellipsis .. py:attribute:: NOISE :type: ClassVar[QMachineType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: QMeasure(arg0: NodeIter) quantum measure node .. py:class:: QOperator QOperator(arg0: QGate) QOperator(arg0: QCircuit) quantum operator class .. py:method:: get_matrix() -> List[complex] Retrieve the matrix representation of the QOperator. Args: None Returns: The matrix representation of the QOperator. .. py:method:: to_instruction(arg0: str) -> str Convert the QOperator to an instruction representation. Args: None Returns: The instruction representation of the QOperator. .. py:class:: QOptimizationResult(arg0: str, arg1: int, arg2: int, arg3: str, arg4: float, arg5: List[float]) quantum QOptimizationResult class .. py:attribute:: fcalls :type: int .. py:attribute:: fun_val :type: float .. py:attribute:: iters :type: int .. py:attribute:: key :type: str .. py:attribute:: message :type: str .. py:attribute:: para :type: List[float] .. py:class:: QPilotOSService(machine_type: str = 'CPU') Bases: :py:obj:`QuantumMachine` origin quantum pilot OS Machine .. py:method:: build_expectation_task_msg(prog: QProg, hamiltonian: str, qubits: List[int] = [], shot: int = 1000, chip_id: int = 33554432, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, specified_block: List[int] = [], task_describe: str = '') -> str use C++ to build a expectation task body. .. py:method:: build_init_msg(api_key: str) -> str .. py:method:: build_qst_task_msg(prog: QProg, shot: int = 1000, chip_id: int = 33554432, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, specified_block: List[int] = [], task_describe: str = '') -> str use C++ to build ordinary qst task msg body .. py:method:: build_query_msg(task_id: str) -> str .. py:method:: build_task_msg(prog: List[QProg], shot: int, chip_id: int, is_amend: bool, is_mapping: bool, is_optimization: bool, specified_block: List[int], task_describe: str) -> str use c++ to build real chip measure task msg body. .. py:method:: cAlloc() -> ClassicalCondition cAlloc(cbit: int) -> ClassicalCondition Allocate a cbit .. py:method:: cAlloc_many(cbit_num: int) -> List[ClassicalCondition] Allocate a list of cbits .. py:method:: cFree(arg0: ClassicalCondition) -> None Free a cbit .. py:method:: cFree_all(cbit_list: List[ClassicalCondition]) -> None cFree_all() -> None Free all of cbits .. py:method:: finalize() -> None finalize .. py:method:: get_token(rep_json: str) -> ErrorCode .. py:method:: init() -> None .. py:method:: init_config(url: str, log_cout: bool) -> None .. py:method:: parse_prob_counts_result(result_str: List[str]) -> List[Dict[str, int]] Parse result str to map Args: result_str: Taeget result string Returns: array: vector> Raises: none .. py:method:: parse_probability_result(result_str: List[str]) -> List[Dict[str, float]] Parse result str to map Args: result_str: Taeget result string Returns: array: vector> Raises: none .. py:method:: parse_task_result(result_str: str) -> Dict[str, float] Parse result str to map Args: result_str: Taeget result string Returns: dict: map Raises: none .. py:method:: parser_expectation_result(json_str: str) -> list deprecated, use Python's json lib. .. py:method:: parser_sync_result(json_str: str) -> list .. py:method:: qAlloc() -> Qubit Allocate a qubit .. py:method:: qAlloc_many(qubit_num: int) -> List[Qubit] Allocate a list of qubits .. py:method:: qFree(qubit: Qubit) -> None Free a qubit .. py:method:: qFree_all(qubit_list: QVec) -> None qFree_all(arg0: QVec) -> None Free all of qubits .. py:method:: set_config(max_qubit: int, max_cbit: int) -> None set QVM max qubit and max cbit Args: max_qubit: quantum machine max qubit num max_cbit: quantum machine max cbit num Returns: none Raises: run_fail: An error occurred in set_configure .. py:method:: tcp_recv(ip: str, port: int, task_id: str) -> list .. py:class:: QProg QProg(arg0: QProg) QProg(arg0: QCircuit) QProg(arg0: QIfProg) QProg(arg0: QWhileProg) QProg(arg0: QGate) QProg(arg0: QMeasure) QProg(arg0: QReset) QProg(arg0: ClassicalCondition) QProg(arg0: NodeIter) Quantum program,can construct quantum circuit,data struct is linked list .. py:method:: begin() -> NodeIter Get an iterator to the first node in the program. Returns: A reference to the iterator pointing to the first node. .. py:method:: end() -> NodeIter Get an iterator to the end of the program. Returns: A reference to the iterator pointing past the last node. .. py:method:: get_max_qubit_addr() -> int .. py:method:: get_qgate_num() -> int .. py:method:: get_used_cbits(cbit_vector: List[ClassicalCondition]) -> List[ClassicalCondition] Get a list of classical bits used in the program. Args: cbit_vector: The vector to store the used classical bits. Returns: A reference to the updated classical bit vector. .. py:method:: get_used_qubits(qubit_vector: QVec) -> QVec Get a list of qubits used in the program. Args: qubit_vector: The vector to store the used qubits. Returns: A reference to the updated qubit vector. .. py:method:: head() -> NodeIter Get an iterator to the head node of the program. Returns: A reference to the iterator pointing to the head node. .. py:method:: insert(arg0: QProg) -> QProg insert(arg0: QGate) -> QProg insert(arg0: QCircuit) -> QProg insert(arg0: QIfProg) -> QProg insert(arg0: QWhileProg) -> QProg insert(arg0: QMeasure) -> QProg insert(arg0: QReset) -> QProg insert(arg0: ClassicalCondition) -> QProg Insert a ClassicalCondition into the program. Args: condition_op: The classical condition operation to be inserted. Returns: A reference to the updated program. .. py:method:: is_empty() -> bool .. py:method:: is_measure_last_pos() -> bool Check if the last operation in the program is a measurement. Returns: True if the last operation is a measurement, otherwise False. .. py:method:: last() -> NodeIter Get an iterator to the last node in the program. Args: None Returns: A reference to the iterator pointing to the last node. .. py:class:: QProgDAG quantum prog dag class .. py:method:: get_edges() -> List[QProgDAGEdge] Retrieve the set of edges in the quantum program DAG. Returns: List[QProgDAGEdge]: A list of edges in the DAG. .. py:method:: get_target_vertex(vertice_num: int) -> QProgDAGVertex Retrieve a target vertex from the quantum program DAG. Args: vertice_num: The index of the vertex to retrieve. Returns: QVertex: A reference to the specified vertex in the DAG. .. py:method:: get_vertex_set() -> List[QProgDAGVertex] Retrieve the set of vertices in the quantum program DAG. Args: QVec: The set of vertices. Returns: QVec: A reference to the vector of vertices in the DAG. .. py:class:: QProgDAGEdge(from_arg: int, to_arg: int, qubit_arg: int) quantum prog dag edge .. py:attribute:: m_from :type: int .. py:attribute:: m_qubit :type: int .. py:attribute:: m_to :type: int .. py:class:: QProgDAGVertex quantum prog dag vertex node .. py:attribute:: m_id :type: int .. py:attribute:: m_layer :type: int .. py:attribute:: m_pre_node :type: List[int] .. py:attribute:: m_succ_node :type: List[int] .. py:attribute:: m_type :type: DAGNodeType .. py:method:: get_control_vec() -> QVec Retrieve the vector of control qubits associated with the vertex. .. py:method:: get_iter() -> NodeIter Retrieve the iterator associated with the vertex. .. py:method:: get_qubits_vec() -> QVec Retrieve the vector of qubits associated with the vertex. .. py:method:: is_dagger() -> bool Check if the vertex is a dagger operation. .. py:class:: QReset(arg0: NodeIter) quantum reset node .. py:class:: QResult(*args, **kwargs) QResult abstract class, this class contains the result of the quantum measurement .. py:method:: getResultMap() -> Dict[str, bool] .. py:class:: QVec QVec(qubit_list: List[Qubit]) QVec(qvec: QVec) QVec(qubit: Qubit) Qubit vector basic class .. py:method:: append(qubit: Qubit) -> None Add a qubit to the end of the QVec. Args: qubit: A pointer to the Qubit to be added. Returns: None. .. py:method:: pop() -> None Remove and return the last qubit from the QVec. Args: None Returns: A pointer to the removed Qubit. .. py:method:: to_list() -> List[Qubit] Convert the QVec to a standard vector of qubit pointers. Args: None Returns: A vector containing pointers to the qubits in the QVec. .. py:class:: QWhileProg(arg0: NodeIter) QWhileProg(arg0: ClassicalCondition, arg1: QProg) quantum while node .. py:method:: get_classical_condition() -> ClassicalCondition Retrieve the classical condition associated with the while program. Returns: The classical condition object used in the while statement. .. py:method:: get_true_branch() -> QProg Retrieve the quantum program corresponding to the true branch. Returns: QProg: The quantum program for the true branch. Raises: runtime_error: If the true branch is null or has an incorrect node type. .. py:class:: QuantumMachine(*args, **kwargs) quantum machine base class .. py:method:: allocate_qubit_through_phy_address(address: int) -> Qubit Allocate qubits through physical address. This function allocates qubits using the specified physical address. Args: address: The physical address of the qubit. Returns: The allocated qubit. .. py:method:: allocate_qubit_through_vir_address(address: int) -> Qubit Allocate a qubit using its physical address. This function allocates a qubit based on the specified physical address. Args: address: The physical address of the qubit to allocate. Returns: A reference to the allocated Qubit. .. py:method:: async_run(qprog: QProg, noise_model: Noise = NoiseModel()) -> None Execute the quantum program asynchronously in the background. This function runs the specified quantum program without blocking the main thread. You can check the progress using get_processed_qgate_num(), determine if the process is finished with is_async_finished(), and retrieve results with get_async_result(). Args: qprog: The quantum program to run. noise_model: (optional) The noise model to apply (default is NoiseModel()). Returns: A reference indicating the status of the asynchronous operation. .. py:method:: cAlloc() -> ClassicalCondition cAlloc(cbit: int) -> ClassicalCondition Allocate a classical bit (CBit) in the QuantumMachine. This function allocates a CBit after the quantum machine has been initialized. Args: cbit_addr: The address of the CBit to allocate, which should be in the range [0, 29). Returns: Reference to the allocated CBit. .. py:method:: cAlloc_many(cbit_num: int) -> List[ClassicalCondition] Allocate multiple classical bits (CBits). This function must be called after init(). Args: cbit_num: The number of classical bits to allocate. Returns: list[CBit]: A list of allocated classical bits. .. py:method:: cFree(arg0: ClassicalCondition) -> None Free a classical bit (CBit). This function deallocates a previously allocated classical bit. Args: CBit: The classical bit to be freed. Returns: None: This function does not return a value. .. py:method:: cFree_all(cbit_list: List[ClassicalCondition]) -> None cFree_all() -> None Free all classical bits (CBits). This function deallocates all classical bits that have been previously allocated. Args: None Returns: None: This function does not return a value. .. py:method:: directly_run(qprog: QProg, noise_model: Noise = NoiseModel()) -> Dict[str, bool] Directly execute the quantum program. This function runs the specified quantum program immediately after the initialization (init()). It supports an optional noise model, which is currently only applicable to CPUQVM. Args: qprog: The quantum program to run. noise_model: (optional) The noise model to apply (default is no noise). Returns: A dictionary with the execution results: The final qubit register state. The measurement probabilities. .. py:method:: finalize() -> None Finalize the quantum machine. Args: None Returns: None .. py:method:: getAllocateCMem() -> int Get the list of allocated classical bits (cbits) in the QuantumMachine. This function retrieves the cbits that have been allocated for use in the quantum machine. Args: None Returns: List of allocated cbits. .. py:method:: getAllocateQubitNum() -> int Get the list of allocated qubits in the QuantumMachine. This function retrieves the qubits that have been allocated for use in the quantum machine. Args: None Returns: List of allocated qubits. .. py:method:: getStatus(*args, **kwargs) -> Any Get the status of the Quantum machine. This function retrieves the current status of the Quantum machine. Args: None Returns: QMachineStatus: The status of the Quantum machine. .. py:method:: get_allocate_cbits() -> List[ClassicalCondition] Retrieve the list of allocated cbits in the QuantumMachine. This function returns a list of currently allocated cbits. Args: None Returns: A list of allocated cbits. .. py:method:: get_allocate_cmem_num() -> int Retrieve the list of allocated cbits in the QuantumMachine. This function returns the currently allocated cbits. Args: None Returns: A list of allocated cbits. .. py:method:: get_allocate_qubit_num() -> int Retrieve the list of allocated qubits in the QuantumMachine. This function returns the currently allocated qubits. Args: None Returns: A list of allocated qubits. .. py:method:: get_allocate_qubits() -> List[Qubit] Retrieve the list of allocated qubits in the QuantumMachine. This function returns a list of currently allocated qubits. Args: None Returns: A list of allocated qubits. .. py:method:: get_async_result() -> Dict[str, bool] Retrieve the result of the asynchronous quantum program execution. This function blocks the current code until the asynchronous process initiated by async_run() is complete, then returns the results. Returns: The result of the asynchronous execution. .. py:method:: get_expectation(qprog: QProg, hamiltonian: List[Tuple[Dict[int, str], float]], qubit_list: QVec) -> float get_expectation(qprog: QProg, hamiltonian: List[Tuple[Dict[int, str], float]], qubit_list: QVec, shots: int) -> float Calculate the expectation value of the given Hamiltonian with specified measurement shots. This function computes the expectation value based on the provided quantum program, Hamiltonian, list of qubits to measure, and the number of measurement shots. Args: qprog: The quantum program to execute. hamiltonian: The Hamiltonian for which the expectation is calculated. qubit_list: A list of qubits to measure. shots: The number of measurement shots to perform. Returns: A double representing the expectation value of the current Hamiltonian. .. py:method:: get_gate_time_map() -> Dict[GateType, int] Retrieve the gate time mapping for the QuantumMachine. This function returns a map of gates to their corresponding execution times. Args: None Returns: A reference to the gate time map. .. py:method:: get_processed_qgate_num() -> int Retrieve the number of processed quantum gates. This function returns the total count of quantum gates that have been processed by the QuantumMachine. Returns: An integer representing the number of processed quantum gates. .. py:method:: get_qstate() -> List[complex] Get the status of the quantum machine. Args: None Returns: QMachineStatus: The current status of the quantum machine. .. py:method:: get_status(*args, **kwargs) -> Any Retrieve the status of the QuantumMachine. This function returns the current status of the quantum machine. Args: None Returns: The status of the Quantum machine, represented as a QMachineStatus. .. py:method:: initQVM() -> None Initialize the global unique quantum machine in the background. This function sets up the quantum machine based on the specified type. Args: machine_type: The type of quantum machine to initialize, as defined in pyQPanda.QMachineType. Returns: bool: True if the initialization is successful, otherwise false. .. py:method:: init_qvm() -> None Initialize the global unique quantum machine in the background. This function sets up the quantum machine based on the specified type. Args: machine_type: The type of quantum machine to initialize, as defined in pyQPanda.QMachineType. Returns: bool: True if the initialization is successful, otherwise false. .. py:method:: init_sparse_state(*args, **kwargs) -> Any Initialize a sparse quantum state for the QuantumMachine. This function sets the initial sparse state of the quantum machine. Args: state: A map representing the sparse state, where keys are state identifiers and values are qcomplex_t. Defaults to an empty map. qlist: The list of qubits to which the sparse state will be applied, represented as a QVec object. Defaults to QVec(). Returns: Reference to the updated quantum machine. .. py:method:: init_state(state: List[complex] = QStat(), qlist: QVec = QVec()) -> None Initialize the quantum state of the QuantumMachine. This function sets the initial state of the quantum machine. Args: state: The initial quantum state, represented as a QStat object. Defaults to QStat(). qlist: The list of qubits to which the state will be applied, represented as a QVec object. Defaults to QVec(). Returns: Reference to the updated quantum machine. .. py:method:: is_async_finished() -> bool Check if the asynchronous quantum program execution is complete. This function returns a boolean indicating whether the asynchronous process initiated by async_run() has finished. Returns: True if the process is complete, False otherwise. .. py:method:: qAlloc() -> Qubit Allocate a qubit. This function must be called after init(). Args: qubit_addr: The physical address of the qubit, should be in the range [0, 29). .. py:method:: qAlloc_many(qubit_num: int) -> List[Qubit] Allocate multiple qubits. This function must be called after init(). Args: qubit_num: The number of qubits to allocate. Returns: list[Qubit]: A list of allocated qubits. .. py:method:: qFree(qubit: Qubit) -> None Free a qubit. This function deallocates a previously allocated qubit. Args: qubit: The Qubit to be freed. Returns: None: This function does not return a value. .. py:method:: qFree_all(qubit_list: QVec) -> None qFree_all(arg0: QVec) -> None Free all qubits. This function deallocates all qubits provided in the input vector. Args: None Returns: None: This function does not return a value. .. py:method:: run_with_configuration(qprog: QProg, cbit_list: List[ClassicalCondition], data: dict, noise_model: Noise = NoiseModel()) -> Dict[str, int] run_with_configuration(qprog: QProg, cbit_list: List[ClassicalCondition], shot: int, noise_model: Noise = NoiseModel()) -> Dict[str, int] run_with_configuration(qprog: QProg, shot: int, noise_model: Noise = NoiseModel()) -> Dict[str, int] run_with_configuration(qprog: QProg, cbit_list: List[int], shot: int, noise_model: Noise = NoiseModel()) -> Dict[str, int] Execute the quantum program with a specified configuration. This function runs the quantum program using the provided classical bits, the number of shots for repeated execution, and an optional noise model. Args: qprog: The quantum program to execute. cbit_list: The list of classical bits. shot: The number of times to repeat the execution. noise_model: (optional) The noise model to apply (default is no noise). Note: Noise models currently work only on CPUQVM. Returns: A tuple containing the execution results over the specified shots: The final qubit register state. The count of hits for each outcome. .. py:method:: set_configure(max_qubit: int, max_cbit: int) -> None Set the maximum qubit and cbit numbers for the QVM. Args: max_qubit: Maximum number of qubits in the quantum machine. max_cbit: Maximum number of cbits in the quantum machine. Returns: None .. py:class:: QuantumStateTomography quantum state tomography class .. py:method:: caculate_tomography_density() -> List[List[complex]] Calculate the tomography density. Returns: A reference to the calculated density matrix. .. py:method:: combine_qprogs(circuit: QProg, qlist: QVec) -> List[QProg] combine_qprogs(circuit: QCircuit, qlist: QVec) -> List[QProg] combine_qprogs(circuit: QProg, qlist: List[int]) -> List[QProg] combine_qprogs(circuit: QCircuit, qlist: List[int]) -> List[QProg] Return a list of quantum state tomography quantum programs. Args: circuit: The quantum circuit to be combined. qlist: A vector of indices representing the qubits involved. Returns: A reference to the combined quantum programs. .. py:method:: exec(qm, shots: int) -> List[List[complex]] Run state tomography quantum programs. Args: qm: The quantum machine to execute the programs on. shots: The number of shots for the execution. Returns: A reference to the execution results. .. py:method:: set_qprog_results(qlist: int, results: List[Dict[str, float]]) -> None Set the results of combined quantum programs. Args: qlist: The index of the qubit list. results: A vector of maps containing the result data. Returns: A reference to the updated state. Raises: run_fail: An error occurred while setting the results. .. py:class:: Qubit(*args, **kwargs) Qubit abstract class .. py:method:: getPhysicalQubitPtr() -> PhysicalQubit Retrieve a pointer to the associated physical qubit. This function returns a pointer to the physical qubit that corresponds to this qubit instance. Args: None Returns: A pointer to the associated physical qubit. .. py:method:: get_phy_addr() -> int Retrieve the physical address of the qubit. This function returns the physical address associated with this qubit instance. Args: None Returns: The physical address of the qubit. .. py:class:: RMSPropOptimizer(arg0: var, arg1: float, arg2: float, arg3: float) variational quantum RMSPropOptimizer .. py:method:: get_loss() -> float .. py:method:: get_variables() -> List[var] .. py:method:: minimize(arg0: float, arg1: float, arg2: float) -> Optimizer .. py:method:: run(arg0: List[var], arg1: int) -> bool .. py:class:: SingleAmpQVM Bases: :py:obj:`QuantumMachine` quantum single amplitude machine class .. py:method:: get_prob_dict(arg0: QVec) -> Dict[str, float] get_prob_dict(arg0: List[int]) -> Dict[str, float] Get the pmeasure result as a dictionary. Args: qubit_list: A list of qubits for pmeasure. Returns: A dictionary containing the measurement results of the quantum machine. .. py:method:: get_quick_map_vertice(arg0: List[Tuple[int, int]]) -> None Get the quick map vertices. Returns: A reference to the quick map vertices. .. py:method:: get_sequence(arg0: List[int], arg1: List[List[Tuple[int, bool]]]) -> int Get the program sequence. Returns: A reference to the current program sequence. .. py:method:: pmeasure_bin_amplitude(arg0: str) -> complex Measure the bin amplitude of the quantum state. Args: bin_string: A string representing the bin. Returns: A complex number representing the bin amplitude. .. py:method:: pmeasure_bin_index(arg0: str) -> float Measure the bin index of the quantum state amplitude. Args: bin_string: A string representing the bin. Returns: A double representing the amplitude probability of the bin. .. py:method:: pmeasure_dec_amplitude(arg0: str) -> complex Measure the dec amplitude of the quantum state. Args: dec_string: A string representing the dec. Returns: A complex number representing the dec amplitude. .. py:method:: pmeasure_dec_index(arg0: str) -> float Measure the dec index of the quantum state amplitude. Args: dec_string: A string representing the dec. Returns: A double representing the amplitude probability of the dec. .. py:method:: prob_run_dict(arg0: QProg, arg1: QVec) -> Dict[str, float] prob_run_dict(arg0: QProg, arg1: List[int]) -> Dict[str, float] Run the quantum program and get the pmeasure result as a dictionary. Args: qprog: The quantum program to run. qubit_list: A list of qubits for pmeasure. Returns: A dictionary containing the measurement results of the quantum machine. .. py:method:: run(prog: QProg, qv: QVec, max_rank: int = 30, alloted_time: int = 5) -> None run(arg0: QProg, arg1: QVec, arg2: int, arg3: List[List[Tuple[int, bool]]]) -> None Run the quantum program. Args: prog: A quantum program (QProg) to be executed. qv: A list of qubits (QVec) involved in the program. max_rank: The maximum rank to consider during execution. sequences: A list of sequences (std::vector). Returns: None, as the function executes the program in place. .. py:class:: SingleGateTransferType(value: int) Quantum single gate transfer type Members: SINGLE_GATE_INVALID ARBITRARY_ROTATION DOUBLE_CONTINUOUS SINGLE_CONTINUOUS_DISCRETE DOUBLE_DISCRETE .. py:attribute:: ARBITRARY_ROTATION :type: ClassVar[SingleGateTransferType] :value: Ellipsis .. py:attribute:: DOUBLE_CONTINUOUS :type: ClassVar[SingleGateTransferType] :value: Ellipsis .. py:attribute:: DOUBLE_DISCRETE :type: ClassVar[SingleGateTransferType] :value: Ellipsis .. py:attribute:: SINGLE_CONTINUOUS_DISCRETE :type: ClassVar[SingleGateTransferType] :value: Ellipsis .. py:attribute:: SINGLE_GATE_INVALID :type: ClassVar[SingleGateTransferType] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: SparseQVM Bases: :py:obj:`QuantumMachine` quantum sparse machine class .. py:method:: directlyRun(arg0: QProg) -> Dict[str, bool] Run the quantum program and get the measurement results as a dictionary. Args: qprog: The quantum program to execute. Returns: Dict[str, bool]: The result of the quantum program execution in one shot. .. py:method:: directly_run(arg0: QProg) -> Dict[str, bool] Run the quantum program and get the measurement results as a dictionary. Args: qprog: The quantum program to execute. Returns: The measurement results of the quantum machine. .. py:method:: init_qvm() -> None init quantum virtual machine .. py:method:: prob_run_dict(arg0: QProg) -> Dict[str, float] Run the quantum program and get the measurement results as a dictionary. Args: qprog: The quantum program to execute. Returns: A dictionary containing the measurement results of the quantum machine. .. py:method:: run_with_configuration(arg0: QProg, arg1: List[ClassicalCondition], arg2: int) -> Dict[str, int] Run the quantum program with the specified configuration and get the measurement results as a dictionary. Args: qprog: The quantum program to execute. cbits: The quantum classical bits. shots: The number of sample shots. Returns: The measurement results of the quantum machine. .. py:class:: Stabilizer Bases: :py:obj:`QuantumMachine` simulator for basic clifford simulator .. py:method:: init_qvm() -> None init quantum virtual machine .. py:method:: prob_run_dict(qprog: QProg, qubits: QVec, select_max: int = -1) -> Dict[str, float] Run quantum program and get probabilities. Args: qprog: Quantum program to execute. qubits: Qubits to be measured for probabilities. select_max: Optional, selects the maximum number of probabilities to return. Returns: Probabilities result of the quantum program. .. py:method:: run_with_configuration(qprog: QProg, shot: int) -> Dict[str, int] Run quantum program and get shots result. Args: qprog: Quantum program to execute. shot: Number of measurement shots. Returns: Shots result of the quantum program. .. py:method:: set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: List[GateType], arg2: float, arg3: QVec) -> None set_noise_model(arg0: NoiseModel, arg1: GateType, arg2: float, arg3: List[QVec]) -> None Set a noise model for the Stabilizer simulator with a specific gate type, probability, and multiple targeted qubits. Args: noise_model: The noise model to apply (e.g., bit-flip, phase-flip, etc.). gate_type: The specific gate type associated with the noise model. probability: The probability of the noise occurring. target_qubits: A vector of qubit vectors targeted by the noise model. Returns: None. .. py:class:: UpdateMode(value: int) quantum imaginary time evolution update mode Members: GD_VALUE GD_DIRECTION .. py:attribute:: GD_DIRECTION :type: ClassVar[UpdateMode] :value: Ellipsis .. py:attribute:: GD_VALUE :type: ClassVar[UpdateMode] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: VanillaGradientDescentOptimizer(arg0: var, arg1: float, arg2: float, arg3: OptimizerMode) variational quantum VanillaGradientDescentOptimizer .. py:method:: get_loss() -> float .. py:method:: get_variables() -> List[var] .. py:method:: minimize(arg0: float, arg1: float) -> Optimizer .. py:method:: run(arg0: List[var], arg1: int) -> bool .. py:class:: VariationalQuantumCircuit VariationalQuantumCircuit(arg0: QCircuit) variational quantum CIRCUIT class .. py:method:: control(arg0: QVec) -> VariationalQuantumCircuit .. py:method:: dagger() -> VariationalQuantumCircuit .. py:method:: feed() -> QCircuit feed(arg0) -> QCircuit .. py:method:: get_control_qubit() -> QVec .. py:method:: insert(arg0: VariationalQuantumGate_I) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_H) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_X) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_Y) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_T) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_S) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_Z) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_X1) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_Y1) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_Z1) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_U1) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_U2) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_U3) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_U4) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_RX) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_RY) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_RZ) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_CNOT) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_CR) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_CZ) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_CRX) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_CRY) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_CRZ) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_SWAP) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_iSWAP) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumGate_SqiSWAP) -> VariationalQuantumCircuit insert(arg0: VariationalQuantumCircuit) -> VariationalQuantumCircuit insert(arg0: QCircuit) -> VariationalQuantumCircuit insert(arg0: QGate) -> VariationalQuantumCircuit .. py:method:: is_dagger() -> bool .. py:method:: set_control(arg0: QVec) -> bool .. py:method:: set_dagger(arg0: bool) -> bool .. py:class:: VariationalQuantumGate(*args, **kwargs) variational quantum gate base class .. py:method:: feed(arg0: Dict[int, float]) -> QGate .. py:method:: get_constants() -> List[float] .. py:method:: get_control_qubit() -> QVec .. py:method:: get_vars() -> List[var] .. py:method:: is_dagger() -> bool .. py:method:: set_control(arg0: QVec) -> bool .. py:method:: set_dagger(arg0: bool) -> bool .. py:class:: VariationalQuantumGate_CNOT(arg0: Qubit, arg1: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum CNOT gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_CNOT .. py:method:: dagger() -> VariationalQuantumGate_CNOT .. py:class:: VariationalQuantumGate_CR(arg0: Qubit, arg1: Qubit, arg2: float) VariationalQuantumGate_CR(arg0: Qubit, arg1: Qubit, arg2: var) VariationalQuantumGate_CR(arg0: VariationalQuantumGate_CR) Bases: :py:obj:`VariationalQuantumGate` variational quantum CR gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_CR .. py:method:: dagger() -> VariationalQuantumGate_CR .. py:class:: VariationalQuantumGate_CRX(arg0: Qubit, arg1: QVec, arg2: float) VariationalQuantumGate_CRX(arg0: Qubit, arg1: QVec, arg2: var) VariationalQuantumGate_CRX(arg0: VariationalQuantumGate_CRX) Bases: :py:obj:`VariationalQuantumGate` variational quantum CRX gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_CRX .. py:method:: dagger() -> VariationalQuantumGate_CRX .. py:class:: VariationalQuantumGate_CRY(arg0: Qubit, arg1: QVec, arg2: float) VariationalQuantumGate_CRY(arg0: Qubit, arg1: QVec, arg2: var) VariationalQuantumGate_CRY(arg0: VariationalQuantumGate_CRY) Bases: :py:obj:`VariationalQuantumGate` variational quantum CRY gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_CRY .. py:method:: dagger() -> VariationalQuantumGate_CRY .. py:class:: VariationalQuantumGate_CRZ(arg0: Qubit, arg1: QVec, arg2: float) VariationalQuantumGate_CRZ(arg0: Qubit, arg1: QVec, arg2: var) VariationalQuantumGate_CRZ(arg0: VariationalQuantumGate_CRZ) Bases: :py:obj:`VariationalQuantumGate` variational quantum CRZ gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_CRZ .. py:method:: dagger() -> VariationalQuantumGate_CRZ .. py:class:: VariationalQuantumGate_CU(arg0: Qubit, arg1: Qubit, arg2: float, arg3: float, arg4: float, arg5: float) VariationalQuantumGate_CU(arg0: Qubit, arg1: Qubit, arg2: var, arg3: var, arg4: var, arg5: var) VariationalQuantumGate_CU(arg0: VariationalQuantumGate_CU) Bases: :py:obj:`VariationalQuantumGate` variational quantum CU gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_CU .. py:method:: dagger() -> VariationalQuantumGate_CU .. py:class:: VariationalQuantumGate_CZ(arg0: Qubit, arg1: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum CZ gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_CZ .. py:method:: dagger() -> VariationalQuantumGate_CZ .. py:class:: VariationalQuantumGate_H(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum H gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_H .. py:method:: dagger() -> VariationalQuantumGate_H .. py:class:: VariationalQuantumGate_I(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum I gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_I .. py:method:: dagger() -> VariationalQuantumGate_I .. py:class:: VariationalQuantumGate_RX(arg0: Qubit, arg1: var) VariationalQuantumGate_RX(arg0: Qubit, arg1: float) Bases: :py:obj:`VariationalQuantumGate` variational quantum RX gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_RX .. py:method:: dagger() -> VariationalQuantumGate_RX .. py:class:: VariationalQuantumGate_RY(arg0: Qubit, arg1: var) VariationalQuantumGate_RY(arg0: Qubit, arg1: float) Bases: :py:obj:`VariationalQuantumGate` variational quantum RY gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_RY .. py:method:: dagger() -> VariationalQuantumGate_RY .. py:class:: VariationalQuantumGate_RZ(arg0: Qubit, arg1: var) VariationalQuantumGate_RZ(arg0: Qubit, arg1: float) Bases: :py:obj:`VariationalQuantumGate` variational quantum RZ gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_RZ .. py:method:: dagger() -> VariationalQuantumGate_RZ .. py:class:: VariationalQuantumGate_S(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum S gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_S .. py:method:: dagger() -> VariationalQuantumGate_S .. py:class:: VariationalQuantumGate_SWAP(arg0: Qubit, arg1: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum SWAP gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_SWAP .. py:method:: dagger() -> VariationalQuantumGate_SWAP .. py:class:: VariationalQuantumGate_SqiSWAP(arg0: Qubit, arg1: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum SqiSWAP gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_SqiSWAP .. py:method:: dagger() -> VariationalQuantumGate_SqiSWAP .. py:class:: VariationalQuantumGate_T(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum T gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_T .. py:method:: dagger() -> VariationalQuantumGate_T .. py:class:: VariationalQuantumGate_U1(arg0: Qubit, arg1: var) VariationalQuantumGate_U1(arg0: Qubit, arg1: float) Bases: :py:obj:`VariationalQuantumGate` variational quantum U1 gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_U1 .. py:method:: dagger() -> VariationalQuantumGate_U1 .. py:class:: VariationalQuantumGate_U2(arg0: Qubit, arg1: var, arg2: var) VariationalQuantumGate_U2(arg0: Qubit, arg1: float, arg2: float) Bases: :py:obj:`VariationalQuantumGate` variational quantum U2 gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_U2 .. py:method:: dagger() -> VariationalQuantumGate_U2 .. py:class:: VariationalQuantumGate_U3(arg0: Qubit, arg1: var, arg2: var, arg3: var) VariationalQuantumGate_U3(arg0: Qubit, arg1: float, arg2: float, arg3: float) Bases: :py:obj:`VariationalQuantumGate` variational quantum U3 gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_U3 .. py:method:: dagger() -> VariationalQuantumGate_U3 .. py:class:: VariationalQuantumGate_U4(arg0: Qubit, arg1: var, arg2: var, arg3: var, arg4: var) VariationalQuantumGate_U4(arg0: Qubit, arg1: float, arg2: float, arg3: float, arg4: float) Bases: :py:obj:`VariationalQuantumGate` variational quantum U4 gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_U4 .. py:method:: dagger() -> VariationalQuantumGate_U4 .. py:class:: VariationalQuantumGate_X(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum X gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_X .. py:method:: dagger() -> VariationalQuantumGate_X .. py:class:: VariationalQuantumGate_X1(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum X1 gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_X1 .. py:method:: dagger() -> VariationalQuantumGate_X1 .. py:class:: VariationalQuantumGate_Y(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum Y gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_Y .. py:method:: dagger() -> VariationalQuantumGate_Y .. py:class:: VariationalQuantumGate_Y1(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum Y1 gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_Y1 .. py:method:: dagger() -> VariationalQuantumGate_Y1 .. py:class:: VariationalQuantumGate_Z(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum Z gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_Z .. py:method:: dagger() -> VariationalQuantumGate_Z .. py:class:: VariationalQuantumGate_Z1(arg0: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum Z1 gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_Z1 .. py:method:: dagger() -> VariationalQuantumGate_Z1 .. py:class:: VariationalQuantumGate_iSWAP(arg0: Qubit, arg1: Qubit) Bases: :py:obj:`VariationalQuantumGate` variational quantum iSWAP gate class .. py:method:: control(arg0: QVec) -> VariationalQuantumGate_iSWAP .. py:method:: dagger() -> VariationalQuantumGate_iSWAP .. py:class:: em_method(value: int) origin quantum real chip error_mitigation type Members: ZNE PEC READ_OUT .. py:attribute:: PEC :type: ClassVar[em_method] :value: Ellipsis .. py:attribute:: READ_OUT :type: ClassVar[em_method] :value: Ellipsis .. py:attribute:: ZNE :type: ClassVar[em_method] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: expression(arg0: var) variational quantum expression class .. py:method:: backprop(arg0: Dict[var, numpy.ndarray[numpy.float64[m, n]]]) -> None backprop(arg0: Dict[var, numpy.ndarray[numpy.float64[m, n]]], arg1: List[var]) -> None .. py:method:: find_leaves() -> List[var] .. py:method:: find_non_consts(arg0: List[var]) -> List[var] .. py:method:: get_root() -> var .. py:method:: propagate() -> numpy.ndarray[numpy.float64[m, n]] propagate(arg0: List[var]) -> numpy.ndarray[numpy.float64[m, n]] .. py:class:: hadamard_circuit(arg0: QVec) Bases: :py:obj:`QCircuit` hadamard circuit class .. py:class:: real_chip_type(value: int) origin quantum real chip type enum Members: origin_wuyuan_d3 origin_wuyuan_d4 origin_wuyuan_d5 origin_72 .. py:attribute:: origin_72 :type: ClassVar[real_chip_type] :value: Ellipsis .. py:attribute:: origin_wuyuan_d3 :type: ClassVar[real_chip_type] :value: Ellipsis .. py:attribute:: origin_wuyuan_d4 :type: ClassVar[real_chip_type] :value: Ellipsis .. py:attribute:: origin_wuyuan_d5 :type: ClassVar[real_chip_type] :value: Ellipsis .. py:property:: name :type: str .. py:property:: value :type: int .. py:class:: var(arg0: float) var(arg0: numpy.ndarray[numpy.float64[m, n], flags.writeable]) var(arg0: float, arg1: bool) var(arg0: numpy.ndarray[numpy.float64[m, n], flags.writeable], arg1: bool) quantum variational class .. py:method:: clone() -> var .. py:method:: get_value() -> numpy.ndarray[numpy.float64[m, n]] .. py:method:: set_value(arg0: numpy.ndarray[numpy.float64[m, n]]) -> None set_value(arg0: float) -> None .. py:function:: BARRIER(qubit: Qubit) -> QGate BARRIER(qubit_list: int) -> QGate BARRIER(qubit_list: QVec) -> QGate BARRIER(qubit_addr_list: List[int]) -> QGate Create a BARRIER gate for a list of qubit addresses. Args: qubit_addr_list: a list of integers representing the addresses of the qubits. Returns: A BARRIER node representing the operation. .. py:function:: CNOT(control_qubit: Qubit, target_qubit: Qubit) -> QGate CNOT(control_qubit_list: QVec, target_qubit_list: QVec) -> QCircuit CNOT(control_qubit_addr: int, target_qubit_addr: int) -> QGate CNOT(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int]) -> QCircuit Returns: a CNOT gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: CP(control_qubit: Qubit, target_qubit: Qubit, theta_angle: float) -> QGate CP(control_qubit_list: QVec, target_qubit_list: QVec, theta_angle: float) -> QCircuit CP(control_qubit_addr: int, target_qubit_addr: int, theta_angle: float) -> QGate CP(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], theta_angle: float) -> QCircuit Returns: a CP gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: CR(control_qubit: Qubit, target_qubit: Qubit, theta_angle: float) -> QGate CR(control_qubit_list: QVec, target_qubit_list: QVec, theta_angle: float) -> QCircuit CR(control_qubit_addr: int, target_qubit_addr: int, theta_angle: float) -> QGate CR(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], theta_angle: float) -> QCircuit Returns: a CR gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: CU(alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float, control_qubit: Qubit, target_qubit: Qubit) -> QGate CU(alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float, control_qubit_list: QVec, target_qubi_list: QVec) -> QCircuit CU(matrix: List[complex], control_qubit: Qubit, target_qubit: Qubit) -> QGate CU(matrix: List[complex], control_qubit_list: QVec, target_qubit_list: QVec) -> QCircuit CU(control_qubit: Qubit, target_qubit: Qubit, alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float) -> QGate CU(control_qubit_list: QVec, target_qubit_list: QVec, alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float) -> QCircuit CU(control_qubit_addr: int, target_qubit_addr: int, alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float) -> QGate CU(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float) -> QCircuit CU(control_qubit: Qubit, target_qubit: Qubit, matrix: List[complex]) -> QGate CU(control_qubit_list: QVec, target_qubit_list: QVec, matrix: List[complex]) -> QCircuit CU(control_qubit_addr: int, target_qubit_addr: int, matrix: List[complex]) -> QGate CU(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], matrix: List[complex]) -> QCircuit Create a CU gate. Args: control_qubit_addr_list (const std::vector &): List of control qubit addresses. target_qubit_addr_list (const std::vector &): List of target qubit addresses. matrix (QStat &): The CU gate matrix. Returns: A CU node representing the operation. .. py:function:: CZ(control_qubit: Qubit, target_qubit: Qubit) -> QGate CZ(control_qubit_list: QVec, target_qubit_list: QVec) -> QCircuit CZ(control_qubit_addr: int, target_qubit_addr: int) -> QGate CZ(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int]) -> QCircuit Returns: a CZ gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: CreateEmptyCircuit() -> QCircuit Create an empty QCircuit container. Args: none Returns: result: An empty QCircuit. .. py:function:: CreateEmptyQProg() -> QProg Create an empty QProg container. Args: none Returns: an empty QProg. .. py:function:: CreateIfProg(classical_condition: ClassicalCondition, true_node: QProg) -> QIfProg CreateIfProg(classical_condition: ClassicalCondition, true_node: QProg, false_node: QProg) -> QIfProg Create an IfProg that executes one of two quantum operations based on a classical condition. Args: classical_condition: A classical condition representing the if condition. true_node: The quantum operations to execute if the condition is true. false_node: The quantum operations to execute if the condition is false. Returns: IfProg: The program that performs the specified operations based on the condition. .. py:function:: CreateWhileProg(classical_condition: ClassicalCondition, true_node: QProg) -> QWhileProg Create a WhileProg that executes while a classical condition is true. Args: classical_condition: A classical condition representing the while-loop condition. true_node: The quantum operations to execute while the condition is true. Returns: WhileProg: The program that performs the specified operations while the condition holds. .. py:function:: Grover(*args, **kwargs) -> Any Quantum grover circuit Args: qvec: qubit list Classical_condition: quantum Classical condition QuantumMachine: quantum machine Returns: result : Grover circuit Raises: run_fail: An error occurred in Grover .. py:function:: Grover_search(list: List[int], Classical_condition: ClassicalCondition, QuantumMachine: Grover_search.QuantumMachine, repeat: int = 2) -> Grover_search.list Grover_search(list: List[str], Classical_condition: str, QuantumMachine: Grover_search.QuantumMachine, data: int = 2) -> Grover_search.list use Grover algorithm to search target data, return QProg and search_result .. py:function:: H(qubit: Qubit) -> QGate H(qubit_list: QVec) -> QCircuit H(qubit_addr: int) -> QGate H(qubit_addr_list: List[int]) -> QCircuit Create a H gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a H gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: HHL_solve_linear_equations(matrix_A: List[complex], data_b: List[float], precision_cnt: int = 0) -> List[complex] Use HHL algorithm to solve the target linear systems of equations : Ax = b Args: matrix_A: a unitary matrix or Hermitian N*N matrix with N = 2 ^ n data_b: a given vector precision_cnt: The count of digits after the decimal point default is 0, indicates that there are only integer solutions. Returns: QStat The solution of equation, i.e.x for Ax = b Notes: The higher the precision is, the more qubit number and circuit - depth will be, for example: 1 - bit precision, 4 additional qubits are required, for 2 - bit precision, we need 7 additional qubits, and so on. .. py:function:: I(qubit: Qubit) -> QGate I(qubit_list: QVec) -> QCircuit I(qubit_addr: int) -> QGate I(qubit_addr_list: List[int]) -> QCircuit Create a I gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a I gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: MAJ(arg0: Qubit, arg1: Qubit, arg2: Qubit) -> QCircuit Quantum adder MAJ module .. py:function:: MAJ2(arg0: QVec, arg1: QVec, arg2: Qubit) -> QCircuit Quantum adder MAJ2 module .. py:function:: MS(first_qubit: Qubit, second_qubit: Qubit) -> QGate MS(first_qubit_list: QVec, second_qubit_list: QVec) -> QCircuit MS(first_qubit_addr: int, second_qubit_addr: int) -> QGate MS(first_qubit_addr_list: List[int], second_qubit_addr_list: List[int]) -> QCircuit Returns: a MS gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Measure(qubit: Qubit, cbit: ClassicalCondition) -> QMeasure Measure(qubit: Qubit, cbit: CBit) -> QMeasure Measure(qubit_addr: int, cbit_addr: int) -> QMeasure Create a measure node. Args: qubit_addr: address of the qubit to be measured. cbit_addr: address of the classical bit that stores the quantum measurement result. Returns: a quantum measure node. .. py:function:: OBMT_mapping(prog: QProg, quantum_machine: QuantumMachine, b_optimization: bool = False, max_partial: int = 4294967295, max_children: int = 4294967295, config_data: str = 'QPandaConfig.json') -> QProg OBMT_mapping(prog: QProg, quantum_machine: QuantumMachine, b_optimization: bool, arch_matrix: numpy.ndarray[numpy.float64[m, n]]) -> QProg OPT_BMT mapping Args: prog: the target prog quantum_machine: quantum machine b_optimization: whether open the optimization arch_matrix: arch graph matrix Returns: mapped quantum program .. py:function:: P(qubit: Qubit, angle: float) -> QGate P(qubit_list: QVec, angle: float) -> QCircuit P(qubit_addr: int, angle: float) -> QGate P(qubit_addr_list: List[int], angle: float) -> QCircuit Create a P gate Args: qubit_list_addr: quantum gate qubits list addr args : quantum gate angles Returns: a P gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: PMeasure(arg0: QVec, arg1: int) -> List[Tuple[int, float]] Deprecated, use pmeasure instead. Args: QVec: pmeasure qubits list. select_num: result select num. Returns: result: pmeasure qubits result. .. py:function:: PMeasure_no_index(arg0: QVec) -> List[float] Deprecated, use pmeasure_no_index instead. Args: QVec: pmeasure qubits list. Returns: result: pmeasure qubits result. .. py:function:: QAdd(arg0: QVec, arg1: QVec, arg2: QVec) -> QCircuit Quantum adder that supports signed operations, but ignore carry .. py:function:: QAdder(arg0: QVec, arg1: QVec, arg2: Qubit, arg3: Qubit) -> QCircuit Quantum adder with carry .. py:function:: QAdderIgnoreCarry(arg0: QVec, arg1: QVec, arg2: Qubit) -> QCircuit Args: QVec: qubits list a QVec: qubits list b QVec: qubits list c Qubit: qubit Returns: result : circuit Raises: run_fail: An error occurred in QAdderIgnoreCarry .. py:function:: QComplement(arg0: QVec, arg1: QVec) -> QCircuit Convert quantum state to binary complement representation .. py:function:: QDiv(arg0: QVec, arg1: QVec, arg2: QVec, arg3: QVec, arg4: ClassicalCondition) -> QProg Quantum division .. py:function:: QDivWithAccuracy(arg0: QVec, arg1: QVec, arg2: QVec, arg3: QVec, arg4: QVec, arg5: List[ClassicalCondition]) -> QProg Args: QVec: qubits list a QVec: qubits list b QVec: qubits list c QVec: qubits list k QVec: qubits list f QVec: qubits list s list: ClassicalCondition list Returns: result : circuit Raises: run_fail: An error occurred in QDivWithAccuracy .. py:function:: QDivider(a: QVec, b: QVec, c: QVec, k: QVec, t: ClassicalCondition) -> QProg Quantum division, only supports positive division, and the highest position of a and b and c is sign bit .. py:function:: QDividerWithAccuracy(a: QVec, b: QVec, c: QVec, k: QVec, f: QVec, s: List[ClassicalCondition]) -> QProg Args: QVec: qubits list a QVec: qubits list b QVec: qubits list c QVec: qubits list k QVec: qubits list f QVec: qubits list s list: ClassicalCondition list Returns: result : circuit Raises: run_fail: An error occurred in QDividerWithAccuracy .. py:function:: QDouble(first_qubit: Qubit, second_qubit: Qubit, matrix: List[complex]) -> QGate QDouble(first_qubit_list: QVec, second_qubit_list: QVec, matrix: List[complex]) -> QCircuit QDouble(first_qubit_addr: int, second_qubit_addr: int, matrix: List[complex]) -> QGate QDouble(first_qubit_addr_list: List[int], second_qubit_addr_list: List[int], matrix: List[complex]) -> QCircuit Returns: a QDouble gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: QFT(qubits: QVec) -> QCircuit Build QFT quantum circuit Args: qvec: qubit list Returns: result : qft circuit Raises: run_fail: An error occurred in QFT .. py:function:: QMul(arg0: QVec, arg1: QVec, arg2: QVec, arg3: QVec) -> QCircuit Quantum multiplication .. py:function:: QMultiplier(arg0: QVec, arg1: QVec, arg2: QVec, arg3: QVec) -> QCircuit Quantum multiplication, only supports positive multiplication .. py:function:: QOracle(qubit_list: QVec, matrix: numpy.ndarray[numpy.complex128[m, n]], tol: float = 1e-10) -> QGate Generate QOracle Gate. Args: qubit_list: gate in qubit list. matrix: gate operator matrix. Returns: Oracle gate. .. py:function:: QPE(control_qubits: QVec, target_qubits: QVec, matrix: List[complex], b_estimate_eigenvalue: bool = False) -> QCircuit Quantum phase estimation Args: control_qubits: control qubit list target_qubits: target qubit list matrix: matrix Returns: result : QPE circuit Raises: run_fail: An error occurred in QPE .. py:function:: QSub(arg0: QVec, arg1: QVec, arg2: QVec) -> QCircuit Quantum subtraction .. py:function:: RX(qubit: Qubit, angle: float) -> QGate RX(qubit_list: QVec, angle: float) -> QCircuit RX(qubit_addr: int, angle: float) -> QGate RX(qubit_addr_list: List[int], angle: float) -> QCircuit Create a RX gate Args: qubit_list_addr: quantum gate qubits list addr args : quantum gate angles Returns: a RX gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: RXX(control_qubit: Qubit, target_qubit: Qubit, alpha_angle: float) -> QGate RXX(control_qubit_list: QVec, target_qubit_list: QVec, alpha_angle: float) -> QCircuit RXX(control_qubit_addr: int, target_qubit_addr: int, alpha_angle: float) -> QGate RXX(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], alpha_angle: float) -> QCircuit Create a RXX gate Args: qubit addr list : control qubit addr list qubit addr list : target qubit addr list double: gate rotation angle theta Returns: a RXX gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: RY(qubit: Qubit, angle: float) -> QGate RY(qubit_list: QVec, angle: float) -> QCircuit RY(qubit_addr: int, angle: float) -> QGate RY(qubit_addr_list: List[int], angle: float) -> QCircuit Create a RY gate Args: qubit_list_addr: quantum gate qubits list addr args : quantum gate angles Returns: a RY gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: RYY(control_qubit: Qubit, target_qubit: Qubit, alpha_angle: float) -> QGate RYY(control_qubit_list: QVec, target_qubit_list: QVec, alpha_angle: float) -> QCircuit RYY(control_qubit_addr: int, target_qubit_addr: int, alpha_angle: float) -> QGate RYY(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], alpha_angle: float) -> QCircuit Create a RYY gate Args: qubit addr list : control qubit addr list qubit addr list : target qubit addr list double: gate rotation angle theta Returns: a RYY gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: RZ(qubit: Qubit, angle: float) -> QGate RZ(qubit_list: QVec, angle: float) -> QCircuit RZ(qubit_addr: int, angle: float) -> QGate RZ(qubit_addr_list: List[int], angle: float) -> QCircuit Create a RZ gate Args: qubit_list_addr: quantum gate qubits list addr args : quantum gate angles Returns: a RZ gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: RZX(control_qubit: Qubit, target_qubit: Qubit, alpha_angle: float) -> QGate RZX(control_qubit_list: QVec, target_qubit_list: QVec, alpha_angle: float) -> QCircuit RZX(control_qubit_addr: int, target_qubit_addr: int, alpha_angle: float) -> QGate RZX(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], alpha_angle: float) -> QCircuit Create a RZX gate Args: qubit addr list : control qubit addr list qubit addr list : target qubit addr list double: gate rotation angle theta Returns: a RZX gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: RZZ(control_qubit: Qubit, target_qubit: Qubit, alpha_angle: float) -> QGate RZZ(control_qubit_list: QVec, target_qubit_list: QVec, alpha_angle: float) -> QCircuit RZZ(control_qubit_addr: int, target_qubit_addr: int, alpha_angle: float) -> QGate RZZ(control_qubit_addr_list: List[int], target_qubit_addr_list: List[int], alpha_angle: float) -> QCircuit Create a RZZ gate Args: qubit addr list : control qubit addr list qubit addr list : target qubit addr list double: gate rotation angle theta Returns: a RZZ gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Reset(qubit: Qubit) -> QReset Reset(qubit_addr: int) -> QReset Create a Reset node. Args: qubit_addr (int): Address of the qubit to be reset. Returns: A Reset node representing the operation. .. py:function:: S(qubit: Qubit) -> QGate S(qubit_list: QVec) -> QCircuit S(qubit_addr: int) -> QGate S(qubit_addr_list: List[int]) -> QCircuit Create a S gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a S gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: SWAP(first_qubit: Qubit, second_qubit: Qubit) -> QGate SWAP(first_qubit_list: QVec, second_qubit_list: QVec) -> QCircuit SWAP(first_qubit_addr: int, second_qubit_addr: int) -> QGate SWAP(first_qubit_addr_list: List[int], second_qubit_addr_list: List[int]) -> QCircuit Returns: a SWAP gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Shor_factorization(arg0: int) -> Tuple[bool, Tuple[int, int]] Use Shor factorize integer num Args: int: target integer num result: Shor result Returns: result : Shor_factorization search result Raises: run_fail: An error occurred in Shor_factorization .. py:function:: SqiSWAP(first_qubit: Qubit, second_qubit: Qubit) -> QGate SqiSWAP(first_qubit_list: QVec, second_qubit_list: QVec) -> QCircuit SqiSWAP(first_qubit_addr: int, second_qubit_addr: int) -> QGate SqiSWAP(first_qubit_addr_list: List[int], second_qubit_addr_list: List[int]) -> QCircuit Returns: a SqiSWAP gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: T(qubit: Qubit) -> QGate T(qubit_list: QVec) -> QCircuit T(qubit_addr: int) -> QGate T(qubit_addr_list: List[int]) -> QCircuit Create a T gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a T gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Toffoli(control_qubit_first: Qubit, control_qubit_second: Qubit, target_qubit: Qubit) -> QGate Toffoli(control_qubit_addr_first: int, control_qubit_addr_second: int, target_qubit_addr: int) -> QGate Create a Toffoli gate. Args: control_qubit_addr_first (int): Address of the first control qubit. control_qubit_addr_second (int): Address of the second control qubit. target_qubit_addr (int): Address of the target qubit. Returns: A Toffoli node representing the operation. .. py:function:: U1(qubit: Qubit, angle: float) -> QGate U1(qubit_list: QVec, angle: float) -> QCircuit U1(qubit_addr: int, angle: float) -> QGate U1(qubit_addr_list: List[int], angle: float) -> QCircuit Create a U1 gate Args: qubit_list_addr: quantum gate qubits list addr args : quantum gate angles Returns: a U1 gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: U2(qubit: Qubit, phi_angle: float, lambda_angle: float) -> QGate U2(qubit_list: QVec, phi_angle: float, lambda_angle: float) -> QCircuit U2(qubit_addr: int, phi_angle: float, lambda_angle: float) -> QGate U2(qubit_addr_list: List[int], phi_angle: float, lambda_angle: float) -> QCircuit Create a U2 gate Args: qubit_list_addr: quantum gate qubits list addr args : quantum gate angles Returns: a U2 gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: U3(qubit: Qubit, theta_angle: float, phi_angle: float, lambda_angle: float) -> QGate U3(qubit_list: QVec, theta_angle: float, phi_angle: float, lambda_angle: float) -> QCircuit U3(qubit_addr: int, theta_angle: float, phi_angle: float, lambda_angle: float) -> QGate U3(qubit_addr_list: List[int], theta_angle: float, phi_angle: float, lambda_angle: float) -> QCircuit Create a U3 gate Args: qubit_list_addr: quantum gate qubits list addr args : quantum gate angles Returns: a U3 gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: U4(matrix: List[complex], qubit: Qubit) -> QGate U4(alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float, qubit: Qubit) -> QGate U4(qubit: Qubit, matrix: List[complex]) -> QGate U4(qubit_list: QVec, matrix: List[complex]) -> QCircuit U4(qubit_addr: int, matrix: List[complex]) -> QGate U4(qubit_addr_list: List[int], matrix: List[complex]) -> QCircuit U4(qubit: Qubit, alpha_anlge: float, beta_anlge: float, gamma_anlge: float, delta_anlge: float) -> QGate U4(qubit_list: QVec, alpha_angle: float, beta_angle: float, gamma_angle: float, delta_angle: float) -> QCircuit U4(qubit_addr: int, alpha_anlge: float, beta_anlge: float, gamma_anlge: float, delta_anlge: float) -> QGate U4(qubit_addr_list: List[int], alpha_anlge: float, beta_anlge: float, gamma_anlge: float, delta_anlge: float) -> QCircuit Create a U4 gate. Args: qubit_addr_list: the list of addresses of target qubits for the U4 gate. alpha_angle: the alpha angle for the U4 gate. beta_angle: the beta angle for the U4 gate. gamma_angle: the gamma angle for the U4 gate. delta_angle: the delta angle for the U4 gate. Returns: A U4 node representing the operation. .. py:function:: UMA(arg0: Qubit, arg1: Qubit, arg2: Qubit) -> QCircuit Quantum adder UMA module .. py:function:: VQG_CNOT_batch(*args, **kwargs) -> Any variational quantum CNOT batch gates .. py:function:: VQG_CU_batch(*args, **kwargs) -> Any variational quantum CU batch gates .. py:function:: VQG_CZ_batch(*args, **kwargs) -> Any variational quantum CZ batch gates .. py:function:: VQG_H_batch(*args, **kwargs) -> Any variational quantum H batch gates .. py:function:: VQG_I_batch(*args, **kwargs) -> Any variational quantum I batch gates .. py:function:: VQG_SWAP_batch(*args, **kwargs) -> Any variational quantum SWAP batch gates .. py:function:: VQG_S_batch(*args, **kwargs) -> Any variational quantum S batch gates .. py:function:: VQG_SqiSWAP_batch(*args, **kwargs) -> Any variational quantum SqiSWAP batch gates .. py:function:: VQG_T_batch(*args, **kwargs) -> Any variational quantum T batch gates .. py:function:: VQG_U1_batch(*args, **kwargs) -> Any variational quantum U1 batch gates .. py:function:: VQG_U2_batch(*args, **kwargs) -> Any variational quantum U2 batch gates .. py:function:: VQG_U3_batch(*args, **kwargs) -> Any variational quantum U3 batch gates .. py:function:: VQG_U4_batch(*args, **kwargs) -> Any variational quantum U4 batch gates .. py:function:: VQG_X1_batch(*args, **kwargs) -> Any variational quantum X1 batch gates .. py:function:: VQG_X_batch(*args, **kwargs) -> Any variational quantum X batch gates .. py:function:: VQG_Y1_batch(*args, **kwargs) -> Any variational quantum Y1 batch gates .. py:function:: VQG_Y_batch(*args, **kwargs) -> Any variational quantum Y batch gates .. py:function:: VQG_Z1_batch(*args, **kwargs) -> Any variational quantum Z1 batch gates .. py:function:: VQG_Z_batch(*args, **kwargs) -> Any variational quantum Z batch gates .. py:function:: VQG_iSWAP_batch(*args, **kwargs) -> Any variational quantum iSWAP batch gates .. py:function:: X(qubit: Qubit) -> QGate X(qubit_list: QVec) -> QCircuit X(qubit_addr: int) -> QGate X(qubit_addr_list: List[int]) -> QCircuit Create a X gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a X gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: X1(qubit: Qubit) -> QGate X1(qubit_list: QVec) -> QCircuit X1(qubit_addr: int) -> QGate X1(qubit_addr_list: List[int]) -> QCircuit Create a X1 gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a X1 gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Y(qubit: Qubit) -> QGate Y(qubit_list: QVec) -> QCircuit Y(qubit_addr: int) -> QGate Y(qubit_addr_list: List[int]) -> QCircuit Create a Y gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a Y gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Y1(qubit: Qubit) -> QGate Y1(qubit_list: QVec) -> QCircuit Y1(qubit_addr: int) -> QGate Y1(qubit_addr_list: List[int]) -> QCircuit Create a Y1 gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a Y1 gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Z(qubit: Qubit) -> QGate Z(qubit_list: QVec) -> QCircuit Z(qubit_addr: int) -> QGate Z(qubit_addr_list: List[int]) -> QCircuit Create a Z gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a Z gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: Z1(qubit: Qubit) -> QGate Z1(qubit_list: QVec) -> QCircuit Z1(qubit_addr: int) -> QGate Z1(qubit_addr_list: List[int]) -> QCircuit Create a Z1 gate Args: qubit_list_addr: quantum gate qubits list addr Returns: a Z1 gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: accumulateProbability(probability_list: List[float]) -> List[float] Accumulate the probability from a probability list. Args: probability_list: measured result in probability list form. Returns: accumulated_result: accumulated result. .. py:function:: accumulate_probabilities(probability_list: List[float]) -> List[float] Accumulate the probability from a probability list. Args: probability_list: measured result in probability list form. Returns: accumulated_result: accumulated result. .. py:function:: accumulate_probability(probability_list: List[float]) -> List[float] Accumulate the probability from a probability list. Args: probability_list: measured result in probability list form. Returns: accumulated_result: accumulated result. .. py:function:: acos(arg0: var) -> var .. py:function:: add(arg0: ClassicalCondition, arg1: ClassicalCondition) -> ClassicalCondition add(arg0: ClassicalCondition, arg1: int) -> ClassicalCondition add(arg0: int, arg1: ClassicalCondition) -> ClassicalCondition Add a bit size and a ClassicalCondition. Args: a: The bit size to be added. b: The ClassicalCondition to which the bit size will be added. Returns: ClassicalCondition: The resulting ClassicalCondition after addition. .. py:function:: all_cut_of_graph(adjacent_matrix: List[List[float]], all_cut_list: List[float], target_value_list: List[int]) -> float Generate a graph representation for the max cut problem. Args: adjacent_matrix: The adjacency matrix for the quantum program. all_cut_list: A list of all cut graphs in the quantum program. target_value_list: A list of target cut values. Returns: max value: The maximum value found from the cuts. .. py:function:: amplitude_encode(qubit: QVec, data: List[float], b_need_check_normalization: bool = True) -> QCircuit amplitude_encode(qubit: QVec, data: List[complex]) -> QCircuit Encode the input double data to the amplitude of qubits Args: qubit: quantum program qubits data: double data list Returns: result circuit Raises: run_fail: An error occurred in amplitude_encode .. py:function:: apply_QGate(qubit_list: QVec, func_obj: Callable[[Qubit], QGate]) -> QCircuit apply_QGate(qubit_addr_list: List[int], func_obj: Callable[[int], QGate]) -> QCircuit Apply a quantum gate operation to a list of qubit addresses. Args: qubit_addr_list: List of qubit addresses to which the gate will be applied. func_obj: A function object that takes a qubit address (int) and returns a QGate. Returns: QCircuit: The resulting circuit containing the QGate operations on all qubits. .. py:function:: asin(arg0: var) -> var .. py:function:: assign(arg0: ClassicalCondition, arg1: ClassicalCondition) -> ClassicalCondition assign(arg0: ClassicalCondition, arg1: int) -> ClassicalCondition Assign a bit size value to a ClassicalCondition. Args: a: The ClassicalCondition to be updated (passed by reference). b: The bit size value to assign. Returns: ClassicalCondition: The updated ClassicalCondition after assignment. .. py:function:: atan(arg0: var) -> var .. py:function:: average_gate_fidelity(state1: numpy.ndarray[numpy.complex128[m, n]], state2: List[complex]) -> float average_gate_fidelity(state1: numpy.ndarray[numpy.complex128[m, n]], state2: numpy.ndarray[numpy.complex128[m, n]]) -> float Calculate the average gate fidelity between two quantum operation matrices. Args: matrix1: the first quantum operation represented as a matrix. matrix2: the second quantum operation represented as a matrix. Returns: The average gate fidelity, a value in the range [0, 1]. .. py:function:: bin_to_prog(bin_data: List[int], qubit_list: QVec, cbit_list: List[ClassicalCondition], qprog: QProg) -> bool Parse binary data to transform into a quantum program. Args: bin_data: binary data that stores quantum program information. qubit_list: list of quantum qubits. cbit_list: list of classical bits. qprog: quantum program. Returns: prog: the parsed quantum program. .. py:function:: bind_data(arg0: int, arg1: QVec) -> QCircuit Args: int: classical data QVec: qubits list Returns: result : circuit Raises: run_fail: An error occurred in bind_data .. py:function:: bind_nonnegative_data(arg0: int, arg1: QVec) -> QCircuit Args: int: classical data QVec: qubits list Returns: result : circuit Raises: run_fail: An error occurred in bind_nonnegative_data .. py:function:: build_HHL_circuit(matrix_A: List[complex], data_b: List[float], qvm: QuantumMachine, precision_cnt: int = 0) -> QCircuit build the quantum circuit for HHL algorithm to solve the target linear systems of equations : Ax = b Args: matrix_A: a unitary matrix or Hermitian N*N matrix with N = 2 ^ n data_b: a given vector qvm: quantum machine precision_cnt: The count of digits after the decimal point, default is 0, indicates that there are only integer solutions Returns: QCircuit The whole quantum circuit for HHL algorithm Notes: The higher the precision is, the more qubit number and circuit - depth will be, for example: 1 - bit precision, 4 additional qubits are required, for 2 - bit precision, we need 7 additional qubits, and so on. The final solution = (HHL result) * (normalization factor for b) * (1 << ceil(log2(pow(10, precision_cnt)))) .. py:function:: cAlloc() -> ClassicalCondition cAlloc(cbit_addr: int) -> ClassicalCondition Allocate a CBit After init() Args: cbit_addr: cbit address, should be in [0,29). Returns: classic result cbit .. py:function:: cAlloc_many(cbit_num: int) -> List[ClassicalCondition] Allocate several CBits After init() Args: cbit_num: numbers of cbit want to be created. Returns: list of cbit .. py:function:: cFree(cbit: ClassicalCondition) -> None Free a CBit Args: CBit: The CBit to be freed. Returns: none .. py:function:: cFree_all() -> None cFree_all(cbit_list: List[ClassicalCondition]) -> None Free all CBits Args: cbit_list: a list of cbits. Returns: none .. py:function:: cast_qprog_qcircuit(qprog: QProg) -> QCircuit Cast a quantum program into a quantum circuit. Args: qprog: The quantum program to be cast. Returns: QCircuit: The resulting quantum circuit. .. py:function:: cast_qprog_qgate(qprog: QProg) -> QGate Cast a quantum program into a quantum gate. Args: qprog: The quantum program to be cast. Returns: None: This function does not return a value. .. py:function:: cast_qprog_qmeasure(qprog: QProg) -> QMeasure Cast a quantum program into a quantum measurement. Args: qprog: The quantum program to be cast. Returns: None: This function does not return a value. .. py:function:: circuit_layer(qprog: QProg) -> list Quantum circuit layering. Args: QProg: Quantum program. Returns: A list containing layer information and qubits/cbits in use. .. py:function:: circuit_optimizer(qprog: QProg, optimizer_cir_vec: List[Tuple[QCircuit, QCircuit]] = [], mode_list: List[QCircuitOPtimizerMode] = []) -> QProg Optimize a quantum circuit. Args: qprog: the quantum program to optimize. optimizer_cir_vec: a list of quantum circuits for optimization. mode_list: a list of optimization modes. Returns: the updated quantum program after optimization. .. py:function:: circuit_optimizer_by_config(qprog: QProg, config_file: str = 'QPandaConfig.json', mode_list: List[QCircuitOPtimizerMode] = []) -> QProg Optimize a quantum circuit using configuration data. Args: qprog: the quantum program to optimize. config_file: configuration data for optimization. mode_list: a list of optimization modes. Returns: the updated quantum program after optimization. .. py:function:: comm_protocol_decode(encode_data: bytes, machine: QuantumMachine) -> Tuple[List[QProg], CommProtocolConfig] Decode binary data into a list of quantum programs using the communication protocol. Args: encode_data: The encoded binary data representing quantum programs. machine: A pointer to the QuantumMachine used for decoding. Returns: tuple: A tuple containing the decoded program list and the communication protocol configuration. .. py:function:: comm_protocol_encode(prog: QProg, config: CommProtocolConfig = ...) -> bytes comm_protocol_encode(prog_list: List[QProg], config: CommProtocolConfig = ...) -> bytes Encode a list of quantum programs into binary communication protocol data. Args: prog_list: A list of quantum programs to be encoded. config: The configuration for the communication protocol. Defaults to an empty configuration. Returns: bytes: The encoded binary data representing the communication protocol. .. py:function:: constModAdd(arg0: QVec, arg1: int, arg2: int, arg3: QVec, arg4: QVec) -> QCircuit Args: QVec qvec int base int module_Num QVec qvec1 QVec qvec2 Returns: result circuit Raises: run_fail: An error occurred in constModAdd .. py:function:: constModExp(arg0: QVec, arg1: QVec, arg2: int, arg3: int, arg4: QVec, arg5: QVec, arg6: QVec) -> QCircuit Args: QVec qvec int base int module_Num QVec qvec1 QVec qvec2 Returns: result circuit Raises: run_fail: An error occurred in constModExp .. py:function:: constModMul(arg0: QVec, arg1: int, arg2: int, arg3: QVec, arg4: QVec, arg5: QVec) -> QCircuit Args: QVec qvec int base int module_Num QVec qvec1 QVec qvec2 Returns: result circuit Raises: run_fail: An error occurred in constModMul .. py:function:: convert_binary_data_to_qprog(machine: QuantumMachine, data: List[int]) -> QProg Parse binary data into a quantum program. Args: machine: The quantum machine used for execution. data: The binary data representing the quantum program. Returns: QProg: The generated quantum program. .. py:function:: convert_originir_str_to_qprog(originir_str: str, machine: QuantumMachine) -> list Transform OriginIR string into QProg. Args: originir_str: OriginIR string. machine: initialized quantum machine. Returns: A list containing QProg, qubit_list, and cbit_list. .. py:function:: convert_originir_to_qprog(file_path: str, machine: QuantumMachine) -> list Read an OriginIR file and transform it into QProg. Args: file_path: OriginIR file path. machine: initialized quantum machine. Returns: A list containing QProg, qubit_list, and cbit_list. .. py:function:: convert_qasm_string_to_qprog(qasm_str: str, machine: QuantumMachine) -> list Transform QASM string into QProg. Args: qasm_str: QASM string. machine: initialized quantum machine. Returns: A list containing QProg, qubit_list, and cbit_list. .. py:function:: convert_qasm_to_qprog(file_path: str, machine: QuantumMachine) -> list Read a QASM file and transform it into QProg. Args: file_path: QASM file path. machine: initialized quantum machine. Returns: A list containing QProg, qubit_list, and cbit_list. .. py:function:: convert_qprog_to_binary(qprog: QProg, machine: QuantumMachine) -> List[int] convert_qprog_to_binary(qprog: QProg, machine: QuantumMachine, fname: str) -> None Store the quantum program in a binary file. Args: qprog: quantum program. machine: quantum machine. fname: name of the binary data file. Returns: none: This function does not return a value. .. py:function:: convert_qprog_to_originir(*args, **kwargs) -> Any Convert QProg to OriginIR string. Args: qprog: quantum program (QProg&). machine: quantum machine (QuantumMachine*). Returns: originir: OriginIR string. For more information, see the OriginIR introduction: https://pyqpanda-toturial.readthedocs.io/zh/latest .. py:function:: convert_qprog_to_qasm(qprog: QProg, machine: QuantumMachine) -> str Convert a quantum program to a QASM instruction string. Args: qprog: The quantum program to be converted. machine: The quantum machine used for execution. Returns: str: A QASM string representing the quantum program. .. py:function:: convert_qprog_to_quil(qprog: QProg, machine: QuantumMachine) -> str Convert QProg to Quil instruction. Args: qprog: quantum program (QProg). machine: quantum machine (QuantumMachine*). Returns: Quil instruction string. .. py:function:: cos(arg0: var) -> var .. py:function:: count_gate(quantum_prog: QProg) -> int count_gate(quantum_circuit: QCircuit) -> int Count quantum gate number in the quantum circuit. Args: quantum_circuit: quantum circuit. Returns: result: gate count. .. py:function:: count_prog_info(node: QProg, selected_types: List[GateType] = []) -> ProgCount count_prog_info(node: QCircuit, selected_types: List[GateType] = []) -> ProgCount Count quantum program information. Args: node: quantum circuit (QCircuit). selected_types: vector of selected GateType (default is empty). Returns: ProgCount struct. .. py:function:: count_qgate_num(prog: QProg, gate_type: int = -1) -> int count_qgate_num(circuit: QCircuit, gate_type: int = -1) -> int Count quantum gate number in the quantum circuit. Args: circuit: quantum circuit (QCircuit&). gate_type: type of gate to count (const GateType). Returns: result: number of quantum gates of the specified GateType. .. py:function:: create_empty_circuit() -> QCircuit Create an empty QCircuit container. Args: none Returns: result: An empty QCircuit. .. py:function:: create_empty_qprog() -> QProg Create an empty QProg container. Args: none. Returns: an empty QProg. .. py:function:: create_if_prog(classical_condition: ClassicalCondition, true_node: QProg) -> QIfProg create_if_prog(classical_condition: ClassicalCondition, true_node: QProg, false_node: QProg) -> QIfProg Create a classical quantum IfProg. Args: classical_condition: A quantum cbit representing the condition. true_node: A quantum IfProg node that defines the operation to execute if the condition is true. false_node: A quantum IfProg node that defines the operation to execute if the condition is false. Returns: result: A classical quantum IfProg that executes based on the specified condition. .. py:function:: create_while_prog(classical_condition: ClassicalCondition, true_node: QProg) -> QWhileProg Create a WhileProg. Args: classical_condition: A quantum cbit representing the condition. true_node: A quantum QWhile node that defines the operation to execute while the condition is true. Returns: result: A WhileProg that executes the specified operations based on the condition. .. py:function:: crossEntropy(arg0: var, arg1: var) -> var .. py:function:: decompose_multiple_control_qgate(qprog: QProg, machine: QuantumMachine, config_file: str = 'QPandaConfig.json') -> QProg decompose_multiple_control_qgate(qprog: QProg, machine: QuantumMachine, convert_single_gates: List[str], convert_double_gates: List[str], b_transform_to_base_qgate: bool = True) -> QProg Decompose multiple control QGate. Args: qprog: Quantum program. machine: Quantum machine. convert_single_gates: Sets of quantum single gates. convert_double_gates: Sets of quantum double gates. b_transform_to_base_qgate: Transform to base QGate sets. Returns: A new program after decomposition. .. py:function:: deep_copy(node: QProg) -> QProg deep_copy(node: QCircuit) -> QCircuit deep_copy(node: QGate) -> QGate deep_copy(node: QMeasure) -> QMeasure deep_copy(node: ClassicalProg) -> ClassicalProg deep_copy(node: QIfProg) -> QIfProg deep_copy(node: QWhileProg) -> QWhileProg Create a deep copy of the given quantum program node. Args: node: The quantum program node to copy. Returns: A deep copy of the quantum program node. .. py:function:: del_weak_edge(topo_data: List[List[int]]) -> None Delete weakly connected edges from the quantum program topology. Args: topo_data: The topology data of the quantum program. Returns: None. .. py:function:: del_weak_edge2(topo_data: List[List[int]], max_connect_degree: int, sub_graph_set: List[int]) -> list Delete weakly connected edges from the quantum program topology. Args: topo_data: The topology data of the quantum program. max_connect_degree: The maximum allowable connection degree. sub_graph_set: A list of subgraph identifiers. Returns: A list containing the updated topology data, intermediary points, and candidate edges. .. py:function:: del_weak_edge3(topo_data: List[List[int]], sub_graph_set: List[int], max_connect_degree: int, lamda1: float, lamda2: float, lamda3: float) -> list Delete weakly connected edges based on specified parameters. Args: topo_data: The topology data of the quantum program. sub_graph_set: A list of subgraph identifiers. max_connect_degree: The maximum allowable connection degree. lamda1: Weight parameter for edge evaluation. lamda2: Weight parameter for edge evaluation. lamda3: Weight parameter for edge evaluation. Returns: A list containing the updated topology data and intermediary points. .. py:function:: destroy_quantum_machine(machine: QuantumMachine) -> None Destroy a quantum machine. Args: machine: type should be one of CPUQVM, CPUSingleThreadQVM, GPUQVM, NoiseQVM. Returns: None. .. py:function:: directly_run(qprog: QProg, noise_model: Noise = NoiseModel()) -> Dict[str, bool] Directly run a quantum program After init() Args: qprog: The quantum program to be executed. noise_model: The noise model to be used, default is no noise. The noise model only works on CPUQVM currently. Returns: Dict[str, bool]: Result of the quantum program execution in one shot. The first element is the final qubit register state, and the second is its measurement probability. .. py:function:: div(arg0: ClassicalCondition, arg1: ClassicalCondition) -> ClassicalCondition div(arg0: ClassicalCondition, arg1: int) -> ClassicalCondition div(arg0: int, arg1: ClassicalCondition) -> ClassicalCondition Divide a bit size by a ClassicalCondition. Args: a: The bit size (numerator). b: The ClassicalCondition (denominator). Returns: ClassicalCondition: The result of the division. .. py:function:: dot(arg0: var, arg1: var) -> var .. py:function:: draw_qprog_latex(prog: QProg, auto_wrap_len: int = 100, output_file: str = 'QCircuit.tex', with_logo: bool = False, itr_start: NodeIter = NodeIter(), itr_end: NodeIter = NodeIter()) -> str Convert a quantum prog/circuit to LaTeX representation, and save the output in a file named QCircuit.tex in the current path. Args: QProg: Quantum prog. auto_wrap_len: Default is 100. output_file: Result output file name. with_logo: Include logo in the output. itr_start: Node iterator start. itr_end: Node iterator end. Returns: A tuple containing program info. .. py:function:: draw_qprog_latex_with_clock(prog: QProg, config_data: str = 'QPandaConfig.json', auto_wrap_len: bool = 100, output_file: int = 'QCircuit.tex', with_logo: str = False, itr_start: NodeIter = NodeIter(), itr_end: NodeIter = NodeIter()) -> str Convert a quantum prog/circuit to LaTeX source code with time sequence, and save the source code to a file in the current path named QCircuit.tex. Args: prog: Quantum prog. config_data: Default config file is QPandaConfig.json. auto_wrap_len: Default is 100. output_file: Result output file name. with_logo: Whether to include a logo in the output. itr_start: Node iterator start. itr_end: Node iterator end. Returns: A tuple containing program info. .. py:function:: draw_qprog_text(qprog: QProg, auto_wrap_len: int = 100, output_file: str = 'QCircuitTextPic.txt', itr_start: NodeIter = NodeIter(), itr_end: NodeIter = NodeIter()) -> str Convert a quantum prog/circuit to text-pic (UTF-8 code), and save the text-pic in a file named QCircuitTextPic.txt in the current path. Args: QProg: Quantum prog. auto_wrap_len: Default is 100. output_file: Result output file name. itr_start: Node iterator start. itr_end: Node iterator end. Returns: A tuple containing program info. .. py:function:: draw_qprog_text_with_clock(prog: QProg, config_data: str = 'QPandaConfig.json', auto_wrap_len: int = 100, output_file: str = 'QCircuitTextPic.txt', itr_start: NodeIter = NodeIter(), itr_end: NodeIter = NodeIter()) -> str Convert a quantum prog/circuit to text-pic (UTF-8 code) with time sequence, and save the text-pic in a file named QCircuitTextPic.txt in the current path. Args: prog: Quantum prog. config_data: Configuration data. auto_wrap_len: Default is 100. output_file: Result output file name. itr_start: Node iterator start. itr_end: Node iterator end. Returns: A tuple containing program info. .. py:function:: dropout(arg0: var, arg1: var) -> var .. py:function:: equal(arg0: ClassicalCondition, arg1: ClassicalCondition) -> ClassicalCondition equal(arg0: ClassicalCondition, arg1: int) -> ClassicalCondition equal(arg0: int, arg1: ClassicalCondition) -> ClassicalCondition Check if a bit size is equal to a ClassicalCondition. Args: a: The bit size to compare. b: The ClassicalCondition to compare against. Returns: bool: True if the bit size is equal to the ClassicalCondition, otherwise False. .. py:function:: estimate_topology(topo_data: List[List[int]]) -> float Evaluate topology performance. Args: topo_data: Quantum program topology data. Returns: Result data. .. py:function:: eval(arg0: var, arg1: bool) -> numpy.ndarray[numpy.float64[m, n]] eval(arg0: var) -> numpy.ndarray[numpy.float64[m, n]] .. py:function:: exp(arg0: var) -> var .. py:function:: expMat(arg0: complex, arg1: numpy.ndarray[numpy.complex128[m, n]], arg2: float) -> numpy.ndarray[numpy.complex128[m, n]] Calculate the matrix power of e. This function returns the power of matrix e. Args: None Returns: The computed matrix. .. py:function:: expand_linear_equations(matrix: List[complex], list: List[float]) -> expand_linear_equations.list expand_linear_equations(matrix: List[complex], list: List[float]) -> expand_linear_equations.list Extending linear equations to N dimension, N = 2 ^ n Args: matrix: the source matrix, which will be extend to N*N, N = 2 ^ n list: the source vector b, which will be extend to 2 ^ n .. py:function:: fill_qprog_by_I(qprog: QProg) -> QProg Fill the input quantum program with I gates and return a new quantum program. Args: qprog: the input quantum program. Returns: a new quantum program filled with I gates. .. py:function:: finalize() -> None Finalize the environment and destroy global unique quantum machine. Args: none Returns: none .. py:function:: fit_to_gbk(utf8_str: str) -> str Special character conversion. Args: utf8_str: string using utf-8 encoding. Returns: result: converted string. .. py:function:: flatten(qprog: QProg) -> None flatten(qcircuit: QCircuit) -> None Flatten a quantum circuit in place. Args: qcircuit: The quantum circuit to be flattened. Returns: None: The function modifies the circuit directly. .. py:function:: getAllocateCMem() -> int Deprecated, use get_allocate_cmem_num instead. Args: none Returns: allocate qubit num. .. py:function:: getAllocateQubitNum() -> int Deprecated, use get_allocate_qubit_num instead. Args: none Returns: allocate cbit num. .. py:function:: get_adjacent_qgate_type(qprog: QProg, node_iter: NodeIter) -> List[NodeInfo] Get the adjacent quantum gates' (the front one and the back one) type info from QProg. Args: qprog: Target quantum program. node_iter: Gate node iterator in qprog. Returns: The front and back node info of node_iter in qprog. .. py:function:: get_all_used_qubits(qprog: QProg) -> List[Qubit] Get all the quantum bits used in the input program. Args: qprog: A quantum program. Returns: result: A list of all used qubits. .. py:function:: get_all_used_qubits_to_int(qprog: QProg) -> List[int] Get the addresses of all used quantum bits in the input program. Args: qprog: A quantum program. Returns: result: A list of addresses of all used qubits. .. py:function:: get_allocate_cbits() -> List[ClassicalCondition] Get allocated cbits of QuantumMachine Args: None Returns: A list of allocated cbits. .. py:function:: get_allocate_cmem_num() -> int Get allocate cmem num. Args: none. Returns: cbit_num: allocate cbit num. .. py:function:: get_allocate_qubit_num() -> int Get allocate qubit num. Args: none. Returns: qubit_num: allocate qubit num. .. py:function:: get_allocate_qubits() -> List[Qubit] Get allocated qubits of QuantumMachine Args: None Returns: A list of allocated qubits. .. py:function:: get_bin_data(qprog: QProg) -> List[int] Get quantum program binary data. Args: qprog: quantum program (QProg). Returns: binary data as a list. .. py:function:: get_bin_str(qprog: QProg, machine: QuantumMachine) -> str Transform a quantum program into a string representation. Args: qprog: quantum program. machine: quantum machine. Returns: string: base64-encoded string of the binary representation. .. py:function:: get_circuit_optimal_topology(qprog: QProg, machine: QuantumMachine, max_connect_degree: int, config_file: str = 'QPandaConfig.json') -> List[List[int]] Retrieve the optimal topology of the input quantum circuit. Args: qprog: The quantum program for which to determine the topology. machine: The quantum machine used for execution. max_connect_degree: The maximum allowable connection degree. config_file: Path to the configuration file (default is CONFIG_PATH). Returns: The topology program data. .. py:function:: get_clock_cycle(qpog: QProg) -> int Get quantum program clock cycle. Args: qprog: quantum program (QProg). Returns: clock_cycle. .. py:function:: get_complex_points(topo_data: List[List[int]], max_connect_degree: int) -> List[int] Retrieve complex points from the given topology data. Args: topo_data: The topology data of the quantum program. max_connect_degree: The maximum allowable connection degree. Returns: A list of complex points extracted from the topology data. .. py:function:: get_double_gate_block_topology(qprog: QProg) -> List[List[int]] Retrieve the double gate block topology from the input quantum program. Args: qprog: The quantum program for which to extract the double gate block topology. Returns: The topology program data. .. py:function:: get_matrix(*args, **kwargs) -> Any Get the target matrix between the input two NodeIters. Args: qprog: Quantum program. positive_seq: Qubit order of output matrix; true for positive sequence (q0q1q2), false for inverted order (q2q1q0), default is false. nodeitr_start: The start NodeIter. nodeitr_end: The end NodeIter. Returns: The target matrix including all the QGate's matrices (multiplied). .. py:function:: get_prob_dict(qubit_list: QVec, select_max: int = -1) -> Dict[str, float] Get pmeasure result as dict Args: qubit_list: pmeasure qubits list. select_max: max returned element num in returned tuple, should be in [-1, 1< List[float] Get pmeasure result as list Args: qubit_list: pmeasure qubits list. select_max: max returned element num in returned tuple, should be in [-1, 1< int get_qgate_num(quantum_circuit: QCircuit) -> int get_qgate_num(qprog: QProg) -> int Count the number of quantum gates in a quantum program. Args: qprog: The quantum program to analyze. Returns: int: The number of quantum gates in the quantum program. .. py:function:: get_qprog_clock_cycle(qprog: QProg, machine: QuantumMachine, optimize: bool = False) -> int Get Quantum Program Clock Cycle. Args: qprog: quantum program (QProg). machine: quantum machine (QuantumMachine*). optimize: whether to optimize qprog (default is false). Returns: QProg time consumed, no unit, not in seconds. .. py:function:: get_qstate() -> List[complex] get_qstate() -> Any .. py:function:: get_sub_graph(topo_data: List[List[int]]) -> List[int] Retrieve a subgraph from the provided topology data. Args: topo_data: The topology data of the quantum program. Returns: sub graph: The extracted subgraph from the provided topology. .. py:function:: get_tuple_list(qubit_list: QVec, select_max: int = -1) -> List[Tuple[int, float]] Get pmeasure result as tuple list Args: qubit_list: pmeasure qubits list. select_max: max returned element num in returned tuple, should be in [-1, 1< Any Get the target unitary matrix between the input two NodeIters. Args: qprog: Quantum program. positive_seq: Qubit order of output matrix; true for positive sequence (q0q1q2), false for inverted order (q2q1q0), default is false. nodeitr_start: The start NodeIter. nodeitr_end: The end NodeIter. Returns: The target unitary matrix including all the QGate's matrices (multiplied). .. py:function:: get_unsupport_qgate_num(qprog: QProg, support_gates: List[List[str]]) -> int Count the number of unsupported gates in a quantum program. Args: qprog: The quantum program to analyze. support_gates: A list of supported gates. Returns: int: The number of unsupported gates in the quantum program. .. py:function:: getstat(*args, **kwargs) -> Any Get the status of the Quantum machine Args: None Returns: The status of the Quantum machine, see QMachineStatus. .. py:function:: iSWAP(first_qubit: Qubit, second_qubit: Qubit) -> QGate iSWAP(first_qubit_list: QVec, second_qubit_list: QVec) -> QCircuit iSWAP(first_qubit_addr: int, second_qubit_addr: int) -> QGate iSWAP(first_qubit_addr_list: List[int], second_qubit_addr_list: List[int]) -> QCircuit iSWAP(first_qubit: Qubit, second_qubit: Qubit, theta_angle: float) -> QGate iSWAP(first_qubit_list: QVec, second_qubit_list: QVec, theta_angle: float) -> QCircuit iSWAP(first_qubit_addr: int, second_qubit_addr: int, theta_angle: float) -> QGate iSWAP(first_qubit_addr_list: List[int], second_qubit_addr_list: List[int], theta_angle: float) -> QCircuit Returns: a iSWAP gate node Raises: run_fail: An error occurred in construct gate node .. py:function:: init(machine_type: QMachineType = QMachineType.CPU) -> bool Init the global unique quantum machine at background. Args: machine_type: quantum machine type, see pyQPanda.QMachineType Returns: bool: true if initialization success .. py:function:: init_quantum_machine(machine_type: QMachineType = QMachineType.CPU) -> QuantumMachine Create and initialize a new quantum machine, and let it be a globally unique quantum machine. Args: machine_type: quantum machine type, see pyQPanda.QMachineType. Returns: object: the quantum machine, type depends on machine_type: QMachineType.CPU --> pyQPanda.CPUQVM QMachineType.CPU_SINGLE_THREAD --> pyQPanda.CPUSingleThreadQVM QMachineType.GPU --> pyQPanda.GPUQVM (if pyQPanda is built with GPU) QMachineType.NOISE --> pyQPanda.NoiseQVM return None if initialization fails. .. py:function:: inverse(arg0: var) -> var .. py:function:: isCarry(arg0: QVec, arg1: QVec, arg2: Qubit, arg3: Qubit) -> QCircuit Construct a circuit to determine if there is a carry .. py:function:: is_match_topology(gate: QGate, topo: List[List[float]]) -> bool Judge if the QGate matches the target topologic structure of the quantum circuit. Args: gate (QGate): The quantum gate to evaluate. topo: The target topologic structure of the quantum circuit. Returns: bool: True if it matches, otherwise false. .. py:function:: is_supported_qgate_type(nodeitr: NodeIter) -> bool Judge if the target node is a QGate type. Args: nodeitr: Node iterator in the quantum program. Returns: bool: True if the target node is a QGate type, otherwise false. .. py:function:: is_swappable(prog: QProg, nodeitr_1: NodeIter, nodeitr_2: NodeIter) -> bool Judge whether the specified two NodeIters in the quantum program can be exchanged. Args: prog: Target quantum program. nodeitr_1: Node iterator 1 in the quantum program. nodeitr_2: Node iterator 2 in the quantum program. Returns: bool: True if the two NodeIters can be exchanged, otherwise false. .. py:function:: iterative_amplitude_estimation(arg0: QCircuit, arg1: QVec, arg2: float, arg3: float) -> float estimate the probability corresponding to the ground state |1> of the last bit Args: QCircuit: quantum circuit qvec: qubit list double: epsilon double: confidence Returns: result iterative amplitude Raises: run_fail: An error occurred in iterative_amplitude_estimation .. py:function:: ldd_decompose(qprog: QProg) -> QProg Decompose a multiple control quantum gate using LDD. Args: qprog: the quantum program to be decomposed. Returns: the updated quantum program after decomposition. .. py:function:: log(arg0: var) -> var .. py:function:: matrix_decompose(qubits: QVec, matrix: numpy.ndarray[numpy.complex128[m, n]], mode: DecompositionMode = DecompositionMode.QSD, b_positive_seq: bool = True) -> QCircuit matrix_decompose(qubits: QVec, matrix: List[complex], mode: DecompositionMode = DecompositionMode.QSD, b_positive_seq: bool = True) -> QCircuit Matrix decomposition Args: qubits: the used qubits matrix: The target matrix mode: DecompositionMode decomposition mode, default is QSD b_positive_seq: true for positive sequence(q0q1q2), false for inverted order(q2q1q0), default is true Returns: QCircuit The quantum circuit for target matrix .. py:function:: matrix_decompose_paulis(arg0: QuantumMachine, arg1: numpy.ndarray[numpy.float64[m, n]]) -> List[Tuple[float, QCircuit]] matrix_decompose_paulis(arg0: QVec, arg1: numpy.ndarray[numpy.float64[m, n]]) -> List[Tuple[float, QCircuit]] decompose matrix into paulis combination Args: quantum_machine: quantum machine matrix: 2^N *2^N double matrix Returns: result : linearcom contains pauli circuit .. py:function:: measure_all(qubit_list: QVec, cbit_list: List[ClassicalCondition]) -> QProg measure_all(qubit_addr_list: List[int], cbit_addr_list: List[int]) -> QProg Create a list of measure nodes. Args: qubit_addr_list: list of addresses of the qubits to be measured. cbit_addr_list: list of addresses of the classical bits that store the quantum measurement results. Returns: a list of measure nodes. .. py:function:: mul(arg0: ClassicalCondition, arg1: ClassicalCondition) -> ClassicalCondition mul(arg0: ClassicalCondition, arg1: int) -> ClassicalCondition mul(arg0: int, arg1: ClassicalCondition) -> ClassicalCondition Multiply a bit size by a ClassicalCondition. Args: a: The bit size to be multiplied. b: The ClassicalCondition to multiply with the bit size. Returns: ClassicalCondition: The resulting ClassicalCondition after multiplication. .. py:function:: originir_to_qprog(file_path: str, machine: QuantumMachine) -> QProg Read an OriginIR file and transform it into QProg. Args: file_path: OriginIR file path. machine: initialized quantum machine. Returns: Transformed QProg. .. py:function:: pauli_combination_replace(arg0: List[Tuple[float, QCircuit]], arg1: QuantumMachine, arg2: str, arg3: str) -> List[Tuple[float, QCircuit]] .. py:function:: planarity_testing(topo_data: List[List[int]]) -> bool Perform planarity testing. Args: topo_data: Quantum program topology data. Returns: Result data. .. py:function:: pmeasure(qubit_list: QVec, select_max: int) -> List[Tuple[int, float]] Get the probability distribution over qubits. Args: qubit_list: qubit list to measure. select_max: max returned element num in returned tuple, should be in [-1, 1< List[float] Get the probability distribution over qubits. Args: qubit_list: qubit list to measure. Returns: Measure result of quantum machine in list form. .. py:function:: poly(arg0: var, arg1: var) -> var .. py:function:: print_matrix(matrix: List[complex], precision: int = 8) -> str Print matrix elements. Args: matrix (QStat): The matrix to print. precision (int, optional): Double value to string cutoff precision (default is 8). Returns: A string representation of the matrix. .. py:function:: prob_run_dict(qprog: QProg, qubit_list: QVec, select_max: int = -1) -> Dict[str, float] Run quantum program and get pmeasure result as dict Args: qprog: quantum program. qubit_list: pmeasure qubits list. select_max: max returned element num in returned tuple, should be in [-1, 1< List[float] Run quantum program and get pmeasure result as list Args: qprog: quantum program. qubit_list: pmeasure qubits list. select_max: max returned element num in returned tuple, should be in [-1, 1< List[Tuple[int, float]] Run quantum program and get pmeasure result as tuple list Args: qprog: quantum program. qubit_list: pmeasure qubits list. select_max: max returned element num in returned tuple, should be in [-1, 1< Any Process the given quantum program layer. Args: prog: The quantum program to be processed. Returns: Processed quantum program layer. .. py:function:: prog_to_dag(prog: QProg) -> QProgDAG Convert a quantum program into a directed acyclic graph (DAG). Args: prog: The quantum program to be converted. Returns: QProgDAG: A reference to the resulting DAG. .. py:function:: qAlloc() -> Qubit qAlloc(qubit_addr: int) -> Qubit Allocate a qubit After init() Args: qubit_addr: The physical address of the qubit, should be in [0, 29). Returns: Qubit: A new qubit. None: If qubit_addr is invalid or if the maximum number of allowed qubits has been reached. .. py:function:: qAlloc_many(qubit_num: int) -> List[Qubit] Allocate several qubits After init() Args: qubit_num: The number of qubits to be created. Returns: list[pyQPanda.Qubit]: list of qubit. .. py:function:: qFree(qubit: Qubit) -> None Free a qubit Args: qubit: a qubit Returns: None .. py:function:: qFree_all() -> None qFree_all(qubit_list: QVec) -> None Free a list of qubits Args: qubit_list: A list of qubits to be freed. Returns: None .. py:function:: qop(VariationalQuantumCircuit: qop.VariationalQuantumCircuit, Hamiltonian, QuantumMachine: qop.QuantumMachine, qubitList: List[Qubit]) -> var qop(VariationalQuantumCircuit: qop.VariationalQuantumCircuit, Hamiltonian, QuantumMachine: qop.QuantumMachine, qubitList: Dict[int, Qubit]) -> var .. py:function:: qop_pmeasure(arg0: VariationalQuantumCircuit, arg1: List[int], arg2: QuantumMachine, arg3: List[Qubit]) -> var .. py:function:: quantum_chip_adapter(qprog: QProg, machine: QuantumMachine, mapping: bool = True, config_file: str = 'QPandaConfig.json') -> list Perform adaptive conversion for the quantum chip. Args: qprog: the quantum program. machine: the quantum machine to be used. mapping: whether to perform the mapping operation (default is true). config_file: configuration file path (default is CONFIG_PATH). Returns: a list containing the quantum program and the list of qubits after mapping; if mapping is false, the qubit list may be misoperated. .. py:function:: quantum_walk_alg(*args, **kwargs) -> Any Build quantum-walk algorithm quantum circuit .. py:function:: quantum_walk_search(list: List[int], Classical_condition: ClassicalCondition, QuantumMachine: quantum_walk_search.QuantumMachine, data: int = 2) -> quantum_walk_search.list Use Quantum-walk Algorithm to search target data, return QProg and search_result Args: list: data list Classical_condition: quantum Classical condition QuantumMachine: quantum machine repeat: search repeat times Returns: result : Quantum-walk search result Raises: run_fail: An error occurred in Quantum-walk .. py:function:: quick_measure(qubit_list: QVec, shots: int) -> Dict[str, int] Quick measure. Args: qubit_list: qubit list to measure. shots: the repeat number of measure operations. Returns: result: result of quantum program execution. .. py:function:: random_qcircuit(qvec: QVec, depth: int = 100, gate_type: List[str] = []) -> QCircuit Generate a random quantum circuit. Args: qvec: Output circuits for the random circuit. depth: Circuit depth (default is 100). gate_type: Types of gates to use (default is an empty vector). Returns: A random quantum circuit. .. py:function:: random_qprog(qubit_row: int, qubit_col: int, depth: int, qvm: QuantumMachine, qvec: QVec) -> QProg Generate a random quantum program. Args: qubit_row: Circuit qubit row value. qubit_col: Circuit qubit column value. depth: Circuit depth. qvm: Quantum machine. qvec: Output circuits for the random quantum program. Returns: A random quantum program. .. py:function:: recover_edges(topo_data: List[List[int]], max_connect_degree: int, candidate_edges: List[Tuple[int, List[int]]]) -> List[List[int]] Recover edges using the specified candidate edges. Args: topo_data: The topology data of the quantum program. max_connect_degree: The maximum allowed connection degree. candidate_edges: A list of edges to consider for recovery. Returns: The updated topology data after recovery. .. py:function:: remap(prog: QProg, target_qlist: QVec, target_clist: List[ClassicalCondition] = []) -> QProg Map the source quantum program to the target qubits. Args: prog: Source quantum program. target_qlist: Target qubits. target_clist: Target classical bits (default is an empty vector). Returns: The target quantum program. .. py:function:: replace_complex_points(src_topo_data: List[List[int]], max_connect_degree: int, sub_topo_vec: List[Tuple[int, List[List[int]]]]) -> None Replace complex points in the source topology with subgraphs. Args: src_topo_data: The source topology data of the quantum program. max_connect_degree: The maximum allowable connection degree. sub_topo_vec: A list of sub-topologies to replace the complex points. Returns: None: This function modifies the source topology in place. .. py:function:: run_with_configuration(*args, **kwargs) -> Any 1. run_with_configuration(program: pyQPanda.QProg, cbit_list: List[pyQPanda.ClassicalCondition], shots: int, noise_model: pyQPanda.Noise = NoiseModel()) -> Dict[str, int] Run quantum program with configuration Args: program: quantum program. cbit_list: classical cbits list. shots: number of times to repeat the quantum program. noise_model: noise model; defaults to no noise. Noise model only works on CPUQVM now. Returns: Result of quantum program execution in shots. First is the final qubit register state, second is its hit count. 2. run_with_configuration(program: pyQPanda.QProg, shots: int, noise_model: pyQPanda.Noise = NoiseModel()) -> Dict[str, int] Run quantum program with configuration. Args: program: quantum program. shots: repeat run quantum program times. noise_model: noise model, default is no noise. Noise model only works on CPUQVM now. Returns: tuple: result of quantum program execution in shots. First is the final qubit register state, second is its hit shot. .. py:function:: sabre_mapping(prog: QProg, quantum_machine: QuantumMachine, init_map: List[int], max_look_ahead: int = 20, max_iterations: int = 10, config_data: str = 'QPandaConfig.json') -> QProg sabre_mapping(prog: QProg, quantum_machine: QuantumMachine, init_map: List[int], max_look_ahead: int, max_iterations: int, arch_matrix: numpy.ndarray[numpy.float64[m, n]]) -> QProg sabre_mapping(prog: QProg, quantum_machine: QuantumMachine, max_look_ahead: int = 20, max_iterations: int = 10, config_data: str = 'QPandaConfig.json') -> QProg sabre_mapping(prog: QProg, quantum_machine: QuantumMachine, max_look_ahead: int, max_iterations: int, arch_matrix: numpy.ndarray[numpy.float64[m, n]]) -> QProg sabre mapping Args: prog: the target prog quantum_machine: quantum machine max_look_ahead: sabre_mapping max_look_ahead, default is 20 max_iterations: sabre_mapping max_iterations, default is 10 arch_matrix: arch matrix Returns: mapped quantum program .. py:function:: sigmoid(arg0: var) -> var .. py:function:: sin(arg0: var) -> var .. py:function:: softmax(arg0: var) -> var .. py:function:: split_complex_points(complex_points: List[int], max_connect_degree: int, topo_data: List[List[int]], split_method: ComplexVertexSplitMethod = ComplexVertexSplitMethod.LINEAR) -> List[Tuple[int, List[List[int]]]] Split complex points into multiple discrete points. Args: complex_points: A list of complex points to be split. max_connect_degree: The maximum allowable connection degree. topo_data: The topology data of the quantum program. split_method: Method for splitting, as defined in ComplexVertexSplitMethod. Defaults to ComplexVertexSplitMethod.LINEAR. Returns: None: The function modifies the input data in place. .. py:function:: stack(arg0: int, *args) -> var .. py:function:: state_fidelity(state1: List[complex], state2: List[complex]) -> float state_fidelity(matrix1: List[List[complex]], matrix2: List[List[complex]]) -> float state_fidelity(state1: List[complex], state2: List[List[complex]]) -> float state_fidelity(state1: List[List[complex]], state2: List[complex]) -> float Compare a quantum state matrix with a quantum state and calculate their fidelity. Args: matrix: a quantum state matrix. state: a single quantum state represented as a list. Returns: The fidelity between the matrix and the state, a value in the range [0, 1]. .. py:function:: sub(arg0: ClassicalCondition, arg1: ClassicalCondition) -> ClassicalCondition sub(arg0: ClassicalCondition, arg1: int) -> ClassicalCondition sub(arg0: int, arg1: ClassicalCondition) -> ClassicalCondition Subtract a ClassicalCondition from a bit size. Args: a: The bit size to subtract from. b: The ClassicalCondition to be subtracted. Returns: ClassicalCondition: The resulting ClassicalCondition after subtraction. .. py:function:: sum(arg0: var) -> var .. py:function:: tan(arg0: var) -> var .. py:function:: to_Quil(qprog: QProg, machine: QuantumMachine) -> str Transform QProg to Quil instruction. Args: qprog: quantum program (QProg). machine: quantum machine (QuantumMachine*). Returns: Quil instruction string. .. py:function:: to_originir(qprog: QProg, machine: QuantumMachine) -> str to_originir(qprog: QCircuit, machine: QuantumMachine) -> str to_originir(qprog: QGate, machine: QuantumMachine) -> str to_originir(qprog: QIfProg, machine: QuantumMachine) -> str to_originir(qprog: QWhileProg, machine: QuantumMachine) -> str to_originir(qprog: QMeasure, machine: QuantumMachine) -> str Transform QProg to OriginIR string. Args: qprog: T, the quantum program or circuit to transform. machine: QuantumMachine*, the quantum machine being used. Returns: OriginIR string, the transformed representation of the quantum program. .. py:function:: topology_match(qprog: QProg, qubit_list: QVec, machine: QuantumMachine, confing_file: str = 'QPandaConfig.json') -> list Judge whether a quantum program matches the topology of the physical qubits. Args: qprog: The quantum program to be evaluated. qubit_list: The list of qubits in the quantum program. machine: The quantum machine used for execution. confing_file: The configuration file path for matching (default: QPandaConfig.json). Returns: list: Contains the resulting quantum program and the qubit list. .. py:function:: transform_binary_data_to_qprog(machine: QuantumMachine, data: List[int]) -> QProg Parse binary data to transform it into a quantum program. Args: machine: quantum machine. data: list containing binary data from transform_qprog_to_binary(). Returns: QProg: the resulting quantum program. .. py:function:: transform_originir_to_qprog(fname: str, machine: QuantumMachine) -> QProg Transform OriginIR instruction from a file into a QProg. Args: fname: file containing the OriginIR instructions. machine: the quantum machine. Returns: QProg: the resulting quantum program. .. py:function:: transform_qprog_to_binary(qprog: QProg, machine: QuantumMachine) -> List[int] transform_qprog_to_binary(qprog: QProg, machine: QuantumMachine, fname: str) -> None Save quantum program to file as binary data. Args: qprog: quantum program (QProg). machine: quantum machine. fname: name of the file to save to. .. py:function:: transform_qprog_to_originir(qprog: QProg, machine: QuantumMachine) -> str Transform a quantum program into an OriginIR instruction string. Args: qprog: the quantum program (QProg). machine: the quantum machine. Returns: string: the resulting OriginIR instruction string. .. py:function:: transform_qprog_to_quil(qprog: QProg, machine: QuantumMachine) -> str Transform QProg to Quil instruction. Args: qprog: quantum program (QProg). machine: quantum machine (QuantumMachine*). Returns: Quil instruction string. .. py:function:: transform_to_base_qgate(qprog: QProg, machine: QuantumMachine, config_file: str = 'QPandaConfig.json') -> QProg transform_to_base_qgate(qprog: QProg, machine: QuantumMachine, convert_single_gates: List[str], convert_double_gates: List[str]) -> QProg Convert quantum gates to basic gates. Args: qprog: the quantum program to transform. machine: the quantum machine for the transformation. convert_single_gates: a set of quantum single gates to convert. convert_double_gates: a set of quantum double gates to convert. Returns: the updated quantum program after the conversion. .. py:function:: transfrom_pauli_operator_to_matrix(arg0) -> List[complex] transfrom pauli operator to matrix Args: matrix: 2^N *2^N double matrix Returns: result : hamiltonian .. py:function:: transpose(arg0: var) -> var .. py:function:: validate_double_qgate_type(gate_str_list: List[str]) -> list Get valid QGates and valid double bit QGate type. Args: double_gates: A list of double gate strings. Returns: result: A list containing the validated gate type and valid double gates. .. py:function:: validate_single_qgate_type(gate_str_list: List[str]) -> list Get valid QGates and valid single bit QGate type. Args: single_gates: A list of single gate strings. Returns: result: A list containing the validated gate type and valid single gates. .. py:function:: vector_dot(x: List[float], y: List[float]) -> float Compute the inner product of two vectors. Args: x: A list representing the first vector. y: A list representing the second vector. Returns: dot result: The dot product of vectors x and y. .. py:function:: virtual_z_transform(prog: QProg, quantum_machine: QuantumMachine, b_del_rz_gate: bool = False, config_data: str = 'QPandaConfig.json') -> QProg virtual z transform Args: prog: the target prog quantum_machine: quantum machine b_del_rz_gate: whether delete the rz gate config_data: config data, @See JsonConfigParam::load_config() Returns: mapped quantum program