pyqpanda.pyQPanda

Module Contents

Classes

AbstractOptimizer

quantum AbstractOptimizer class

AdaGradOptimizer

variational quantum AdaGradOptimizer

AdamOptimizer

variational quantum AdamOptimizer

Ansatz

quantum ansatz class

AnsatzGate

ansatz gate struct

AnsatzGateType

Quantum ansatz gate type

BackendType

Quantum machine backend type

CBit

quantum classical bit

CPUQVM

quantum machine cpu

CPUSingleThreadQVM

quantum machine class for cpu single thread

ChipID

origin quantum real chip type

ClassicalCondition

Classical condition class Proxy class of cexpr class

ClassicalProg

quantum ClassicalProg

CommProtocolConfig

ComplexVertexSplitMethod

quantum complex vertex split method

DAGNodeType

Quantum dag node type

DecompositionMode

Quantum matrix decomposition mode

DensityMatrixSimulator

simulator for density matrix

DoubleGateTransferType

Quantum double gate transfer type

Encode

quantum amplitude encode

ErrorCode

pliot error code

Fusion

quantum fusion operation

GateType

quantum gate type

HHLAlg

quantum hhl algorithm class

LATEX_GATE_TYPE

Quantum latex gate type

LatexMatrix

Generate quantum circuits latex src code can be compiled on latex package 'qcircuit'

MPSQVM

quantum matrix product state machine class

MomentumOptimizer

variational quantum MomentumOptimizer

NodeInfo

Detailed information of a QProg node

NodeIter

quantum node iter

NodeType

quantum node type

Noise

Quantum machine for noise simulation

NoiseModel

noise model type

NoiseQVM

quantum machine class for simulate noise prog

Optimizer

variational quantum Optimizer class

OptimizerFactory

quantum OptimizerFactory class

OptimizerMode

variational quantum OptimizerMode

OptimizerType

quantum OptimizerType

OriginCMem

origin quantum cmem

OriginCollection

A relatively free data collection class for saving data

OriginQubitPool

quantum qubit pool

PartialAmpQVM

quantum partial amplitude machine class

PhysicalQubit

Physical Qubit abstract class

PilotNoiseParams

pliot noise simulate params

ProgCount

QCircuit

quantum circuit node

QCircuitOPtimizerMode

Quantum circuit optimize mode

QCloudService

origin quantum cloud machine

QCloudTaskConfig

QError

Quantum QError Type

QGate

quantum gate node

QITE

quantum imaginary time evolution

QIfProg

quantum if prog node

QMachineType

Quantum machine type

QMeasure

quantum measure node

QOperator

quantum operator class

QOptimizationResult

quantum QOptimizationResult class

QPilotMachine

pliot machine

QPilotOSService

origin quantum pilot OS Machine

QProg

Quantum program,can construct quantum circuit,data struct is linked list

QProgDAG

quantum prog dag class

QProgDAGEdge

quantum prog dag edge

QProgDAGVertex

quantum prog dag vertex node

QReset

quantum reset node

QResult

QResult abstract class, this class contains the result of the quantum measurement

QVec

Qubit vector basic class

QWhileProg

quantum while node

QuantumMachine

quantum machine base class

QuantumStateTomography

quantum state tomography class

Qubit

Qubit abstract class

RMSPropOptimizer

variational quantum RMSPropOptimizer

SingleAmpQVM

quantum single amplitude machine class

SingleGateTransferType

Quantum single gate transfer type

SparseQVM

quantum sparse machine class

Stabilizer

simulator for basic clifford simulator

UpdateMode

quantum imaginary time evolution update mode

VanillaGradientDescentOptimizer

variational quantum VanillaGradientDescentOptimizer

VariationalQuantumCircuit

variational quantum CIRCUIT class

VariationalQuantumGate

variational quantum gate base class

VariationalQuantumGate_CNOT

variational quantum CNOT gate class

VariationalQuantumGate_CR

variational quantum CR gate class

VariationalQuantumGate_CRX

variational quantum CRX gate class

VariationalQuantumGate_CRY

variational quantum CRY gate class

VariationalQuantumGate_CRZ

variational quantum CRZ gate class

VariationalQuantumGate_CU

variational quantum CU gate class

VariationalQuantumGate_CZ

variational quantum CZ gate class

VariationalQuantumGate_H

variational quantum H gate class

VariationalQuantumGate_I

variational quantum I gate class

VariationalQuantumGate_RX

variational quantum RX gate class

VariationalQuantumGate_RY

variational quantum RY gate class

VariationalQuantumGate_RZ

variational quantum RZ gate class

VariationalQuantumGate_S

variational quantum S gate class

VariationalQuantumGate_SWAP

variational quantum SWAP gate class

VariationalQuantumGate_SqiSWAP

variational quantum SqiSWAP gate class

VariationalQuantumGate_T

variational quantum T gate class

VariationalQuantumGate_U1

variational quantum U1 gate class

VariationalQuantumGate_U2

variational quantum U2 gate class

VariationalQuantumGate_U3

variational quantum U3 gate class

VariationalQuantumGate_U4

variational quantum U4 gate class

VariationalQuantumGate_X

variational quantum X gate class

VariationalQuantumGate_X1

variational quantum X1 gate class

VariationalQuantumGate_Y

variational quantum Y gate class

VariationalQuantumGate_Y1

variational quantum Y1 gate class

VariationalQuantumGate_Z

variational quantum Z gate class

VariationalQuantumGate_Z1

variational quantum Z1 gate class

VariationalQuantumGate_iSWAP

variational quantum iSWAP gate class

em_method

origin quantum real chip error_mitigation type

expression

variational quantum expression class

hadamard_circuit

hadamard circuit class

real_chip_type

origin quantum real chip type enum

var

quantum variational class

Functions

BARRIER(…)

Create a BARRIER gate

CNOT(…)

Returns:

CP(…)

Returns:

CR(…)

Returns:

CU(…)

Create a CU gate

CZ(…)

Returns:

CreateEmptyCircuit(→ QCircuit)

Create an empty QCircuit Container

CreateEmptyQProg(→ QProg)

Create an empty QProg Container

CreateIfProg(…)

Create a classical quantum IfProg

CreateWhileProg(→ QWhileProg)

Create a WhileProg

Grover(→ Any)

Quantum grover circuit

Grover_search(…)

use Grover algorithm to search target data, return QProg and search_result

H(…)

Create a H gate

HHL_solve_linear_equations(→ List[complex])

Use HHL algorithm to solve the target linear systems of equations : Ax = b

I(…)

Create a I gate

MAJ(→ QCircuit)

Quantum adder MAJ module

MAJ2(→ QCircuit)

Quantum adder MAJ2 module

MS(…)

Returns:

Measure(…)

Create an measure node

OBMT_mapping(…)

OPT_BMT mapping

P(…)

Create a P gate

PMeasure(→ List[Tuple[int, float]])

Deprecated, use pmeasure instead

PMeasure_no_index(→ List[float])

Deprecated, use pmeasure_no_index instead

QAdd(→ QCircuit)

Quantum adder that supports signed operations, but ignore carry

QAdder(→ QCircuit)

Quantum adder with carry

QAdderIgnoreCarry(→ QCircuit)

Args:

QComplement(→ QCircuit)

Convert quantum state to binary complement representation

QDiv(→ QProg)

Quantum division

QDivWithAccuracy(→ QProg)

Args:

QDivider(→ QProg)

Quantum division, only supports positive division, and the highest position of a and b and c is sign bit

QDividerWithAccuracy(→ QProg)

Args:

QDouble(…)

Returns:

QFT(→ QCircuit)

Build QFT quantum circuit

QMul(→ QCircuit)

Quantum multiplication

QMultiplier(→ QCircuit)

Quantum multiplication, only supports positive multiplication

QOracle(→ QGate)

Generate QOracle Gate

QPE(→ QCircuit)

Quantum phase estimation

QSub(→ QCircuit)

Quantum subtraction

RX(…)

Create a RX gate

RXX(…)

Create a RXX gate

RY(…)

Create a RY gate

RYY(…)

Create a RYY gate

RZ(…)

Create a RZ gate

RZX(…)

Create a RZX gate

RZZ(…)

Create a RZZ gate

Reset(…)

Create a Reset node

S(…)

Create a S gate

SWAP(…)

Returns:

Shor_factorization(→ Tuple[bool, Tuple[int, int]])

Use Shor factorize integer num

SqiSWAP(…)

Returns:

T(…)

Create a T gate

Toffoli(…)

Create a Toffoli gate

U1(…)

Create a U1 gate

U2(…)

Create a U2 gate

U3(…)

Create a U3 gate

U4(…)

Create a U4 gate

UMA(→ QCircuit)

Quantum adder UMA module

VQG_CNOT_batch(→ Any)

variational quantum CNOT batch gates

VQG_CU_batch(→ Any)

variational quantum CU batch gates

VQG_CZ_batch(→ Any)

variational quantum CZ batch gates

VQG_H_batch(→ Any)

variational quantum H batch gates

VQG_I_batch(→ Any)

variational quantum I batch gates

VQG_SWAP_batch(→ Any)

variational quantum SWAP batch gates

VQG_S_batch(→ Any)

variational quantum S batch gates

