<s>
The	O
swap	B-Algorithm
test	I-Algorithm
is	O
a	O
procedure	O
in	O
quantum	B-Architecture
computation	I-Architecture
that	O
is	O
used	O
to	O
check	O
how	O
much	O
two	O
quantum	O
states	O
differ	O
,	O
appearing	O
first	O
in	O
the	O
work	O
of	O
Barenco	O
et	O
al	O
.	O
</s>
<s>
It	O
appears	O
commonly	O
in	O
quantum	B-Device
machine	I-Device
learning	I-Device
,	O
and	O
is	O
a	O
circuit	O
used	O
for	O
proofs-of-concept	O
in	O
implementations	O
of	O
quantum	B-Architecture
computers	I-Architecture
.	O
</s>
<s>
Formally	O
,	O
the	O
swap	B-Algorithm
test	I-Algorithm
takes	O
two	O
input	O
states	O
and	O
and	O
outputs	O
a	O
Bernoulli	O
random	O
variable	O
that	O
is	O
1	O
with	O
probability	O
(	O
where	O
the	O
expressions	O
here	O
use	O
bra	O
–	O
ket	O
notation	O
)	O
.	O
</s>
<s>
This	O
allows	O
one	O
to	O
,	O
for	O
example	O
,	O
estimate	O
the	O
squared	O
inner	O
product	O
between	O
the	O
two	O
states	O
,	O
,	O
to	O
additive	O
error	O
by	O
taking	O
the	O
average	O
over	O
runs	O
of	O
the	O
swap	B-Algorithm
test	I-Algorithm
.	O
</s>
<s>
In	O
general	O
,	O
for	O
trials	O
of	O
the	O
swap	B-Algorithm
test	I-Algorithm
using	O
copies	O
of	O
and	O
copies	O
of	O
,	O
the	O
fraction	O
of	O
measurements	O
that	O
are	O
zero	O
is	O
,	O
so	O
by	O
taking	O
,	O
one	O
can	O
get	O
arbitrary	O
precision	O
of	O
this	O
value	O
.	O
</s>
