Update target packages for QIR emission (#773)
This commit is contained in:
Родитель
f3b25549cc
Коммит
6dd7b75061
|
@ -83,7 +83,7 @@ if ($Env:ENABLE_EXPERIMENTALSIM -ne "false") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Skipping test of experimental simulators because ENABLE_OPENSIM variable is set to: $Env:ENABLE_OPENSIM."
|
Write-Host "Skipping test of experimental simulators because ENABLE_EXPERIMENTALSIM variable is set to: $Env:ENABLE_EXPERIMENTALSIM."
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $all_ok) {
|
if (-not $all_ok) {
|
||||||
|
|
|
@ -14,10 +14,5 @@ namespace Microsoft.Quantum.Simulation.Simulators
|
||||||
CheckAngle(angle);
|
CheckAngle(angle);
|
||||||
R(this.Id, Pauli.PauliX, angle, (uint)target.Id);
|
R(this.Id, Pauli.PauliX, angle, (uint)target.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IIntrinsicApplyUncontrolledRx.AdjointBody(double angle, Qubit target)
|
|
||||||
{
|
|
||||||
((IIntrinsicApplyUncontrolledRx)this).Body(-angle, target);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,5 @@ namespace Microsoft.Quantum.Simulation.Simulators
|
||||||
CheckAngle(angle);
|
CheckAngle(angle);
|
||||||
R(this.Id, Pauli.PauliY, angle, (uint)target.Id);
|
R(this.Id, Pauli.PauliY, angle, (uint)target.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IIntrinsicApplyUncontrolledRy.AdjointBody(double angle, Qubit target)
|
|
||||||
{
|
|
||||||
((IIntrinsicApplyUncontrolledRy)this).Body(-angle, target);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,5 @@ namespace Microsoft.Quantum.Simulation.Simulators
|
||||||
CheckAngle(angle);
|
CheckAngle(angle);
|
||||||
R(this.Id, Pauli.PauliZ, angle, (uint)target.Id);
|
R(this.Id, Pauli.PauliZ, angle, (uint)target.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IIntrinsicApplyUncontrolledRz.AdjointBody(double angle, Qubit target)
|
|
||||||
{
|
|
||||||
((IIntrinsicApplyUncontrolledRz)this).Body(-angle, target);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,5 @@ namespace Microsoft.Quantum.Simulation.Simulators
|
||||||
|
|
||||||
S(this.Id, (uint)target.Id);
|
S(this.Id, (uint)target.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IIntrinsicApplyUncontrolledS.AdjointBody(Qubit target)
|
|
||||||
{
|
|
||||||
this.CheckQubit(target);
|
|
||||||
|
|
||||||
AdjS(this.Id, (uint)target.Id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using Microsoft.Quantum.Simulation.Core;
|
||||||
|
using Microsoft.Quantum.Intrinsic.Interfaces;
|
||||||
|
|
||||||
|
namespace Microsoft.Quantum.Simulation.Simulators
|
||||||
|
{
|
||||||
|
public partial class QuantumSimulator
|
||||||
|
{
|
||||||
|
void IIntrinsicApplyUncontrolledSAdj.Body(Qubit target)
|
||||||
|
{
|
||||||
|
this.CheckQubit(target);
|
||||||
|
|
||||||
|
AdjS(this.Id, (uint)target.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,12 +14,5 @@ namespace Microsoft.Quantum.Simulation.Simulators
|
||||||
|
|
||||||
T(this.Id, (uint)target.Id);
|
T(this.Id, (uint)target.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IIntrinsicApplyUncontrolledT.AdjointBody(Qubit target)
|
|
||||||
{
|
|
||||||
this.CheckQubit(target);
|
|
||||||
|
|
||||||
AdjT(this.Id, (uint)target.Id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using Microsoft.Quantum.Simulation.Core;
|
||||||
|
using Microsoft.Quantum.Intrinsic.Interfaces;
|
||||||
|
|
||||||
|
namespace Microsoft.Quantum.Simulation.Simulators
|
||||||
|
{
|
||||||
|
public partial class QuantumSimulator
|
||||||
|
{
|
||||||
|
void IIntrinsicApplyUncontrolledTAdj.Body(Qubit target)
|
||||||
|
{
|
||||||
|
this.CheckQubit(target);
|
||||||
|
|
||||||
|
AdjT(this.Id, (uint)target.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
|
||||||
|
/// # Summary
|
||||||
|
/// Applies the controlled-NOT (CNOT) gate to a pair of qubits.
|
||||||
|
///
|
||||||
|
/// # Description
|
||||||
|
/// \begin{align}
|
||||||
|
/// \operatorname{CNOT} \mathrel{:=}
|
||||||
|
/// \begin{bmatrix}
|
||||||
|
/// 1 & 0 & 0 & 0 \\\\
|
||||||
|
/// 0 & 1 & 0 & 0 \\\\
|
||||||
|
/// 0 & 0 & 0 & 1 \\\\
|
||||||
|
/// 0 & 0 & 1 & 0
|
||||||
|
/// \end{bmatrix},
|
||||||
|
/// \end{align}
|
||||||
|
///
|
||||||
|
/// where rows and columns are ordered as in the quantum concepts guide.
|
||||||
|
///
|
||||||
|
/// # Input
|
||||||
|
/// ## control
|
||||||
|
/// Control qubit for the CNOT gate.
|
||||||
|
/// ## target
|
||||||
|
/// Target qubit for the CNOT gate.
|
||||||
|
///
|
||||||
|
/// # Remarks
|
||||||
|
/// Equivalent to:
|
||||||
|
/// ```qsharp
|
||||||
|
/// Controlled X([control], target);
|
||||||
|
/// ```
|
||||||
|
operation CNOT (control : Qubit, target : Qubit) : Unit is Adj + Ctl {
|
||||||
|
body (...) {
|
||||||
|
ApplyControlledX(control, target);
|
||||||
|
}
|
||||||
|
controlled (ctls, ...) {
|
||||||
|
if (Length(ctls) == 0) {
|
||||||
|
ApplyControlledX(control, target);
|
||||||
|
}
|
||||||
|
elif (Length(ctls) == 1) {
|
||||||
|
CCNOT(ctls[0], control, target);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ApplyWithLessControlsA(Controlled CNOT, (ctls, (control, target)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
adjoint self;
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,9 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
body (...) {
|
body (...) {
|
||||||
ApplyUncontrolledS(qubit);
|
ApplyUncontrolledS(qubit);
|
||||||
}
|
}
|
||||||
|
adjoint (...) {
|
||||||
|
ApplyUncontrolledSAdj(qubit);
|
||||||
|
}
|
||||||
controlled (ctls, ...) {
|
controlled (ctls, ...) {
|
||||||
if (Length(ctls) == 0) {
|
if (Length(ctls) == 0) {
|
||||||
ApplyUncontrolledS(qubit);
|
ApplyUncontrolledS(qubit);
|
||||||
|
@ -37,5 +40,20 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
ApplyWithLessControlsA(Controlled S, (ctls, qubit));
|
ApplyWithLessControlsA(Controlled S, (ctls, qubit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
controlled adjoint (ctls, ...) {
|
||||||
|
if (Length(ctls) == 0) {
|
||||||
|
ApplyUncontrolledSAdj(qubit);
|
||||||
|
}
|
||||||
|
elif (Length(ctls) == 1) {
|
||||||
|
Adjoint T(ctls[0]);
|
||||||
|
Adjoint T(qubit);
|
||||||
|
CNOT(ctls[0], qubit);
|
||||||
|
T(qubit);
|
||||||
|
CNOT(ctls[0], qubit);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ApplyWithLessControlsA(Controlled Adjoint S, (ctls, qubit));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,9 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
body (...) {
|
body (...) {
|
||||||
ApplyUncontrolledT(qubit);
|
ApplyUncontrolledT(qubit);
|
||||||
}
|
}
|
||||||
|
adjoint (...) {
|
||||||
|
ApplyUncontrolledTAdj(qubit);
|
||||||
|
}
|
||||||
controlled (ctls, ...) {
|
controlled (ctls, ...) {
|
||||||
if (Length(ctls) == 0) {
|
if (Length(ctls) == 0) {
|
||||||
ApplyUncontrolledT(qubit);
|
ApplyUncontrolledT(qubit);
|
||||||
|
@ -37,5 +40,20 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
ApplyWithLessControlsA(Controlled T, (ctls, qubit));
|
ApplyWithLessControlsA(Controlled T, (ctls, qubit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
controlled adjoint (ctls, ...) {
|
||||||
|
if (Length(ctls) == 0) {
|
||||||
|
ApplyUncontrolledTAdj(qubit);
|
||||||
|
}
|
||||||
|
elif (Length(ctls) == 1) {
|
||||||
|
Adjoint R1Frac(1, 3, ctls[0]);
|
||||||
|
Adjoint R1Frac(1, 3, qubit);
|
||||||
|
CNOT(ctls[0], qubit);
|
||||||
|
R1Frac(1, 3, qubit);
|
||||||
|
CNOT(ctls[0], qubit);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ApplyWithLessControlsA(Controlled Adjoint T, (ctls, qubit));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,5 @@ namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
public interface IIntrinsicApplyUncontrolledRx : IOperationFactory
|
public interface IIntrinsicApplyUncontrolledRx : IOperationFactory
|
||||||
{
|
{
|
||||||
void Body(double angle, Qubit target);
|
void Body(double angle, Qubit target);
|
||||||
|
|
||||||
void AdjointBody(double angle, Qubit target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,5 @@ namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
public interface IIntrinsicApplyUncontrolledRy : IOperationFactory
|
public interface IIntrinsicApplyUncontrolledRy : IOperationFactory
|
||||||
{
|
{
|
||||||
void Body(double angle, Qubit target);
|
void Body(double angle, Qubit target);
|
||||||
|
|
||||||
void AdjointBody(double angle, Qubit target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,5 @@ namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
public interface IIntrinsicApplyUncontrolledRz : IOperationFactory
|
public interface IIntrinsicApplyUncontrolledRz : IOperationFactory
|
||||||
{
|
{
|
||||||
void Body(double angle, Qubit target);
|
void Body(double angle, Qubit target);
|
||||||
|
|
||||||
void AdjointBody(double angle, Qubit target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,5 @@ namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
public interface IIntrinsicApplyUncontrolledS : IOperationFactory
|
public interface IIntrinsicApplyUncontrolledS : IOperationFactory
|
||||||
{
|
{
|
||||||
void Body(Qubit target);
|
void Body(Qubit target);
|
||||||
|
|
||||||
void AdjointBody(Qubit target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using Microsoft.Quantum.Simulation.Core;
|
||||||
|
|
||||||
|
namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
|
{
|
||||||
|
public interface IIntrinsicApplyUncontrolledSAdj : IOperationFactory
|
||||||
|
{
|
||||||
|
void Body(Qubit target);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,5 @@ namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
public interface IIntrinsicApplyUncontrolledT : IOperationFactory
|
public interface IIntrinsicApplyUncontrolledT : IOperationFactory
|
||||||
{
|
{
|
||||||
void Body(Qubit target);
|
void Body(Qubit target);
|
||||||
|
|
||||||
void AdjointBody(Qubit target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using Microsoft.Quantum.Simulation.Core;
|
||||||
|
|
||||||
|
namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
|
{
|
||||||
|
public interface IIntrinsicApplyUncontrolledTAdj : IOperationFactory
|
||||||
|
{
|
||||||
|
void Body(Qubit target);
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,9 @@ namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
IIntrinsicApplyUncontrolledRy,
|
IIntrinsicApplyUncontrolledRy,
|
||||||
IIntrinsicApplyUncontrolledRz,
|
IIntrinsicApplyUncontrolledRz,
|
||||||
IIntrinsicApplyUncontrolledS,
|
IIntrinsicApplyUncontrolledS,
|
||||||
|
IIntrinsicApplyUncontrolledSAdj,
|
||||||
IIntrinsicApplyUncontrolledT,
|
IIntrinsicApplyUncontrolledT,
|
||||||
|
IIntrinsicApplyUncontrolledTAdj,
|
||||||
IIntrinsicApplyUncontrolledX,
|
IIntrinsicApplyUncontrolledX,
|
||||||
IIntrinsicApplyUncontrolledY,
|
IIntrinsicApplyUncontrolledY,
|
||||||
IIntrinsicApplyUncontrolledZ,
|
IIntrinsicApplyUncontrolledZ,
|
||||||
|
|
|
@ -11,8 +11,10 @@ namespace Microsoft.Quantum.Intrinsic.Interfaces
|
||||||
IIntrinsicApplyUncontrolledRy,
|
IIntrinsicApplyUncontrolledRy,
|
||||||
IIntrinsicApplyUncontrolledRz,
|
IIntrinsicApplyUncontrolledRz,
|
||||||
IIntrinsicApplyUncontrolledS,
|
IIntrinsicApplyUncontrolledS,
|
||||||
|
IIntrinsicApplyUncontrolledSAdj,
|
||||||
IIntrinsicApplyUncontrolledSWAP,
|
IIntrinsicApplyUncontrolledSWAP,
|
||||||
IIntrinsicApplyUncontrolledT,
|
IIntrinsicApplyUncontrolledT,
|
||||||
|
IIntrinsicApplyUncontrolledTAdj,
|
||||||
IIntrinsicApplyUncontrolledX,
|
IIntrinsicApplyUncontrolledX,
|
||||||
IIntrinsicApplyUncontrolledY,
|
IIntrinsicApplyUncontrolledY,
|
||||||
IIntrinsicApplyUncontrolledZ,
|
IIntrinsicApplyUncontrolledZ,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the controlled-X (or CNOT) gate to a pair of qubits. Does not support
|
/// Applies the controlled-X (or CNOT) gate to a pair of qubits. Does not support
|
||||||
|
@ -31,6 +32,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// ```qsharp
|
/// ```qsharp
|
||||||
/// CNOT(control, target);
|
/// CNOT(control, target);
|
||||||
/// ```
|
/// ```
|
||||||
|
@TargetInstruction("cnot")
|
||||||
internal operation ApplyControlledX (control : Qubit, target : Qubit) : Unit is Adj {
|
internal operation ApplyControlledX (control : Qubit, target : Qubit) : Unit is Adj {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
adjoint self;
|
adjoint self;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the controlled-Z (CZ) gate to a pair of qubits.
|
/// Applies the controlled-Z (CZ) gate to a pair of qubits.
|
||||||
|
@ -27,6 +28,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// ```qsharp
|
/// ```qsharp
|
||||||
/// Controlled Z([control], target);
|
/// Controlled Z([control], target);
|
||||||
/// ```
|
/// ```
|
||||||
|
@TargetInstruction("cz")
|
||||||
internal operation ApplyControlledZ (control : Qubit, target : Qubit) : Unit is Adj {
|
internal operation ApplyControlledZ (control : Qubit, target : Qubit) : Unit is Adj {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
adjoint self;
|
adjoint self;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the Hadamard transformation to a single qubit. Note that the Controlled
|
/// Applies the Hadamard transformation to a single qubit. Note that the Controlled
|
||||||
|
@ -20,6 +21,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// # Input
|
/// # Input
|
||||||
/// ## qubit
|
/// ## qubit
|
||||||
/// Qubit to which the gate should be applied.
|
/// Qubit to which the gate should be applied.
|
||||||
|
@TargetInstruction("h")
|
||||||
internal operation ApplyUncontrolledH (qubit : Qubit) : Unit is Adj {
|
internal operation ApplyUncontrolledH (qubit : Qubit) : Unit is Adj {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
adjoint self;
|
adjoint self;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies a rotation about the $x$-axis by a given angle. Note that the Controlled
|
/// Applies a rotation about the $x$-axis by a given angle. Note that the Controlled
|
||||||
|
@ -28,7 +29,8 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// ```qsharp
|
/// ```qsharp
|
||||||
/// R(PauliX, theta, qubit);
|
/// R(PauliX, theta, qubit);
|
||||||
/// ```
|
/// ```
|
||||||
internal operation ApplyUncontrolledRx (theta : Double, qubit : Qubit) : Unit is Adj {
|
@TargetInstruction("rx")
|
||||||
|
internal operation ApplyUncontrolledRx (theta : Double, qubit : Qubit) : Unit {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies a rotation about the $y$-axis by a given angle. Note that the Controlled
|
/// Applies a rotation about the $y$-axis by a given angle. Note that the Controlled
|
||||||
|
@ -28,7 +29,8 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// ```qsharp
|
/// ```qsharp
|
||||||
/// R(PauliY, theta, qubit);
|
/// R(PauliY, theta, qubit);
|
||||||
/// ```
|
/// ```
|
||||||
internal operation ApplyUncontrolledRy (theta : Double, qubit : Qubit) : Unit is Adj {
|
@TargetInstruction("ry")
|
||||||
|
internal operation ApplyUncontrolledRy (theta : Double, qubit : Qubit) : Unit {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies a rotation about the $z$-axis by a given angle. Note that the Controlled
|
/// Applies a rotation about the $z$-axis by a given angle. Note that the Controlled
|
||||||
|
@ -28,7 +29,8 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// ```qsharp
|
/// ```qsharp
|
||||||
/// R(PauliZ, theta, qubit);
|
/// R(PauliZ, theta, qubit);
|
||||||
/// ```
|
/// ```
|
||||||
internal operation ApplyUncontrolledRz (theta : Double, qubit : Qubit) : Unit is Adj {
|
@TargetInstruction("rz")
|
||||||
|
internal operation ApplyUncontrolledRz (theta : Double, qubit : Qubit) : Unit {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the π/4 phase gate to a single qubit. Note that the Controlled functor
|
/// Applies the π/4 phase gate to a single qubit. Note that the Controlled functor
|
||||||
|
@ -19,7 +20,8 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// # Input
|
/// # Input
|
||||||
/// ## qubit
|
/// ## qubit
|
||||||
/// Qubit to which the gate should be applied.
|
/// Qubit to which the gate should be applied.
|
||||||
internal operation ApplyUncontrolledS (qubit : Qubit) : Unit is Adj {
|
@TargetInstruction("s")
|
||||||
|
internal operation ApplyUncontrolledS (qubit : Qubit) : Unit {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
|
/// # Summary
|
||||||
|
/// Applies the -π/4 phase gate to a single qubit. Note that the Controlled functor
|
||||||
|
/// is not supported.
|
||||||
|
///
|
||||||
|
/// # Description
|
||||||
|
/// \begin{align}
|
||||||
|
/// SAdj \mathrel{:=}
|
||||||
|
/// \begin{bmatrix}
|
||||||
|
/// 1 & 0 \\\\
|
||||||
|
/// 0 & -i
|
||||||
|
/// \end{bmatrix}.
|
||||||
|
/// \end{align}
|
||||||
|
///
|
||||||
|
/// # Input
|
||||||
|
/// ## qubit
|
||||||
|
/// Qubit to which the gate should be applied.
|
||||||
|
@TargetInstruction("sadj")
|
||||||
|
internal operation ApplyUncontrolledSAdj (qubit : Qubit) : Unit {
|
||||||
|
body intrinsic;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the SWAP gate to a pair of qubits. Note that the Controlled functor
|
/// Applies the SWAP gate to a pair of qubits. Note that the Controlled functor
|
||||||
|
@ -33,6 +34,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// CNOT(qubit2, qubit1);
|
/// CNOT(qubit2, qubit1);
|
||||||
/// CNOT(qubit1, qubit2);
|
/// CNOT(qubit1, qubit2);
|
||||||
/// ```
|
/// ```
|
||||||
|
@TargetInstruction("swap")
|
||||||
operation ApplyUncontrolledSWAP (qubit1 : Qubit, qubit2 : Qubit) : Unit is Adj {
|
operation ApplyUncontrolledSWAP (qubit1 : Qubit, qubit2 : Qubit) : Unit is Adj {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
adjoint self;
|
adjoint self;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the π/8 gate to a single qubit. Note that the Controlled functor is
|
/// Applies the π/8 gate to a single qubit. Note that the Controlled functor is
|
||||||
|
@ -19,7 +20,8 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// # Input
|
/// # Input
|
||||||
/// ## qubit
|
/// ## qubit
|
||||||
/// Qubit to which the gate should be applied.
|
/// Qubit to which the gate should be applied.
|
||||||
internal operation ApplyUncontrolledT (qubit : Qubit) : Unit is Adj {
|
@TargetInstruction("t")
|
||||||
|
internal operation ApplyUncontrolledT (qubit : Qubit) : Unit {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
|
/// # Summary
|
||||||
|
/// Applies the -π/8 gate to a single qubit. Note that the Controlled functor is
|
||||||
|
/// not supported.
|
||||||
|
///
|
||||||
|
/// # Description
|
||||||
|
/// \begin{align}
|
||||||
|
/// TAdj \mathrel{:=}
|
||||||
|
/// \begin{bmatrix}
|
||||||
|
/// 1 & 0 \\\\
|
||||||
|
/// 0 & e^{i -\pi / 4}
|
||||||
|
/// \end{bmatrix}.
|
||||||
|
/// \end{align}
|
||||||
|
///
|
||||||
|
/// # Input
|
||||||
|
/// ## qubit
|
||||||
|
/// Qubit to which the gate should be applied.
|
||||||
|
@TargetInstruction("tadj")
|
||||||
|
internal operation ApplyUncontrolledTAdj (qubit : Qubit) : Unit {
|
||||||
|
body intrinsic;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the Pauli $X$ gate. Note that the Controlled functor is not supported.
|
/// Applies the Pauli $X$ gate. Note that the Controlled functor is not supported.
|
||||||
|
@ -18,6 +19,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// # Input
|
/// # Input
|
||||||
/// ## qubit
|
/// ## qubit
|
||||||
/// Qubit to which the gate should be applied.
|
/// Qubit to which the gate should be applied.
|
||||||
|
@TargetInstruction("x")
|
||||||
internal operation ApplyUncontrolledX (qubit : Qubit) : Unit is Adj {
|
internal operation ApplyUncontrolledX (qubit : Qubit) : Unit is Adj {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
adjoint self;
|
adjoint self;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the Pauli $Y$ gate. Note that the Controlled functor is not supported.
|
/// Applies the Pauli $Y$ gate. Note that the Controlled functor is not supported.
|
||||||
|
@ -18,6 +19,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// # Input
|
/// # Input
|
||||||
/// ## qubit
|
/// ## qubit
|
||||||
/// Qubit to which the gate should be applied.
|
/// Qubit to which the gate should be applied.
|
||||||
|
@TargetInstruction("y")
|
||||||
internal operation ApplyUncontrolledY (qubit : Qubit) : Unit is Adj {
|
internal operation ApplyUncontrolledY (qubit : Qubit) : Unit is Adj {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
adjoint self;
|
adjoint self;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the Pauli $Z$ gate. Note that the Controlled functor is not supported.
|
/// Applies the Pauli $Z$ gate. Note that the Controlled functor is not supported.
|
||||||
|
@ -18,6 +19,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// # Input
|
/// # Input
|
||||||
/// ## qubit
|
/// ## qubit
|
||||||
/// Qubit to which the gate should be applied.
|
/// Qubit to which the gate should be applied.
|
||||||
|
@TargetInstruction("z")
|
||||||
internal operation ApplyUncontrolledZ (qubit : Qubit) : Unit is Adj {
|
internal operation ApplyUncontrolledZ (qubit : Qubit) : Unit is Adj {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
adjoint self;
|
adjoint self;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the two qubit Ising $XX$ rotation gate.
|
/// Applies the two qubit Ising $XX$ rotation gate.
|
||||||
|
@ -24,6 +25,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// The first qubit input to the gate.
|
/// The first qubit input to the gate.
|
||||||
/// ## qubit1
|
/// ## qubit1
|
||||||
/// The second qubit input to the gate.
|
/// The second qubit input to the gate.
|
||||||
|
@TargetInstruction("xx")
|
||||||
internal operation IsingXX (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl {
|
internal operation IsingXX (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the two qubit Ising $YY$ rotation gate.
|
/// Applies the two qubit Ising $YY$ rotation gate.
|
||||||
|
@ -24,6 +25,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// The first qubit input to the gate.
|
/// The first qubit input to the gate.
|
||||||
/// ## qubit1
|
/// ## qubit1
|
||||||
/// The second qubit input to the gate.
|
/// The second qubit input to the gate.
|
||||||
|
@TargetInstruction("yy")
|
||||||
internal operation IsingYY (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl {
|
internal operation IsingYY (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
namespace Microsoft.Quantum.Intrinsic {
|
namespace Microsoft.Quantum.Intrinsic {
|
||||||
|
open Microsoft.Quantum.Targeting;
|
||||||
|
|
||||||
/// # Summary
|
/// # Summary
|
||||||
/// Applies the two qubit Ising $ZZ$ rotation gate.
|
/// Applies the two qubit Ising $ZZ$ rotation gate.
|
||||||
|
@ -24,6 +25,7 @@ namespace Microsoft.Quantum.Intrinsic {
|
||||||
/// The first qubit input to the gate.
|
/// The first qubit input to the gate.
|
||||||
/// ## qubit1
|
/// ## qubit1
|
||||||
/// The second qubit input to the gate.
|
/// The second qubit input to the gate.
|
||||||
|
@TargetInstruction("zz")
|
||||||
internal operation IsingZZ (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl {
|
internal operation IsingZZ (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl {
|
||||||
body intrinsic;
|
body intrinsic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRy.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRy.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRz.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRz.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledS.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledS.qs" />
|
||||||
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledSAdj.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledT.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledT.qs" />
|
||||||
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledTAdj.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledX.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledX.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledY.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledY.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledZ.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledZ.qs" />
|
||||||
|
@ -23,7 +25,7 @@
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualInPlace.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualInPlace.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualReferenced.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualReferenced.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Decompositions\CCNOTFromCCZ.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Decompositions\CCNOTFromCCZ.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Decompositions\CNOT.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Decompositions\CNOTFromSinglyControlled.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Decompositions\ExpFracFromExpUtil.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Decompositions\ExpFracFromExpUtil.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Decompositions\ExpFromExpUtil.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Decompositions\ExpFromExpUtil.qs" />
|
||||||
<QSharpCompile Include="..\TargetDefinitions\Decompositions\ExpUtil.qs" />
|
<QSharpCompile Include="..\TargetDefinitions\Decompositions\ExpUtil.qs" />
|
||||||
|
|
|
@ -11,8 +11,10 @@
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRy.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRy.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRz.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledRz.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledS.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledS.qs" />
|
||||||
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledSAdj.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledSWAP.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledSWAP.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledT.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledT.qs" />
|
||||||
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledTAdj.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledX.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledX.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledY.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledY.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledZ.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Intrinsic\ApplyUncontrolledZ.qs" />
|
||||||
|
@ -24,7 +26,7 @@
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualInPlace.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualInPlace.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualReferenced.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Decompositions\AssertOperationsEqualReferenced.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Decompositions\CCNOTFromCCZ.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Decompositions\CCNOTFromCCZ.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Decompositions\CNOT.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Decompositions\CNOTFromSinglyControlled.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Decompositions\ExpFracFromExpUtil.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Decompositions\ExpFracFromExpUtil.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Decompositions\ExpFromExpUtil.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Decompositions\ExpFromExpUtil.qs" />
|
||||||
<QsharpCompile Include="..\TargetDefinitions\Decompositions\ExpUtil.qs" />
|
<QsharpCompile Include="..\TargetDefinitions\Decompositions\ExpUtil.qs" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче