@yuichirominato 2019.02.10更新 137views

0+0,0+1,1+0,1+1 at once on universal gate model


Introduction

By using the superposition we can implement an adder circuit with all possibility only one circuit.

About adder

Simple adder circuit is,


a--H---*-------*---
b--H---*---*---|---
c------|---X---X---
d------X-----------

with the code and try 100 times

from blueqat import Circuit 
Circuit(4).h[:2].ccx[0,1,3].cx[1,2].cx[0,2].m[:].run(shots=100) 

Counter({'0000': 25, '0110': 30, '1010': 19, '1101': 26})

We get 4 possibility and these are,

#0+0=0
0000

#0+1=1
0110

#1+0=1
1010

#1+1=10
1101

With just a simple circuit we could calculate adder with superposition using H gate.

Recommend


Back To Top