MCXRecursive

class MCXRecursive(num_ctrl_qubits=None, label=None, ctrl_state=None)[source]

Implement the multi-controlled X gate using recursion.

Using a single ancilla qubit, the multi-controlled X gate is recursively split onto four sub-registers. This is done until we reach the 3- or 4-controlled X gate since for these we have a concrete implementation that do not require ancillas.

Create new MCX gate.

Attributes

MCXRecursive.ctrl_state

Return the control state of the gate as a decimal integer.

MCXRecursive.decompositions

Get the decompositions of the instruction from the SessionEquivalenceLibrary.

MCXRecursive.definition

Return definition in terms of other basic gates.

MCXRecursive.label

Return gate label

MCXRecursive.num_ancilla_qubits

The number of ancilla qubits.

MCXRecursive.num_ctrl_qubits

Get number of control qubits.

MCXRecursive.params

return instruction params.

Methods

MCXRecursive.add_decomposition(decomposition)

Add a decomposition of the instruction to the SessionEquivalenceLibrary.

MCXRecursive.assemble()

Assemble a QasmQobjInstruction

MCXRecursive.broadcast_arguments(qargs, cargs)

Validation and handling of the arguments and its relationship.

MCXRecursive.c_if(classical, val)

Add classical condition on register classical and value val.

MCXRecursive.control([num_ctrl_qubits, …])

Return a multi-controlled-X gate with more control lines.

MCXRecursive.copy([name])

Copy of the instruction.

MCXRecursive.get_num_ancilla_qubits(…[, mode])

Get the number of required ancilla qubits.

MCXRecursive.inverse()

Invert this gate.

MCXRecursive.is_parameterized()

Return True .IFF.

MCXRecursive.mirror()

DEPRECATED: use instruction.reverse_ops().

MCXRecursive.power(exponent)

Creates a unitary gate as gate^exponent.

MCXRecursive.qasm()

Return a default OpenQASM string for the instruction.

MCXRecursive.repeat(n)

Creates an instruction with gate repeated n amount of times.

MCXRecursive.reverse_ops()

For a composite instruction, reverse the order of sub-instructions.

MCXRecursive.to_matrix()

Return a Numpy.array for the gate unitary matrix.