VQG_SqiSWAP_batch(→ Any)

variational quantum SqiSWAP batch gates

VQG_T_batch(→ Any)

variational quantum T batch gates

VQG_U1_batch(→ Any)

variational quantum U1 batch gates

VQG_U2_batch(→ Any)

variational quantum U2 batch gates

VQG_U3_batch(→ Any)

variational quantum U3 batch gates

VQG_U4_batch(→ Any)

variational quantum U4 batch gates

VQG_X1_batch(→ Any)

variational quantum X1 batch gates

VQG_X_batch(→ Any)

variational quantum X batch gates

VQG_Y1_batch(→ Any)

variational quantum Y1 batch gates

VQG_Y_batch(→ Any)

variational quantum Y batch gates

VQG_Z1_batch(→ Any)

variational quantum Z1 batch gates

VQG_Z_batch(→ Any)

variational quantum Z batch gates

VQG_iSWAP_batch(→ Any)

variational quantum iSWAP batch gates

X(…)

Create a X gate

X1(…)

Create a X1 gate

Y(…)

Create a Y gate

Y1(…)

Create a Y1 gate

Z(…)

Create a Z gate

Z1(…)

Create a Z1 gate

accumulateProbability(→ List[float])

Accumulate the probability from a prob list

accumulate_probabilities(→ List[float])

Accumulate the probability from a prob list

accumulate_probability(→ List[float])

Accumulate the probability from a prob list

acos(→ var)

add(…)

all_cut_of_graph(→ float)

Generate graph of maxcut problem

amplitude_encode(…)

Encode the input double data to the amplitude of qubits

apply_QGate(…)

Apply QGate to qubits

asin(→ var)

assign(…)

atan(→ var)

average_gate_fidelity(…)

compare two quantum states , Get the state fidelity

bin_to_prog(→ bool)

Parse binary data transfor to quantum program

bind_data(→ QCircuit)

Args:

bind_nonnegative_data(→ QCircuit)

Args:

build_HHL_circuit(→ QCircuit)

build the quantum circuit for HHL algorithm to solve the target linear systems of equations : Ax = b

cAlloc(…)

Allocate a CBit

cAlloc_many(→ List[ClassicalCondition])

Allocate several CBits

cFree(→ None)

Free a CBit

cFree_all(…)

Free all cbits

calculate_quantum_volume(…)

calculate quantum volume

cast_qprog_qcircuit(→ QCircuit)

Cast QProg to QCircuit

cast_qprog_qgate(→ QGate)

Cast QProg to QGate

cast_qprog_qmeasure(→ QMeasure)

Cast QProg to QMeasure

circuit_layer(→ list)

Quantum circuit layering

circuit_optimizer(→ QProg)

Optimize QCircuit

circuit_optimizer_by_config(→ QProg)

QCircuit optimizer

comm_protocol_decode(→ Tuple[List[QProg], ...)

decode binary data to comm protocol prog list

comm_protocol_encode(…)

encode comm protocol data to binary data

constModAdd(→ QCircuit)

Args:

constModExp(→ QCircuit)

Args:

constModMul(→ QCircuit)

Args:

convert_binary_data_to_qprog(→ QProg)

Parse binary data to quantum program

convert_originir_str_to_qprog(→ list)

Trans OriginIR to QProg

convert_originir_to_qprog(→ list)

Read OriginIR file and trans to QProg

convert_qasm_string_to_qprog(→ list)

Trans QASM to QProg

convert_qasm_to_qprog(→ list)

Read QASM file and trans to QProg

convert_qprog_to_binary(…)

Store quantum program in binary file

convert_qprog_to_originir(→ str)

Args:

convert_qprog_to_qasm(→ str)

Convert QProg to QASM instruction string

convert_qprog_to_quil(→ str)

convert QProg to Quil instruction

cos(→ var)

count_gate(…)

Count quantum gate num under quantum program, quantum circuit

count_prog_info(…)

count quantum program info

count_qgate_num(…)

Count quantum gate num under quantum program

create_empty_circuit(→ QCircuit)

Create an empty QCircuit Container

create_empty_qprog(→ QProg)

Create an empty QProg Container

create_if_prog(…)

Create a classical quantum IfProg

create_while_prog(→ QWhileProg)

Create a WhileProg

crossEntropy(→ var)

decompose_multiple_control_qgate(…)

Decompose multiple control QGate

deep_copy(…)

del_weak_edge(→ None)

Delete weakly connected edges

del_weak_edge2(→ list)

Delete weakly connected edges

del_weak_edge3(→ list)

Delete weakly connected edges

destroy_quantum_machine(→ None)

Destroy a quantum machine

directly_run() → Dict[str, bool])

Directly run quantum prog

div(…)

dot(→ var)

double_gate_xeb(…)

double gate xeb

double_qubit_rb(…)

double qubit rb with origin chip

draw_qprog_latex(, itr_end)

Convert a quantum prog/circuit to latex source code, and save the source code to file in current path with name QCircuit.tex

draw_qprog_latex_with_clock(, itr_end)

Convert a quantum prog/circuit to latex source code with time sequence, and save the source code to file in current path with name QCircuit.tex

draw_qprog_text(, itr_end)

Convert a quantum prog/circuit to text-pic(UTF-8 code),

draw_qprog_text_with_clock(, itr_end)

Convert a quantum prog/circuit to text-pic(UTF-8 code) with time sequence,

dropout(→ var)

equal(…)

estimate_topology(→ float)

Evaluate topology performance

eval(…)

exp(→ var)

expMat(→ numpy.ndarray[numpy.complex128[m, n]])

calculate the matrix power of e

expand_linear_equations(…)

Extending linear equations to N dimension, N = 2 ^ n

fill_qprog_by_I(→ QProg)

Fill the input QProg by I gate, return a new quantum program

finalize(→ None)

Finalize the environment and destory global unique quantum machine.

fit_to_gbk(→ str)

Special character conversion

flatten(…)

Flatten quantum circuit

getAllocateCMem(→ int)

Deprecated, use get_allocate_cmem_num instead

getAllocateQubitNum(→ int)

Deprecated, use get_allocate_qubit_num instead

get_adjacent_qgate_type(→ List[NodeInfo])

Get the adjacent quantum gates's(the front one and the back one) typeinfo from QProg

get_all_used_qubits(→ List[Qubit])

Get all the used quantum bits in the input prog

get_all_used_qubits_to_int(→ List[int])

Get all the used quantum bits addr in the input prog

get_allocate_cbits(→ List[ClassicalCondition])

Get allocated cbits of QuantumMachine

get_allocate_cmem_num(→ int)

get allocate cmem num

get_allocate_qubit_num(→ int)

get allocate qubit num

get_allocate_qubits(→ List[Qubit])

Get allocated qubits of QuantumMachine

get_bin_data(→ List[int])

Get quantum program binary data

get_bin_str(→ str)

Transfor quantum program to string

get_circuit_optimal_topology(→ List[List[int]])

Get the optimal topology of the input circuit

get_clock_cycle(→ int)

Get quantum program clock cycle

get_complex_points(→ List[int])

Get complex points

get_double_gate_block_topology(→ List[List[int]])

get double gate block topology

get_matrix(, nodeitr_end)

Get the target matrix between the input two Nodeiters

get_prob_dict(→ Dict[str, float])

Get pmeasure result as dict

get_prob_list(→ List[float])

Get pmeasure result as list

get_qgate_num(…)

Count quantum gate num under quantum program

get_qprog_clock_cycle(→ int)

Get Quantum Program Clock Cycle

get_qstate(…)

get_sub_graph(→ List[int])

Get sub graph

get_tuple_list(→ List[Tuple[int, float]])

Get pmeasure result as tuple list

get_unitary(, nodeitr_end)

Get the target matrix between the input two Nodeiters

get_unsupport_qgate_num(→ int)

Count quantum program unsupported gate numner

getstat(→ Any)

Get the status of the Quantum machine

iSWAP(…)

Returns:

init(→ bool)

Init the global unique quantum machine at background.

init_quantum_machine(→ QuantumMachine)

Create and initialize a new quantum machine, and let it be global unique quantum machine

inverse(→ var)

isCarry(→ QCircuit)

Construct a circuit to determine if there is a carry

is_match_topology(→ bool)

Judge the QGate if match the target topologic structure of quantum circuit

is_supported_qgate_type(→ bool)

Judge if the target node is a QGate type

is_swappable(→ bool)

Judge the specialed two NodeIters in qprog whether can be exchanged

iterative_amplitude_estimation(→ float)

estimate the probability corresponding to the ground state |1> of the last bit

ldd_decompose(→ QProg)

Decompose multiple control QGate

log(→ var)

matrix_decompose(…)

Matrix decomposition

matrix_decompose_paulis(…)

decompose matrix into paulis combination

measure_all(…)

Create a list of measure node

mul(…)

originir_to_qprog(→ QProg)

Read OriginIR file and trans to QProg

pauli_combination_replace(→ List[Tuple[float, QCircuit]])

planarity_testing(→ bool)

planarity testing

pmeasure(→ List[Tuple[int, float]])

Get the probability distribution over qubits

pmeasure_no_index(→ List[float])

Get the probability distribution over qubits

