DWQMI¶
-
class
DWQMI: public xacc::Instruction¶ The DWQMI (D=Wave Quantum Machine Instruction) class is an XACC Instruction that models a logical problem or hardware bias or connection for an optimization problem to be solved on the D-Wave QPU. It keeps track of 2 bits indices, if both are the same index then this DWQMI Instruction models a bias value, and if they are different indices, then this Instruction models a logical coupling.
Note that this class can model both problem bias/couplings and hardware bias/couplings. The hardware bias/couplings result from a minor graph embedding computation.
Public Functions
-
DWQMI(int qbit)¶ The Constructor, takes one qubit indicating this is a bias value, initialized to 0.0
- Parameters
qbit: The bit index
-
DWQMI(int qbit, double param)¶ The Constructor, takes one qubit indicating this is a bias value, but set to the provided bias.
- Parameters
qbit: The bit indexparam: The bias value
-
DWQMI(int qbit1, int qbit2, double param)¶ The Constructor, takes two qubit indices to indicate that this is a coupler, with value given by the provided parameter.
- Parameters
qbit1: The bit indexqbit2: The bit indexparam: The coupling weight
-
const std::string
name() const¶ Return the name of this Instruction
- Return
name The name of this Instruction
-
const std::string
description() const¶ Return the description of this instance
- Return
description The description of this object.
-
void
mapBits(std::vector<int> bitMap)¶ Map bits [0,1,2,…] to [bitMap[0],bitMap[1],…]
- Parameters
bitMap: The bits to map to
-
const std::string
toString(const std::string &bufferVarName)¶ Persist this Instruction to an assembly-like string.
- Return
str The assembly-like string.
- Parameters
bufferVarName: The name of the AcceleratorBuffer
-
const std::string
toString()¶ Persist this Instruction to an assembly-like string.
- Return
str The assembly-like string.
-
const std::vector<int>
bits()¶ Return the indices of the bits that this Instruction operates on.
- Return
bits The bits this Instruction operates on.
-
InstructionParameter
getParameter(const int idx) const¶ Return this Instruction’s parameter at the given index.
- Return
param The InstructionParameter at the given index.
- Parameters
idx: The index of the parameter.
-
std::vector<InstructionParameter>
getParameters()¶ Return all of this Instruction’s parameters.
- Return
params This instructions parameters.
-
void
setParameter(const int idx, InstructionParameter &inst)¶ Set this Instruction’s parameter at the given index.
- Parameters
idx: The index of the parameterinst: The instruction.
-
const int
nParameters()¶ Return the number of InstructionParameters this Instruction contains.
- Return
nInsts The number of instructions.
-
bool
isParameterized()¶ Return true if this Instruction is parameterized.
- Return
parameterized True if this Instruction has parameters.
-
bool
isComposite()¶ Returns true if this Instruction is composite, ie, contains other Instructions.
- Return
isComposite True if this is a composite Instruction
-
bool
isEnabled()¶ Returns true if this Instruction is enabled
- Return
enabled True if this Instruction is enabled.
-
void
disable()¶ Disable this Instruction
-
void
enable()¶ Enable this Instruction.
-
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.
-