OpInterface definitions

DifferentiableGate (DifferentiableGate)

This interface provides a generic way to interact with differentiable quantum instructions. These are quantum operations with differentiable gate parameters (must be scalar F64 values).

Methods:

getDiffParams

mlir::ValueRange getDiffParams();

Return all operands which are considered differentiable gate parameters.

NOTE: This method must be implemented by the user.

getDiffOperandIdx

size_t getDiffOperandIdx();

Return the starting index at which to find differentiable operands in the Operation*.Differentiable gate parameter operands do not need to be stored in a single ODS argument or be located in a particular position, but are assumed to be contiguous.

NOTE: This method must be implemented by the user.

MeasurementProcess (MeasurementProcess)

This interface provides a generic way to interact with quantum measurement processes. These are instructions that represent some information extraction procedure on the underlying statevector. On simulators, they may be implemented by direct manipulation of the statevector, but on hardware they typically turn into procedures over the quantum program as a whole, usually requiring many executions of the same circuit.

Methods:

ParametrizedGate (ParametrizedGate)

This interface provides a generic way to interact with parametrized quantum instructions. These are quantum operations with arbitrary classical gate parameters.

Methods:

getAllParams

mlir::ValueRange getAllParams();

Return all operands which are considered gate parameters.

NOTE: This method must be implemented by the user.

getParamOperandIdx

size_t getParamOperandIdx();

Return the starting index at which to find gate parameter operands.

NOTE: This method must be implemented by the user.

QuantumGate (QuantumGate)

This interface provides a generic way to interact with instructions that are considered ‘unitary’ gates, which in addition to the properties of the “QuantumOperation” can be inverted and controlled.

Methods:

getNonCtrlQubitOperands

mlir::ValueRange getNonCtrlQubitOperands();

Return operands which are considered non-controlled input qubit values.

NOTE: This method must be implemented by the user.

setNonCtrlQubitOperands

void setNonCtrlQubitOperands(mlir::ValueRange replacements);

Set all operands which are considered non-controlled input qubit values.

NOTE: This method must be implemented by the user.

getNonCtrlQubitResults

mlir::ResultRange getNonCtrlQubitResults();

Return results which are considered non-controlled output qubit values.

NOTE: This method must be implemented by the user.

getCtrlQubitOperands

mlir::ValueRange getCtrlQubitOperands();

Return all operands which are considered controlling input qubit values.

NOTE: This method must be implemented by the user.

setCtrlQubitOperands

void setCtrlQubitOperands(mlir::ValueRange replacements);

Set all operands which are considered controlling input qubit values.

NOTE: This method must be implemented by the user.

getCtrlValueOperands

mlir::ValueRange getCtrlValueOperands();

Return all operands which are considered controlling input boolean values.

NOTE: This method must be implemented by the user.

setCtrlValueOperands

void setCtrlValueOperands(mlir::ValueRange replacements);

Set all operands which are considered controlling input boolean values.

NOTE: This method must be implemented by the user.

getCtrlQubitResults

mlir::ResultRange getCtrlQubitResults();

Return all operands which are considered controlling output qubit values.

NOTE: This method must be implemented by the user.

getAdjointFlag

bool getAdjointFlag();

Return adjoint flag.

NOTE: This method must be implemented by the user.

setAdjointFlag

void setAdjointFlag(bool adjoint);

Set adjoint flag.

NOTE: This method must be implemented by the user.

QuantumOperation (QuantumOperation)

This interface provides a generic way to interact with instructions that are considered quantum logic gates. These are characterized by operating on zero or more qubit values, and returning the same amount of qubit values.

Methods:

getQubitOperands

std::vector<mlir::Value> getQubitOperands();

Return all operands which are considered input qubit values (including controls).

NOTE: This method must be implemented by the user.

setQubitOperands

void setQubitOperands(mlir::ValueRange replacements);

Set all operands which are considered input qubit values (including controls).

NOTE: This method must be implemented by the user.

getQubitResults

std::vector<mlir::OpResult> getQubitResults();

Return all results which are considered output qubit values (including controls).

NOTE: This method must be implemented by the user.

QuantumRegion (QuantumRegion)

This interface provides a generic way to interact with instructions that are considered quantum regions. These are characterized by operating on a single qubit register, and returning a new register value.

Methods:

getRegisterOperand

mlir::Value getRegisterOperand();

Return the quantum register operand.

getRegisterResult

mlir::Value getRegisterResult();

Return the quantum register result.