poly(→ var)

print_matrix(→ str)

Print matrix element

prob_run_dict(→ Dict[str, float])

Run quantum program and get pmeasure result as dict

prob_run_list(→ List[float])

Run quantum program and get pmeasure result as list

prob_run_tuple_list(→ List[Tuple[int, float]])

Run quantum program and get pmeasure result as tuple list

prog_layer(→ Any)

prog_to_dag(→ QProgDAG)

qAlloc(…)

Allocate a qubits

qAlloc_many(→ List[Qubit])

Allocate several qubits

qFree(→ None)

Free a qubit

qFree_all(…)

Free a list of qubits

qop(…)

qop_pmeasure(→ var)

quantum_chip_adapter(→ list)

Quantum chip adaptive conversion

quantum_walk_alg(→ Any)

Build quantum-walk algorithm quantum circuit

quantum_walk_search(→ quantum_walk_search.list)

Use Quantum-walk Algorithm to search target data, return QProg and search_result

quick_measure(→ Dict[str, int])

Quick measure

random_qcircuit(→ QCircuit)

Generate random quantum circuit

random_qprog(→ QProg)

Generate random quantum program

recover_edges(→ List[List[int]])

Recover edges from the candidate edges

remap(→ QProg)

Source qunatum program is mapped to the target qubits

replace_complex_points(→ None)

Replacing complex points with subgraphs

run_with_configuration(…)

Run quantum program with configuration

sabre_mapping(…)

sabre mapping

sigmoid(→ var)

sin(→ var)

single_qubit_rb(…)

Single qubit rb with origin chip

softmax(→ var)

split_complex_points(→ List[Tuple[int, List[List[int]]]])

Splitting complex points into multiple points

stack(→ var)

state_fidelity(…)

compare two quantum states , Get the state fidelity

sub(…)

sum(→ var)

tan(→ var)

to_Quil(→ str)

Transform QProg to Quil instruction

to_originir(…)

Transform QProg to OriginIR string

topology_match(→ list)

Judge QProg/QCircuit matches the topology of the physical qubits

transform_binary_data_to_qprog(→ QProg)

Parse binary data trans to quantum program

transform_originir_to_qprog(→ QProg)

Transform OriginIR to QProg

transform_qprog_to_binary(…)

Save quantum program to file as binary data

transform_qprog_to_originir(→ str)

Quantum program transform to OriginIR string

transform_qprog_to_quil(→ str)

Transform QProg to Quil instruction

transform_to_base_qgate(…)

Basic quantum - gate conversion

transfrom_pauli_operator_to_matrix(→ List[complex])

transfrom pauli operator to matrix

transpose(→ var)

validate_double_qgate_type(→ list)

Get valid QGates and valid double bit QGate type

validate_single_qgate_type(→ list)

Get valid QGates and valid single bit QGate type

vector_dot(→ float)

Inner product of vector x and y

virtual_z_transform(→ QProg)

virtual z transform

class pyqpanda.pyQPanda.AbstractOptimizer(*args, **kwargs)[源代码]

quantum AbstractOptimizer class

exec() None[源代码]
getResult(*args, **kwargs) Any[源代码]
registerFunc(arg0: Callable[[List[float], List[float], int, int], Tuple[str, float]], arg1: List[float]) None[源代码]
setAdaptive(arg0: bool) None[源代码]
setCacheFile(arg0: str) None[源代码]
setDisp(arg0: bool) None[源代码]
setFatol(arg0: float) None[源代码]
setMaxFCalls(arg0: int) None[源代码]
setMaxIter(arg0: int) None[源代码]
setRestoreFromCacheFile(arg0: bool) None[源代码]
setXatol(arg0: float) None[源代码]
class pyqpanda.pyQPanda.AdaGradOptimizer(arg0: var, arg1: float, arg2: float, arg3: float)[源代码]

variational quantum AdaGradOptimizer

get_loss() float[源代码]
get_variables() List[var][源代码]
minimize(arg0: float, arg1: float, arg2: float) Optimizer[源代码]
run(arg0: List[var], arg1: int) bool[源代码]
class pyqpanda.pyQPanda.AdamOptimizer(arg0: var, arg1: float, arg2: float, arg3: float, arg4: float)[源代码]

variational quantum AdamOptimizer

get_loss() float[源代码]
get_variables() List[var][源代码]
minimize(arg0: float, arg1: float, arg2: float, arg3: float) Optimizer[源代码]
run(arg0: List[var], arg1: int) bool[源代码]
class pyqpanda.pyQPanda.Ansatz[源代码]
class pyqpanda.pyQPanda.Ansatz(arg0: QGate)
class pyqpanda.pyQPanda.Ansatz(arg0: AnsatzGate)
class pyqpanda.pyQPanda.Ansatz(ansatz: List[AnsatzGate], thetas: List[float] = [])
class pyqpanda.pyQPanda.Ansatz(ansatz_circuit: Ansatz, thetas: List[float] = [])
class pyqpanda.pyQPanda.Ansatz(circuit: QCircuit, thetas: List[float] = [])

quantum ansatz class

get_ansatz_list() List[AnsatzGate][源代码]
get_thetas_list() List[float][源代码]
insert(gate: QGate) None[源代码]
insert(gate: AnsatzGate) None
insert(gate: List[AnsatzGate]) None
insert(gate: QCircuit) None
insert(gate: Ansatz, thetas: List[float] = []) None
set_thetas(thetas: List[float]) None[源代码]
class pyqpanda.pyQPanda.AnsatzGate(arg0: AnsatzGateType, arg1: int)[源代码]
class pyqpanda.pyQPanda.AnsatzGate(arg0: AnsatzGateType, arg1: int, arg2: float)
class pyqpanda.pyQPanda.AnsatzGate(arg0: AnsatzGateType, arg1: int, arg2: float, arg3: int)

ansatz gate struct

control: int[源代码]
target: int[源代码]
theta: float[源代码]
type: AnsatzGateType[源代码]
class pyqpanda.pyQPanda.AnsatzGateType(value: int)[源代码]

Quantum ansatz gate type

Members:

AGT_X

AGT_H

AGT_RX

AGT_RY

AGT_RZ

property name: str[源代码]
property value: int[源代码]
AGT_H: ClassVar[AnsatzGateType] = Ellipsis[源代码]
AGT_RX: ClassVar[AnsatzGateType] = Ellipsis[源代码]
AGT_RY: ClassVar[AnsatzGateType] = Ellipsis[源代码]
AGT_RZ: ClassVar[AnsatzGateType] = Ellipsis[源代码]
AGT_X: ClassVar[AnsatzGateType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.BackendType(value: int)[源代码]

Quantum machine backend type

Members:

CPU

GPU

CPU_SINGLE_THREAD

NOISE

MPS

property name: str[源代码]
property value: int[源代码]
CPU: ClassVar[BackendType] = Ellipsis[源代码]
CPU_SINGLE_THREAD: ClassVar[BackendType] = Ellipsis[源代码]
GPU: ClassVar[BackendType] = Ellipsis[源代码]
MPS: ClassVar[BackendType] = Ellipsis[源代码]
NOISE: ClassVar[BackendType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.CBit(*args, **kwargs)[源代码]

quantum classical bit

getName() str[源代码]
class pyqpanda.pyQPanda.CPUQVM[源代码]

Bases: QuantumMachine

quantum machine cpu

get_prob_dict(qubit_list: QVec, select_max: int = -1) Dict[str, float][源代码]
get_prob_list(qubit_list: QVec, select_max: int = -1) List[float][源代码]
get_prob_tuple_list(qubit_list: QVec, select_max: int = -1) List[Tuple[int, float]][源代码]
init_qvm(arg0: bool) None[源代码]
init_qvm() None
pmeasure(qubit_list: QVec, select_max: int = -1) List[Tuple[int, float]][源代码]

Get the probability distribution over qubits

pmeasure_no_index(qubit_list: QVec) List[float][源代码]

Get the probability distribution over qubits

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]
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]
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]]
quick_measure(qubit_list: QVec, shots: int) Dict[str, int][源代码]
set_max_threads(size: int) None[源代码]

set CPUQVM max thread size

class pyqpanda.pyQPanda.CPUSingleThreadQVM[源代码]

Bases: QuantumMachine

quantum machine class for cpu single thread

get_prob_dict(qubit_list: QVec, select_max: int = -1) Dict[str, float][源代码]
get_prob_list(qubit_list: QVec, select_max: int = -1) List[float][源代码]
get_prob_tuple_list(qubit_list: QVec, select_max: int = -1) List[Tuple[int, float]][源代码]
pmeasure(qubit_list: QVec, select_max: int = -1) List[Tuple[int, float]][源代码]

Get the probability distribution over qubits

pmeasure_no_index(qubit_list: QVec) List[float][源代码]

Get the probability distribution over qubits

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]
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]
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]]
quick_measure(qubit_list: QVec, shots: int) Dict[str, int][源代码]
class pyqpanda.pyQPanda.ChipID(value: int)[源代码]

origin quantum real chip type

Members:

Simulation

WUYUAN_1

WUYUAN_2

WUYUAN_3

