Skip to content

Commit 0aca8ea

Browse files
committed
Update some files
1 parent 2af7338 commit 0aca8ea

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,11 @@ for i := range 10 {
227227
qsim.InvQFT(q0, q1, q2)
228228

229229
// measure q0, q1, q2
230-
m := qsim.Measure(q0, q1, q2).BinaryString()
230+
m := qsim.Measure(q0, q1, q2)
231+
phi := number.Ldexp(m.Int(), -m.NumQubits())
231232

232233
// find s/r. 0.010 -> 0.25 -> 1/4, 0.110 -> 0.75 -> 3/4, ...
233-
s, r, d, ok := number.FindOrder(a, N, fmt.Sprintf("0.%s", m))
234+
s, r, d, ok := number.FindOrder(a, N, phi)
234235
if !ok || number.IsOdd(r) {
235236
continue
236237
}

q_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,9 +990,10 @@ func Example_shor15() {
990990

991991
// measure q0, q1, q2
992992
m := qsim.Measure(q0, q1, q2)
993+
phi := number.Ldexp(m.Int(), -m.NumQubits())
993994

994995
// find s/r. 0.010 -> 0.25 -> 1/4, 0.110 -> 0.75 -> 3/4, ...
995-
s, r, d, ok := number.FindOrder(a, N, number.Ldexp(m.Int(), -3))
996+
s, r, d, ok := number.FindOrder(a, N, phi)
996997
if !ok || number.IsOdd(r) {
997998
return
998999
}

0 commit comments

Comments
 (0)