mindquantum.engine
Circuit engine module.
- class mindquantum.engine.BasicQubit(qubit_id, circuit=None)[source]
A quantum qubit.
- Parameters
- property circuit
Get the quantum circuit that this qubit belongs to.
- class mindquantum.engine.CircuitEngine[source]
A simple circuit engine that allows you to generate quantum circuit as projectq style.
Note
For more usage, please refers to
CircuitEngine.generator
- allocate_qureg(n)[source]
Allocate a quantum register.
- Parameters
n (int) – Number of quantum qubits.
- property circuit
Get the quantum circuit that construct by this engin.
- static generator(n_qubits, *args, **kwds)[source]
Quantum circuit register.
- Parameters
n_qubits (int) – qubit number of quantum circuit.
Examples
>>> import mindquantum.core.gates as G >>> from mindquantum.engine import circuit_generator >>> @circuit_generator(2,prefix='p') ... def ansatz(qubits, prefix): ... G.X | (qubits[0], qubits[1]) ... G.RX(prefix+'_0') | qubits[1] >>> print(ansatz) q0: ──●───────────── │ q1: ──X────RX(p_0)── >>> print(type(ansatz)) <class 'mindquantum.core.circuit.circuit.Circuit'>
- mindquantum.engine.circuit_generator(n_qubits, *args, **kwds)[source]
Generate quantum circuit as projectq style.
- Parameters
n_qubits (int) – qubit number of quantum circuit.
Note
More information please refers to
CircuitEngine.generator
.