property name: str[源代码]
property value: int[源代码]
Simulation: ClassVar[ChipID] = Ellipsis[源代码]
WUYUAN_1: ClassVar[ChipID] = Ellipsis[源代码]
WUYUAN_2: ClassVar[ChipID] = Ellipsis[源代码]
WUYUAN_3: ClassVar[ChipID] = Ellipsis[源代码]
class pyqpanda.pyQPanda.ClassicalCondition(*args, **kwargs)[源代码]

Classical condition class Proxy class of cexpr class

c_and(arg0: int) ClassicalCondition[源代码]
c_and(arg0: ClassicalCondition) ClassicalCondition
c_not() ClassicalCondition[源代码]
c_or(arg0: int) ClassicalCondition[源代码]
c_or(arg0: ClassicalCondition) ClassicalCondition
get_val() int[源代码]

get value

set_val(arg0: int) None[源代码]

set value

class pyqpanda.pyQPanda.ClassicalProg(arg0: ClassicalCondition)[源代码]

quantum ClassicalProg

class pyqpanda.pyQPanda.CommProtocolConfig[源代码]
circuits_num: int[源代码]
open_error_mitigation: bool[源代码]
open_mapping: bool[源代码]
optimization_level: int[源代码]
shots: int[源代码]
class pyqpanda.pyQPanda.ComplexVertexSplitMethod(value: int)[源代码]

quantum complex vertex split method

Members:

METHOD_UNDEFINED

LINEAR

RING

property name: str[源代码]
property value: int[源代码]
LINEAR: ClassVar[ComplexVertexSplitMethod] = Ellipsis[源代码]
METHOD_UNDEFINED: ClassVar[ComplexVertexSplitMethod] = Ellipsis[源代码]
RING: ClassVar[ComplexVertexSplitMethod] = Ellipsis[源代码]
class pyqpanda.pyQPanda.DAGNodeType(value: int)[源代码]

Quantum dag node type

Members:

NUKNOW_SEQ_NODE_TYPE

MAX_GATE_TYPE

MEASURE

QUBIT

RESET

