ClassicalFunction¶
- class ClassicalFunction(source, name=None)[ソース]¶
ベースクラス:
ClassicalElement
Represent a classical function and its logic network.
Creates a
ClassicalFunction
from Python source code insource
.The code should be a single function with types.
- パラメータ
source (str) – Python code with type hints.
name (str) – Optional. Default: 「classicalfunction」. ClassicalFunction name.
- 例外
QiskitError – If source is not a string.
Methods
Add a decomposition of the instruction to the SessionEquivalenceLibrary.
Assemble a QasmQobjInstruction
Validation and handling of the arguments and its relationship.
Set a classical equality condition on this instruction between the register or cbit
classical
and valueval
.Parses and creates the logical circuit
Return controlled version of gate.
Copy of the instruction.
Invert this instruction.
Return True .IFF.
Creates a unitary gate as gate^exponent.
Return a default OpenQASM string for the instruction.
Creates an instruction with gate repeated n amount of times.
For a composite instruction, reverse the order of sub-instructions.
Evaluate the expression on a bitstring.
Returns a truth table.
Soft comparison between gates.
Synthesis the logic network into a
QuantumCircuit
.Return a Numpy.array for the gate unitary matrix.
Gate parameters should be int, float, or ParameterExpression
Attributes
- args¶
Returns the classicalfunction arguments
- condition_bits¶
Get Clbits in condition.
- decompositions¶
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
- definition¶
Return definition in terms of other basic gates.
- duration¶
Get the duration.
- label¶
Return instruction label
- name¶
Return the name.
- network¶
Returns the logical network
- num_clbits¶
Return the number of clbits.
- num_qubits¶
Return the number of qubits.
- params¶
return instruction params.
- qregs¶
The list of qregs used by the classicalfunction
- scopes¶
Returns the scope dict
- truth_table¶
Returns (and computes) the truth table
- types¶
Dumps a list of scopes with their variables and types.
- 戻り値
A list of scopes as dicts, where key is the variable name and value is its type.
- 戻り値の型
list(dict)
- unit¶
Get the time unit of duration.