GateInstruction¶
-
class
GateInstruction: public xacc::Instruction, public xacc::Cloneable<GateInstruction>¶ Subclassed by xacc::quantum::CNOT, xacc::quantum::CPhase, xacc::quantum::CZ, xacc::quantum::Hadamard, xacc::quantum::Identity, xacc::quantum::Measure, xacc::quantum::Rx, xacc::quantum::Ry, xacc::quantum::Rz, xacc::quantum::Swap, xacc::quantum::U, xacc::quantum::X, xacc::quantum::Y, xacc::quantum::Z
Public Functions
-
GateInstruction()¶ Nullary constructor
-
GateInstruction(std::string name)¶ Constructor, construct with gate name
-
GateInstruction(std::string name, std::vector<InstructionParameter> params)¶ Constructor, construct with gate name and instruction parameters.
-
GateInstruction(std::string name, std::vector<int> qubts)¶ The constructor, takes the name and qubits this instruction acts on.
-
GateInstruction(std::string name, std::vector<int> qubts, std::vector<InstructionParameter> params)¶ The constructor, takes the name, bits operated on, and parameters.
-
GateInstruction(const GateInstruction &inst)¶ The copy constructor
-
const std::string
name() const¶ Return the instruction name.
- Return
-
const std::string
description() const¶ Return this instruction’s description.
- Return
desc The description.
-
const std::vector<int>
bits()¶ Return the list of qubits this instruction acts on.
- Return
bits The qubits this instruction operates on.
-
void
mapBits(std::vector<int> bitMap)¶ Map this Instruction’s qubit indices to the given physical qubits.
- Parameters
bitMap: The physical bits to map to.
-
const std::string
toString()¶ Return this instruction’s assembly-like string representation.
- Return
qasm The instruction as qasm
-
const std::string
toString(const std::string &bufferVarName)¶ Return this instruction’s assembly-like string representation.
- Return
qasm The instruction as qasm
- Parameters
bufferVarName: The qubit register name
-
bool
isEnabled()¶ Return true if this Instruction is enabled.
- Return
enabled True if this Instruction is enabled.
-
void
disable()¶ Disable this Instruction.
-
void
enable()¶ Enable this Instruction.
-
InstructionParameter
getParameter(const int idx) const¶ Return the parameter at the given index.
- Return
param The parameter.
- Parameters
idx: The parameter index
-
void
setParameter(const int idx, InstructionParameter &p)¶ Set the parameter at the given index.
- Parameters
idx: The parameter indexparam: The parameter.
-
std::vector<InstructionParameter>
getParameters()¶ Return this Instructions Parameters.
- Return
params The Instruction Parameters.
-
bool
isParameterized()¶ Return true if this Instruction is parameterized.
- Return
isParameterized True if parameterized.
-
const int
nParameters()¶ Return the number of parameters this Instruction has.
- Return
nParams The number of parameters.
-
bool
hasOptions()¶ Return true if this Instruction has customizable options.
- Return
hasOptions
-
void
setOption(const std::string optName, InstructionParameter option)¶ Set the value of an option with the given name.
- Parameters
optName: The name of the option.option: The value of the option
-
InstructionParameter
getOption(const std::string optName)¶ Get the value of an option with the given name.
- Return
option The value of the option.
- Parameters
optName: Then name of the option.
-
std::map<std::string, InstructionParameter>
getOptions()¶ Return all the Instructions options as a map.
- Return
optMap The options map.
-
virtual
~GateInstruction()¶ This configures this Instruction with the appropriate accept() method for the XACC IR InstructionVisitor pattern. The destructor
-