property name: str[源代码]
property value: int[源代码]
MAX_GATE_TYPE: ClassVar[DAGNodeType] = Ellipsis[源代码]
MEASURE: ClassVar[DAGNodeType] = Ellipsis[源代码]
NUKNOW_SEQ_NODE_TYPE: ClassVar[DAGNodeType] = Ellipsis[源代码]
QUBIT: ClassVar[DAGNodeType] = Ellipsis[源代码]
RESET: ClassVar[DAGNodeType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.DecompositionMode(value: int)[源代码]

Quantum matrix decomposition mode

Members:

QR

HOUSEHOLDER_QR

QSDecomposition

CSDecomposition

property name: str[源代码]
property value: int[源代码]
CSDecomposition: ClassVar[DecompositionMode] = Ellipsis[源代码]
HOUSEHOLDER_QR: ClassVar[DecompositionMode] = Ellipsis[源代码]
QR: ClassVar[DecompositionMode] = Ellipsis[源代码]
QSDecomposition: ClassVar[DecompositionMode] = Ellipsis[源代码]
class pyqpanda.pyQPanda.DensityMatrixSimulator[源代码]

Bases: QuantumMachine

simulator for density matrix

get_density_matrix(prog: QProg) numpy.ndarray[numpy.complex128[m, n]][源代码]

Run quantum program and get full density matrix

Args:

prog: quantum program

Returns:

full density matrix

Raises:

run_fail: An error occurred in get_density_matrix

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 quantum program and hamiltonian expection for current qubits

Args:

prog: quantum program hamiltonian: QHamiltonian qubits: select qubits

Returns:

hamiltonian expection for current qubits

Raises:

run_fail: An error occurred in get_expectation

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 quantum program and get all indices probabilities for current binary indices

Args:

prog: quantum program indices: select binary indices

Returns:

probabilities result of quantum program

Raises:

run_fail: An error occurred in get_probabilities

get_probability(prog: QProg, index: int) float[源代码]
get_probability(prog: QProg, index: str) float

Run quantum program and get index probability

Args:

prog: quantum program index: measure index in [0,2^N - 1]

Returns:

probability result of quantum program

Raises:

run_fail: An error occurred in get_probability

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 density matrix for current qubits

Args:

prog: quantum program qubits: quantum program select qubits

Returns:

density matrix

Raises:

run_fail: An error occurred in get_reduced_density_matrix

init_qvm(is_double_precision: bool = True) None[源代码]
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
class pyqpanda.pyQPanda.DoubleGateTransferType(value: int)[源代码]

Quantum double gate transfer type

Members:

DOUBLE_GATE_INVALID

DOUBLE_BIT_GATE

property name: str[源代码]
property value: int[源代码]
DOUBLE_BIT_GATE: ClassVar[DoubleGateTransferType] = Ellipsis[源代码]
DOUBLE_GATE_INVALID: ClassVar[DoubleGateTransferType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.Encode[源代码]

quantum amplitude encode

amplitude_encode(qubit: QVec, data: List[float]) None[源代码]
amplitude_encode(qubit: QVec, data: List[complex]) None
amplitude_encode_recursive(qubit: QVec, data: List[float]) None[源代码]
amplitude_encode_recursive(qubit: QVec, data: List[complex]) None

Encode by amplitude recursive

Args:

QVec: qubits QStat: amplitude

Returns:

circuit

Raises:

run_fail: An error occurred in get amplitude_encode_recursive

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

Raises:

run_fail: An error occurred in get angle_encode

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

approx mps encode

Args:

Qubit: qubits data: std::vector<qcomplex_t> int: layer int: step

Returns:

circuit

Raises:

run_fail: An error occurred in approx_mps

basic_encode(qubit: QVec, data: str) None[源代码]

basic_encode

Args:

QVec: qubits string: data

Returns:

circuit

Raises:

run_fail: An error occurred in basic_encode

bid_amplitude_encode(qubit: QVec, data: List[float], split: int = 0) None[源代码]

Encode by bid

Args:

QVec: qubits QStat: amplitude split: int

Returns:

circuit

Raises:

run_fail: An error occurred in bid_amplitude_encode

dc_amplitude_encode(qubit: QVec, data: List[float]) None[源代码]

Encode by dc amplitude

Args:

QVec: qubits QStat: amplitude

Returns:

circuit

Raises:

run_fail: An error occurred in dc_amplitude_encode

dense_angle_encode(qubit: QVec, data: List[float]) None[源代码]

Encode by dense angle

Args:

QVec: qubits prob_vec: data

Returns:

circuit

Raises:

run_fail: An error occurred in dense_angle_encode

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
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
get_circuit() QCircuit[源代码]
get_fidelity(data: List[float]) float[源代码]
get_fidelity(data: List[complex]) float
get_fidelity(data: List[float]) float
get_out_qubits() QVec[源代码]
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

Raises:

run_fail: An error occurred in iqp_encode

schmidt_encode(qubit: QVec, data: List[float], cutoff: float) None[源代码]

Encode by schmidt

Args:

QVec: qubits QStat: amplitude double: cut_off

Returns:

circuit

Raises:

run_fail: An error occurred in schmidt_encode

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
class pyqpanda.pyQPanda.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

property name: str[源代码]
property value: int[源代码]
BACKEND_CALC_ERROR: ClassVar[ErrorCode] = Ellipsis[源代码]
CLUSTER_BASE: ClassVar[ErrorCode] = Ellipsis[源代码]
CLUSTER_SIMULATE_CALC_ERR: ClassVar[ErrorCode] = Ellipsis[源代码]
DATABASE_ERROR: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_BACKEND_CHIP_TASK_SOCKET_WRONG: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_CHIP_OFFLINE: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_EMPTY_PROG: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_FIDELITY_MATRIX: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_INVALID_URL: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_MATE_GATE_CONFIG: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_NOT_FOUND_APP_ID: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_NOT_FOUND_TASK_ID: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_OPERATOR_DB: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_PARAMETER: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_PARSER_SUB_TASK_RESULT: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_PRE_ESTIMATE: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_QCOMPILER_FAILED: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_QPROG_LENGTH: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_QST_PROG: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_QUANTUM_CHIP_PROG: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_QUBIT_SIZE: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_QUBIT_TOPO: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_QVM_INIT_FAILED: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_REPEAT_MEASURE: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_SCHEDULE_CHIP_TOPOLOGY_SUPPORTED: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_SUB_GRAPH_OUT_OF_RANGE: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_SYS_CALL_TIME_OUT: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_TASK_BUF_OVERFLOW: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_TASK_CONFIG: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_TASK_STATUS_BUF_OVERFLOW: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_TASK_TERMINATED: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_TCP_INIT_FATLT: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_TCP_SERVER_HALT: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_UNKNOW_TASK_TYPE: ClassVar[ErrorCode] = Ellipsis[源代码]
ERR_UNSUPPORT_BACKEND_TYPE: ClassVar[ErrorCode] = Ellipsis[源代码]
EXCEED_MAX_CLOCK: ClassVar[ErrorCode] = Ellipsis[源代码]
EXCEED_MAX_QUBIT: ClassVar[ErrorCode] = Ellipsis[源代码]
JSON_FIELD_ERROR: ClassVar[ErrorCode] = Ellipsis[源代码]
NO_ERROR_FOUND: ClassVar[ErrorCode] = Ellipsis[源代码]
ORIGINIR_ERROR: ClassVar[ErrorCode] = Ellipsis[源代码]
UNDEFINED_ERROR: ClassVar[ErrorCode] = Ellipsis[源代码]
class pyqpanda.pyQPanda.Fusion[源代码]

quantum fusion operation

aggregate_operations(circuit: QCircuit) None[源代码]
aggregate_operations(qprog: QProg) None
class pyqpanda.pyQPanda.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

property name: str[源代码]
property value: int[源代码]
BARRIER_GATE: ClassVar[GateType] = Ellipsis[源代码]
CNOT_GATE: ClassVar[GateType] = Ellipsis[源代码]
CPHASE_GATE: ClassVar[GateType] = Ellipsis[源代码]
CP_GATE: ClassVar[GateType] = Ellipsis[源代码]
CU_GATE: ClassVar[GateType] = Ellipsis[源代码]
CZ_GATE: ClassVar[GateType] = Ellipsis[源代码]
GATE_NOP: ClassVar[GateType] = Ellipsis[源代码]
GATE_UNDEFINED: ClassVar[GateType] = Ellipsis[源代码]
HADAMARD_GATE: ClassVar[GateType] = Ellipsis[源代码]
ISWAP_GATE: ClassVar[GateType] = Ellipsis[源代码]
ISWAP_THETA_GATE: ClassVar[GateType] = Ellipsis[源代码]
I_GATE: ClassVar[GateType] = Ellipsis[源代码]
MS_GATE: ClassVar[GateType] = Ellipsis[源代码]
ORACLE_GATE: ClassVar[GateType] = Ellipsis[源代码]
P00_GATE: ClassVar[GateType] = Ellipsis[源代码]
P0_GATE: ClassVar[GateType] = Ellipsis[源代码]
P11_GATE: ClassVar[GateType] = Ellipsis[源代码]
P1_GATE: ClassVar[GateType] = Ellipsis[源代码]
PAULI_X_GATE: ClassVar[GateType] = Ellipsis[源代码]
PAULI_Y_GATE: ClassVar[GateType] = Ellipsis[源代码]
PAULI_Z_GATE: ClassVar[GateType] = Ellipsis[源代码]
P_GATE: ClassVar[GateType] = Ellipsis[源代码]
RPHI_GATE: ClassVar[GateType] = Ellipsis[源代码]
RXX_GATE: ClassVar[GateType] = Ellipsis[源代码]
RX_GATE: ClassVar[GateType] = Ellipsis[源代码]
RYY_GATE: ClassVar[GateType] = Ellipsis[源代码]
RY_GATE: ClassVar[GateType] = Ellipsis[源代码]
RZX_GATE: ClassVar[GateType] = Ellipsis[源代码]
RZZ_GATE: ClassVar[GateType] = Ellipsis[源代码]
RZ_GATE: ClassVar[GateType] = Ellipsis[源代码]
SQISWAP_GATE: ClassVar[GateType] = Ellipsis[源代码]
SWAP_GATE: ClassVar[GateType] = Ellipsis[源代码]
S_GATE: ClassVar[GateType] = Ellipsis[源代码]
TOFFOLI_GATE: ClassVar[GateType] = Ellipsis[源代码]
TWO_QUBIT_GATE: ClassVar[GateType] = Ellipsis[源代码]
T_GATE: ClassVar[GateType] = Ellipsis[源代码]
U1_GATE: ClassVar[GateType] = Ellipsis[源代码]
U2_GATE: ClassVar[GateType] = Ellipsis[源代码]
U3_GATE: ClassVar[GateType] = Ellipsis[源代码]
U4_GATE: ClassVar[GateType] = Ellipsis[源代码]
X_HALF_PI: ClassVar[GateType] = Ellipsis[源代码]
Y_HALF_PI: ClassVar[GateType] = Ellipsis[源代码]
Z_HALF_PI: ClassVar[GateType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.HHLAlg(arg0: QuantumMachine)[源代码]

quantum hhl algorithm class

check_QPE_result() str[源代码]

check QPE result

get_amplification_factor() float[源代码]

get_amplification_factor

get_ancillary_qubit() QVec[源代码]

get_ancillary_qubit

get_hhl_circuit(matrix_A: List[complex], data_b: List[float], precision_cnt: int = 0) QCircuit[源代码]
get_qubit_for_QFT() List[Qubit][源代码]

get_qubit_for_QFT

get_qubit_for_b() List[Qubit][源代码]

get_qubit_for_b

query_uesed_qubit_num() int[源代码]

query_uesed_qubit_num

class pyqpanda.pyQPanda.LATEX_GATE_TYPE(value: int)[源代码]

Quantum latex gate type

Members:

GENERAL_GATE

CNOT_GATE

SWAP_GATE

property name: str[源代码]
property value: int[源代码]
CNOT_GATE: ClassVar[LATEX_GATE_TYPE] = Ellipsis[源代码]
GENERAL_GATE: ClassVar[LATEX_GATE_TYPE] = Ellipsis[源代码]
SWAP_GATE: ClassVar[LATEX_GATE_TYPE] = Ellipsis[源代码]
class pyqpanda.pyQPanda.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]

insert_barrier(rows: List[int], from_col: int) int[源代码]
Args:

rows: rows need be barriered, may not continus

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 circute

Args:

target_rows: gate targets row of latex matrix ctrl_rows from_col: gate wanted col pos, but there may be not enough zone to put gate gate_type: enum type of LATEX_GATE_TYPE gate_name dagger: dagger flag param: gate param str

Returns:

int: real col num. if there is no enough zone to put gate at 'from_col', we will find suitable col to put gate after 'from_col'

insert_measure(q_row: int, c_row: int, from_col: int) int[源代码]
insert_reset(q_row: int, from_col: int) int[源代码]
insert_timeseq(t_col: int, time_seq: int) None[源代码]

Beware we do not check col num, may cause overwrite. user must take care col num self

set_label(qubit_label: Dict[int, str], cbit_label: Dict[int, str] = {}, time_seq_label: str = '', head: bool = True) None[源代码]

Set Label at left most head col or right most tail col label can be reseted at any time

Args:
qubit_label: label for qwire left most head label, at row, in latex syntax. not given row will keep empty

eg. {0: 'q_{1}', 2:'q_{2}'}

cbit_label: classic label string, support latex str time_seq_label: if given, set time squence lable head: if true, label append head; false, append at tail

Add a logo string

str(with_time: bool = False) str[源代码]

return final latex source code, can be called at any time

class pyqpanda.pyQPanda.MPSQVM[源代码]

Bases: QuantumMachine

quantum matrix product state machine class

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
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 returnd tuple, should in [-1, 1<<len(qubit_list)]

default is -1, means no limit

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in get_prob_dict

get_prob_list(qubit_list: QVec, select_max: int = -1) List[float][源代码]

Get pmeasure result as list

Args:

qubit_list: pmeasure qubits list select_max: max returned element num in returnd tuple, should in [-1, 1<<len(qubit_list)]

default is -1, means no limit

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in get_prob_list

get_prob_tuple_list(qubit_list: QVec, select_max: int = -1) List[Tuple[int, float]][源代码]

Get pmeasure result as list

Args:

qubit_list: pmeasure qubits list select_max: max returned element num in returnd tuple, should in [-1, 1<<len(qubit_list)]

default is -1, means no limit

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in get_prob_tuple_list

pmeasure(qubit_list: QVec, select_max: int = -1) List[Tuple[int, float]][源代码]

Get the probability distribution over qubits

Args:

qubit_list: qubit list to measure select_max: max returned element num in returnd tuple, should in [-1, 1<<len(qubit_list)]

default is -1, means no limit

Returns:

measure result of quantum machine in tuple form

pmeasure_bin_index(program: QProg, string: str) complex[源代码]

pmeasure bin index quantum state amplitude

Args:

string : bin string

Returns:

complex : bin amplitude

Raises:

run_fail: An error occurred in pmeasure_bin_index

pmeasure_bin_subset(program: QProg, string_list: List[str]) List[complex][源代码]

pmeasure quantum state amplitude subset

Args:

list : bin state string list

Returns:

list : bin amplitude result list

Raises:

run_fail: An error occurred in pmeasure_bin_subset

pmeasure_dec_index(program: QProg, string: str) complex[源代码]

pmeasure dec index quantum state amplitude

Args:

string : dec string

Returns:

complex : dec amplitude

Raises:

run_fail: An error occurred in pmeasure_dec_index

pmeasure_dec_subset(program: QProg, string_list: List[str]) List[complex][源代码]

pmeasure quantum state amplitude subset

Args:

list : dec state string list

Returns:

list : dec amplitude result list

Raises:

run_fail: An error occurred in pmeasure_dec_subset

pmeasure_no_index(qubit_list: QVec) List[float][源代码]

Get the probability distribution over qubits

Args:

qubit_list: qubit list to measure

Returns:

measure result of quantum machine in list form

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:

qprog: quantum program qubit_list: pmeasure qubits list select_max: max returned element num in returnd tuple, should in [-1, 1<<len(qubit_list)]

default is -1, means no limit

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in measure quantum program

prob_run_list(program: QProg, qubit_list: QVec, select_max: int = -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 returnd tuple, should in [-1, 1<<len(qubit_list)]

default is -1, means no limit

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in measure quantum program

prob_run_tuple_list(program: QProg, qubit_list: QVec, select_max: int = -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 returnd tuple, should in [-1, 1<<len(qubit_list)]

default is -1, means no limit

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in prob_run_tuple_list

quick_measure(qubit_list: QVec, shots: int) Dict[str, int][源代码]

Quick measure

Args:

qubit_list: qubit list to measure shots: the repeat num of measure operate

Returns:

result of quantum program

Raises:

run_fail: An error occurred in measure quantum program

set_measure_error(arg0: NoiseModel, arg1: float) None[源代码]
set_measure_error(arg0: NoiseModel, arg1: float, arg2: float, arg3: float) None
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_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_readout_error(readout_params: List[List[float]], qubits: QVec) None[源代码]
set_reset_error(reset_0_param: float, reset_1_param: float) None[源代码]
set_rotation_error(param: float) None[源代码]
class pyqpanda.pyQPanda.MomentumOptimizer(arg0: var, arg1: float, arg2: float)[源代码]

variational quantum MomentumOptimizer

get_loss() float[源代码]
get_variables() List[var][源代码]
minimize(arg0: float, arg1: float) Optimizer[源代码]
run(arg0: List[var], arg1: int) bool[源代码]
class pyqpanda.pyQPanda.NodeInfo[源代码]
class pyqpanda.pyQPanda.NodeInfo(iter: NodeIter, target_qubits: QVec, control_qubits: QVec, type: int, dagger: bool)

Detailed information of a QProg node

m_cbits: List[int][源代码]
m_control_qubits: QVec[源代码]
m_gate_type: GateType[源代码]
m_is_dagger: bool[源代码]
m_iter: NodeIter[源代码]
m_name: str[源代码]
m_node_type: NodeType[源代码]
m_params: List[float][源代码]
m_target_qubits: QVec[源代码]
reset() None[源代码]
class pyqpanda.pyQPanda.NodeIter[源代码]

quantum node iter

get_next() NodeIter[源代码]
get_node_type() NodeType[源代码]
get_pre() NodeIter[源代码]
class pyqpanda.pyQPanda.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

property name: str[源代码]
property value: int[源代码]
CIRCUIT_NODE: ClassVar[NodeType] = Ellipsis[源代码]
CLASS_COND_NODE: ClassVar[NodeType] = Ellipsis[源代码]
GATE_NODE: ClassVar[NodeType] = Ellipsis[源代码]
MEASURE_GATE: ClassVar[NodeType] = Ellipsis[源代码]
NODE_UNDEFINED: ClassVar[NodeType] = Ellipsis[源代码]
PROG_NODE: ClassVar[NodeType] = Ellipsis[源代码]
QIF_START_NODE: ClassVar[NodeType] = Ellipsis[源代码]
RESET_NODE: ClassVar[NodeType] = Ellipsis[源代码]
WHILE_START_NODE: ClassVar[NodeType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.Noise[源代码]

Quantum machine for noise simulation

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_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
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_readout_error(prob_list: List[List[float]], qubits: QVec = ...) None[源代码]
set_reset_error(p0: float, p1: float, qubits: QVec) None[源代码]
set_rotation_error(error: float) None[源代码]
class pyqpanda.pyQPanda.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

property name: str[源代码]
property value: int[源代码]
BITFLIP_KRAUS_OPERATOR: ClassVar[NoiseModel] = Ellipsis[源代码]
BIT_PHASE_FLIP_OPRATOR: ClassVar[NoiseModel] = Ellipsis[源代码]
DAMPING_KRAUS_OPERATOR: ClassVar[NoiseModel] = Ellipsis[源代码]
DECOHERENCE_KRAUS_OPERATOR: ClassVar[NoiseModel] = Ellipsis[源代码]
DEPHASING_KRAUS_OPERATOR: ClassVar[NoiseModel] = Ellipsis[源代码]
DEPOLARIZING_KRAUS_OPERATOR: ClassVar[NoiseModel] = Ellipsis[源代码]
PAULI_KRAUS_MAP: ClassVar[NoiseModel] = Ellipsis[源代码]
PHASE_DAMPING_OPRATOR: ClassVar[NoiseModel] = Ellipsis[源代码]
class pyqpanda.pyQPanda.NoiseQVM[源代码]

Bases: QuantumMachine

quantum machine class for simulate noise prog

initQVM(arg0: dict) None[源代码]

init quantum virtual machine

init_qvm(json_config: dict) None[源代码]
init_qvm() None

init quantum virtual machine

set_max_threads(size: int) None[源代码]

set NoiseQVM max thread size

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_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_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_readout_error(probs_list: List[List[float]], qubits: QVec = ...) None[源代码]
set_reset_error(p0: float, p1: float, qubits: QVec = ...) None[源代码]
set_rotation_error(arg0: float) None[源代码]
class pyqpanda.pyQPanda.Optimizer(*args, **kwargs)[源代码]

variational quantum Optimizer class

get_loss() float[源代码]
get_variables() List[var][源代码]
run(arg0: List[var], arg1: int) bool[源代码]
class pyqpanda.pyQPanda.OptimizerFactory[源代码]

quantum OptimizerFactory class

makeOptimizer() AbstractOptimizer[源代码]
makeOptimizer() AbstractOptimizer

Please input the Optimizer's name(string)

class pyqpanda.pyQPanda.OptimizerMode(value: int)[源代码]

variational quantum OptimizerMode

Members:

property name: str[源代码]
property value: int[源代码]
class pyqpanda.pyQPanda.OptimizerType(value: int)[源代码]

quantum OptimizerType

Members:

NELDER_MEAD

POWELL

GRADIENT

property name: str[源代码]
property value: int[源代码]
GRADIENT: ClassVar[OptimizerType] = Ellipsis[源代码]
NELDER_MEAD: ClassVar[OptimizerType] = Ellipsis[源代码]
POWELL: ClassVar[OptimizerType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.OriginCMem[源代码]

origin quantum cmem

Allocate_CBit() CBit[源代码]
Allocate_CBit(cbit_num: int) CBit
Free_CBit(cbit: CBit) None[源代码]
cAlloc() CBit[源代码]
cAlloc(cbit_num: int) CBit
cAlloc_many(count: int) List[ClassicalCondition][源代码]
cFree(classical_cond: ClassicalCondition) None[源代码]
cFree_all(classical_cond_list: List[ClassicalCondition]) None[源代码]
cFree_all() None
clearAll() None[源代码]
getIdleMem() int[源代码]
getMaxMem() int[源代码]
get_allocate_cbits() List[ClassicalCondition][源代码]

Get allocate cbits

get_capacity() int[源代码]
get_cbit_by_addr(cbit_addr: int) CBit[源代码]
set_capacity(arg0: int) None[源代码]
class pyqpanda.pyQPanda.OriginCollection[源代码]
class pyqpanda.pyQPanda.OriginCollection(file_name: str)
class pyqpanda.pyQPanda.OriginCollection(arg0: OriginCollection)

A relatively free data collection class for saving data

getFilePath() str[源代码]

Get file path

getJsonString() str[源代码]

Get Json String

getKeyVector() List[str][源代码]

Get key vector

getValue(key_name: str) List[str][源代码]

Get value by Key name

getValueByKey(key_value: str) str[源代码]
getValueByKey(key_value: int) str

Get Value by key value

insertValue(key: str, *args) None[源代码]
open(file_name: str) bool[源代码]

Read the json file of the specified path

setNames(*args) None[源代码]
write() bool[源代码]

write json file

class pyqpanda.pyQPanda.OriginQubitPool[源代码]

quantum qubit pool

allocateQubitThroughPhyAddress(qubit_addr: int) Qubit[源代码]
allocateQubitThroughVirAddress(qubit_num: int) Qubit[源代码]
clearAll() None[源代码]
getIdleQubit() int[源代码]
getMaxQubit() int[源代码]
getPhysicalQubitAddr(qubit: Qubit) int[源代码]
getVirtualQubitAddress(qubit: Qubit) int[源代码]
get_allocate_qubits() QVec[源代码]

get allocate qubits

get_capacity() int[源代码]
get_max_usedqubit_addr() int[源代码]
get_qubit_by_addr(qubit_addr: int) Qubit[源代码]
qAlloc() Qubit[源代码]
qAlloc_many(qubit_num: int) List[Qubit][源代码]

Allocate a list of qubits

qFree(arg0: Qubit) None[源代码]
qFree_all(arg0: QVec) None[源代码]
qFree_all() None
set_capacity(arg0: int) None[源代码]
class pyqpanda.pyQPanda.PartialAmpQVM[源代码]

Bases: QuantumMachine

quantum partial amplitude machine class

get_prob_dict(arg0: QVec) Dict[str, float][源代码]

Get pmeasure result as dict

Args:

qubit_list: pmeasure qubits list

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in get_prob_dict

init_qvm(backend_type: int = 0) None[源代码]
pmeasure_bin_index(bin_index: str) complex[源代码]

pmeasure bin index quantum state amplitude

Args:

string : bin string

Returns:

complex : bin amplitude

Raises:

run_fail: An error occurred in pmeasure_bin_index

pmeasure_dec_index(dec_index: str) complex[源代码]

pmeasure dec index quantum state amplitude

Args:

string : dec string

Returns:

complex : dec amplitude

Raises:

run_fail: An error occurred in pmeasure_dec_index

pmeasure_subset(index_list: List[str]) Dict[str, complex][源代码]

pmeasure quantum state amplitude subset

Args:

list : dec state string list

Returns:

list : dec amplitude result list

Raises:

run_fail: An error occurred in pmeasure_dec_index

prob_run_dict(arg0: QProg, arg1: QVec) Dict[str, float][源代码]

Run quantum program and get pmeasure result as dict

Args:

qprog: quantum program qubit_list: pmeasure qubits list

Returns:

measure result of quantum machine

Raises:

run_fail: An error occurred in measure quantum program

run(qprog: QProg, noise_model: Noise = NoiseModel()) None[源代码]
run(qprog: QCircuit, noise_model: Noise = NoiseModel()) None

run the quantum program

Args:

QProg: quantum prog size_t : NoiseModel

Returns:

none

Raises:

run_fail: An error occurred in run

class pyqpanda.pyQPanda.PhysicalQubit(*args, **kwargs)[源代码]

Physical Qubit abstract class

getQubitAddr() int[源代码]
class pyqpanda.pyQPanda.PilotNoiseParams(*args, **kwargs)[源代码]

pliot noise simulate params

double_gate_param: float[源代码]
double_p2: float[源代码]
double_pgate: float[源代码]
noise_model: str[源代码]
single_gate_param: float[源代码]
single_p2: float[源代码]
single_pgate: float[源代码]
class pyqpanda.pyQPanda.ProgCount[源代码]
double_gate_layer_num: int[源代码]
double_gate_num: int[源代码]
gate_num: int[源代码]
layer_num: int[源代码]
multi_control_gate_num: int[源代码]
node_num: int[源代码]
selected_gate_nums: Dict[GateType, int][源代码]
single_gate_layer_num: int[源代码]
single_gate_num: int[源代码]
class pyqpanda.pyQPanda.QCircuit[源代码]
class pyqpanda.pyQPanda.QCircuit(arg0: NodeIter)

quantum circuit node

begin() NodeIter[源代码]
control(control_qubits: QVec) QCircuit[源代码]
dagger() QCircuit[源代码]
end() NodeIter[源代码]
head() NodeIter[源代码]
insert(arg0: QCircuit) QCircuit[源代码]
insert(arg0: QGate) QCircuit
is_empty() bool[源代码]
last() NodeIter[源代码]
set_control(control_qubits: QVec) None[源代码]
set_dagger(arg0: bool) None[源代码]
class pyqpanda.pyQPanda.QCircuitOPtimizerMode(value: int)[源代码]

Quantum circuit optimize mode

Members:

Merge_H_X

Merge_U3

Merge_RX

Merge_RY

Merge_RZ

property name: str[源代码]
property value: int[源代码]
Merge_H_X: ClassVar[QCircuitOPtimizerMode] = Ellipsis[源代码]
Merge_RX: ClassVar[QCircuitOPtimizerMode] = Ellipsis[源代码]
Merge_RY: ClassVar[QCircuitOPtimizerMode] = Ellipsis[源代码]
Merge_RZ: ClassVar[QCircuitOPtimizerMode] = Ellipsis[源代码]
Merge_U3: ClassVar[QCircuitOPtimizerMode] = Ellipsis[源代码]
class pyqpanda.pyQPanda.QCloudService[源代码]

Bases: QuantumMachine

origin quantum cloud machine

batch_compute_url: str[源代码]
batch_inquire_url: str[源代码]
big_data_batch_compute_url: str[源代码]
compute_url: str[源代码]
configuration_header_data: str[源代码]
estimate_url: str[源代码]
inquire_url: str[源代码]
measure_qubits_num: List[int][源代码]
pqc_batch_compute_url: str[源代码]
pqc_batch_inquire_url: str[源代码]
pqc_compute_url: str[源代码]
pqc_init_url: str[源代码]
pqc_inquire_url: str[源代码]
pqc_keys_url: str[源代码]
use_compress_data: bool[源代码]
user_token: str[源代码]
batch_cyclic_query(arg0: str) Tuple[bool, List[str]][源代码]
build_error_mitigation(shots: int, chip_id: int, expectations: List[str], noise_strength: List[float], qemMethod: em_method) str[源代码]
build_full_amplitude_measure(shots: int) str[源代码]
build_full_amplitude_pmeasure(qubit_vec: List[int]) str[源代码]
build_get_expectation(hamiltonian: List[Tuple[Dict[int, str], float]], qubits: List[int]) str[源代码]
build_get_state_fidelity(shot: int, chip_id: int = 2, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True) str[源代码]
build_get_state_tomography_density(shot: int, chip_id: int = 2, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True) str[源代码]
build_init_object(prog: QProg, task_name: str = 'QPanda Experiment', task_from: int = 4) None[源代码]
build_init_object(prog_str: str, task_name: str = 'QPanda Experiment', task_from: int = 4) None
build_noise_measure(shots: int) str[源代码]
build_partial_amplitude_pmeasure(amplitudes: List[str]) str[源代码]
build_read_out_mitigation(shots: int, chip_id: int, expectations: List[str], noise_strength: List[float], qem_method: em_method) str[源代码]
build_real_chip_measure(shots: int, chip_id: int = 2, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True) str[源代码]
build_real_chip_measure_batch(prog_list: List[str], shots: int, chip_id: int = 2, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, enable_compress_check: bool = False, batch_id: str = '', task_from: int = 4) str[源代码]
build_real_chip_measure_batch(prog_list: List[QProg], shots: int, chip_id: int = 2, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, enable_compress_check: bool = False, batch_id: str = '', task_from: int = 4) str
build_single_amplitude_pmeasure(amplitude: str) str[源代码]
cyclic_query(arg0: str) Tuple[bool, str][源代码]
enc_hybrid(pk_str: str, rdnum: str) tuple[源代码]

Perform hybrid encryption and return a tuple

init(user_token: str, is_logged: bool = False) None[源代码]
parse_get_task_id(arg0: str) str[源代码]
query_comolex_result(arg0: str) complex[源代码]
query_prob_dict_result(arg0: str) Dict[str, float][源代码]
query_prob_dict_result_batch(arg0: List[str]) List[Dict[str, float]][源代码]
query_prob_result(arg0: str) float[源代码]
query_prob_vec_result(arg0: str) List[float][源代码]
query_qst_result(arg0: str) List[List[complex]][源代码]
query_state_dict_result(arg0: str) Dict[str, complex][源代码]
set_noise_model(arg0: NoiseModel, arg1: List[float], arg2: List[float]) None[源代码]
set_qcloud_url(cloud_url: str) None[源代码]
sm4_decode(key: str, IV: str, enc_data: str) str[源代码]

Decode data using SM4 algorithm

sm4_encode(key: str, IV: str, data: str) str[源代码]

Encode data using SM4 algorithm

class pyqpanda.pyQPanda.QCloudTaskConfig[源代码]
chip_id: real_chip_type[源代码]
cloud_token: str[源代码]
open_amend: bool[源代码]
open_mapping: bool[源代码]
open_optimization: bool[源代码]
shots: int[源代码]
class pyqpanda.pyQPanda.QError(value: int)[源代码]

Quantum QError Type

Members:

UndefineError

qErrorNone

qParameterError

qubitError

loadFileError

initStateError

destroyStateError

setComputeUnitError

runProgramError

getResultError

getQStateError

property name: str[源代码]
property value: int[源代码]
UndefineError: ClassVar[QError] = Ellipsis[源代码]
destroyStateError: ClassVar[QError] = Ellipsis[源代码]
getQStateError: ClassVar[QError] = Ellipsis[源代码]
getResultError: ClassVar[QError] = Ellipsis[源代码]
initStateError: ClassVar[QError] = Ellipsis[源代码]
loadFileError: ClassVar[QError] = Ellipsis[源代码]
qErrorNone: ClassVar[QError] = Ellipsis[源代码]
qParameterError: ClassVar[QError] = Ellipsis[源代码]
qubitError: ClassVar[QError] = Ellipsis[源代码]
runProgramError: ClassVar[QError] = Ellipsis[源代码]
setComputeUnitError: ClassVar[QError] = Ellipsis[源代码]
class pyqpanda.pyQPanda.QGate(arg0: NodeIter)[源代码]

quantum gate node

control(control_qubits: QVec) QGate[源代码]

Get a control quantumgate base on current quantum gate node

dagger() QGate[源代码]
gate_matrix() List[complex][源代码]
gate_type() int[源代码]
get_control_qubit_num() int[源代码]
get_control_qubits(control_qubits: QVec) int[源代码]

Get control vector fron current quantum gate node

Args:

qvec: control qubits output

Returns:

int: size of control qubits

get_qubits(qubits: QVec) int[源代码]

Get qubit vector inside this quantum gate

Args:

qvec: qubits output

Returns:

int: size of qubits

get_target_qubit_num() int[源代码]
is_dagger() bool[源代码]
set_control(arg0: QVec) bool[源代码]
set_dagger(arg0: bool) bool[源代码]
class pyqpanda.pyQPanda.QITE[源代码]

quantum imaginary time evolution

exec(is_optimization: bool = True) int[源代码]
get_all_exec_result(reverse: bool = False, sort: bool = False) List[List[Tuple[int, float]]][源代码]
get_ansatz_list(*args, **kwargs) Any[源代码]
get_ansatz_theta_list() List[List[float]][源代码]
get_arbitary_cofficient(arg0: float) None[源代码]
get_exec_result(reverse: bool = False, sort: bool = False) List[Tuple[int, float]][源代码]
get_result() List[Tuple[int, float]][源代码]
set_Hamiltonian(arg0) None[源代码]
set_ansatz_gate(arg0) None[源代码]
set_convergence_factor_Q(arg0: float) None[源代码]
set_delta_tau(arg0: float) None[源代码]
set_iter_num(arg0: int) None[源代码]
set_log_file(arg0: str) None[源代码]
set_para_update_mode(arg0: UpdateMode) None[源代码]
set_pauli_matrix(arg0: QuantumMachine, arg1: numpy.ndarray[numpy.float64[m, n]]) None[源代码]
set_quantum_machine_type(arg0: QMachineType) None[源代码]
set_upthrow_num(arg0: int) None[源代码]
class pyqpanda.pyQPanda.QIfProg(arg0: NodeIter)[源代码]
class pyqpanda.pyQPanda.QIfProg(classical_cond: ClassicalCondition, true_branch_qprog: QProg)
class pyqpanda.pyQPanda.QIfProg(classical_cond: ClassicalCondition, true_branch_qprog: QProg, false_branch_qprog: QProg)

quantum if prog node

get_classical_condition() ClassicalCondition[源代码]
get_false_branch() QProg[源代码]
get_true_branch() QProg[源代码]
class pyqpanda.pyQPanda.QMachineType(value: int)[源代码]

Quantum machine type

Members:

CPU

GPU

CPU_SINGLE_THREAD

NOISE

property name: str[源代码]
property value: int[源代码]
CPU: ClassVar[QMachineType] = Ellipsis[源代码]
CPU_SINGLE_THREAD: ClassVar[QMachineType] = Ellipsis[源代码]
GPU: ClassVar[QMachineType] = Ellipsis[源代码]
NOISE: ClassVar[QMachineType] = Ellipsis[源代码]
class pyqpanda.pyQPanda.QMeasure(arg0: NodeIter)[源代码]

quantum measure node

class pyqpanda.pyQPanda.QOperator[源代码]
class pyqpanda.pyQPanda.QOperator(arg0: QGate)
class pyqpanda.pyQPanda.QOperator(arg0: QCircuit)

quantum operator class

get_matrix() List[complex][源代码]
to_instruction(arg0: str) str[源代码]
class pyqpanda.pyQPanda.QOptimizationResult(arg0: str, arg1: int, arg2: int, arg3: str, arg4: float, arg5: List[float])[源代码]

quantum QOptimizationResult class

fcalls: int[源代码]
fun_val: float[源代码]
iters: int[源代码]
key: str[源代码]
message: str[源代码]
para: List[float][源代码]
class pyqpanda.pyQPanda.QPilotMachine[源代码]

pliot machine

build_noise_params(nose_model_type: int, single_params: List[float], double_params: List[float]) PilotNoiseParams[源代码]
execute_callback_full_amplitude_expectation(prog_str: str, hamiltonian: List[Tuple[Dict[int, str], float]], qubit_vec: List[int], cb_func: Callable[[ErrorCode, float], None], chip_id: int = 33554433) ErrorCode[源代码]
execute_callback_full_amplitude_measure_task(prog_str: str, cb_func: Callable[[ErrorCode, Dict[str, float]], None], chip_id: int = 33554433, shots: int = 1000) ErrorCode[源代码]
execute_callback_full_amplitude_pmeasure_task(prog_str: str, qubit_vec: List[int], cb_func: Callable[[ErrorCode, Dict[str, float]], None], chip_id: int = 33554433) ErrorCode[源代码]
execute_callback_measure_task(prog_str: str, cb_func: Callable[[ErrorCode, Dict[str, float]], None], chip_id: int = 33554432, b_mapping: bool = True, b_optimization: bool = True, shots: int = 1000, specified_block: List[int] = []) ErrorCode[源代码]
execute_callback_noise_measure_task(prog_str: str, noise_params: PilotNoiseParams, cb_func: Callable[[ErrorCode, Dict[str, float]], None], chip_id: int = 33554433, shots: int = 1000) ErrorCode[源代码]
execute_callback_partial_amplitude_task(prog_str: str, target_amplitude_vec: List[str], cb_func: Callable[[ErrorCode, Dict[str, complex]], None], chip_id: int = 33554433) ErrorCode[源代码]
execute_callback_single_amplitude_task(prog_str: str, target_amplitude: str, cb_func: Callable[[ErrorCode, complex], None], chip_id: int = 33554433) ErrorCode[源代码]
execute_full_amplitude_expectation(prog_str: str, hamiltonian: List[Tuple[Dict[int, str], float]], qubit_vec: List[int], chip_id: int = 33554433) float[源代码]
execute_full_amplitude_measure_task(prog_str: str, chip_id: int = 33554433, shots: int = 1000) Dict[str, float][源代码]
execute_full_amplitude_pmeasure_task(prog_str: str, qubit_vec: List[int], chip_id: int = 33554433) Dict[str, float][源代码]
execute_measure_task(prog_str: str, chip_id: int = 33554432, b_mapping: bool = True, b_optimization: bool = True, shots: int = 1000, specified_block: List[int] = []) List[Dict[str, float]][源代码]
execute_noise_measure_task(prog_str: str, noise_params: PilotNoiseParams, chip_id: int = 33554433, shots: int = 1000) Dict[str, float][源代码]
execute_partial_amplitude_task(prog_str: str, target_amplitude_vec: List[str], chip_id: int = 33554433) Dict[str, complex][源代码]
execute_single_amplitude_task(prog_str: str, target_amplitude: str, chip_id: int = 33554433) complex[源代码]
init(pilot_url: str, log_cout: bool = False) bool[源代码]
init_withconfig(config_path: str = 'pilotmachine.conf') bool[源代码]
class pyqpanda.pyQPanda.QPilotOSService(machine_type: str = 'CPU')[源代码]

Bases: QuantumMachine

origin quantum pilot OS Machine

async_em_compute(parameter_json: str) str[源代码]
async_real_chip_expectation(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] = [], describe: str = '') str[源代码]

deprecated, use request instead.

async_real_chip_measure(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] = [], is_prob_counts: bool = True, describe: str = '') str[源代码]
async_real_chip_measure(ir: str, shot: int = 1000, chip_id: int = 33554432, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, specified_block: List[int] = [], is_prob_counts: bool = True, describe: str = '') str
async_real_chip_measure(prog: List[QProg], shot: int = 1000, chip_id: int = 33554432, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, specified_block: List[int] = [], is_prob_counts: bool = True, describe: str = '') str
async_real_chip_measure(ir: List[str], shot: int = 1000, chip_id: int = 33554432, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, specified_block: List[int] = [], is_prob_counts: bool = True, describe: str = '') str
async_real_chip_measure(prog: List[QProg], config_str: str) str
async_real_chip_measure_vec(prog: List[QProg], shot: int = 1000, chip_id: int = 33554432, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, specified_block: List[int] = [], is_prob_counts: bool = True, describe: str = '') str[源代码]
async_real_chip_measure_vec(ir: List[str], shot: int = 1000, chip_id: int = 33554432, is_amend: bool = True, is_mapping: bool = True, is_optimization: bool = True, specified_block: List[int] = [], is_prob_counts: bool = True, describe: str = '') str
async_real_chip_qst(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] = [], describe: str = '') str[源代码]
async_real_chip_qst_density(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] = [], describe: str = '') str[源代码]
async_real_chip_qst_fidelity(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] = [], describe: str = '') str[源代码]
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.

build_init_msg(api_key: str) str[源代码]
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

build_query_msg(task_id: str) str[源代码]
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.

cAlloc() ClassicalCondition[源代码]
cAlloc(cbit: int) ClassicalCondition

Allocate a cbit

cAlloc_many(cbit_num: int) List[ClassicalCondition][源代码]

Allocate a list of cbits

cFree(arg0: ClassicalCondition) None[源代码]

Free a cbit

cFree_all(cbit_list: List[ClassicalCondition]) None[源代码]
cFree_all() None

Free all of cbits

em_compute(parameter_json: str) List[float][源代码]
finalize() None[源代码]

finalize

get_expectation_result(task_id: str) list[源代码]
get_measure_result(task_id: str) list[源代码]
get_measure_result(task_id: str) list
get_token(rep_json: str) ErrorCode[源代码]
init() None[源代码]
init(url: str, log_cout: bool = False, api_key: str = None) None
init(url: str, log_cout: bool = False, username: str = None, password: str = None) None
init_config(url: str, log_cout: bool) None[源代码]
noise_learning(parameter_json: str = True) str[源代码]
output_version() str[源代码]
pMeasureBinindex(prog: QProg, index