MCXGrayCode

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

Implement the multi-controlled X gate using the Gray code.

This delegates the implementation to the MCU1 gate, since \(X = H \cdot U1(\pi) \cdot H\).

Create new MCX gate.

Attributes

MCXGrayCode.ctrl_state

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

MCXGrayCode.decompositions

Get the decompositions of the instruction from the SessionEquivalenceLibrary.

MCXGrayCode.definition

Return definition in terms of other basic gates.

MCXGrayCode.label

Return gate label

MCXGrayCode.num_ancilla_qubits

The number of ancilla qubits.

MCXGrayCode.num_ctrl_qubits

Get number of control qubits.

MCXGrayCode.params

return instruction params.

Methods

MCXGrayCode.add_decomposition(decomposition)

Add a decomposition of the instruction to the SessionEquivalenceLibrary.

MCXGrayCode.assemble()

Assemble a QasmQobjInstruction

MCXGrayCode.broadcast_arguments(qargs, cargs)

Validation and handling of the arguments and its relationship.

MCXGrayCode.c_if(classical, val)

Add classical condition on register classical and value val.

MCXGrayCode.control([num_ctrl_qubits, …])

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

MCXGrayCode.copy([name])

Copy of the instruction.

MCXGrayCode.get_num_ancilla_qubits(…[, mode])

Get the number of required ancilla qubits without instantiating the class.

MCXGrayCode.inverse()

Invert this gate.

MCXGrayCode.is_parameterized()

Return True .IFF.

MCXGrayCode.mirror()

DEPRECATED: use instruction.reverse_ops().

MCXGrayCode.power(exponent)

Creates a unitary gate as gate^exponent.

MCXGrayCode.qasm()

Return a default OpenQASM string for the instruction.

MCXGrayCode.repeat(n)

Creates an instruction with gate repeated n amount of times.

MCXGrayCode.reverse_ops()

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

MCXGrayCode.to_matrix()

Return a Numpy.array for the gate unitary matrix.