# ClassicalFunction¶

class ClassicalFunction(source, name=None)[ソース]

ベースクラス: qiskit.circuit.classicalfunction.classical_element.ClassicalElement

Represent a classical function function and its logic network.

Creates a ClassicalFunction from Python source code in source.

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_decomposition Add a decomposition of the instruction to the SessionEquivalenceLibrary. assemble Assemble a QasmQobjInstruction broadcast_arguments Validation and handling of the arguments and its relationship. c_if Add classical condition on register or cbit classical and value val. compile Parses and creates the logical circuit control Return controlled version of gate. copy Copy of the instruction. inverse Invert this instruction. is_parameterized Return True .IFF. mirror DEPRECATED: use instruction.reverse_ops(). power Creates a unitary gate as gate^exponent. qasm Return a default OpenQASM string for the instruction. repeat Creates an instruction with gate repeated n amount of times. reverse_ops For a composite instruction, reverse the order of sub-instructions. simulate Evaluate the expression on a bitstring. simulate_all Returns a truth table. soft_compare Soft comparison between gates. synth Synthesis the logic network into a QuantumCircuit. to_matrix Return a Numpy.array for the gate unitary matrix. validate_parameter Gate parameters should be int, float, or ParameterExpression

Attributes

args

Returns the classicalfunction arguments

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

str

network

Returns the logical network

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.