1
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation.
2
2
// Licensed under the MIT License.
3
3
4
4
namespace Microsoft .Quantum .AmplitudeAmplification {
@@ -129,16 +129,16 @@ namespace Microsoft.Quantum.AmplitudeAmplification {
129
129
/// It is assumed that the target state is marked by $\ket{1}\_f$.
130
130
/// It is assumed that
131
131
/// \begin{align}
132
- /// O\ket{\text{start}}\_{fa}\ket{\psi}\_s= \lambda\ket{1}\_f\ket{\text{anything}}\_a\ket{\text{target}}\_s U \ket{\psi}\_s + \sqrt{1-|\lambda|^2}\ket{0}\_f\cdots,
132
+ /// O\ket{\text{start}}\_{fa}\ket{\psi}\_s= \lambda\ket{1}\_f\ket{\text{anything}}\_a\ket{\text{target}}\_s + \sqrt{1-|\lambda|^2}\ket{0}\_f\cdots,
133
133
/// \end{align}
134
- /// for some unitary $U$.
134
+ /// where $\ket{\text{target}}\_s = U \ket{\psi}\_s$ for some unitary $U$.
135
135
function ObliviousAmplitudeAmplificationFromStatePreparation (
136
136
phases : ReflectionPhases ,
137
137
startStateOracle : DeterministicStateOracle ,
138
138
signalOracle : ObliviousOracle ,
139
139
idxFlagQubit : Int
140
140
)
141
- : (( Qubit [], Qubit []) => Unit is Adj + Ctl ) {
141
+ : (Qubit [], Qubit []) => Unit is Adj + Ctl {
142
142
let startStateReflection = ReflectionStart ();
143
143
let targetStateReflection = TargetStateReflectionOracle (idxFlagQubit );
144
144
let obliviousSignalOracle = ObliviousOracleFromDeterministicStateOracle (
@@ -205,7 +205,7 @@ namespace Microsoft.Quantum.AmplitudeAmplification {
205
205
startStateReflection : ReflectionOracle ,
206
206
targetStateReflection : ReflectionOracle
207
207
)
208
- : ( Qubit [] => Unit is Adj + Ctl ) {
208
+ : Qubit [] => Unit is Adj + Ctl {
209
209
// Pass empty qubit array using fact that NoOp does nothing.
210
210
let qubitEmpty = [];
211
211
let signalOracle = ObliviousOracle (NoOp );
@@ -247,7 +247,7 @@ namespace Microsoft.Quantum.AmplitudeAmplification {
247
247
stateOracle : StateOracle ,
248
248
idxFlagQubit : Int
249
249
)
250
- : ( Qubit [] => Unit is Adj + Ctl ) {
250
+ : Qubit [] => Unit is Adj + Ctl {
251
251
let systemRegister = [];
252
252
let signalOracle = ObliviousOracle (NoOp );
253
253
let startStateOracle = DeterministicStateOracleFromStateOracle (idxFlagQubit , stateOracle );
@@ -290,7 +290,7 @@ namespace Microsoft.Quantum.AmplitudeAmplification {
290
290
stateOracle : StateOracle ,
291
291
idxFlagQubit : Int
292
292
)
293
- : ( Qubit [] => Unit is Adj + Ctl ) {
293
+ : Qubit [] => Unit is Adj + Ctl {
294
294
let phases = StandardReflectionPhases (nIterations );
295
295
return AmplitudeAmplificationFromStatePreparation (phases , stateOracle , idxFlagQubit );
296
296
}
@@ -317,15 +317,15 @@ namespace Microsoft.Quantum.AmplitudeAmplification {
317
317
mutable exponentMax = 0 ;
318
318
mutable exponentCurrent = 0 ;
319
319
320
- //Complexity: Let \theta = \mathcal{O}(\sqrt{lambda})
320
+ // Complexity: Let \theta = \mathcal{O}(\sqrt{lambda})
321
321
// Number of Measurements = O( Log^2(1/\theta) )
322
322
// Number of Queries = O(1/\theta)
323
323
use flagQubit = Qubit ();
324
324
let qubits = [flagQubit ] + startQubits ;
325
325
let idxFlagQubit = 0 ;
326
326
327
327
repeat {
328
- if 2 ^ exponentMax > queriesMax {
328
+ if 2 ^ exponentMax > queriesMax {
329
329
fail $"Target state not found. Maximum number of queries exceeded." ;
330
330
}
331
331
0 commit comments