def update_qmi(self, prefix, next_prefix, problem): num1 = qmasm.symbol_to_number(prefix + self.sym1, prefix, next_prefix) num2 = qmasm.symbol_to_number(prefix + self.sym2, prefix, next_prefix) if num1 == num2: self.error_in_line("An anti-chain cannot connect a spin to itself") elif num1 > num2: num1, num2 = num2, num1 problem.antichains.add((num1, num2)) sym1 = qmasm.apply_prefix(prefix + self.sym1, None, next_prefix) sym2 = qmasm.apply_prefix(prefix + self.sym2, None, next_prefix) problem.pending_asserts.append((sym1, "/=", sym2))
def apply_prefix(self, prefix, next_prefix): "Prefix every identifier with a given string." if self.type == "ident": self.value = qmasm.apply_prefix(self.value, prefix, next_prefix) else: for k in self.kids: k.apply_prefix(prefix, next_prefix)
def update_qmi(self, prefix, next_prefix, problem): num = qmasm.symbol_to_number(prefix + self.sym, prefix, next_prefix) problem.pinned.append((num, self.goal)) sym = qmasm.apply_prefix(prefix + self.sym, None, next_prefix) problem.pending_asserts.append((sym, "=", str(int(self.goal))))