TransWikia.com

Is there a quantum circuit to find the maximum of two inputs?

Quantum Computing Asked by Soulfulnerds on December 28, 2020

Is there a quantum circuit (preferably on Quirk as an example) that will enable me to find the maximum from two inputs?

Example

  • input A: 11011
  • input B: 11100

Expected output: 11100

One Answer

The easiest way is with a temporary comparison to decide which input to copy over:

circuit

If you want it to run without the extra output register, you can instead CSWAP the inputs based on the comparison bit, sorting them. You can't uncompute the comparison bit until you unsort them though.

Answered by Craig Gidney on December 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP