diff --git a/library/std/internal.qs b/library/std/internal.qs index da83205385..72afb101b7 100644 --- a/library/std/internal.qs +++ b/library/std/internal.qs @@ -150,24 +150,6 @@ namespace Microsoft.Quantum.Intrinsic { } } - @Config(Adaptive) - internal operation AND(control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj { - body ... { - __quantum__qis__ccx__body(control1, control2, target); - } - adjoint ... { - __quantum__qis__h__body(target); - if MResetZ(target) == One { - __quantum__qis__cz__body(control1, control2); - } - } - } - - @Config(not Adaptive) - internal operation AND(control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj { - PhaseCCX(control1, control2, target); - } - internal operation PhaseCCX(control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj { // https://arxiv.org/pdf/1210.0974.pdf#page=2 H(target); diff --git a/library/std/intrinsic.qs b/library/std/intrinsic.qs index a945a1ce87..f3cfb326d7 100644 --- a/library/std/intrinsic.qs +++ b/library/std/intrinsic.qs @@ -8,6 +8,52 @@ namespace Microsoft.Quantum.Intrinsic { open Microsoft.Quantum.Math; open QIR.Intrinsic; + /// # Summary + /// Applies the AND gate that is more efficient for use with decomposition of multi-controlled operations. + /// Note that target qubit must be in |0⟩ state. + /// + /// # Input + /// ## control1 + /// First control qubit for the AND gate. + /// ## control2 + /// Second control qubit for the AND gate. + /// ## target + /// Target qubit for the AND gate. + /// + /// # Remarks + /// Use the Adjoint only for uncomputation purposes. + @Config(Adaptive) + operation AND(control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj { + body ... { + __quantum__qis__ccx__body(control1, control2, target); + } + adjoint ... { + __quantum__qis__h__body(target); + if MResetZ(target) == One { + __quantum__qis__cz__body(control1, control2); + } + } + } + + /// # Summary + /// Applies the AND gate that is more efficient for use with decomposition of multi-controlled operations. + /// Note that target qubit must be in |0⟩ state. + /// + /// # Input + /// ## control1 + /// First control qubit for the AND gate. + /// ## control2 + /// Second control qubit for the AND gate. + /// ## target + /// Target qubit for the AND gate. + /// + /// # Remarks + /// Use the Adjoint only for uncomputation purposes. + @Config(not Adaptive) + operation AND(control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj { + PhaseCCX(control1, control2, target); + } + /// # Summary /// Applies the doubly controlled–NOT (CCNOT) gate to three qubits. /// diff --git a/vscode/test/suites/debugger/debugger.test.ts b/vscode/test/suites/debugger/debugger.test.ts index 724f76c100..084a0a36c1 100644 --- a/vscode/test/suites/debugger/debugger.test.ts +++ b/vscode/test/suites/debugger/debugger.test.ts @@ -375,10 +375,10 @@ suite("Q# Debugger Tests", function suite() { sourceReference: 0, adapterData: "qsharp-adapter-data", }, - line: 159, + line: 205, column: 13, name: "H ", - endLine: 159, + endLine: 205, endColumn: 44, }, {