QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.core.QCircuit Class Reference

Public Member Functions

None __init__ (self)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, int qubits_num)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, QCircuit arg0)
 init(*args, **kwargs) Overloaded function.
 
None append (self, QGate gate)
 append(*args, **kwargs) Overloaded function.
 
None append (self, QCircuit circuit)
 append(*args, **kwargs) Overloaded function.
 
None clear (self)
 clear(self: core.QCircuit) -> None
 
None clear_control (self)
 clear_control(self: core.QCircuit) -> None
 
QCircuit control (self, list[int] qubits)
 control(self: core.QCircuit, qubits: list[int]) -> core.QCircuit
 
list[int] control_qubits (self)
 control_qubits(self: core.QCircuit) -> list[int]
 
dict[str, int] count_ops (self, bool only_q2=...)
 count_ops(self: core.QCircuit, only_q2: bool = False) -> dict[str, int]
 
QCircuit dagger (self)
 dagger(self: core.QCircuit) -> core.QCircuit
 
int depth (self, bool only_q2=...)
 depth(self: core.QCircuit, only_q2: bool = False) -> int
 
QCircuit expand (self)
 expand(self: core.QCircuit) -> core.QCircuit
 
list[QGategate_operations (self, bool only_q2=...)
 gate_operations(self: core.QCircuit, only_q2: bool = False) -> list[core.QGate]
 
int get_register_size (self)
 get_register_size(self: core.QCircuit) -> int
 
bool is_dagger (self)
 is_dagger(self: core.QCircuit) -> bool
 
str name (self)
 name(self: core.QCircuit) -> str
 
int num_2q_gate (self)
 num_2q_gate(self: core.QCircuit) -> int
 
list[QGate|QCircuitoperations (self)
 operations(self: core.QCircuit) -> list[Union[core.QGate, core.QCircuit]]
 
Any operations (self, QGateorQCircuit)
 operations(self: core.QCircuit) -> list[Union[core.QGate, core.QCircuit]]
 
list[int] qubits (self)
 qubits(self: core.QCircuit) -> list[int]
 
None set_name (self, str name)
 set_name(self: core.QCircuit, name: str) -> None
 
int size (self)
 size(self: core.QCircuit) -> int
 
list[int] target_qubits (self)
 target_qubits(self: core.QCircuit) -> list[int]
 
QCircuit __lshift__ (self, QGate arg0)
 lshift(*args, **kwargs) Overloaded function.
 
QCircuit __lshift__ (self, QCircuit arg0)
 lshift(*args, **kwargs) Overloaded function.
 

Constructor & Destructor Documentation

◆ __init__() [1/3]

None pyqpanda3.core.QCircuit.__init__ ( self)

init(*args, **kwargs) Overloaded function.

  1. init(self: core.QCircuit) -> None

Default constructor for QCircuit.

  1. init(self: core.QCircuit, qubits_num: int) -> None

Constructor for QCircuit with a specified number of qubits.

Parameters
qubits_numNumber of qubits in the circuit.
  1. init(self: core.QCircuit, arg0: core.QCircuit) -> None

Copy constructor for QCircuit.

Parameters
circuitThe QCircuit instance to copy.

◆ __init__() [2/3]

None pyqpanda3.core.QCircuit.__init__ ( self,
int qubits_num )

init(*args, **kwargs) Overloaded function.

  1. init(self: core.QCircuit) -> None

Default constructor for QCircuit.

  1. init(self: core.QCircuit, qubits_num: int) -> None

Constructor for QCircuit with a specified number of qubits.

Parameters
qubits_numNumber of qubits in the circuit.
  1. init(self: core.QCircuit, arg0: core.QCircuit) -> None

Copy constructor for QCircuit.

Parameters
circuitThe QCircuit instance to copy.

◆ __init__() [3/3]

None pyqpanda3.core.QCircuit.__init__ ( self,
QCircuit arg0 )

init(*args, **kwargs) Overloaded function.

  1. init(self: core.QCircuit) -> None

Default constructor for QCircuit.

  1. init(self: core.QCircuit, qubits_num: int) -> None

Constructor for QCircuit with a specified number of qubits.

Parameters
qubits_numNumber of qubits in the circuit.
  1. init(self: core.QCircuit, arg0: core.QCircuit) -> None

Copy constructor for QCircuit.

Parameters
circuitThe QCircuit instance to copy.

Member Function Documentation

◆ __lshift__() [1/2]

QCircuit pyqpanda3.core.QCircuit.__lshift__ ( self,
QCircuit arg0 )

lshift(*args, **kwargs) Overloaded function.

  1. lshift(self: core.QCircuit, arg0: core.QGate) -> core.QCircuit

Use << to append a node to the circuit.

  1. lshift(self: core.QCircuit, arg0: core.QCircuit) -> core.QCircuit

Use << to append a node to the circuit.

◆ __lshift__() [2/2]

QCircuit pyqpanda3.core.QCircuit.__lshift__ ( self,
QGate arg0 )

lshift(*args, **kwargs) Overloaded function.

  1. lshift(self: core.QCircuit, arg0: core.QGate) -> core.QCircuit

Use << to append a node to the circuit.

  1. lshift(self: core.QCircuit, arg0: core.QCircuit) -> core.QCircuit

Use << to append a node to the circuit.

◆ append() [1/2]

None pyqpanda3.core.QCircuit.append ( self,
QCircuit circuit )

append(*args, **kwargs) Overloaded function.

  1. append(self: core.QCircuit, gate: core.QGate) -> None

Append a gate to the circuit.

Parameters
TheQGate to append.
  1. append(self: core.QCircuit, circuit: core.QCircuit) -> None

Append a circuit to the circuit.

Parameters
TheQCircuit to append.

◆ append() [2/2]

None pyqpanda3.core.QCircuit.append ( self,
QGate gate )

append(*args, **kwargs) Overloaded function.

  1. append(self: core.QCircuit, gate: core.QGate) -> None

Append a gate to the circuit.

Parameters
TheQGate to append.
  1. append(self: core.QCircuit, circuit: core.QCircuit) -> None

Append a circuit to the circuit.

Parameters
TheQCircuit to append.

◆ clear()

None pyqpanda3.core.QCircuit.clear ( self)

clear(self: core.QCircuit) -> None

Clear all operations in the circuit.

◆ clear_control()

None pyqpanda3.core.QCircuit.clear_control ( self)

clear_control(self: core.QCircuit) -> None

Clear all control qubits from this circuit.

◆ control()

QCircuit pyqpanda3.core.QCircuit.control ( self,
list[int] qubits )

control(self: core.QCircuit, qubits: list[int]) -> core.QCircuit

Get the controlled version of this circuit.

Parameters
qubitsA vector of control qubit indices.
Returns
A new QCircuit instance representing the controlled circuit.

◆ control_qubits()

list[int] pyqpanda3.core.QCircuit.control_qubits ( self)

control_qubits(self: core.QCircuit) -> list[int]

Get the control qubit indices.

Returns
A vector of control qubit indices.

◆ count_ops()

dict[str, int] pyqpanda3.core.QCircuit.count_ops ( self,
bool only_q2 = ... )

count_ops(self: core.QCircuit, only_q2: bool = False) -> dict[str, int]

Count the operations in the circuit.

Parameters
only_q2Boolean to consider only 2-qubit gates.
Returns
A map of gate counts by name.

◆ dagger()

QCircuit pyqpanda3.core.QCircuit.dagger ( self)

dagger(self: core.QCircuit) -> core.QCircuit

Get the dagger of the circuit.

Returns
A new QCircuit instance representing the dagger.

◆ depth()

int pyqpanda3.core.QCircuit.depth ( self,
bool only_q2 = ... )

depth(self: core.QCircuit, only_q2: bool = False) -> int

Get the depth of the circuit.

Parameters
only_q2Boolean to consider only 2-qubit gates.
Returns
The depth of the circuit.

◆ expand()

QCircuit pyqpanda3.core.QCircuit.expand ( self)

expand(self: core.QCircuit) -> core.QCircuit

Get the expand circuit .

Returns
Theexpand circuit.

◆ gate_operations()

list[QGate] pyqpanda3.core.QCircuit.gate_operations ( self,
bool only_q2 = ... )

gate_operations(self: core.QCircuit, only_q2: bool = False) -> list[core.QGate]

Get all gate operations in the circuit.

Parameters
only_q2Boolean to filter only 2-qubit gates.
Returns
A vector of QGate instances.

◆ get_register_size()

int pyqpanda3.core.QCircuit.get_register_size ( self)

get_register_size(self: core.QCircuit) -> int

Get the size of the register.

Returns
The size of the register.

◆ is_dagger()

bool pyqpanda3.core.QCircuit.is_dagger ( self)

is_dagger(self: core.QCircuit) -> bool

Check if the circuit is a dagger circuit.

Returns
True if it is a dagger circuit, false otherwise.

◆ name()

str pyqpanda3.core.QCircuit.name ( self)

name(self: core.QCircuit) -> str

Get the name of the circuit.

Returns
The name as a string.

◆ num_2q_gate()

int pyqpanda3.core.QCircuit.num_2q_gate ( self)

num_2q_gate(self: core.QCircuit) -> int

Get the number of 2-qubit gates in the circuit.

Returns
The count of 2-qubit gates.

◆ operations() [1/2]

list[QGate | QCircuit] pyqpanda3.core.QCircuit.operations ( self)

operations(self: core.QCircuit) -> list[Union[core.QGate, core.QCircuit]]

Get all operations in the circuit.

Returns
A vector of operations (QGate or QCircuit).

◆ operations() [2/2]

Any pyqpanda3.core.QCircuit.operations ( self,
QGateorQCircuit )

operations(self: core.QCircuit) -> list[Union[core.QGate, core.QCircuit]]

Get all operations in the circuit.

Returns
A vector of operations (QGate or QCircuit).

◆ qubits()

list[int] pyqpanda3.core.QCircuit.qubits ( self)

qubits(self: core.QCircuit) -> list[int]

Get the qubit indices used in the circuit.

Returns
A vector of qubit indices.

◆ set_name()

None pyqpanda3.core.QCircuit.set_name ( self,
str name )

set_name(self: core.QCircuit, name: str) -> None

Set the name of the circuit.

Parameters
nameThe name to set.

◆ size()

int pyqpanda3.core.QCircuit.size ( self)

size(self: core.QCircuit) -> int

Get the number of operations in the circuit.

Returns
The number of operations.

◆ target_qubits()

list[int] pyqpanda3.core.QCircuit.target_qubits ( self)

target_qubits(self: core.QCircuit) -> list[int]

Get the target qubit indices.

Returns
A vector of target qubit indices.

The documentation for this class was generated from the following file: