Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Quantum Comparator Experiment

An educational Qiskit notebook that explores how a quantum circuit can compare two signed integers and return the larger value. The project was completed as a screening task for the Quantum Open Software Foundation (QOSF).

Approach

The notebook:

  1. Encodes each input integer as a sign bit plus a zero-padded binary magnitude.
  2. Initializes corresponding qubits with X gates for set bits.
  3. Applies comparison logic using CNOT and Toffoli-based oracle operations.
  4. Uses multi-controlled X gates to consolidate the comparison result into an output qubit.
  5. Measures the output on Qiskit Aer’s qasm_simulator and maps the measured result back to the larger input.

Repository contents

  • LargestNumber.ipynb — the complete experiment, circuit construction, simulation, and sample execution.

Tech stack

  • Python
  • Qiskit
  • Qiskit Aer simulator

Run locally

  1. Create a Python environment with a Qiskit version compatible with the notebook’s QuantumCircuit, Aer, and execute imports.
  2. Install Qiskit and its Aer simulator.
  3. Open LargestNumber.ipynb in Jupyter and run the cells in order.

Notes

This is an experimental learning project rather than a production comparator. Its value is in the circuit design: representing signed binary inputs, composing controlled operations, and validating the output through simulation.

Possible next steps

  • Add a conventional test suite covering positive, negative, and equal inputs.
  • Refactor the circuit into reusable, parameterized gates.
  • Update the notebook for current Qiskit APIs and document complexity limits.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages