def update_qmi(self, prefix, problem): num1 = qasm.symbol_to_number(prefix + self.sym1) num2 = qasm.symbol_to_number(prefix + self.sym2) if num1 == num2: self.error_in_line("A chain cannot connect a spin to itself") elif num1 > num2: num1, num2 = num2, num1 problem.chains[(num1, num2)] = None # Value is a don't-care.
def update_qmi(self, prefix, problem): num1 = qasm.symbol_to_number(prefix + self.sym1) num2 = qasm.symbol_to_number(prefix + self.sym2) if num1 == num2: self.error_in_line("A coupler cannot connect a spin to itself") elif num1 > num2: num1, num2 = num2, num1 problem.strengths[(num1, num2)] += self.strength
def pin_qubits(self, pin_str): "Use a helper qubit to help pin values to true or false." for q_user, b in self.pinned: q_helper = qasm.symbol_to_number(new_internal_sym()) q1, q2 = q_helper, q_user if q1 > q2: q1, q2 = q2, q1 if b: self.weights[q_helper] += pin_str/2.0 self.weights[q_user] += pin_str self.strengths[(q1, q2)] += -pin_str/2.0 else: self.weights[q_helper] += pin_str/2.0 self.weights[q_user] += -pin_str self.strengths[(q1, q2)] += pin_str/2.0
def update_qmi(self, prefix, problem): num = qasm.symbol_to_number(prefix + self.sym) problem.weights[num] += self.weight
def update_qmi(self, prefix, problem): num = qasm.symbol_to_number(prefix + self.sym) problem.pinned.append((num, self.goal))