I wrote this code that uses a swap test to find if 2 pairs of sides are equal. First, amplitude encoding the 4 sides on 3 qubits then performing the swap test. I'm not sure where my logic went faulty, especially that I'm not very familiar with the logic of swap test yet. Here is the code
import math
def is_rectangle(A: int, B: int, C: int, D: int) -> int:
# Define quantum circuit with 3 qubits and 1 classical bit
qr = QuantumRegister(3)
cr = ClassicalRegister(1)
qc = QuantumCircuit(qr, cr)
# Encode the input integers into the state of the first 2 qubits using amplitude encoding
alpha = math.acos(math.sqrt(A/float(A**2 + B**2)))
beta = math.acos(math.sqrt(B/float(A**2 + B**2)))
qc.ry(2*alpha, qr[0])
qc.ry(2*beta, qr[1])
gamma = math.acos(math.sqrt(C/float(C**2 + D**2)))
delta = math.acos(math.sqrt(D/float(C**2 + D**2)))
qc.ry(2*gamma, qr[2])
qc.ry(2*delta, qr[1])
# Apply a series of SWAP gates to create the entangled state needed for the swap test
qc.cx(qr[1], qr[2])
qc.cx(qr[0], qr[1])
qc.cx(qr[1], qr[2])
qc.cx(qr[0], qr[1])
qc.cx(qr[1], qr[2])
# Apply the swap test to determine if the input integers satisfy any of the conditions
qc.h(qr[2])
qc.cx(qr[2], qr[1])
qc.h(qr[2])
# Measure the third qubit and return the measurement result as the output of the function
qc.measure(qr[2], cr[0])
# Run the quantum circuit using the Qiskit simulator
simulator = Aer.get_backend('qasm_simulator')
result = execute(qc, simulator, shots=1).result()
counts = result.get_counts()
if '1' in counts:
return 1
else:
return 0```