QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.core.QProg 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, QProg arg0)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, str originir_src, bool is_file=...)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, QCircuit node)
 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 append (self, QProg prog)
 append(*args, **kwargs) Overloaded function.
 
None append (self, measure)
 append(*args, **kwargs) Overloaded function.
 
list[int] cbits (self)
 cbits(self: core.QProg) -> list[int]
 
int cbits_num (self)
 cbits_num(self: core.QProg) -> int
 
None clear (self)
 clear(self: core.QProg) -> None
 
dict[str, int] count_ops (self, bool only_q2=...)
 count_ops(self: core.QProg, only_q2: bool = False) -> dict[str, int]
 
int depth (self, bool only_q2=...)
 depth(self: core.QProg, only_q2: bool = False) -> int
 
QProg flatten (self)
 flatten(self: core.QProg) -> core.QProg
 
list[QGategate_operations (self, bool only_q2=...)
 gate_operations(self: core.QProg, only_q2: bool = False) -> list[core.QGate]
 
 get_measure_nodes (self, *args, **kwargs)
 get_measure_nodes(self: core.QProg) -> list[Union[core.QGate, core.QCircuit, QPanda::Karus, QPanda::QMeasure, core.QProg]]
 
str name (self)
 name(self: core.QProg) -> str
 
Any operations (self, QProgNode)
 operations(self: core.QProg) -> list[Union[core.QGate, core.QCircuit, QPanda::Karus, QPanda::QMeasure, core.QProg]]
 
list[int] qubits (self)
 qubits(self: core.QProg) -> list[int]
 
int qubits_num (self)
 qubits_num(self: core.QProg) -> int
 
QCircuit to_circuit (self)
 to_circuit(self: core.QProg) -> core.QCircuit
 
QProg __lshift__ (self, QGate arg0)
 lshift(*args, **kwargs) Overloaded function.
 
QProg __lshift__ (self, QCircuit arg0)
 lshift(*args, **kwargs) Overloaded function.
 
QProg __lshift__ (self, QProg arg0)
 lshift(*args, **kwargs) Overloaded function.
 
QProg __lshift__ (self, arg0)
 lshift(*args, **kwargs) Overloaded function.
 

Constructor & Destructor Documentation

◆ __init__() [1/5]

None pyqpanda3.core.QProg.__init__ ( self)

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

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

Default constructor for QProg.

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

Constructor for QProg with a specified number of qubits.

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

Copy constructor for QProg.

Parameters
progThe QProg instance to copy.
  1. init(self: core.QProg, originir_src: str, is_file: bool = False) -> None

Constructor for QProg from a source string or file.

Parameters
originir_srcThe source string or file path.
is_fileBoolean indicating if the source is a file.
  1. init(self: core.QProg, node: core.QCircuit) -> None

Constructor for QProg from a QCircuit.

Parameters
nodeThe QCircuit instance to append to the program.

◆ __init__() [2/5]

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

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

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

Default constructor for QProg.

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

Constructor for QProg with a specified number of qubits.

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

Copy constructor for QProg.

Parameters
progThe QProg instance to copy.
  1. init(self: core.QProg, originir_src: str, is_file: bool = False) -> None

Constructor for QProg from a source string or file.

Parameters
originir_srcThe source string or file path.
is_fileBoolean indicating if the source is a file.
  1. init(self: core.QProg, node: core.QCircuit) -> None

Constructor for QProg from a QCircuit.

Parameters
nodeThe QCircuit instance to append to the program.

◆ __init__() [3/5]

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

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

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

Default constructor for QProg.

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

Constructor for QProg with a specified number of qubits.

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

Copy constructor for QProg.

Parameters
progThe QProg instance to copy.
  1. init(self: core.QProg, originir_src: str, is_file: bool = False) -> None

Constructor for QProg from a source string or file.

Parameters
originir_srcThe source string or file path.
is_fileBoolean indicating if the source is a file.
  1. init(self: core.QProg, node: core.QCircuit) -> None

Constructor for QProg from a QCircuit.

Parameters
nodeThe QCircuit instance to append to the program.

◆ __init__() [4/5]

None pyqpanda3.core.QProg.__init__ ( self,
str originir_src,
bool is_file = ... )

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

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

Default constructor for QProg.

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

Constructor for QProg with a specified number of qubits.

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

Copy constructor for QProg.

Parameters
progThe QProg instance to copy.
  1. init(self: core.QProg, originir_src: str, is_file: bool = False) -> None

Constructor for QProg from a source string or file.

Parameters
originir_srcThe source string or file path.
is_fileBoolean indicating if the source is a file.
  1. init(self: core.QProg, node: core.QCircuit) -> None

Constructor for QProg from a QCircuit.

Parameters
nodeThe QCircuit instance to append to the program.

◆ __init__() [5/5]

None pyqpanda3.core.QProg.__init__ ( self,
QCircuit node )

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

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

Default constructor for QProg.

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

Constructor for QProg with a specified number of qubits.

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

Copy constructor for QProg.

Parameters
progThe QProg instance to copy.
  1. init(self: core.QProg, originir_src: str, is_file: bool = False) -> None

Constructor for QProg from a source string or file.

Parameters
originir_srcThe source string or file path.
is_fileBoolean indicating if the source is a file.
  1. init(self: core.QProg, node: core.QCircuit) -> None

Constructor for QProg from a QCircuit.

Parameters
nodeThe QCircuit instance to append to the program.

Member Function Documentation

◆ __lshift__() [1/4]

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

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

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

  1. lshift(self: core.QProg, arg0: QPanda::QMeasure) -> core.QProg

Use << to append a node to the prog.

◆ __lshift__() [2/4]

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

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

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

  1. lshift(self: core.QProg, arg0: QPanda::QMeasure) -> core.QProg

Use << to append a node to the prog.

◆ __lshift__() [3/4]

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

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

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

  1. lshift(self: core.QProg, arg0: QPanda::QMeasure) -> core.QProg

Use << to append a node to the prog.

◆ __lshift__() [4/4]

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

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

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

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

Use << to append a node to the prog.

  1. lshift(self: core.QProg, arg0: QPanda::QMeasure) -> core.QProg

Use << to append a node to the prog.

◆ append() [1/4]

None pyqpanda3.core.QProg.append ( self,
measure )

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

  1. append(self: core.QProg, gate: core.QGate) -> None
  2. append(self: core.QProg, circuit: core.QCircuit) -> None
  3. append(self: core.QProg, prog: core.QProg) -> None
  4. append(self: core.QProg, measure: QPanda::QMeasure) -> None

◆ append() [2/4]

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

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

  1. append(self: core.QProg, gate: core.QGate) -> None
  2. append(self: core.QProg, circuit: core.QCircuit) -> None
  3. append(self: core.QProg, prog: core.QProg) -> None
  4. append(self: core.QProg, measure: QPanda::QMeasure) -> None

◆ append() [3/4]

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

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

  1. append(self: core.QProg, gate: core.QGate) -> None
  2. append(self: core.QProg, circuit: core.QCircuit) -> None
  3. append(self: core.QProg, prog: core.QProg) -> None
  4. append(self: core.QProg, measure: QPanda::QMeasure) -> None

◆ append() [4/4]

None pyqpanda3.core.QProg.append ( self,
QProg prog )

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

  1. append(self: core.QProg, gate: core.QGate) -> None
  2. append(self: core.QProg, circuit: core.QCircuit) -> None
  3. append(self: core.QProg, prog: core.QProg) -> None
  4. append(self: core.QProg, measure: QPanda::QMeasure) -> None

◆ cbits()

list[int] pyqpanda3.core.QProg.cbits ( self)

cbits(self: core.QProg) -> list[int]

Get the classical bit indices used in the program.

Returns
A vector of classical bit indices.

◆ cbits_num()

int pyqpanda3.core.QProg.cbits_num ( self)

cbits_num(self: core.QProg) -> int

Get the number of classical bits used in the program.

Returns
The number of classical bits.

◆ clear()

None pyqpanda3.core.QProg.clear ( self)

clear(self: core.QProg) -> None

Clear all operations in the program.

◆ count_ops()

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

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

Count the operations in the program.

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

◆ depth()

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

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

Get the depth of the program.

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

◆ flatten()

QProg pyqpanda3.core.QProg.flatten ( self)

flatten(self: core.QProg) -> core.QProg

Flatten the program into a linear representation.

Returns
A new QProg instance representing the flattened program.

◆ gate_operations()

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

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

Get all gate operations in the program.

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

◆ get_measure_nodes()

pyqpanda3.core.QProg.get_measure_nodes ( self,
* args,
** kwargs )

get_measure_nodes(self: core.QProg) -> list[Union[core.QGate, core.QCircuit, QPanda::Karus, QPanda::QMeasure, core.QProg]]

Get all measurement nodes in the program.

Returns
A vector of measurement nodes (QProgNode).

◆ name()

str pyqpanda3.core.QProg.name ( self)

name(self: core.QProg) -> str

Get the name of the program.

Returns
The name as a string.

◆ operations()

Any pyqpanda3.core.QProg.operations ( self,
QProgNode )

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

Get all operations in the program.

Returns
A vector of operations (QProgNode).

◆ qubits()

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

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

Get the qubit indices used in the program.

Returns
A vector of qubit indices.

◆ qubits_num()

int pyqpanda3.core.QProg.qubits_num ( self)

qubits_num(self: core.QProg) -> int

Get the number of qubits used in the program.

Returns
The number of qubits.

◆ to_circuit()

QCircuit pyqpanda3.core.QProg.to_circuit ( self)

to_circuit(self: core.QProg) -> core.QCircuit

Convert the program to a QCircuit.

Returns
A QCircuit instance representing the program.

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