diff --git a/AdvantageBenchmark/privateBuild/advantage.sln b/AdvantageBenchmark/privateBuild/advantage.sln index 91b39bc2b87..c8a39658898 100644 Binary files a/AdvantageBenchmark/privateBuild/advantage.sln and b/AdvantageBenchmark/privateBuild/advantage.sln differ diff --git a/AdvantageBenchmark/privateBuild/host.csproj b/AdvantageBenchmark/privateBuild/host.csproj index deaab16f4ae..f68765787b8 100644 --- a/AdvantageBenchmark/privateBuild/host.csproj +++ b/AdvantageBenchmark/privateBuild/host.csproj @@ -8,4 +8,8 @@ false + + + + diff --git a/NOTICE.txt b/NOTICE.txt index ea1fd3063d2..114083df6a5 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -2715,7 +2715,7 @@ SOFTWARE. ------------------------------------------------------------------- -Microsoft.Quantum.Compiler 0.12.20082209-beta - MIT +Microsoft.Quantum.Compiler 0.13.20102604 - MIT (c) 2008 VeriSign, Inc. diff --git a/Simulation.sln b/Simulation.sln index 8b6e60cdf10..ef30cc459c6 100644 --- a/Simulation.sln +++ b/Simulation.sln @@ -1,534 +1,678 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28809.33 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Runtime.Core", "src\Simulation\Core\Microsoft.Quantum.Runtime.Core.csproj", "{E9123D45-C1B0-4462-8810-D26ED6D31944}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime", "src\Simulation\QCTraceSimulator\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj", "{058CB08D-BFA7-41E2-BE6B-0A0A72054F91}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.Common", "src\Simulation\Common\Microsoft.Quantum.Simulation.Common.csproj", "{8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulators", "src\Simulation\Simulators\Microsoft.Quantum.Simulators.csproj", "{72B7E75C-D305-45BD-929E-C86298AAA8DE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime", "src\Simulation\QCTraceSimulator.Tests\Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj", "{DD50D2D9-2765-449B-8C4B-835A428E160D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators", "src\Simulation\Simulators.Tests\Tests.Microsoft.Quantum.Simulators.csproj", "{23461B29-F9DE-4F5B-BC30-50BBE1A10B48}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simulation", "simulation", "{34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Core", "src\Simulation\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj", "{A6C5BA7A-DF6F-476F-9106-95905932B810}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xunit", "xunit", "{34117E2A-DEDC-4274-AAA4-3C61ACF86284}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{03736C2E-DB2A-46A9-B7B2-C1216BDECB4F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Xunit", "src\Xunit\Microsoft.Quantum.Xunit.csproj", "{ECFE1CE8-46A1-4D14-99D6-AAF76B704638}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "generation", "generation", "{A567C185-A429-418B-AFDE-6F1785BA4A77}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.CsharpGeneration", "src\Simulation\CsharpGeneration.Tests\Tests.CsharpGeneration.fsproj", "{10D7C395-4F79-4DAF-9289-A4B8FAF6183A}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.RoslynWrapper", "src\Simulation\RoslynWrapper\Microsoft.Quantum.RoslynWrapper.fsproj", "{618FBF9D-4EF3-435D-9728-81C726236668}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.RoslynWrapper", "src\Simulation\RoslynWrapper.Tests\Tests.RoslynWrapper.fsproj", "{48206BD6-48DD-4442-A395-3A6594E4C9C6}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.CsharpGeneration", "src\Simulation\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj", "{B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{09C842CB-930C-4C7D-AD5F-E30DE4A55820}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QsharpExe", "src\Simulation\Simulators.Tests\TestProjects\QsharpExe\QsharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver\Microsoft.Quantum.EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver.Tests\Tests.Microsoft.Quantum.EntryPointDriver.fsproj", "{E2F30496-19D8-46A8-9BC0-26936FFE70D2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library1", "src\Simulation\Simulators.Tests\TestProjects\Library1\Library1.csproj", "{7256B986-6705-42FC-9F57-485D72D9DE51}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library2", "src\Simulation\Simulators.Tests\TestProjects\Library2\Library2.csproj", "{A85277B3-4E07-4E15-8F0C-07CC855A3BCB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library with Spaces", "src\Simulation\Simulators.Tests\TestProjects\Library with Spaces\Library with Spaces.csproj", "{418E79F7-9FCF-4128-AA35-1334A685377D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "src\Simulation\Simulators.Tests\TestProjects\UnitTests\UnitTests.csproj", "{46278108-D247-4EFC-AC34-23D4A676F62F}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure", "Azure", "{37CDC768-16D4-4574-8553-07D99D0A72F7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Client", "src\Azure\Azure.Quantum.Client\Microsoft.Azure.Quantum.Client.csproj", "{7F05FD87-A2FB-4915-A988-4EF92AB82179}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Client.Test", "src\Azure\Azure.Quantum.Client.Test\Microsoft.Azure.Quantum.Client.Test.csproj", "{4858E5E3-23FA-4928-B99A-54065875A2B9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HoneywellExe", "src\Simulation\Simulators.Tests\TestProjects\HoneywellExe\HoneywellExe.csproj", "{1448512E-132F-4DA8-BCBA-D98F16B31600}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IonQExe", "src\Simulation\Simulators.Tests\TestProjects\IonQExe\IonQExe.csproj", "{55833C6C-6E91-4413-9F77-96B3A09666B8}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QCIExe", "src\Simulation\Simulators.Tests\TestProjects\QCIExe\QCIExe.csproj", "{C015FF41-9A51-4AF0-AEFC-2547D596B10A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TargetedExe", "src\Simulation\Simulators.Tests\TestProjects\TargetedExe\TargetedExe.csproj", "{D292BF18-3956-4827-820E-254C3F81EF09}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntrinsicTests", "src\Simulation\Simulators.Tests\TestProjects\IntrinsicTests\IntrinsicTests.csproj", "{D5D41201-101F-4C0D-B6A0-201D8FC3AB91}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - MinSizeRel|Any CPU = MinSizeRel|Any CPU - MinSizeRel|x64 = MinSizeRel|x64 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - RelWithDebInfo|Any CPU = RelWithDebInfo|Any CPU - RelWithDebInfo|x64 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|x64.ActiveCfg = Debug|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|x64.Build.0 = Debug|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|x64.ActiveCfg = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|x64.Build.0 = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|Any CPU.Build.0 = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|x64.ActiveCfg = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|x64.Build.0 = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|x64.ActiveCfg = Debug|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|x64.Build.0 = Debug|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|x64.ActiveCfg = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|x64.Build.0 = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|Any CPU.ActiveCfg = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|Any CPU.Build.0 = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|x64.ActiveCfg = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|x64.Build.0 = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|x64.ActiveCfg = Debug|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|x64.Build.0 = Debug|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|x64.ActiveCfg = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|x64.Build.0 = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|Any CPU.Build.0 = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|x64.ActiveCfg = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|x64.Build.0 = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|x64.ActiveCfg = Debug|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|x64.Build.0 = Debug|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|x64.ActiveCfg = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|x64.Build.0 = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|Any CPU.Build.0 = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|x64.ActiveCfg = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|x64.Build.0 = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|x64.ActiveCfg = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|x64.Build.0 = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|Any CPU.Build.0 = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|x64.ActiveCfg = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|x64.Build.0 = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|x64.ActiveCfg = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|x64.Build.0 = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|Any CPU.Build.0 = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|x64.ActiveCfg = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|x64.Build.0 = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|x64.ActiveCfg = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|x64.Build.0 = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|Any CPU.Build.0 = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|x64.ActiveCfg = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|x64.Build.0 = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|x64.ActiveCfg = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|x64.Build.0 = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|Any CPU.Build.0 = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|x64.ActiveCfg = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|x64.Build.0 = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|x64.ActiveCfg = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|x64.Build.0 = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|Any CPU.Build.0 = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|x64.ActiveCfg = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|x64.Build.0 = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|Any CPU.Build.0 = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|x64.ActiveCfg = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|x64.Build.0 = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Release|Any CPU.ActiveCfg = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Release|Any CPU.Build.0 = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Release|x64.ActiveCfg = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.Release|x64.Build.0 = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|x64.ActiveCfg = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|x64.Build.0 = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|Any CPU.Build.0 = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|x64.ActiveCfg = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|x64.Build.0 = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|x64.ActiveCfg = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|x64.Build.0 = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|Any CPU.Build.0 = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|x64.ActiveCfg = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|x64.Build.0 = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|x64.ActiveCfg = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|x64.Build.0 = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|Any CPU.Build.0 = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|x64.ActiveCfg = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|x64.Build.0 = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|Any CPU.Build.0 = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|x64.ActiveCfg = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|x64.Build.0 = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|Any CPU.ActiveCfg = Release|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|Any CPU.Build.0 = Release|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|x64.ActiveCfg = Release|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|x64.Build.0 = Release|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|x64.ActiveCfg = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|x64.Build.0 = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|Any CPU.Build.0 = Release|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|x64.ActiveCfg = Release|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|x64.Build.0 = Release|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|x64.ActiveCfg = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|x64.Build.0 = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|Any CPU.Build.0 = Release|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|x64.ActiveCfg = Release|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|x64.Build.0 = Release|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|x64.ActiveCfg = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|x64.Build.0 = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|Any CPU.Build.0 = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|x64.ActiveCfg = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|x64.Build.0 = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|x64.ActiveCfg = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|x64.Build.0 = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|Any CPU.Build.0 = Release|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|x64.ActiveCfg = Release|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|x64.Build.0 = Release|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|x64.ActiveCfg = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|x64.Build.0 = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|Any CPU.Build.0 = Release|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|x64.ActiveCfg = Release|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|x64.Build.0 = Release|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|x64.ActiveCfg = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|x64.Build.0 = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|Any CPU.Build.0 = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|x64.ActiveCfg = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|x64.Build.0 = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|x64.ActiveCfg = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|x64.Build.0 = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|Any CPU.Build.0 = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|x64.ActiveCfg = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|x64.Build.0 = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|x64.ActiveCfg = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|x64.Build.0 = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|Any CPU.Build.0 = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|x64.ActiveCfg = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|x64.Build.0 = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|x64.ActiveCfg = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|x64.Build.0 = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|Any CPU.Build.0 = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|x64.ActiveCfg = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|x64.Build.0 = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|x64.ActiveCfg = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|x64.Build.0 = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|Any CPU.Build.0 = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|x64.ActiveCfg = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|x64.Build.0 = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|x64.ActiveCfg = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|x64.Build.0 = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Release|Any CPU.Build.0 = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Release|x64.ActiveCfg = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.Release|x64.Build.0 = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|x64.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Debug|x64.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|Any CPU.Build.0 = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|x64.ActiveCfg = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.Release|x64.Build.0 = Release|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {E9123D45-C1B0-4462-8810-D26ED6D31944} = {03736C2E-DB2A-46A9-B7B2-C1216BDECB4F} - {058CB08D-BFA7-41E2-BE6B-0A0A72054F91} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {72B7E75C-D305-45BD-929E-C86298AAA8DE} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {DD50D2D9-2765-449B-8C4B-835A428E160D} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {23461B29-F9DE-4F5B-BC30-50BBE1A10B48} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {A6C5BA7A-DF6F-476F-9106-95905932B810} = {03736C2E-DB2A-46A9-B7B2-C1216BDECB4F} - {ECFE1CE8-46A1-4D14-99D6-AAF76B704638} = {34117E2A-DEDC-4274-AAA4-3C61ACF86284} - {10D7C395-4F79-4DAF-9289-A4B8FAF6183A} = {A567C185-A429-418B-AFDE-6F1785BA4A77} - {618FBF9D-4EF3-435D-9728-81C726236668} = {A567C185-A429-418B-AFDE-6F1785BA4A77} - {48206BD6-48DD-4442-A395-3A6594E4C9C6} = {A567C185-A429-418B-AFDE-6F1785BA4A77} - {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC} = {A567C185-A429-418B-AFDE-6F1785BA4A77} - {09C842CB-930C-4C7D-AD5F-E30DE4A55820} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} - {2F5796A7-4AF8-4B78-928A-0A3A80752F9D} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {944FE7EF-9220-4CC6-BB20-CE517195B922} = {A567C185-A429-418B-AFDE-6F1785BA4A77} - {E2F30496-19D8-46A8-9BC0-26936FFE70D2} = {A567C185-A429-418B-AFDE-6F1785BA4A77} - {7256B986-6705-42FC-9F57-485D72D9DE51} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {A85277B3-4E07-4E15-8F0C-07CC855A3BCB} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {418E79F7-9FCF-4128-AA35-1334A685377D} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {46278108-D247-4EFC-AC34-23D4A676F62F} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {7F05FD87-A2FB-4915-A988-4EF92AB82179} = {37CDC768-16D4-4574-8553-07D99D0A72F7} - {4858E5E3-23FA-4928-B99A-54065875A2B9} = {37CDC768-16D4-4574-8553-07D99D0A72F7} - {1448512E-132F-4DA8-BCBA-D98F16B31600} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {55833C6C-6E91-4413-9F77-96B3A09666B8} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {C015FF41-9A51-4AF0-AEFC-2547D596B10A} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {D292BF18-3956-4827-820E-254C3F81EF09} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - {D5D41201-101F-4C0D-B6A0-201D8FC3AB91} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {929C0464-86D8-4F70-8835-0A5EAF930821} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28809.33 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Runtime.Core", "src\Simulation\Core\Microsoft.Quantum.Runtime.Core.csproj", "{E9123D45-C1B0-4462-8810-D26ED6D31944}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime", "src\Simulation\QCTraceSimulator\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj", "{058CB08D-BFA7-41E2-BE6B-0A0A72054F91}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulation.Common", "src\Simulation\Common\Microsoft.Quantum.Simulation.Common.csproj", "{8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Simulators", "src\Simulation\Simulators\Microsoft.Quantum.Simulators.csproj", "{72B7E75C-D305-45BD-929E-C86298AAA8DE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime", "src\Simulation\QCTraceSimulator.Tests\Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj", "{DD50D2D9-2765-449B-8C4B-835A428E160D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Microsoft.Quantum.Simulators", "src\Simulation\Simulators.Tests\Tests.Microsoft.Quantum.Simulators.csproj", "{23461B29-F9DE-4F5B-BC30-50BBE1A10B48}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "simulation", "simulation", "{34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.QSharp.Core", "src\Simulation\QsharpCore\Microsoft.Quantum.QSharp.Core.csproj", "{A6C5BA7A-DF6F-476F-9106-95905932B810}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xunit", "xunit", "{34117E2A-DEDC-4274-AAA4-3C61ACF86284}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{03736C2E-DB2A-46A9-B7B2-C1216BDECB4F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.Xunit", "src\Xunit\Microsoft.Quantum.Xunit.csproj", "{ECFE1CE8-46A1-4D14-99D6-AAF76B704638}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "generation", "generation", "{A567C185-A429-418B-AFDE-6F1785BA4A77}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.CsharpGeneration", "src\Simulation\CsharpGeneration.Tests\Tests.CsharpGeneration.fsproj", "{10D7C395-4F79-4DAF-9289-A4B8FAF6183A}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.RoslynWrapper", "src\Simulation\RoslynWrapper\Microsoft.Quantum.RoslynWrapper.fsproj", "{618FBF9D-4EF3-435D-9728-81C726236668}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.RoslynWrapper", "src\Simulation\RoslynWrapper.Tests\Tests.RoslynWrapper.fsproj", "{48206BD6-48DD-4442-A395-3A6594E4C9C6}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.Quantum.CsharpGeneration", "src\Simulation\CsharpGeneration\Microsoft.Quantum.CsharpGeneration.fsproj", "{B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{09C842CB-930C-4C7D-AD5F-E30DE4A55820}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QsharpExe", "src\Simulation\Simulators.Tests\TestProjects\QsharpExe\QsharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver\Microsoft.Quantum.EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Tests.Microsoft.Quantum.EntryPointDriver", "src\Simulation\EntryPointDriver.Tests\Tests.Microsoft.Quantum.EntryPointDriver.fsproj", "{E2F30496-19D8-46A8-9BC0-26936FFE70D2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library1", "src\Simulation\Simulators.Tests\TestProjects\Library1\Library1.csproj", "{7256B986-6705-42FC-9F57-485D72D9DE51}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library2", "src\Simulation\Simulators.Tests\TestProjects\Library2\Library2.csproj", "{A85277B3-4E07-4E15-8F0C-07CC855A3BCB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library with Spaces", "src\Simulation\Simulators.Tests\TestProjects\Library with Spaces\Library with Spaces.csproj", "{418E79F7-9FCF-4128-AA35-1334A685377D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "src\Simulation\Simulators.Tests\TestProjects\UnitTests\UnitTests.csproj", "{46278108-D247-4EFC-AC34-23D4A676F62F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure", "Azure", "{37CDC768-16D4-4574-8553-07D99D0A72F7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Client", "src\Azure\Azure.Quantum.Client\Microsoft.Azure.Quantum.Client.csproj", "{7F05FD87-A2FB-4915-A988-4EF92AB82179}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Quantum.Client.Test", "src\Azure\Azure.Quantum.Client.Test\Microsoft.Azure.Quantum.Client.Test.csproj", "{4858E5E3-23FA-4928-B99A-54065875A2B9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HoneywellExe", "src\Simulation\Simulators.Tests\TestProjects\HoneywellExe\HoneywellExe.csproj", "{1448512E-132F-4DA8-BCBA-D98F16B31600}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IonQExe", "src\Simulation\Simulators.Tests\TestProjects\IonQExe\IonQExe.csproj", "{55833C6C-6E91-4413-9F77-96B3A09666B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QCIExe", "src\Simulation\Simulators.Tests\TestProjects\QCIExe\QCIExe.csproj", "{C015FF41-9A51-4AF0-AEFC-2547D596B10A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TargetedExe", "src\Simulation\Simulators.Tests\TestProjects\TargetedExe\TargetedExe.csproj", "{D292BF18-3956-4827-820E-254C3F81EF09}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BC562DAE-FE2B-4A8C-880C-C546F83F99E4}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Simulation", "Simulation", "{9008B252-2DF7-404B-B626-D4497BB70A05}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.QSharp.Foundation", "src\Simulation\QsharpFoundation\Microsoft.Quantum.QSharp.Foundation.csproj", "{DB45AD73-4D91-43F3-85CC-C63614A96FB0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.Type2.Core", "src\Simulation\Type2Core\Microsoft.Quantum.Type2.Core.csproj", "{AF6CD304-8E03-433D-AAA2-6E0094B53071}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.Simulators.Type2", "src\Simulation\Simulators.Type2\Microsoft.Quantum.Simulators.Type2.csproj", "{E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Microsoft.Quantum.Simulators.Type2", "src\Simulation\Simulators.Type2.Tests\Tests.Microsoft.Quantum.Simulators.Type2.csproj", "{ED3D7040-4B3F-4217-A75E-9DF63DD84707}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Simulators.Tests", "Simulators.Tests", "{CF48986A-B487-407F-98A7-97AED29C6A43}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{F5F80AEA-34F4-4E1D-8145-0634E9DCF2C3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntrinsicTests", "src\Simulation\Simulators.Tests\TestProjects\IntrinsicTests\IntrinsicTests.csproj", "{4EF958CA-B4A6-4E5F-924A-100B5615BEC3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.Simulators.Type1", "src\Simulation\Simulators.Type1\Microsoft.Quantum.Simulators.Type1.csproj", "{F995209F-FEE1-4083-ABD9-4998563E0070}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Microsoft.Quantum.Simulators.Type1", "src\Simulation\Simulators.Type1.Tests\Tests.Microsoft.Quantum.Simulators.Type1.csproj", "{EB6E3DBD-C884-4241-9BC4-8281191D1F53}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Quantum.Type1.Core", "src\Simulation\Type1Core\Microsoft.Quantum.Type1.Core.csproj", "{E1A463D7-2E23-4134-BE04-1EFF7A546813}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + MinSizeRel|Any CPU = MinSizeRel|Any CPU + MinSizeRel|x64 = MinSizeRel|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + RelWithDebInfo|Any CPU = RelWithDebInfo|Any CPU + RelWithDebInfo|x64 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|x64.ActiveCfg = Debug|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Debug|x64.Build.0 = Debug|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|x64.ActiveCfg = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.MinSizeRel|x64.Build.0 = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|Any CPU.Build.0 = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|x64.ActiveCfg = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.Release|x64.Build.0 = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {E9123D45-C1B0-4462-8810-D26ED6D31944}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|Any CPU.Build.0 = Debug|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|x64.ActiveCfg = Debug|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Debug|x64.Build.0 = Debug|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|x64.ActiveCfg = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.MinSizeRel|x64.Build.0 = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|Any CPU.ActiveCfg = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|Any CPU.Build.0 = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|x64.ActiveCfg = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.Release|x64.Build.0 = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|x64.ActiveCfg = Debug|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Debug|x64.Build.0 = Debug|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|x64.ActiveCfg = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.MinSizeRel|x64.Build.0 = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|Any CPU.Build.0 = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|x64.ActiveCfg = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.Release|x64.Build.0 = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|x64.ActiveCfg = Debug|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Debug|x64.Build.0 = Debug|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|x64.ActiveCfg = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.MinSizeRel|x64.Build.0 = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|Any CPU.Build.0 = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|x64.ActiveCfg = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.Release|x64.Build.0 = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {72B7E75C-D305-45BD-929E-C86298AAA8DE}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|x64.ActiveCfg = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Debug|x64.Build.0 = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|Any CPU.Build.0 = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|x64.ActiveCfg = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.Release|x64.Build.0 = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {DD50D2D9-2765-449B-8C4B-835A428E160D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|x64.ActiveCfg = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Debug|x64.Build.0 = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|Any CPU.Build.0 = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|x64.ActiveCfg = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.Release|x64.Build.0 = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|x64.ActiveCfg = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Debug|x64.Build.0 = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|Any CPU.Build.0 = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|x64.ActiveCfg = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.Release|x64.Build.0 = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {A6C5BA7A-DF6F-476F-9106-95905932B810}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|x64.ActiveCfg = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Debug|x64.Build.0 = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|Any CPU.Build.0 = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|x64.ActiveCfg = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.Release|x64.Build.0 = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|x64.ActiveCfg = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Debug|x64.Build.0 = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|Any CPU.Build.0 = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|x64.ActiveCfg = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.Release|x64.Build.0 = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|Any CPU.Build.0 = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|x64.ActiveCfg = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Debug|x64.Build.0 = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Release|Any CPU.ActiveCfg = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Release|Any CPU.Build.0 = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Release|x64.ActiveCfg = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.Release|x64.Build.0 = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {618FBF9D-4EF3-435D-9728-81C726236668}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|x64.ActiveCfg = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Debug|x64.Build.0 = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|Any CPU.Build.0 = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|x64.ActiveCfg = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.Release|x64.Build.0 = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {48206BD6-48DD-4442-A395-3A6594E4C9C6}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|x64.ActiveCfg = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Debug|x64.Build.0 = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|Any CPU.Build.0 = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|x64.ActiveCfg = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.Release|x64.Build.0 = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|x64.ActiveCfg = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Debug|x64.Build.0 = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|Any CPU.Build.0 = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|x64.ActiveCfg = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.Release|x64.Build.0 = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|Any CPU.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|x64.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|x64.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|Any CPU.ActiveCfg = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|Any CPU.Build.0 = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|x64.ActiveCfg = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|x64.Build.0 = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|x64.ActiveCfg = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Debug|x64.Build.0 = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|Any CPU.Build.0 = Release|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|x64.ActiveCfg = Release|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.Release|x64.Build.0 = Release|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {E2F30496-19D8-46A8-9BC0-26936FFE70D2}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|x64.ActiveCfg = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Debug|x64.Build.0 = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|Any CPU.Build.0 = Release|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|x64.ActiveCfg = Release|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.Release|x64.Build.0 = Release|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {7256B986-6705-42FC-9F57-485D72D9DE51}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|x64.ActiveCfg = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Debug|x64.Build.0 = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|Any CPU.Build.0 = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|x64.ActiveCfg = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.Release|x64.Build.0 = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|x64.ActiveCfg = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Debug|x64.Build.0 = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|Any CPU.Build.0 = Release|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|x64.ActiveCfg = Release|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.Release|x64.Build.0 = Release|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {418E79F7-9FCF-4128-AA35-1334A685377D}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|x64.ActiveCfg = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Debug|x64.Build.0 = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|Any CPU.Build.0 = Release|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|x64.ActiveCfg = Release|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.Release|x64.Build.0 = Release|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {46278108-D247-4EFC-AC34-23D4A676F62F}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|x64.ActiveCfg = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Debug|x64.Build.0 = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|Any CPU.Build.0 = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|x64.ActiveCfg = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.Release|x64.Build.0 = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {7F05FD87-A2FB-4915-A988-4EF92AB82179}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|x64.ActiveCfg = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Debug|x64.Build.0 = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|Any CPU.Build.0 = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|x64.ActiveCfg = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.Release|x64.Build.0 = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {4858E5E3-23FA-4928-B99A-54065875A2B9}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|x64.ActiveCfg = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Debug|x64.Build.0 = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|Any CPU.Build.0 = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|x64.ActiveCfg = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.Release|x64.Build.0 = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {1448512E-132F-4DA8-BCBA-D98F16B31600}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Debug|x64.Build.0 = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|Any CPU.Build.0 = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|x64.ActiveCfg = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.Release|x64.Build.0 = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {55833C6C-6E91-4413-9F77-96B3A09666B8}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|x64.ActiveCfg = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Debug|x64.Build.0 = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|Any CPU.Build.0 = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|x64.ActiveCfg = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.Release|x64.Build.0 = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {C015FF41-9A51-4AF0-AEFC-2547D596B10A}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|x64.ActiveCfg = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Debug|x64.Build.0 = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Release|Any CPU.Build.0 = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Release|x64.ActiveCfg = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.Release|x64.Build.0 = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {D292BF18-3956-4827-820E-254C3F81EF09}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|x64.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Debug|x64.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|Any CPU.Build.0 = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|x64.ActiveCfg = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.Release|x64.Build.0 = Release|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {DB45AD73-4D91-43F3-85CC-C63614A96FB0}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|x64.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Debug|x64.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|Any CPU.Build.0 = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|x64.ActiveCfg = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.Release|x64.Build.0 = Release|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {AF6CD304-8E03-433D-AAA2-6E0094B53071}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Debug|x64.ActiveCfg = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Debug|x64.Build.0 = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Release|Any CPU.Build.0 = Release|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Release|x64.ActiveCfg = Release|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.Release|x64.Build.0 = Release|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|x64.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Debug|x64.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|Any CPU.Build.0 = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|x64.ActiveCfg = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.Release|x64.Build.0 = Release|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {ED3D7040-4B3F-4217-A75E-9DF63DD84707}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|x64.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Debug|x64.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|Any CPU.Build.0 = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|x64.ActiveCfg = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.Release|x64.Build.0 = Release|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Debug|x64.ActiveCfg = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Debug|x64.Build.0 = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Release|Any CPU.Build.0 = Release|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Release|x64.ActiveCfg = Release|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.Release|x64.Build.0 = Release|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {F995209F-FEE1-4083-ABD9-4998563E0070}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|x64.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Debug|x64.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|Any CPU.Build.0 = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|x64.ActiveCfg = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.Release|x64.Build.0 = Release|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {EB6E3DBD-C884-4241-9BC4-8281191D1F53}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|x64.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Debug|x64.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|Any CPU.Build.0 = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|x64.ActiveCfg = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.Release|x64.Build.0 = Release|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {E1A463D7-2E23-4134-BE04-1EFF7A546813}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {E9123D45-C1B0-4462-8810-D26ED6D31944} = {03736C2E-DB2A-46A9-B7B2-C1216BDECB4F} + {058CB08D-BFA7-41E2-BE6B-0A0A72054F91} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {8EC46ADB-7FAA-49EA-BA63-E7B32C4F4445} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {72B7E75C-D305-45BD-929E-C86298AAA8DE} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {DD50D2D9-2765-449B-8C4B-835A428E160D} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {23461B29-F9DE-4F5B-BC30-50BBE1A10B48} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {A6C5BA7A-DF6F-476F-9106-95905932B810} = {03736C2E-DB2A-46A9-B7B2-C1216BDECB4F} + {ECFE1CE8-46A1-4D14-99D6-AAF76B704638} = {34117E2A-DEDC-4274-AAA4-3C61ACF86284} + {10D7C395-4F79-4DAF-9289-A4B8FAF6183A} = {A567C185-A429-418B-AFDE-6F1785BA4A77} + {618FBF9D-4EF3-435D-9728-81C726236668} = {A567C185-A429-418B-AFDE-6F1785BA4A77} + {48206BD6-48DD-4442-A395-3A6594E4C9C6} = {A567C185-A429-418B-AFDE-6F1785BA4A77} + {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC} = {A567C185-A429-418B-AFDE-6F1785BA4A77} + {09C842CB-930C-4C7D-AD5F-E30DE4A55820} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} + {2F5796A7-4AF8-4B78-928A-0A3A80752F9D} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {944FE7EF-9220-4CC6-BB20-CE517195B922} = {A567C185-A429-418B-AFDE-6F1785BA4A77} + {E2F30496-19D8-46A8-9BC0-26936FFE70D2} = {A567C185-A429-418B-AFDE-6F1785BA4A77} + {7256B986-6705-42FC-9F57-485D72D9DE51} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {A85277B3-4E07-4E15-8F0C-07CC855A3BCB} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {418E79F7-9FCF-4128-AA35-1334A685377D} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {46278108-D247-4EFC-AC34-23D4A676F62F} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {7F05FD87-A2FB-4915-A988-4EF92AB82179} = {37CDC768-16D4-4574-8553-07D99D0A72F7} + {4858E5E3-23FA-4928-B99A-54065875A2B9} = {37CDC768-16D4-4574-8553-07D99D0A72F7} + {1448512E-132F-4DA8-BCBA-D98F16B31600} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {55833C6C-6E91-4413-9F77-96B3A09666B8} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {C015FF41-9A51-4AF0-AEFC-2547D596B10A} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {D292BF18-3956-4827-820E-254C3F81EF09} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {9008B252-2DF7-404B-B626-D4497BB70A05} = {BC562DAE-FE2B-4A8C-880C-C546F83F99E4} + {DB45AD73-4D91-43F3-85CC-C63614A96FB0} = {9008B252-2DF7-404B-B626-D4497BB70A05} + {AF6CD304-8E03-433D-AAA2-6E0094B53071} = {9008B252-2DF7-404B-B626-D4497BB70A05} + {E7163371-74D5-4DAD-AB04-8DA3FA1AD46F} = {9008B252-2DF7-404B-B626-D4497BB70A05} + {ED3D7040-4B3F-4217-A75E-9DF63DD84707} = {9008B252-2DF7-404B-B626-D4497BB70A05} + {CF48986A-B487-407F-98A7-97AED29C6A43} = {9008B252-2DF7-404B-B626-D4497BB70A05} + {F5F80AEA-34F4-4E1D-8145-0634E9DCF2C3} = {CF48986A-B487-407F-98A7-97AED29C6A43} + {4EF958CA-B4A6-4E5F-924A-100B5615BEC3} = {F5F80AEA-34F4-4E1D-8145-0634E9DCF2C3} + {F995209F-FEE1-4083-ABD9-4998563E0070} = {9008B252-2DF7-404B-B626-D4497BB70A05} + {EB6E3DBD-C884-4241-9BC4-8281191D1F53} = {9008B252-2DF7-404B-B626-D4497BB70A05} + {E1A463D7-2E23-4134-BE04-1EFF7A546813} = {9008B252-2DF7-404B-B626-D4497BB70A05} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {929C0464-86D8-4F70-8835-0A5EAF930821} + EndGlobalSection +EndGlobal diff --git a/bootstrap.ps1 b/bootstrap.ps1 index a5ef2e9d889..0209b5efba6 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -11,6 +11,14 @@ Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators") .\FindNuspecReferences.ps1 Pop-Location +Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators.Type1") + .\FindNuspecReferences.ps1 +Pop-Location + +Push-Location (Join-Path $PSScriptRoot "src/Simulation/Simulators.Type2") + .\FindNuspecReferences.ps1 +Pop-Location + if ($Env:ENABLE_QIRRUNTIME -eq "true") { Push-Location (Join-Path $PSScriptRoot "src/QirRuntime") .\install-prereqs.ps1 diff --git a/build/manifest.ps1 b/build/manifest.ps1 index dc3a0d218e5..fb53f6fd051 100644 --- a/build/manifest.ps1 +++ b/build/manifest.ps1 @@ -24,8 +24,12 @@ $artifacts = @{ "Microsoft.Quantum.Development.Kit", "Microsoft.Quantum.EntryPointDriver", "Microsoft.Quantum.QSharp.Core", + "Microsoft.Quantum.Type1.Core", + "Microsoft.Quantum.Type2.Core", "Microsoft.Quantum.Runtime.Core", "Microsoft.Quantum.Simulators", + "Microsoft.Quantum.Simulators.Type1", + "Microsoft.Quantum.Simulators.Type2", "Microsoft.Quantum.Xunit" ) | ForEach-Object { Join-Path $Env:NUGET_OUTDIR "$_.$Env:NUGET_VERSION.nupkg" }; @@ -37,9 +41,14 @@ $artifacts = @{ ".\src\Simulation\Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Runtime.Core.dll", ".\src\Simulation\EntryPointDriver\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.EntryPointDriver.dll", ".\src\Simulation\QsharpCore\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Core.dll", + ".\src\Simulation\Type1Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Type1.Core.dll", + ".\src\Simulation\Type2Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Type2.Core.dll", + ".\src\Simulation\QsharpFoundation\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Foundation.dll", ".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Common.dll", ".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll", ".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.dll", + ".\src\Simulation\Simulators.Type1\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.Type1.dll", + ".\src\Simulation\Simulators.Type2\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.Type2.dll", ".\src\Xunit\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Xunit.dll" ) | ForEach-Object { Join-Path $PSScriptRoot (Join-Path ".." $_) }; diff --git a/build/pack.ps1 b/build/pack.ps1 index 2b3116e2684..bfc880eaae3 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -65,8 +65,13 @@ Pack-Dotnet '../src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.cs Pack-One '../src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj' '-IncludeReferencedProjects' Pack-Dotnet '../src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj' Pack-Dotnet '../src/Simulation/Core/Microsoft.Quantum.Runtime.Core.csproj' +Pack-Dotnet '../src/Simulation/QSharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj' Pack-Dotnet '../src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj' +Pack-Dotnet '../src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj' +Pack-Dotnet '../src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj' Pack-One '../src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec' +Pack-One '../src/Simulation/Simulators.Type1/Microsoft.Quantum.Simulators.Type1.nuspec' +Pack-One '../src/Simulation/Simulators.Type2/Microsoft.Quantum.Simulators.Type2.nuspec' Pack-One '../src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec' Pack-One '../src/Xunit/Microsoft.Quantum.Xunit.csproj' diff --git a/src/Simulation/Common/Microsoft.Quantum.Simulation.Common.csproj b/src/Simulation/Common/Microsoft.Quantum.Simulation.Common.csproj index db67c8130ed..5772508edfb 100644 --- a/src/Simulation/Common/Microsoft.Quantum.Simulation.Common.csproj +++ b/src/Simulation/Common/Microsoft.Quantum.Simulation.Common.csproj @@ -14,7 +14,6 @@ - diff --git a/src/Simulation/Common/OperationException.cs b/src/Simulation/Common/OperationException.cs new file mode 100644 index 00000000000..ab4d7e6d177 --- /dev/null +++ b/src/Simulation/Common/OperationException.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.CompilerServices; + +#nullable enable + +namespace Microsoft.Quantum.Simulation.Common +{ + /// + /// A class that implements exception to be thrown when Operation is not supported. + /// + public class UnsupportedOperationException : PlatformNotSupportedException + { + public UnsupportedOperationException(string text = "", + [CallerFilePath] string file = "", + [CallerMemberName] string member = "", + [CallerLineNumber] int line = 0) + : base($"{file}::{line}::[{member}]:{text}") + { + } + } + +} \ No newline at end of file diff --git a/src/Simulation/Common/Simulators.Dev.props b/src/Simulation/Common/Simulators.Dev.props index 7c44b437a38..80151763c82 100644 --- a/src/Simulation/Common/Simulators.Dev.props +++ b/src/Simulation/Common/Simulators.Dev.props @@ -20,10 +20,7 @@ - - - diff --git a/src/Simulation/Common/Simulators.Impl.props b/src/Simulation/Common/Simulators.Impl.props new file mode 100644 index 00000000000..0f0e4e4ed8a --- /dev/null +++ b/src/Simulation/Common/Simulators.Impl.props @@ -0,0 +1,53 @@ + + + + + $([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory)..\..\..\)) + + + + + + + + netstandard2.1 + false + false + + + + 8.0 + enable + + + + + + + + + + + + + + + + + runtimes\win-x64\native\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + false + + + runtimes\osx-x64\native\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + false + + + runtimes\linux-x64\native\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + false + + + + diff --git a/src/Simulation/Common/Simulators.Test.props b/src/Simulation/Common/Simulators.Test.props new file mode 100644 index 00000000000..6e2cf7b766f --- /dev/null +++ b/src/Simulation/Common/Simulators.Test.props @@ -0,0 +1,34 @@ + + + + + $([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory)..\..\..\)) + + + + + + + + netcoreapp3.1 + false + false + false + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj b/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj index 6ae95f3fea9..d3625abf5f8 100644 --- a/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj +++ b/src/Simulation/CsharpGeneration.Tests/Tests.CsharpGeneration.fsproj @@ -52,9 +52,7 @@ - - diff --git a/src/Simulation/EntryPointDriver.Tests/Tests.fs b/src/Simulation/EntryPointDriver.Tests/Tests.fs index 99bafc265f3..3073ec39349 100644 --- a/src/Simulation/EntryPointDriver.Tests/Tests.fs +++ b/src/Simulation/EntryPointDriver.Tests/Tests.fs @@ -100,6 +100,7 @@ let private compileCSharp (sources : string seq) = "System.Runtime.Extensions" "System.Runtime.Numerics" "Microsoft.Quantum.EntryPointDriver" + "Microsoft.Quantum.QSharp.Foundation" "Microsoft.Quantum.QSharp.Core" "Microsoft.Quantum.QsDataStructures" "Microsoft.Quantum.Runtime.Core" diff --git a/src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj b/src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj index a506e16a6f9..3c13f0f8c65 100644 --- a/src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj +++ b/src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj @@ -26,7 +26,6 @@ - diff --git a/src/Simulation/Native/src/simulator/capi.cpp b/src/Simulation/Native/src/simulator/capi.cpp index 13148bb3477..4a5f95356b6 100644 --- a/src/Simulation/Native/src/simulator/capi.cpp +++ b/src/Simulation/Native/src/simulator/capi.cpp @@ -45,7 +45,7 @@ extern "C" return Microsoft::Quantum::Simulator::get(id)->JointEnsembleProbability(bv, qv); } - MICROSOFT_QUANTUM_DECL void InjectState( + MICROSOFT_QUANTUM_DECL bool InjectState( _In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* q, @@ -61,7 +61,7 @@ extern "C" } std::vector qubits(q, q + n); - Microsoft::Quantum::Simulator::get(sid)->InjectState(qubits, amplitudes); + return Microsoft::Quantum::Simulator::get(sid)->InjectState(qubits, amplitudes); } MICROSOFT_QUANTUM_DECL void allocateQubit(_In_ unsigned id, _In_ unsigned q) diff --git a/src/Simulation/Native/src/simulator/capi.hpp b/src/Simulation/Native/src/simulator/capi.hpp index a8909130fbb..75d8779423a 100644 --- a/src/Simulation/Native/src/simulator/capi.hpp +++ b/src/Simulation/Native/src/simulator/capi.hpp @@ -35,7 +35,7 @@ extern "C" _In_reads_(n) int* b, _In_reads_(n) unsigned* q); - MICROSOFT_QUANTUM_DECL void InjectState( + MICROSOFT_QUANTUM_DECL bool InjectState( _In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* q, // The listed qubits must be unentangled and in state |0> diff --git a/src/Simulation/Native/src/simulator/local_test.cpp b/src/Simulation/Native/src/simulator/local_test.cpp index 43d7f867982..d9641b620ad 100644 --- a/src/Simulation/Native/src/simulator/local_test.cpp +++ b/src/Simulation/Native/src/simulator/local_test.cpp @@ -390,7 +390,7 @@ TEST_CASE("permute_basis", "[local_test]") const double amp = 1.0 / std::sqrt(5); std::vector amplitudes = {{amp, 0.0}, {amp, 0.0}, {amp, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {amp, 0.0}, {amp, 0.0}}; - psi.inject_state({q0, q1, q2}, amplitudes); + REQUIRE(psi.inject_state({q0, q1, q2}, amplitudes)); SECTION("identity permutation") { @@ -453,7 +453,7 @@ TEST_CASE("permute_basis depends on the order of logical qubits (2)", "[local_te // Inject state, which would allow us to easily check permutations. It's not a normalized state but for this // test it doesn't matter. std::vector amplitudes = {{0.0, 0.0}, {1.0, 0.0}, {2.0, 0.0}, {3.0, 0.0}}; - psi.inject_state({q0, q1}, amplitudes); + REQUIRE(psi.inject_state({q0, q1}, amplitudes)); // after the state injection, positions of the qubits are q0:0 and q1:1 SECTION("q0-q1 order (matches the current positions of the qubits in the standard basis)") @@ -496,7 +496,7 @@ TEST_CASE("permute_basis depends on the order of logical qubits (3)", "[local_te // test it doesn't matter. std::vector amplitudes = {{0.0, 0.0}, {1.0, 0.0}, {2.0, 0.0}, {3.0, 0.0}, {4.0, 0.0}, {5.0, 0.0}, {6.0, 0.0}, {7.0, 0.0}}; - psi.inject_state({q0, q1, q2}, amplitudes); + REQUIRE(psi.inject_state({q0, q1, q2}, amplitudes)); SECTION("q0-q1-q2 order") { @@ -544,7 +544,7 @@ TEST_CASE("Inject total cat state", "[local_test]") std::vector amplitudes = {{amp, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {amp, 0.0}}; REQUIRE(amplitudes.size() == N); - sim.InjectState(qs, amplitudes); + REQUIRE(sim.InjectState(qs, amplitudes)); // undo the injected state back to |00> sim.CX({qs[0]}, qs[1]); @@ -571,13 +571,13 @@ TEST_CASE("Should fail to inject state if qubits aren't all |0>", "[local_test]" // unentangled but not |0> sim.H(qs[1]); - REQUIRE_THROWS(sim.InjectState(qs, amplitudes)); - REQUIRE_THROWS(sim.InjectState({qs[0], qs[1]}, amplitudes_sub)); + REQUIRE_FALSE(sim.InjectState(qs, amplitudes)); + REQUIRE_FALSE(sim.InjectState({qs[0], qs[1]}, amplitudes_sub)); // entanglement doesn't make things any better sim.CX({qs[1]}, qs[2]); - REQUIRE_THROWS(sim.InjectState(qs, amplitudes)); - REQUIRE_THROWS(sim.InjectState({qs[0], qs[1]}, amplitudes_sub)); + REQUIRE_FALSE(sim.InjectState(qs, amplitudes)); + REQUIRE_FALSE(sim.InjectState({qs[0], qs[1]}, amplitudes_sub)); } TEST_CASE("Inject total state on reordered qubits", "[local_test]") @@ -599,7 +599,7 @@ TEST_CASE("Inject total state on reordered qubits", "[local_test]") // Notice, that we are listing the qubits in order that doesn't match their allocation order. We are saying here, // that InjectState should create Bell pair from qs[1] and qs[2]! - sim.InjectState({qs[1], qs[2], qs[0]}, amplitudes); + REQUIRE(sim.InjectState({qs[1], qs[2], qs[0]}, amplitudes)); REQUIRE((sim.isclassical(qs[0]) && !sim.M(qs[0]))); // undo the state change and check that the whole system is back to |000> @@ -652,7 +652,7 @@ TEST_CASE("Inject state on two qubits out of three", "[local_test]") sim.H(q0); } - sim.InjectState({x, y}, amplitudes); + REQUIRE(sim.InjectState({x, y}, amplitudes)); // undo the state injection with quantum op and check that the qubits we injected state for are back to |0> sim.H(x); @@ -697,7 +697,7 @@ TEST_CASE("Perf of injecting equal superposition state", "[skip]") // local micr std::vector amplitudes(N, {amp, 0.0}); auto start = high_resolution_clock::now(); - sim.InjectState(qs, amplitudes); + REQUIRE(sim.InjectState(qs, amplitudes)); sim.M(qs[0]); // to have the same overhead compared to preparation test case std::cout << " Total state injection:\t"; std::cout << duration_cast(high_resolution_clock::now() - start).count(); @@ -712,7 +712,7 @@ TEST_CASE("Perf of injecting equal superposition state", "[skip]") // local micr std::vector amplitudes(N, {amp, 0.0}); auto start = std::chrono::high_resolution_clock::now(); - sim.InjectState(qs, amplitudes); + REQUIRE(sim.InjectState(qs, amplitudes)); sim.H(q_last); sim.M(qs[0]); // to have the same overhead compared to preparation test case std::cout << " Partial state injection:\t"; @@ -761,7 +761,7 @@ TEST_CASE("Perf of injecting cat state", "[skip]") // local micro_benchmark amplitudes[N - 1] = {amp, 0.0}; auto start = std::chrono::high_resolution_clock::now(); - sim.InjectState(qs, amplitudes); + REQUIRE(sim.InjectState(qs, amplitudes)); sim.M(qs[0]); // to have the same overhead compared to preparation test case std::cout << " Total cat state injection:\t"; std::cout << duration_cast(high_resolution_clock::now() - start).count(); @@ -778,7 +778,7 @@ TEST_CASE("Perf of injecting cat state", "[skip]") // local micro_benchmark amplitudes[N - 1] = {amp, 0.0}; auto start = std::chrono::high_resolution_clock::now(); - sim.InjectState(qs, amplitudes); + REQUIRE(sim.InjectState(qs, amplitudes)); sim.CX({qs[0]}, q_last); sim.M(qs[0]); // to have the same overhead compared to preparation test case std::cout << " Partial cat state injection:\t"; diff --git a/src/Simulation/Native/src/simulator/simulator.hpp b/src/Simulation/Native/src/simulator/simulator.hpp index f6988f0ab3b..9617a4f1ad1 100644 --- a/src/Simulation/Native/src/simulator/simulator.hpp +++ b/src/Simulation/Native/src/simulator/simulator.hpp @@ -59,10 +59,10 @@ class Simulator : public Microsoft::Quantum::Simulator::SimulatorInterface return p; } - void InjectState(const std::vector& qubits, const std::vector& amplitudes) + bool InjectState(const std::vector& qubits, const std::vector& amplitudes) { recursive_lock_type l(mutex()); - psi.inject_state(qubits, amplitudes); + return psi.inject_state(qubits, amplitudes); } bool isclassical(logical_qubit_id q) diff --git a/src/Simulation/Native/src/simulator/simulatorinterface.hpp b/src/Simulation/Native/src/simulator/simulatorinterface.hpp index 9c89abe8289..23bba3fb5ea 100644 --- a/src/Simulation/Native/src/simulator/simulatorinterface.hpp +++ b/src/Simulation/Native/src/simulator/simulatorinterface.hpp @@ -30,7 +30,7 @@ class SimulatorInterface virtual double JointEnsembleProbability(std::vector bs, std::vector qs) = 0; - virtual void InjectState( + virtual bool InjectState( const std::vector& qubits, const std::vector& amplitudes) = 0; diff --git a/src/Simulation/Native/src/simulator/wavefunction.hpp b/src/Simulation/Native/src/simulator/wavefunction.hpp index fba2f571e0b..4ff2b68c07a 100644 --- a/src/Simulation/Native/src/simulator/wavefunction.hpp +++ b/src/Simulation/Native/src/simulator/wavefunction.hpp @@ -565,27 +565,27 @@ class Wavefunction return kernels::jointprobability(wfn_, bs, get_qubit_positions(qs)); } - /// \pre: Each qubit, listed in `q`, must be unentangled and in state |0>. + /// \pre: Each qubit, listed in `q`, must be unentangled and in state |0>. If the prerequisite isn't satisfied, + /// the method returns `false` and leaves the state of the system unchanged. /// Place qubits, listed in `q` into superposition of basis vectors with provided `amplitudes`, where the order of - /// qubits in array `q` defines the standard computational basis in little endian order. - void inject_state(const std::vector& qubits, const std::vector& amplitudes) + /// qubits in array `q` defines the standard computational basis in little endian order. Returns `true` if the state + /// is successfuly injected. + bool inject_state(const std::vector& qubits, const std::vector& amplitudes) { assert((static_cast(1) << qubits.size()) == amplitudes.size()); flush(); - // Check prerequisites. - std::vector positions = get_qubit_positions(qubits); - for (positional_qubit_id p : positions) + if (qubits.size() == num_qubits_) { - if (!kernels::isclassical(wfn_, p) || kernels::getvalue(wfn_, p) != 0) + // Check prerequisites. In the case of total state injection the wave function must consist of a single + // term |0...0> (so we can avoid checking each qubit individually). + double eps = 100. * std::numeric_limits::epsilon(); + if (std::norm(wfn_[0]) < 1.0 - eps) { - throw std::runtime_error("Cannot prepare state of entangled qubits or if they are not in state |0>"); + return false; } - } - if (qubits.size() == num_qubits_) - { // For full state injection we can copy the user's wave function into our store and reorder the // positions map without doing any math. for (unsigned i = 0; i < qubits.size(); i++) @@ -596,6 +596,16 @@ class Wavefunction } else { + // Check prerequisites. + std::vector positions = get_qubit_positions(qubits); + for (positional_qubit_id p : positions) + { + if (!kernels::isclassical(wfn_, p) || kernels::getvalue(wfn_, p) != 0) + { + return false; + } + } + // The current state can be thought of as Sum(a_i*|i>|0...0>), after the state injection it will become // Sum(a_i*|i>Sum(b_j*|j>)) = Sum(a_i*b_j|i>|j>). Thus, to compute amplitude of a term |k> after the state // injection we need to find the corresponding |i> vector from the original wave function and |j> vector @@ -619,6 +629,8 @@ class Wavefunction } std::swap(wfn_, wfn_new); } + + return true; } /// measure a qubit diff --git a/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj b/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj index 385e3f72955..3ffd3ea24bc 100644 --- a/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj +++ b/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj @@ -13,6 +13,7 @@ + diff --git a/src/Simulation/QsharpCore/Diagnostics/DeprecatedDiagnostics.qs b/src/Simulation/QsharpCore/Diagnostics/DeprecatedDiagnostics.qs deleted file mode 100644 index 05a0a31185d..00000000000 --- a/src/Simulation/QsharpCore/Diagnostics/DeprecatedDiagnostics.qs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Quantum.Extensions.Diagnostics { - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.dumpmachine". - @Deprecated("Microsoft.Quantum.Diagnostics.DumpMachine") - function DumpMachine<'T> (location : 'T) : Unit { - return Microsoft.Quantum.Diagnostics.DumpMachine(location); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.dumpregister". - @Deprecated("Microsoft.Quantum.Diagnostics.DumpRegister") - function DumpRegister<'T> (location : 'T, qubits : Qubit[]) : Unit { - return Microsoft.Quantum.Diagnostics.DumpRegister(location, qubits); - } - -} diff --git a/src/Simulation/QsharpCore/Diagnostics/DeprecatedTesting.qs b/src/Simulation/QsharpCore/Diagnostics/DeprecatedTesting.qs deleted file mode 100644 index 22886674a90..00000000000 --- a/src/Simulation/QsharpCore/Diagnostics/DeprecatedTesting.qs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Quantum.Extensions.Testing { - open Microsoft.Quantum.Math; - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertqubit". - @Deprecated("Microsoft.Quantum.Diagnostics.AssertQubit") - operation AssertQubit(expected : Result, q : Qubit) : Unit { - Microsoft.Quantum.Diagnostics.AssertQubit(expected, q); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertqubitwithintolerance". - @Deprecated("Microsoft.Quantum.Diagnostics.AssertQubitWithinTolerance") - operation AssertQubitTol(expected : Result, q : Qubit, tolerance : Double) : Unit { - Microsoft.Quantum.Diagnostics.AssertQubitWithinTolerance(expected, q, tolerance); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertqubitisinstatewithintolerance". - @Deprecated("Microsoft.Quantum.Diagnostics.AssertQubitIsInStateWithinTolerance") - operation AssertQubitState(expected : (Complex, Complex), register : Qubit, tolerance : Double) : Unit { - Microsoft.Quantum.Diagnostics.AssertQubitIsInStateWithinTolerance(expected, register, tolerance); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertoperationsequalreferenced". - /// Note that the order of the arguments to this operation has changed. - @Deprecated("Microsoft.Quantum.Diagnostics.AssertOperationsEqualReferenced") - operation AssertOperationsEqualReferenced(actual : (Qubit[] => Unit), expected : (Qubit[] => Unit is Adj), nQubits : Int) : Unit { - Microsoft.Quantum.Diagnostics.AssertOperationsEqualReferenced(nQubits, actual, expected); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertoperationsequalinplace". - /// Note that the order of the arguments to this operation has changed. - @Deprecated("Microsoft.Quantum.Diagnostics.AssertOperationsEqualInPlace") - operation AssertOperationsEqualInPlace(actual : (Qubit[] => Unit), expected : (Qubit[] => Unit is Adj), nQubits : Int) : Unit { - Microsoft.Quantum.Diagnostics.AssertOperationsEqualInPlace(nQubits, actual, expected); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertoperationsequalinplaceCompBasis". - /// Note that the order of the arguments to this operation has changed. - @Deprecated("Microsoft.Quantum.Diagnostics.AssertOperationsEqualInPlaceCompBasis") - operation AssertOperationsEqualInPlaceCompBasis(actual : (Qubit[] => Unit), expected : (Qubit[] => Unit is Adj), nQubits : Int) : Unit { - Microsoft.Quantum.Diagnostics.AssertOperationsEqualInPlaceCompBasis(nQubits, actual, expected); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertallzero". - @Deprecated("Microsoft.Quantum.Diagnostics.AssertAllZero") - operation AssertAllZero(qubits : Qubit[]) : Unit is Adj + Ctl { - Microsoft.Quantum.Diagnostics.AssertAllZero(qubits); - } - - /// # Deprecated - /// Please use @"microsoft.quantum.diagnostics.assertallzerowithintolerance". - @Deprecated("Microsoft.Quantum.Diagnostics.AssertAllZeroWithinTolerance") - operation AssertAllZeroTol(qubits : Qubit[], tolerance : Double) : Unit is Adj + Ctl { - Microsoft.Quantum.Diagnostics.AssertAllZeroWithinTolerance(qubits, tolerance); - } - -} diff --git a/src/Simulation/QsharpCore/Intrinsic.qs b/src/Simulation/QsharpCore/Intrinsic.qs deleted file mode 100644 index 0ce887c0ae6..00000000000 --- a/src/Simulation/QsharpCore/Intrinsic.qs +++ /dev/null @@ -1,693 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Quantum.Intrinsic { - open Microsoft.Quantum.Math; - open Microsoft.Quantum.Convert; - open Microsoft.Quantum.Targeting; - - @Deprecated("Microsoft.Quantum.Random.DrawCategorical") - operation Random (probs : Double[]) : Int { - body intrinsic; - } - - @Deprecated("Microsoft.Quantum.Diagnostics.AssertMeasurement") - operation Assert (bases : Pauli[], qubits : Qubit[], result : Result, msg : String) : Unit - is Adj + Ctl { - Microsoft.Quantum.Diagnostics.AssertMeasurement(bases, qubits, result, msg); - } - - @Deprecated("Microsoft.Quantum.Diagnostics.AssertMeasurementProbability") - operation AssertProb (bases : Pauli[], qubits : Qubit[], result : Result, prob : Double, msg : String, tol : Double) : Unit - is Adj + Ctl { - Microsoft.Quantum.Diagnostics.AssertMeasurementProbability(bases, qubits, result, prob, msg, tol); - } - - - /// # Summary - /// Logs a message. - /// - /// # Input - /// ## msg - /// The message to be reported. - /// - /// # Remarks - /// The specific behavior of this function is simulator-dependent, - /// but in most cases the given message will be written to the console. - function Message (msg : String) : Unit { - body intrinsic; - } - - - //------------------------------------------------- - // Clifford and related operations - //------------------------------------------------- - - /// # Summary - /// Performs the identity operation (no-op) on a single qubit. - /// - /// # Remarks - /// This is a no-op. It is provided for completeness and because - /// sometimes it is useful to call the identity in an algorithm or to pass it as a parameter. - operation I (target : Qubit) : Unit - is Adj + Ctl { - body (...) { } - adjoint self; - } - - - /// # Summary - /// Applies the Pauli $X$ gate. - /// - /// \begin{align} - /// \sigma_x \mathrel{:=} - /// \begin{bmatrix} - /// 0 & 1 \\\\ - /// 1 & 0 - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## qubit - /// Qubit to which the gate should be applied. - operation X (qubit : Qubit) : Unit - is Adj + Ctl { - body intrinsic; - adjoint self; - } - - /// # Summary - /// Applies the Pauli $Y$ gate. - /// - /// \begin{align} - /// \sigma_y \mathrel{:=} - /// \begin{bmatrix} - /// 0 & -i \\\\ - /// i & 0 - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## qubit - /// Qubit to which the gate should be applied. - operation Y (qubit : Qubit) : Unit - is Adj + Ctl { - body intrinsic; - adjoint self; - } - - - /// # Summary - /// Applies the Pauli $Z$ gate. - /// - /// \begin{align} - /// \sigma_z \mathrel{:=} - /// \begin{bmatrix} - /// 1 & 0 \\\\ - /// 0 & -1 - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## qubit - /// Qubit to which the gate should be applied. - operation Z (qubit : Qubit) : Unit - is Adj + Ctl { - body intrinsic; - adjoint self; - } - - - /// # Summary - /// Applies the Hadamard transformation to a single qubit. - /// - /// \begin{align} - /// H \mathrel{:=} - /// \frac{1}{\sqrt{2}} - /// \begin{bmatrix} - /// 1 & 1 \\\\ - /// 1 & -1 - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## qubit - /// Qubit to which the gate should be applied. - operation H (qubit : Qubit) : Unit - is Adj + Ctl { - body intrinsic; - adjoint self; - } - - - /// # Summary - /// Applies the S gate to a single qubit. - /// - /// # Description - /// This operation can be simulated by the unitary matrix - /// \begin{align} - /// S \mathrel{:=} - /// \begin{bmatrix} - /// 1 & 0 \\\\ - /// 0 & i - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## qubit - /// Qubit to which the gate should be applied. - operation S(qubit : Qubit) : Unit - is Adj + Ctl { - body intrinsic; - } - - - /// # Summary - /// Applies the T gate to a single qubit. - /// - /// # Description - /// This operation can be simulated by the unitary matrix - /// \begin{align} - /// T \mathrel{:=} - /// \begin{bmatrix} - /// 1 & 0 \\\\ - /// 0 & e^{i \pi / 4} - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## qubit - /// Qubit to which the gate should be applied. - operation T(qubit : Qubit) : Unit - is Adj + Ctl { - body intrinsic; - } - - - /// # Summary - /// Applies the controlled-NOT (CNOT) gate to a pair of qubits. - /// - /// \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 (...) { - Controlled X([control], target); - } - - adjoint self; - } - - - /// # Summary - /// Applies the doubly controlled–NOT (CCNOT) gate to three qubits. - /// - /// # Input - /// ## control1 - /// First control qubit for the CCNOT gate. - /// ## control2 - /// Second control qubit for the CCNOT gate. - /// ## target - /// Target qubit for the CCNOT gate. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// Controlled X([control1, control2], target); - /// ``` - operation CCNOT (control1 : Qubit, control2 : Qubit, target : Qubit) : Unit - is Adj + Ctl { - body (...) { - Controlled X([control1, control2], target); - } - - adjoint self; - } - - - /// # Summary - /// Applies the SWAP gate to a pair of qubits. - /// - /// \begin{align} - /// \operatorname{SWAP} \mathrel{:=} - /// \begin{bmatrix} - /// 1 & 0 & 0 & 0 \\\\ - /// 0 & 0 & 1 & 0 \\\\ - /// 0 & 1 & 0 & 0 \\\\ - /// 0 & 0 & 0 & 1 - /// \end{bmatrix}, - /// \end{align} - /// - /// where rows and columns are ordered as in the quantum concepts guide. - /// - /// # Input - /// ## qubit1 - /// First qubit to be swapped. - /// ## qubit2 - /// Second qubit to be swapped. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// CNOT(qubit1, qubit2); - /// CNOT(qubit2, qubit1); - /// CNOT(qubit1, qubit2); - /// ``` - operation SWAP (qubit1 : Qubit, qubit2 : Qubit) : Unit - is Adj + Ctl { - body (...) - { - CNOT(qubit1, qubit2); - CNOT(qubit2, qubit1); - CNOT(qubit1, qubit2); - } - - adjoint self; - } - - //------------------------------------------------- - // Rotations - //------------------------------------------------- - - /// # Summary - /// Applies a rotation about the given Pauli axis. - /// - /// \begin{align} - /// R_{\mu}(\theta) \mathrel{:=} - /// e^{-i \theta \sigma_{\mu} / 2}, - /// \end{align} - /// where $\mu \in \{I, X, Y, Z\}$. - /// - /// # Input - /// ## pauli - /// Pauli operator ($\mu$) to be exponentiated to form the rotation. - /// ## theta - /// Angle about which the qubit is to be rotated. - /// ## qubit - /// Qubit to which the gate should be applied. - /// - /// # Remarks - /// When called with `pauli = PauliI`, this operation applies - /// a *global phase*. This phase can be significant - /// when used with the `Controlled` functor. - operation R (pauli : Pauli, theta : Double, qubit : Qubit) : Unit - is Adj + Ctl { - body intrinsic; - } - - - /// # Summary - /// Applies a rotation about the given Pauli axis by an angle specified - /// as a dyadic fraction. - /// - /// \begin{align} - /// R_{\mu}(n, k) \mathrel{:=} - /// e^{i \pi n \sigma_{\mu} / 2^k}, - /// \end{align} - /// where $\mu \in \{I, X, Y, Z\}$. - /// - /// > [!WARNING] - /// > This operation uses the **opposite** sign convention from - /// > @"microsoft.quantum.intrinsic.r". - /// - /// # Input - /// ## pauli - /// Pauli operator to be exponentiated to form the rotation. - /// ## numerator - /// Numerator in the dyadic fraction representation of the angle - /// by which the qubit is to be rotated. - /// ## power - /// Power of two specifying the denominator of the angle by which - /// the qubit is to be rotated. - /// ## qubit - /// Qubit to which the gate should be applied. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// // PI() is a Q# function that returns an approximation of π. - /// R(pauli, -PI() * IntAsDouble(numerator) / IntAsDouble(2 ^ (power - 1)), qubit); - /// ``` - operation RFrac (pauli : Pauli, numerator : Int, power : Int, qubit : Qubit) : Unit - is Adj + Ctl { - - let angle = ((-2.0 * PI()) * IntAsDouble(numerator)) / IntAsDouble(2 ^ power); - R(pauli, angle, qubit); - } - - - /// # Summary - /// Applies a rotation about the $x$-axis by a given angle. - /// - /// \begin{align} - /// R_x(\theta) \mathrel{:=} - /// e^{-i \theta \sigma_x / 2} = - /// \begin{bmatrix} - /// \cos \frac{\theta}{2} & -i\sin \frac{\theta}{2} \\\\ - /// -i\sin \frac{\theta}{2} & \cos \frac{\theta}{2} - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## theta - /// Angle about which the qubit is to be rotated. - /// ## qubit - /// Qubit to which the gate should be applied. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// R(PauliX, theta, qubit); - /// ``` - operation Rx (theta : Double, qubit : Qubit) : Unit - is Adj + Ctl { - body (...) - { - R(PauliX, theta, qubit); - } - - adjoint (...) - { - R(PauliX, -theta, qubit); - } - } - - - /// # Summary - /// Applies a rotation about the $y$-axis by a given angle. - /// - /// \begin{align} - /// R_y(\theta) \mathrel{:=} - /// e^{-i \theta \sigma_y / 2} = - /// \begin{bmatrix} - /// \cos \frac{\theta}{2} & -\sin \frac{\theta}{2} \\\\ - /// \sin \frac{\theta}{2} & \cos \frac{\theta}{2} - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## theta - /// Angle about which the qubit is to be rotated. - /// ## qubit - /// Qubit to which the gate should be applied. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// R(PauliY, theta, qubit); - /// ``` - operation Ry (theta : Double, qubit : Qubit) : Unit - is Adj + Ctl { - body (...) - { - R(PauliY, theta, qubit); - } - - adjoint (...) - { - R(PauliY, -theta, qubit); - } - } - - - /// # Summary - /// Applies a rotation about the $z$-axis by a given angle. - /// - /// \begin{align} - /// R_z(\theta) \mathrel{:=} - /// e^{-i \theta \sigma_z / 2} = - /// \begin{bmatrix} - /// e^{-i \theta / 2} & 0 \\\\ - /// 0 & e^{i \theta / 2} - /// \end{bmatrix}. - /// \end{align} - /// - /// # Input - /// ## theta - /// Angle about which the qubit is to be rotated. - /// ## qubit - /// Qubit to which the gate should be applied. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// R(PauliZ, theta, qubit); - /// ``` - operation Rz (theta : Double, qubit : Qubit) : Unit - is Adj + Ctl { - body (...) - { - R(PauliZ, theta, qubit); - } - - adjoint (...) - { - R(PauliZ, -theta, qubit); - } - } - - - /// # Summary - /// Applies a rotation about the $\ket{1}$ state by a given angle. - /// - /// \begin{align} - /// R_1(\theta) \mathrel{:=} - /// \operatorname{diag}(1, e^{i\theta}). - /// \end{align} - /// - /// # Input - /// ## theta - /// Angle about which the qubit is to be rotated. - /// ## qubit - /// Qubit to which the gate should be applied. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// R(PauliZ, theta, qubit); - /// R(PauliI, -theta, qubit); - /// ``` - operation R1 (theta : Double, qubit : Qubit) : Unit - is Adj + Ctl { - - R(PauliZ, theta, qubit); - R(PauliI, -theta, qubit); - } - - - /// # Summary - /// Applies a rotation about the $\ket{1}$ state by an angle specified - /// as a dyadic fraction. - /// - /// \begin{align} - /// R_1(n, k) \mathrel{:=} - /// \operatorname{diag}(1, e^{i \pi k / 2^n}). - /// \end{align} - /// - /// > [!WARNING] - /// > This operation uses the **opposite** sign convention from - /// > @"microsoft.quantum.intrinsic.r", and does not include the - /// > factor of $1/ 2$ included by @"microsoft.quantum.intrinsic.r1". - /// - /// # Input - /// ## numerator - /// Numerator in the dyadic fraction representation of the angle - /// by which the qubit is to be rotated. - /// ## power - /// Power of two specifying the denominator of the angle by which - /// the qubit is to be rotated. - /// ## qubit - /// Qubit to which the gate should be applied. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// RFrac(PauliZ, -numerator, denominator + 1, qubit); - /// RFrac(PauliI, numerator, denominator + 1, qubit); - /// ``` - operation R1Frac (numerator : Int, power : Int, qubit : Qubit) : Unit - is Adj + Ctl { - - RFrac(PauliZ, -numerator, power + 1, qubit); - RFrac(PauliI, numerator, power + 1, qubit); - } - - - /// # Summary - /// Applies the exponential of a multi-qubit Pauli operator. - /// - /// \begin{align} - /// e^{i \theta [P_0 \otimes P_1 \cdots P_{N-1}]}, - /// \end{align} - /// where $P_i$ is the $i$th element of `paulis`, and where - /// $N = $`Length(paulis)`. - /// - /// # Input - /// ## paulis - /// Array of single-qubit Pauli values indicating the tensor product - /// factors on each qubit. - /// ## theta - /// Angle about the given multi-qubit Pauli operator by which the - /// target register is to be rotated. - /// ## qubits - /// Register to apply the given rotation to. - operation Exp (paulis : Pauli[], theta : Double, qubits : Qubit[]) : Unit - is Adj + Ctl { - body intrinsic; - } - - - /// # Summary - /// Applies the exponential of a multi-qubit Pauli operator - /// with an argument given by a dyadic fraction. - /// - /// \begin{align} - /// e^{i \pi k [P_0 \otimes P_1 \cdots P_{N-1}] / 2^n}, - /// \end{align} - /// where $P_i$ is the $i$th element of `paulis`, and where - /// $N = $`Length(paulis)`. - /// - /// # Input - /// ## paulis - /// Array of single-qubit Pauli values indicating the tensor product - /// factors on each qubit. - /// ## numerator - /// Numerator ($k$) in the dyadic fraction representation of the angle - /// by which the qubit register is to be rotated. - /// ## power - /// Power of two ($n$) specifying the denominator of the angle by which - /// the qubit register is to be rotated. - /// ## qubits - /// Register to apply the given rotation to. - operation ExpFrac (paulis : Pauli[], numerator : Int, power : Int, qubits : Qubit[]) : Unit - is Adj + Ctl { - let angle = (PI() * IntAsDouble(numerator)) / IntAsDouble(2 ^ power); - Exp(paulis, angle, qubits); - } - - - //------------------------------------------------- - // Measurements - //------------------------------------------------- - - /// # Summary - /// Performs a joint measurement of one or more qubits in the - /// specified Pauli bases. - /// - /// The output result is given by the distribution: - /// \begin{align} - /// \Pr(\texttt{Zero} | \ket{\psi}) = - /// \frac12 \braket{ - /// \psi \mid| - /// \left( - /// \boldone + P_0 \otimes P_1 \otimes \cdots \otimes P_{N-1} - /// \right) \mid| - /// \psi - /// }, - /// \end{align} - /// where $P_i$ is the $i$th element of `bases`, and where - /// $N = \texttt{Length}(\texttt{bases})$. - /// That is, measurement returns a `Result` $d$ such that the eigenvalue of the - /// observed measurement effect is $(-1)^d$. - /// - /// # Input - /// ## bases - /// Array of single-qubit Pauli values indicating the tensor product - /// factors on each qubit. - /// ## qubits - /// Register of qubits to be measured. - /// - /// # Output - /// `Zero` if the $+1$ eigenvalue is observed, and `One` if - /// the $-1$ eigenvalue is observed. - /// - /// # Remarks - /// If the basis array and qubit array are different lengths, then the - /// operation will fail. - operation Measure (bases : Pauli[], qubits : Qubit[]) : Result { - body intrinsic; - } - - - /// # Summary - /// Performs a measurement of a single qubit in the - /// Pauli $Z$ basis. - /// - /// The output result is given by - /// the distribution - /// \begin{align} - /// \Pr(\texttt{Zero} | \ket{\psi}) = - /// \braket{\psi | 0} \braket{0 | \psi}. - /// \end{align} - /// - /// # Input - /// ## qubit - /// Qubit to be measured. - /// - /// # Output - /// `Zero` if the $+1$ eigenvalue is observed, and `One` if - /// the $-1$ eigenvalue is observed. - /// - /// # Remarks - /// Equivalent to: - /// ```qsharp - /// Measure([PauliZ], [qubit]); - /// ``` - operation M (qubit : Qubit) : Result { - return Measure([PauliZ], [qubit]); - } - - - /// # Summary - /// Given a single qubit, measures it and ensures it is in the |0⟩ state - /// such that it can be safely released. - /// - /// # Input - /// ## target - /// The qubit whose state is to be reset to $\ket{0}$. - @RequiresCapability( - "BasicQuantumFunctionality", - "Reset is replaced by a supported implementation on all execution targets." - ) - operation Reset (target : Qubit) : Unit { - if (M(target) == One) { - X(target); - } - } - - - /// # Summary - /// Given an array of qubits, measure them and ensure they are in the |0⟩ state - /// such that they can be safely released. - /// - /// # Input - /// ## qubits - /// An array of qubits whose states are to be reset to $\ket{0}$. - operation ResetAll (qubits : Qubit[]) : Unit { - for (qubit in qubits) { - Reset(qubit); - } - } -} diff --git a/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj b/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj index 36526c2956b..5c5a591f07b 100644 --- a/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj +++ b/src/Simulation/QsharpCore/Microsoft.Quantum.QSharp.Core.csproj @@ -1,44 +1,10 @@  - - + - netstandard2.1 - true - false - false - - - - Microsoft Core support for the Q# programming language. - See: https://docs.microsoft.com/en-us/quantum/relnotes/ - MIT - https://github.com/microsoft/qsharp-runtime - qdk-nuget-icon.png - Quantum Q# Qsharp - true - + - - - - - - - - - - - - - - - - - - - diff --git a/src/Simulation/QsharpCore/Properties/AssemblyInfo.cs b/src/Simulation/QsharpCore/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..109c9a91f80 --- /dev/null +++ b/src/Simulation/QsharpCore/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allow the simulator assembly to use our internal methods +[assembly: InternalsVisibleTo("Microsoft.Quantum.Simulators" + SigningConstants.PUBLIC_KEY)] \ No newline at end of file diff --git a/src/Simulation/QsharpCore/Reset.qs b/src/Simulation/QsharpCore/Reset.qs deleted file mode 100644 index f69ef1a6785..00000000000 --- a/src/Simulation/QsharpCore/Reset.qs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Quantum.Measurement { - open Microsoft.Quantum.Intrinsic; - open Microsoft.Quantum.Targeting; - - internal operation BasisChangeZtoY(target : Qubit) : Unit is Adj + Ctl { - H(target); - S(target); - } - - - /// # Summary - /// Sets a qubit to a given computational basis state by measuring the - /// qubit and applying a bit flip if needed. - /// - /// # Input - /// ## desired - /// The basis state that the qubit should be set to. - /// ## target - /// The qubit whose state is to be set. - /// - /// # Remarks - /// As an invariant of this operation, calling `M(q)` immediately - /// after `SetToBasisState(result, q)` will return `result`. - operation SetToBasisState(desired : Result, target : Qubit) : Unit { - if (desired != M(target)) { - X(target); - } - } - - /// # Summary - /// Measures a single qubit in the Z basis, - /// and resets it to a fixed initial state - /// following the measurement. - /// - /// # Description - /// Performs a single-qubit measurement in the $Z$-basis, - /// and ensures that the qubit is returned to $\ket{0}$ - /// following the measurement. - /// - /// # Input - /// ## target - /// A single qubit to be measured. - /// - /// # Output - /// The result of measuring `target` in the Pauli $Z$ basis. - @RequiresCapability( - "BasicQuantumFunctionality", - "MResetZ is replaced by a supported implementation on all execution targets." - ) - operation MResetZ (target : Qubit) : Result { - let result = M(target); - - if (result == One) { - // Recall that the +1 eigenspace of a measurement operator corresponds to - // the Result case Zero. Thus, if we see a One case, we must reset the state - // have +1 eigenvalue. - X(target); - } - - return result; - } - - - /// # Summary - /// Measures a single qubit in the X basis, - /// and resets it to a fixed initial state - /// following the measurement. - /// - /// # Description - /// Performs a single-qubit measurement in the $X$-basis, - /// and ensures that the qubit is returned to $\ket{0}$ - /// following the measurement. - /// - /// # Input - /// ## target - /// A single qubit to be measured. - /// - /// # Output - /// The result of measuring `target` in the Pauli $X$ basis. - @RequiresCapability( - "BasicQuantumFunctionality", - "MResetX is replaced by a supported implementation on all execution targets." - ) - operation MResetX (target : Qubit) : Result { - let result = Measure([PauliX], [target]); - - // We must return the qubit to the Z basis as well. - H(target); - - if (result == One) { - // Recall that the +1 eigenspace of a measurement operator corresponds to - // the Result case Zero. Thus, if we see a One case, we must reset the state - // have +1 eigenvalue. - X(target); - } - - return result; - } - - - /// # Summary - /// Measures a single qubit in the Y basis, - /// and resets it to a fixed initial state - /// following the measurement. - /// - /// # Description - /// Performs a single-qubit measurement in the $Y$-basis, - /// and ensures that the qubit is returned to $\ket{0}$ - /// following the measurement. - /// - /// # Input - /// ## target - /// A single qubit to be measured. - /// - /// # Output - /// The result of measuring `target` in the Pauli $Y$ basis. - @RequiresCapability( - "BasicQuantumFunctionality", - "MResetY is replaced by a supported implementation on all execution targets." - ) - operation MResetY (target : Qubit) : Result { - let result = Measure([PauliY], [target]); - - // We must return the qubit to the Z basis as well. - Adjoint BasisChangeZtoY(target); - - if (result == One) { - // Recall that the +1 eigenspace of a measurement operator corresponds to - // the Result case Zero. Thus, if we see a One case, we must reset the state - // have +1 eigenvalue. - X(target); - } - - return result; - } - -} diff --git a/src/Simulation/QsharpCore/Arrays/Empty.cs b/src/Simulation/QsharpFoundation/Arrays/Empty.cs similarity index 100% rename from src/Simulation/QsharpCore/Arrays/Empty.cs rename to src/Simulation/QsharpFoundation/Arrays/Empty.cs diff --git a/src/Simulation/QsharpCore/Arrays/Empty.qs b/src/Simulation/QsharpFoundation/Arrays/Empty.qs similarity index 100% rename from src/Simulation/QsharpCore/Arrays/Empty.qs rename to src/Simulation/QsharpFoundation/Arrays/Empty.qs diff --git a/src/Simulation/QsharpCore/Arrays/Enumeration.qs b/src/Simulation/QsharpFoundation/Arrays/Enumeration.qs similarity index 91% rename from src/Simulation/QsharpCore/Arrays/Enumeration.qs rename to src/Simulation/QsharpFoundation/Arrays/Enumeration.qs index a90383b1ab5..2a4634681a7 100644 --- a/src/Simulation/QsharpCore/Arrays/Enumeration.qs +++ b/src/Simulation/QsharpFoundation/Arrays/Enumeration.qs @@ -2,9 +2,6 @@ // Licensed under the MIT License. namespace Microsoft.Quantum.Arrays { - open Microsoft.Quantum.Intrinsic; - open Microsoft.Quantum.Canon; - /// # Summary /// Given an array, returns a range over the indices of that array, suitable /// for use in a for loop. @@ -29,5 +26,4 @@ namespace Microsoft.Quantum.Arrays { function IndexRange<'TElement>(array : 'TElement[]) : Range { return 0..(Length(array) - 1); } - } diff --git a/src/Simulation/QsharpFoundation/Assert.qs b/src/Simulation/QsharpFoundation/Assert.qs new file mode 100644 index 00000000000..30832b83767 --- /dev/null +++ b/src/Simulation/QsharpFoundation/Assert.qs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + @Deprecated("Microsoft.Quantum.Diagnostics.AssertMeasurement") + operation Assert (bases : Pauli[], qubits : Qubit[], result : Result, msg : String) : Unit + is Adj + Ctl { + Microsoft.Quantum.Diagnostics.AssertMeasurement(bases, qubits, result, msg); + } + + @Deprecated("Microsoft.Quantum.Diagnostics.AssertMeasurementProbability") + operation AssertProb (bases : Pauli[], qubits : Qubit[], result : Result, prob : Double, msg : String, tol : Double) : Unit + is Adj + Ctl { + Microsoft.Quantum.Diagnostics.AssertMeasurementProbability(bases, qubits, result, prob, msg, tol); + } +} \ No newline at end of file diff --git a/src/Simulation/QsharpCore/Bitwise/Bitwise.cs b/src/Simulation/QsharpFoundation/Bitwise/Bitwise.cs similarity index 100% rename from src/Simulation/QsharpCore/Bitwise/Bitwise.cs rename to src/Simulation/QsharpFoundation/Bitwise/Bitwise.cs diff --git a/src/Simulation/QsharpCore/Bitwise/Bitwise.qs b/src/Simulation/QsharpFoundation/Bitwise/Bitwise.qs similarity index 100% rename from src/Simulation/QsharpCore/Bitwise/Bitwise.qs rename to src/Simulation/QsharpFoundation/Bitwise/Bitwise.qs diff --git a/src/Simulation/QsharpCore/Bitwise/Deprecated.qs b/src/Simulation/QsharpFoundation/Bitwise/Deprecated.qs similarity index 100% rename from src/Simulation/QsharpCore/Bitwise/Deprecated.qs rename to src/Simulation/QsharpFoundation/Bitwise/Deprecated.qs diff --git a/src/Simulation/QsharpCore/Canon/NoOp.qs b/src/Simulation/QsharpFoundation/Canon/NoOp.qs similarity index 100% rename from src/Simulation/QsharpCore/Canon/NoOp.qs rename to src/Simulation/QsharpFoundation/Canon/NoOp.qs diff --git a/src/Simulation/QsharpCore/ClassicalControl.qs b/src/Simulation/QsharpFoundation/ClassicalControl.qs similarity index 99% rename from src/Simulation/QsharpCore/ClassicalControl.qs rename to src/Simulation/QsharpFoundation/ClassicalControl.qs index f26320286bc..05ea7392569 100644 --- a/src/Simulation/QsharpCore/ClassicalControl.qs +++ b/src/Simulation/QsharpFoundation/ClassicalControl.qs @@ -3,8 +3,6 @@ namespace Microsoft.Quantum.Simulation.QuantumProcessor.Extensions //ToDo: update namespace to a more appropriate name { - open Microsoft.Quantum.Intrinsic; - operation NoOp() : Unit is Ctl + Adj {} // Private helper operations. diff --git a/src/Simulation/QsharpCore/Convert/Convert.cs b/src/Simulation/QsharpFoundation/Convert/Convert.cs similarity index 100% rename from src/Simulation/QsharpCore/Convert/Convert.cs rename to src/Simulation/QsharpFoundation/Convert/Convert.cs diff --git a/src/Simulation/QsharpCore/Convert/Convert.qs b/src/Simulation/QsharpFoundation/Convert/Convert.qs similarity index 100% rename from src/Simulation/QsharpCore/Convert/Convert.qs rename to src/Simulation/QsharpFoundation/Convert/Convert.qs diff --git a/src/Simulation/QsharpCore/Convert/Deprecated.qs b/src/Simulation/QsharpFoundation/Convert/Deprecated.qs similarity index 100% rename from src/Simulation/QsharpCore/Convert/Deprecated.qs rename to src/Simulation/QsharpFoundation/Convert/Deprecated.qs diff --git a/src/Simulation/QsharpCore/Core.cs b/src/Simulation/QsharpFoundation/Core.cs similarity index 100% rename from src/Simulation/QsharpCore/Core.cs rename to src/Simulation/QsharpFoundation/Core.cs diff --git a/src/Simulation/QsharpCore/Core.qs b/src/Simulation/QsharpFoundation/Core.qs similarity index 100% rename from src/Simulation/QsharpCore/Core.qs rename to src/Simulation/QsharpFoundation/Core.qs diff --git a/src/Simulation/QsharpCore/Diagnostics/Assert.qs b/src/Simulation/QsharpFoundation/Diagnostics/Assert.qs similarity index 95% rename from src/Simulation/QsharpCore/Diagnostics/Assert.qs rename to src/Simulation/QsharpFoundation/Diagnostics/Assert.qs index 6f5cb339633..9b0635279a9 100644 --- a/src/Simulation/QsharpCore/Diagnostics/Assert.qs +++ b/src/Simulation/QsharpFoundation/Diagnostics/Assert.qs @@ -1,10 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -namespace Microsoft.Quantum.Diagnostics { - open Microsoft.Quantum.Intrinsic; - open Microsoft.Quantum.Canon; - +namespace Microsoft.Quantum.Diagnostics { /// # Summary /// Asserts that measuring the given qubits in the given Pauli basis will /// always have the given result. diff --git a/src/Simulation/QsharpCore/Diagnostics/AssertAllZero.qs b/src/Simulation/QsharpFoundation/Diagnostics/AssertAllZero.qs similarity index 100% rename from src/Simulation/QsharpCore/Diagnostics/AssertAllZero.qs rename to src/Simulation/QsharpFoundation/Diagnostics/AssertAllZero.qs diff --git a/src/Simulation/QsharpCore/Diagnostics/AssertQubit.qs b/src/Simulation/QsharpFoundation/Diagnostics/AssertQubit.qs similarity index 87% rename from src/Simulation/QsharpCore/Diagnostics/AssertQubit.qs rename to src/Simulation/QsharpFoundation/Diagnostics/AssertQubit.qs index 973c07e8f7a..9c74954cd08 100644 --- a/src/Simulation/QsharpCore/Diagnostics/AssertQubit.qs +++ b/src/Simulation/QsharpFoundation/Diagnostics/AssertQubit.qs @@ -22,7 +22,7 @@ namespace Microsoft.Quantum.Diagnostics { /// allows for asserting /// arbitrary qubit states rather than only $Z$ eigenstates. operation AssertQubit (expected : Result, q : Qubit) : Unit { - Assert([PauliZ], [q], expected, $"Qubit in invalid state. Expecting: {expected}"); + AssertMeasurement([PauliZ], [q], expected, $"Qubit in invalid state. Expecting: {expected}"); } /// # Summary @@ -47,7 +47,7 @@ namespace Microsoft.Quantum.Diagnostics { /// allows for asserting /// arbitrary qubit states rather than only $Z$ eigenstates. operation AssertQubitWithinTolerance(expected : Result, q : Qubit, tolerance : Double) : Unit { - AssertProb([PauliZ], [q], expected, 1.0, $"Qubit in invalid state. Expecting: {expected} with tolerance {tolerance}", tolerance); + AssertMeasurementProbability([PauliZ], [q], expected, 1.0, $"Qubit in invalid state. Expecting: {expected} with tolerance {tolerance}", tolerance); } /// # Summary @@ -126,10 +126,10 @@ namespace Microsoft.Quantum.Diagnostics { // Probability of getting outcome One in measuring PauliZ is Tr(M(I-Z)/2) = (mi-mz)/2.0 // similarly, we find the probabilities for measuring PauliX,PauliY let tol = tolerance / 2.0; - AssertProb([PauliX], [register], Zero, (mi + mx) / 2.0, $"Qubit Zero probability on X basis failed", tol); - AssertProb([PauliY], [register], Zero, (mi + my) / 2.0, $"Qubit Zero probability on Y basis failed", tol); - AssertProb([PauliZ], [register], Zero, (mi + mz) / 2.0, $"Qubit Zero probability on Z basis failed", tol); - AssertProb([PauliZ], [register], One, (mi - mz) / 2.0, $"Qubit One probability on Z basis failed", tol); + AssertMeasurementProbability([PauliX], [register], Zero, (mi + mx) / 2.0, $"Qubit Zero probability on X basis failed", tol); + AssertMeasurementProbability([PauliY], [register], Zero, (mi + my) / 2.0, $"Qubit Zero probability on Y basis failed", tol); + AssertMeasurementProbability([PauliZ], [register], Zero, (mi + mz) / 2.0, $"Qubit Zero probability on Z basis failed", tol); + AssertMeasurementProbability([PauliZ], [register], One, (mi - mz) / 2.0, $"Qubit One probability on Z basis failed", tol); } } diff --git a/src/Simulation/QsharpCore/Diagnostics/Dump.qs b/src/Simulation/QsharpFoundation/Diagnostics/Dump.qs similarity index 98% rename from src/Simulation/QsharpCore/Diagnostics/Dump.qs rename to src/Simulation/QsharpFoundation/Diagnostics/Dump.qs index 6484a93cc35..316b3305290 100644 --- a/src/Simulation/QsharpCore/Diagnostics/Dump.qs +++ b/src/Simulation/QsharpFoundation/Diagnostics/Dump.qs @@ -26,6 +26,7 @@ namespace Microsoft.Quantum.Diagnostics { /// one-dimensional array of complex numbers, in which each element represents /// the amplitudes of the probability of measuring the corresponding state. function DumpMachine<'T> (location : 'T) : Unit { + body intrinsic; } /// # Summary @@ -56,6 +57,7 @@ namespace Microsoft.Quantum.Diagnostics { /// If the given qubits are entangled with some other qubit and their /// state can't be separated, it just reports that the qubits are entangled. function DumpRegister<'T> (location : 'T, qubits : Qubit[]) : Unit { + body intrinsic; } } diff --git a/src/Simulation/QsharpCore/Diagnostics/Facts.qs b/src/Simulation/QsharpFoundation/Diagnostics/Facts.qs similarity index 100% rename from src/Simulation/QsharpCore/Diagnostics/Facts.qs rename to src/Simulation/QsharpFoundation/Diagnostics/Facts.qs diff --git a/src/Simulation/QsharpCore/Diagnostics/Properties/NamespaceInfo.qs b/src/Simulation/QsharpFoundation/Diagnostics/Properties/NamespaceInfo.qs similarity index 100% rename from src/Simulation/QsharpCore/Diagnostics/Properties/NamespaceInfo.qs rename to src/Simulation/QsharpFoundation/Diagnostics/Properties/NamespaceInfo.qs diff --git a/src/Simulation/QsharpCore/Diagnostics/UnitTests.qs b/src/Simulation/QsharpFoundation/Diagnostics/UnitTests.qs similarity index 100% rename from src/Simulation/QsharpCore/Diagnostics/UnitTests.qs rename to src/Simulation/QsharpFoundation/Diagnostics/UnitTests.qs diff --git a/src/Simulation/QsharpCore/Environment.qs b/src/Simulation/QsharpFoundation/Environment.qs similarity index 95% rename from src/Simulation/QsharpCore/Environment.qs rename to src/Simulation/QsharpFoundation/Environment.qs index 145a9f0d645..9f5018d1fc4 100644 --- a/src/Simulation/QsharpCore/Environment.qs +++ b/src/Simulation/QsharpFoundation/Environment.qs @@ -15,7 +15,7 @@ namespace Microsoft.Quantum.Environment { /// # See Also /// - GetQubitsAvailableToBorrow operation GetQubitsAvailableToUse () : Int { - return -1; + body intrinsic; } /// # Summary @@ -30,7 +30,7 @@ namespace Microsoft.Quantum.Environment { /// # See Also /// - GetQubitsAvailableToUse operation GetQubitsAvailableToBorrow () : Int { - return -1; + body intrinsic; } } diff --git a/src/Simulation/QsharpCore/Math/Constants.qs b/src/Simulation/QsharpFoundation/Math/Constants.qs similarity index 100% rename from src/Simulation/QsharpCore/Math/Constants.qs rename to src/Simulation/QsharpFoundation/Math/Constants.qs diff --git a/src/Simulation/QsharpCore/Math/Deprecated.qs b/src/Simulation/QsharpFoundation/Math/Deprecated.qs similarity index 100% rename from src/Simulation/QsharpCore/Math/Deprecated.qs rename to src/Simulation/QsharpFoundation/Math/Deprecated.qs diff --git a/src/Simulation/QsharpCore/Math/Math.cs b/src/Simulation/QsharpFoundation/Math/Math.cs similarity index 100% rename from src/Simulation/QsharpCore/Math/Math.cs rename to src/Simulation/QsharpFoundation/Math/Math.cs diff --git a/src/Simulation/QsharpCore/Math/Math.qs b/src/Simulation/QsharpFoundation/Math/Math.qs similarity index 100% rename from src/Simulation/QsharpCore/Math/Math.qs rename to src/Simulation/QsharpFoundation/Math/Math.qs diff --git a/src/Simulation/QsharpCore/Math/Trig.qs b/src/Simulation/QsharpFoundation/Math/Trig.qs similarity index 100% rename from src/Simulation/QsharpCore/Math/Trig.qs rename to src/Simulation/QsharpFoundation/Math/Trig.qs diff --git a/src/Simulation/QsharpCore/Math/Types.qs b/src/Simulation/QsharpFoundation/Math/Types.qs similarity index 100% rename from src/Simulation/QsharpCore/Math/Types.qs rename to src/Simulation/QsharpFoundation/Math/Types.qs diff --git a/src/Simulation/QsharpFoundation/Message.qs b/src/Simulation/QsharpFoundation/Message.qs new file mode 100644 index 00000000000..2a5a920491b --- /dev/null +++ b/src/Simulation/QsharpFoundation/Message.qs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + /// # Summary + /// Logs a message. + /// + /// # Input + /// ## msg + /// The message to be reported. + /// + /// # Remarks + /// The specific behavior of this function is simulator-dependent, + /// but in most cases the given message will be written to the console. + function Message (msg : String) : Unit { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/QsharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj b/src/Simulation/QsharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj new file mode 100644 index 00000000000..485fa751f6b --- /dev/null +++ b/src/Simulation/QsharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj @@ -0,0 +1,44 @@ + + + + + + + netstandard2.1 + true + false + false + + + + Microsoft + Foundation implementation for the Q# programming language. + See: https://docs.microsoft.com/en-us/quantum/relnotes/ + MIT + https://github.com/microsoft/qsharp-runtime + qdk-nuget-icon.png + Quantum Q# Qsharp + true + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/QsharpFoundation/Random.qs b/src/Simulation/QsharpFoundation/Random.qs new file mode 100644 index 00000000000..c32e1fc731a --- /dev/null +++ b/src/Simulation/QsharpFoundation/Random.qs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + /// # Summary + /// The random operation takes an array of doubles as input, and returns + /// a randomly-selected index into the array as an `Int`. + /// The probability of selecting a specific index is proportional to the value + /// of the array element at that index. + /// Array elements that are equal to zero are ignored and their indices are never + /// returned. If any array element is less than zero, + /// or if no array element is greater than zero, then the operation fails. + /// + /// # Input + /// ## probs + /// An array of floating-point numbers proportional to the probability of + /// selecting each index. + /// + /// # Output + /// An integer $i$ with probability $\Pr(i) = p_i / \sum_i p_i$, where $p_i$ + /// is the $i$th element of `probs`. + @Deprecated("Microsoft.Quantum.Random.DrawCategorical") + operation Random (probs : Double[]) : Int { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/QsharpCore/Random/Convienence.qs b/src/Simulation/QsharpFoundation/Random/Convienence.qs similarity index 100% rename from src/Simulation/QsharpCore/Random/Convienence.qs rename to src/Simulation/QsharpFoundation/Random/Convienence.qs diff --git a/src/Simulation/QsharpCore/Random/Internal.qs b/src/Simulation/QsharpFoundation/Random/Internal.qs similarity index 100% rename from src/Simulation/QsharpCore/Random/Internal.qs rename to src/Simulation/QsharpFoundation/Random/Internal.qs diff --git a/src/Simulation/QsharpCore/Random/Intrinsic.qs b/src/Simulation/QsharpFoundation/Random/Intrinsic.qs similarity index 100% rename from src/Simulation/QsharpCore/Random/Intrinsic.qs rename to src/Simulation/QsharpFoundation/Random/Intrinsic.qs diff --git a/src/Simulation/QsharpCore/Random/Normal.qs b/src/Simulation/QsharpFoundation/Random/Normal.qs similarity index 100% rename from src/Simulation/QsharpCore/Random/Normal.qs rename to src/Simulation/QsharpFoundation/Random/Normal.qs diff --git a/src/Simulation/QsharpCore/Random/Types.qs b/src/Simulation/QsharpFoundation/Random/Types.qs similarity index 100% rename from src/Simulation/QsharpCore/Random/Types.qs rename to src/Simulation/QsharpFoundation/Random/Types.qs diff --git a/src/Simulation/QsharpCore/Random/Uniform.qs b/src/Simulation/QsharpFoundation/Random/Uniform.qs similarity index 100% rename from src/Simulation/QsharpCore/Random/Uniform.qs rename to src/Simulation/QsharpFoundation/Random/Uniform.qs diff --git a/src/Simulation/QsharpCore/Statements/Allocate.cs b/src/Simulation/QsharpFoundation/Statements/Allocate.cs similarity index 100% rename from src/Simulation/QsharpCore/Statements/Allocate.cs rename to src/Simulation/QsharpFoundation/Statements/Allocate.cs diff --git a/src/Simulation/QsharpCore/Statements/Borrow.cs b/src/Simulation/QsharpFoundation/Statements/Borrow.cs similarity index 100% rename from src/Simulation/QsharpCore/Statements/Borrow.cs rename to src/Simulation/QsharpFoundation/Statements/Borrow.cs diff --git a/src/Simulation/QsharpCore/Statements/Release.cs b/src/Simulation/QsharpFoundation/Statements/Release.cs similarity index 100% rename from src/Simulation/QsharpCore/Statements/Release.cs rename to src/Simulation/QsharpFoundation/Statements/Release.cs diff --git a/src/Simulation/QsharpCore/Statements/Return.cs b/src/Simulation/QsharpFoundation/Statements/Return.cs similarity index 100% rename from src/Simulation/QsharpCore/Statements/Return.cs rename to src/Simulation/QsharpFoundation/Statements/Return.cs diff --git a/src/Simulation/QsharpCore/Targeting.qs b/src/Simulation/QsharpFoundation/Targeting.qs similarity index 100% rename from src/Simulation/QsharpCore/Targeting.qs rename to src/Simulation/QsharpFoundation/Targeting.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/AndLadder.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/AndLadder.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/AndLadder.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/AndLadder.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ApplyByIndex.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ApplyByIndex.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ApplyByIndex.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ApplyByIndex.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/CCX.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCX.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/CCX.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCX.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/CCZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCZ.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/CCZ.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCZ.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/CCminusIX.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCminusIX.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/CCminusIX.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCminusIX.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/CCminusIZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCminusIZ.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/CCminusIZ.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CCminusIZ.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/CZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CZ.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/CZ.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/CZ.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledH.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledH.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledH.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledH.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledR.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledR.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledR.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledR.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledR1.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledR1.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledR1.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledR1.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledR1Frac.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledR1Frac.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledR1Frac.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledR1Frac.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledRFrac.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledRFrac.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledRFrac.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledRFrac.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledRZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledRZ.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledRZ.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledRZ.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledRZFrac.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledRZFrac.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledRZFrac.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledRZFrac.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledSWAP.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledSWAP.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledSWAP.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledSWAP.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledT.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledT.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledT.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledT.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledTPower.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledTPower.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledTPower.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledTPower.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledTS.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledTS.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ControlledTS.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ControlledTS.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ExpFracZZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ExpFracZZ.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ExpFracZZ.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ExpFracZZ.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ExpFracZZZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ExpFracZZZ.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ExpFracZZZ.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ExpFracZZZ.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ExpZZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ExpZZ.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ExpZZ.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ExpZZ.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/FailOn.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/FailOn.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/FailOn.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/FailOn.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/IndiciesOfNonIdentity.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/IndiciesOfNonIdentity.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/IndiciesOfNonIdentity.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/IndiciesOfNonIdentity.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Interface.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Interface.qs similarity index 96% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Interface.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Interface.qs index b3a4884303c..bccc4e6a815 100644 --- a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Interface.qs +++ b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Interface.qs @@ -1,80 +1,80 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Quantum.Simulation.Simulators.QCTraceSimulators.Implementation { - - /// # Summary - /// Controlled-X gate natively supported by the machine - /// - /// # Input - /// ## control - /// the qubit used to control the application of X gate - /// ## target - /// the qubit to which Pauli X is applied when control qubit is in state |1⟩ - /// - /// # Remarks - /// Controlled-X gate with target on qubit 2 and control on qubit 1 - /// is C₁X₂ = [ [1,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,1,0] ] - operation Interface_CX (control : Qubit, target : Qubit) : Unit { - body intrinsic; - } - - /// # Summary - /// R gate natively supported by the machine. It is exp(-iφP/2) where P is the Pauli matrix - /// - /// # Input - /// ## axis - /// Pauli matrix, P - /// ## angle - /// Rotation angle, φ - /// ## target - /// the qubit operation is acting on - operation Interface_R (axis : Pauli, angle : Double, target : Qubit) : Unit { - body intrinsic; - } - - /// # Summary - /// RzFrac gate natively supported by the machine. It is exp(iπkP/2ⁿ) where P is the Pauli matrix - /// - /// # Input - /// ## axis - /// Pauli matrix, P - /// ## numerator - /// k - /// ## power - /// n - /// ## target - /// the qubit operation is acting on - /// - /// # Remarks - /// When power is 3 or less the operation is guaranteed to use S and T and Z gates to perform rotation - operation Interface_RFrac (axis : Pauli, numerator : Int, power : Int, target : Qubit) : Unit { - body intrinsic; - } - - /// # Summary - /// Applies Clifford multiplied by a pauli matrix - /// given by 'pauli' to the qubit given by 'target' - /// - /// # Input - /// ## cliffordId - /// Id of the single qubit unitary to apply. See remarks - /// - /// # Remarks - /// The list of id's corresponding to Cliffords is given by: - /// Identity - 0 - /// H - 1 - /// S - 2 - /// H followed by S ( as circuit ) - 3 - /// S followed by H ( as circuit ) - 4 - /// H S H - 5 - operation Interface_Clifford (cliffordId : Int, pauli : Pauli, target : Qubit) : Unit { - body intrinsic; - } - - - /// Forces the future measurement of a given observable to give specified result - operation ForceMeasure (observable : Pauli[], target : Qubit[], result : Result) : Unit { - body intrinsic; - } -} +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Simulation.Simulators.QCTraceSimulators.Implementation { + + /// # Summary + /// Controlled-X gate natively supported by the machine + /// + /// # Input + /// ## control + /// the qubit used to control the application of X gate + /// ## target + /// the qubit to which Pauli X is applied when control qubit is in state |1⟩ + /// + /// # Remarks + /// Controlled-X gate with target on qubit 2 and control on qubit 1 + /// is C₁X₂ = [ [1,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,1,0] ] + operation Interface_CX (control : Qubit, target : Qubit) : Unit { + body intrinsic; + } + + /// # Summary + /// R gate natively supported by the machine. It is exp(-iφP/2) where P is the Pauli matrix + /// + /// # Input + /// ## axis + /// Pauli matrix, P + /// ## angle + /// Rotation angle, φ + /// ## target + /// the qubit operation is acting on + operation Interface_R (axis : Pauli, angle : Double, target : Qubit) : Unit { + body intrinsic; + } + + /// # Summary + /// RzFrac gate natively supported by the machine. It is exp(iπkP/2ⁿ) where P is the Pauli matrix + /// + /// # Input + /// ## axis + /// Pauli matrix, P + /// ## numerator + /// k + /// ## power + /// n + /// ## target + /// the qubit operation is acting on + /// + /// # Remarks + /// When power is 3 or less the operation is guaranteed to use S and T and Z gates to perform rotation + operation Interface_RFrac (axis : Pauli, numerator : Int, power : Int, target : Qubit) : Unit { + body intrinsic; + } + + /// # Summary + /// Applies Clifford multiplied by a pauli matrix + /// given by 'pauli' to the qubit given by 'target' + /// + /// # Input + /// ## cliffordId + /// Id of the single qubit unitary to apply. See remarks + /// + /// # Remarks + /// The list of id's corresponding to Cliffords is given by: + /// Identity - 0 + /// H - 1 + /// S - 2 + /// H followed by S ( as circuit ) - 3 + /// S followed by H ( as circuit ) - 4 + /// H S H - 5 + operation Interface_Clifford (cliffordId : Int, pauli : Pauli, target : Qubit) : Unit { + body intrinsic; + } + + + /// Forces the future measurement of a given observable to give specified result + operation ForceMeasure (observable : Pauli[], target : Qubit[], result : Result) : Unit { + body intrinsic; + } +} diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/InternalOperations.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/InternalOperations.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/InternalOperations.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/InternalOperations.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Mod.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Mod.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Mod.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Mod.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiCX.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiCX.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiCX.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiCX.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiControlledFromOpAndSinglyCtrldOp.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiControlledFromOpAndSinglyCtrldOp.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiControlledFromOpAndSinglyCtrldOp.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiControlledFromOpAndSinglyCtrldOp.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiControlledMultiNot.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiControlledMultiNot.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiControlledMultiNot.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiControlledMultiNot.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiControlledU.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiControlledU.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiControlledU.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiControlledU.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiPauliFlip.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiPauliFlip.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/MultiPauliFlip.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/MultiPauliFlip.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/PauliArrayByIndex.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/PauliArrayByIndex.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/PauliArrayByIndex.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/PauliArrayByIndex.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/PauliXFlip.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/PauliXFlip.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/PauliXFlip.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/PauliXFlip.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/PauliZFlip.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/PauliZFlip.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/PauliZFlip.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/PauliZFlip.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.CCNOT.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.CCNOT.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.CCNOT.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.CCNOT.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.CNOT.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.CNOT.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.CNOT.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.CNOT.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Exp.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Exp.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Exp.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Exp.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.ExpFrac.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.ExpFrac.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.ExpFrac.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.ExpFrac.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.H.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.H.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.H.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.H.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.HY.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.HY.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.HY.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.HY.qs diff --git a/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingXX.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingXX.qs new file mode 100644 index 00000000000..3a3a2fb9899 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingXX.qs @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Simulation.Simulators.QCTraceSimulators.Circuits { + internal operation IsingXX (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + Exp([PauliX, PauliX], theta * 2.0, [qubit0, qubit1]); + } +} \ No newline at end of file diff --git a/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingYY.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingYY.qs new file mode 100644 index 00000000000..78484a19d3d --- /dev/null +++ b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingYY.qs @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Simulation.Simulators.QCTraceSimulators.Circuits { + internal operation IsingYY (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + Exp([PauliY, PauliY], theta * 2.0, [qubit0, qubit1]); + } +} \ No newline at end of file diff --git a/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingZZ.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingZZ.qs new file mode 100644 index 00000000000..797f7986f71 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.IsingZZ.qs @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Simulation.Simulators.QCTraceSimulators.Circuits { + internal operation IsingZZ (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + Exp([PauliZ, PauliZ], theta * 2.0, [qubit0, qubit1]); + } +} \ No newline at end of file diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.MultiX.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.MultiX.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.MultiX.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.MultiX.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.R.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.R.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.R.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.R.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.R1.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.R1.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.R1.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.R1.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.R1Frac.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.R1Frac.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.R1Frac.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.R1Frac.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.RFrac.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.RFrac.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.RFrac.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.RFrac.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Rx.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Rx.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Rx.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Rx.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Ry.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Ry.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Ry.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Ry.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Rz.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Rz.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Rz.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Rz.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.S.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.S.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.S.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.S.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.SWAP.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.SWAP.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.SWAP.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.SWAP.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.T.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.T.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.T.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.T.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.X.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.X.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.X.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.X.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Y.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Y.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Y.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Y.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Z.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Z.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/Primitive.Z.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/Primitive.Z.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Circuits/ReducedForm.qs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ReducedForm.qs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Circuits/ReducedForm.qs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Circuits/ReducedForm.qs diff --git a/src/Simulation/Simulators/QCTraceSimulator/InterfaceUtils.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/InterfaceUtils.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/InterfaceUtils.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/InterfaceUtils.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Diagnostics.Dump.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Diagnostics.Dump.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Diagnostics.Dump.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Diagnostics.Dump.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.CX.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.CX.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.CX.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.CX.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.Clifford.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.Clifford.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.Clifford.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.Clifford.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.ForceMeasure.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.ForceMeasure.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.ForceMeasure.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.ForceMeasure.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.R.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.R.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.R.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.R.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.RFrac.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.RFrac.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Interface.RFrac.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Interface.RFrac.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Allocate.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Allocate.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Allocate.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Allocate.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Assert.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Assert.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Assert.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Assert.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.AssertProb.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.AssertProb.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.AssertProb.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.AssertProb.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Borrow.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Borrow.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Borrow.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Borrow.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Measure.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Measure.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Measure.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Measure.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Release.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Release.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Release.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Release.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Return.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Return.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.Return.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.Return.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.random.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.random.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.Primitive.random.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.Primitive.random.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulator.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulator.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulatorImpl.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulatorImpl.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/QCTraceSimulatorImpl.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/QCTraceSimulatorImpl.cs diff --git a/src/Simulation/Simulators/QCTraceSimulator/Utils.cs b/src/Simulation/Simulators.Impl/QCTraceSimulator/Utils.cs similarity index 100% rename from src/Simulation/Simulators/QCTraceSimulator/Utils.cs rename to src/Simulation/Simulators.Impl/QCTraceSimulator/Utils.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Allocate.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Allocate.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Allocate.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Allocate.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Assert.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Assert.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Assert.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Assert.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/AssertProb.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/AssertProb.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/AssertProb.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/AssertProb.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Borrow.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Borrow.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Borrow.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Borrow.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/ClassicalControl.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/ClassicalControl.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/ClassicalControl.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/ClassicalControl.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Dump.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Dump.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Dump.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Dump.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Exp.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Exp.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Exp.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Exp.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/ExpFrac.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/ExpFrac.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/ExpFrac.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/ExpFrac.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/H.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/H.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/H.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/H.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/M.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/M.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/M.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/M.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Measure.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Measure.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Measure.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Measure.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/QuantumProcessorDispatcher.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/QuantumProcessorDispatcher.cs similarity index 80% rename from src/Simulation/Simulators/QuantumProcessor/QuantumProcessorDispatcher.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/QuantumProcessorDispatcher.cs index 0865e201a4e..19e72828973 100644 --- a/src/Simulation/Simulators/QuantumProcessor/QuantumProcessorDispatcher.cs +++ b/src/Simulation/Simulators.Impl/QuantumProcessor/QuantumProcessorDispatcher.cs @@ -29,13 +29,15 @@ public IQuantumProcessor QuantumProcessor /// An instance of a class implementing interface to be wrapped. /// An instance of a class implementing interface. If the parameter is null is used. /// A seed to be used by Q# Microsoft.Quantum.Intrinsic.Random operation. - public QuantumProcessorDispatcher(IQuantumProcessor quantumProcessor, IQubitManager? qubitManager = null, int? randomSeed = null) + /// A boolean that indicates whether only Q# callables that are defined as body intrinsic should be overridden. If false, the C# implementation will always override any Q# implementation. If true, the C# will only override Q# that does not have an implementation and is marked as body intrinsic. The value is false by default. + public QuantumProcessorDispatcher(IQuantumProcessor quantumProcessor, IQubitManager? qubitManager = null, int? randomSeed = null, bool onlyOverrideBodyIntrinsic = false) : base( qubitManager ?? new QubitManager( PreallocatedQubitCount, mayExtendCapacity: true, disableBorrowing: false ), - randomSeed + randomSeed, + onlyOverrideBodyIntrinsic ) { QuantumProcessor = quantumProcessor; diff --git a/src/Simulation/Simulators/QuantumProcessor/R.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/R.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/R.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/R.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/R1.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/R1.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/R1.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/R1.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/R1Frac.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/R1Frac.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/R1Frac.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/R1Frac.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/RFrac.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/RFrac.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/RFrac.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/RFrac.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Release.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Release.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Release.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Release.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Reset.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Reset.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Reset.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Reset.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Return.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Return.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Return.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Return.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/S.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/S.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/S.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/S.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/SWAP.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/SWAP.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/SWAP.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/SWAP.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/T.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/T.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/T.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/T.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/X.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/X.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/X.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/X.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Y.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Y.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Y.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Y.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/Z.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/Z.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/Z.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/Z.cs diff --git a/src/Simulation/Simulators/QuantumProcessor/random.cs b/src/Simulation/Simulators.Impl/QuantumProcessor/random.cs similarity index 100% rename from src/Simulation/Simulators/QuantumProcessor/random.cs rename to src/Simulation/Simulators.Impl/QuantumProcessor/random.cs diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyControlledX.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyControlledX.cs new file mode 100644 index 00000000000..835f6fa80cb --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyControlledX.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyControlledX : Intrinsic.ApplyControlledX + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCX")] + private static extern void MCX(uint id, uint count, uint[] ctrls, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimApplyControlledX(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(Qubit, Qubit), QVoid> __Body__ => (args) => + { + var (control, target) = args; + + Simulator.CheckQubits(new QArray(new Qubit[]{ control, target })); + + MCX(Simulator.Id, 1, new uint[]{(uint)control.Id}, (uint)target.Id); + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyControlledZ.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyControlledZ.cs new file mode 100644 index 00000000000..5bf1b755cab --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyControlledZ.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyControlledZ : Intrinsic.ApplyControlledZ + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCZ")] + private static extern void MCZ(uint id, uint count, uint[] ctrls, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimApplyControlledZ(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(Qubit, Qubit), QVoid> __Body__ => (args) => + { + var (control, target) = args; + + Simulator.CheckQubits(new QArray(new Qubit[]{ control, target })); + + MCZ(Simulator.Id, 1, new uint[]{(uint)control.Id}, (uint)target.Id); + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledH.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledH.cs new file mode 100644 index 00000000000..de3859e9f69 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledH.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledH : Intrinsic.ApplyUncontrolledH + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "H")] + private static extern void H(uint id, uint qubit); + + private QuantumSimulator Simulator { get; } + + + public QSimApplyUncontrolledH(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func __Body__ => (q1) => + { + Simulator.CheckQubit(q1); + + H(Simulator.Id, (uint)q1.Id); + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRx.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRx.cs new file mode 100644 index 00000000000..067f1294654 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRx.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledRx : Intrinsic.ApplyUncontrolledRx + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "R")] + private static extern void R(uint id, Pauli basis, double angle, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimApplyUncontrolledRx(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit), QVoid> __Body__ => (args) => + { + var (angle, target) = args; + Simulator.CheckQubit(target, nameof(target)); + CheckAngle(angle); + R(Simulator.Id, Pauli.PauliX, angle, (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(double, Qubit), QVoid> __AdjointBody__ => (_args) => + { + var (angle, q1) = _args; + + return this.__Body__.Invoke((-angle, q1)); + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRy.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRy.cs new file mode 100644 index 00000000000..25e79b98468 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRy.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledRy : Intrinsic.ApplyUncontrolledRy + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "R")] + private static extern void R(uint id, Pauli basis, double angle, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimApplyUncontrolledRy(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit), QVoid> __Body__ => (args) => + { + var (angle, target) = args; + Simulator.CheckQubit(target, nameof(target)); + CheckAngle(angle); + R(Simulator.Id, Pauli.PauliY, angle, (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(double, Qubit), QVoid> __AdjointBody__ => (_args) => + { + var (angle, q1) = _args; + + return this.__Body__.Invoke((-angle, q1)); + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRz.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRz.cs new file mode 100644 index 00000000000..4b1f3196daf --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledRz.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledRz : Intrinsic.ApplyUncontrolledRz + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "R")] + private static extern void R(uint id, Pauli basis, double angle, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimApplyUncontrolledRz(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit), QVoid> __Body__ => (args) => + { + var (angle, target) = args; + Simulator.CheckQubit(target, nameof(target)); + CheckAngle(angle); + R(Simulator.Id, Pauli.PauliZ, angle, (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(double, Qubit), QVoid> __AdjointBody__ => (_args) => + { + var (angle, q1) = _args; + + return this.__Body__.Invoke((-angle, q1)); + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledS.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledS.cs new file mode 100644 index 00000000000..19c92deb736 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledS.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledS : Intrinsic.ApplyUncontrolledS + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "S")] + private static extern void S(uint id, uint qubit); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AdjS")] + private static extern void AdjS(uint id, uint qubit); + + private QuantumSimulator Simulator { get; } + + + public QSimApplyUncontrolledS(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func __Body__ => (q1) => + { + Simulator.CheckQubit(q1); + + S(Simulator.Id, (uint)q1.Id); + + return QVoid.Instance; + }; + + public override Func __AdjointBody__ => (q1) => + { + Simulator.CheckQubit(q1); + + AdjS(Simulator.Id, (uint)q1.Id); + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledT.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledT.cs new file mode 100644 index 00000000000..94d626d53bb --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledT.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledT : Intrinsic.ApplyUncontrolledT + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "T")] + private static extern void T(uint id, uint qubit); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "AdjT")] + private static extern void AdjT(uint id, uint qubit); + + private QuantumSimulator Simulator { get; } + + + public QSimApplyUncontrolledT(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func __Body__ => (q1) => + { + Simulator.CheckQubit(q1); + + T(Simulator.Id, (uint)q1.Id); + return QVoid.Instance; + }; + + public override Func __AdjointBody__ => (q1) => + { + Simulator.CheckQubit(q1); + + AdjT(this.Simulator.Id, (uint)q1.Id); + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledX.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledX.cs new file mode 100644 index 00000000000..e2f9efa7347 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledX.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledX : Intrinsic.ApplyUncontrolledX + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "X")] + private static extern void X(uint id, uint qubit); + + private QuantumSimulator Simulator { get; } + + + public QSimApplyUncontrolledX(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func __Body__ => (q1) => + { + Simulator.CheckQubit(q1); + + X(Simulator.Id, (uint)q1.Id); + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledY.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledY.cs new file mode 100644 index 00000000000..8aa4c4b641e --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledY.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledY : Intrinsic.ApplyUncontrolledY + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Y")] + private static extern void Y(uint id, uint qubit); + + private QuantumSimulator Simulator { get; } + + + public QSimApplyUncontrolledY(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func __Body__ => (q1) => + { + Simulator.CheckQubit(q1); + + Y(Simulator.Id, (uint)q1.Id); + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledZ.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledZ.cs new file mode 100644 index 00000000000..1dc626a959b --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/ApplyUncontrolledZ.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + internal class QSimApplyUncontrolledZ : Intrinsic.ApplyUncontrolledZ + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Z")] + private static extern void Z(uint id, uint qubit); + + private QuantumSimulator Simulator { get; } + + + public QSimApplyUncontrolledZ(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func __Body__ => (q1) => + { + Simulator.CheckQubit(q1); + + Z(Simulator.Id, (uint)q1.Id); + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators/QuantumSimulator/Assert.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Assert.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/Assert.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Assert.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/AssertProb.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/AssertProb.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/AssertProb.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/AssertProb.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/Dump.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Dump.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/Dump.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Dump.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/Exp.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Exp.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/Exp.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Exp.cs diff --git a/src/Simulation/Common/Extensions.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Extensions.cs similarity index 89% rename from src/Simulation/Common/Extensions.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Extensions.cs index 22b14c4f7c3..bc7b9603630 100644 --- a/src/Simulation/Common/Extensions.cs +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/Extensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Reflection; using System.Diagnostics; using System.Linq; @@ -30,7 +31,7 @@ public static uint[] GetIds(this IQArray qubits) /// a subclass of T and registers as the override of the BaseType /// it implements. /// - public static void InitBuiltinOperations(this Factory factory, Type t) + public static void InitBuiltinOperations(this Factory factory, Type t, bool onlyOverrideBodyIntrinsic = false) { if (t == null) { @@ -39,11 +40,20 @@ public static void InitBuiltinOperations(this Factory factory, Type t) InitBuiltinOperations(factory, t.BaseType); + var overrideTypes = t.GetNestedTypes( + System.Reflection.BindingFlags.Public | + System.Reflection.BindingFlags.NonPublic); + var ops = - from op in t.GetNestedTypes() + from op in overrideTypes where op.IsSubclassOf(typeof(T)) select op; + if (onlyOverrideBodyIntrinsic) + { + ops = ops.Where(o => o.BaseType.IsAbstract); + } + foreach (var op in ops) { factory.Register(op.BaseType, op); diff --git a/src/Simulation/Simulators/QuantumSimulator/H.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/H.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/H.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/H.cs diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/IsingXX.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/IsingXX.cs new file mode 100644 index 00000000000..16672d025b0 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/IsingXX.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + internal class QSimIsingXX : Intrinsic.IsingXX + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Exp")] + private static extern void Exp(uint id, uint n, Pauli[] paulis, double angle, uint[] ids); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCExp")] + private static extern void MCExp(uint id, uint n, Pauli[] paulis, double angle, uint nc, uint[] ctrls, uint[] ids); + + private QuantumSimulator Simulator { get; } + + public QSimIsingXX(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit, Qubit), QVoid> __Body__ => (args) => + { + var (angle, qubit1, qubit2) = args; + var paulis = new Pauli[]{ Pauli.PauliX, Pauli.PauliX }; + var targets = new QArray(new Qubit[]{ qubit1, qubit2 }); + CheckAngle(angle); + Simulator.CheckQubits(targets); + + Exp(Simulator.Id, (uint)targets.Length, paulis, angle * 2.0, targets.GetIds()); + + return QVoid.Instance; + }; + + public override Func<(double, Qubit, Qubit), QVoid> __AdjointBody__ => (args) => + { + var (angle, qubit1, qubit2) = args; + + return this.__Body__.Invoke((-angle, qubit1, qubit2)); + }; + + public override Func<(IQArray, (double, Qubit, Qubit)), QVoid> __ControlledBody__ => (args) => + { + var (ctrls, (angle, qubit1, qubit2)) = args; + + if (ctrls == null || ctrls.Length == 0) + { + this.__Body__.Invoke((angle, qubit1, qubit2)); + } + else + { + var targets = new QArray(new Qubit[]{ qubit1, qubit2 }); + var paulis = new Pauli[]{ Pauli.PauliX, Pauli.PauliX }; + CheckAngle(angle); + Simulator.CheckQubits(QArray.Add(ctrls, targets)); + + MCExp(Simulator.Id, (uint)targets.Length, paulis, angle * 2.0, (uint)ctrls.Length, ctrls.GetIds(), targets.GetIds()); + } + + return QVoid.Instance; + }; + + public override Func<(IQArray, (double, Qubit, Qubit)), QVoid> __ControlledAdjointBody__ => (args) => + { + var (ctrls, (angle, qubit1, qubit2)) = args; + + return this.__ControlledBody__.Invoke((ctrls, (-angle, qubit1, qubit2))); + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/IsingYY.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/IsingYY.cs new file mode 100644 index 00000000000..1a22e5a1a62 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/IsingYY.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + internal class QSimIsingYY : Intrinsic.IsingYY + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Exp")] + private static extern void Exp(uint id, uint n, Pauli[] paulis, double angle, uint[] ids); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCExp")] + private static extern void MCExp(uint id, uint n, Pauli[] paulis, double angle, uint nc, uint[] ctrls, uint[] ids); + + private QuantumSimulator Simulator { get; } + + public QSimIsingYY(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit, Qubit), QVoid> __Body__ => (args) => + { + var (angle, qubit1, qubit2) = args; + var paulis = new Pauli[]{ Pauli.PauliY, Pauli.PauliY }; + var targets = new QArray(new Qubit[]{ qubit1, qubit2 }); + CheckAngle(angle); + Simulator.CheckQubits(targets); + + Exp(Simulator.Id, (uint)targets.Length, paulis, angle * 2.0, targets.GetIds()); + + return QVoid.Instance; + }; + + public override Func<(double, Qubit, Qubit), QVoid> __AdjointBody__ => (args) => + { + var (angle, qubit1, qubit2) = args; + + return this.__Body__.Invoke((-angle, qubit1, qubit2)); + }; + + public override Func<(IQArray, (double, Qubit, Qubit)), QVoid> __ControlledBody__ => (args) => + { + var (ctrls, (angle, qubit1, qubit2)) = args; + + if (ctrls == null || ctrls.Length == 0) + { + this.__Body__.Invoke((angle, qubit1, qubit2)); + } + else + { + var targets = new QArray(new Qubit[]{ qubit1, qubit2 }); + var paulis = new Pauli[]{ Pauli.PauliY, Pauli.PauliY }; + CheckAngle(angle); + Simulator.CheckQubits(QArray.Add(ctrls, targets)); + + MCExp(Simulator.Id, (uint)targets.Length, paulis, angle * 2.0, (uint)ctrls.Length, ctrls.GetIds(), targets.GetIds()); + } + + return QVoid.Instance; + }; + + public override Func<(IQArray, (double, Qubit, Qubit)), QVoid> __ControlledAdjointBody__ => (args) => + { + var (ctrls, (angle, qubit1, qubit2)) = args; + + return this.__ControlledBody__.Invoke((ctrls, (-angle, qubit1, qubit2))); + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/IsingZZ.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/IsingZZ.cs new file mode 100644 index 00000000000..faf9df00312 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/IsingZZ.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + internal class QSimIsingZZ : Intrinsic.IsingZZ + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "Exp")] + private static extern void Exp(uint id, uint n, Pauli[] paulis, double angle, uint[] ids); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCExp")] + private static extern void MCExp(uint id, uint n, Pauli[] paulis, double angle, uint nc, uint[] ctrls, uint[] ids); + + private QuantumSimulator Simulator { get; } + + public QSimIsingZZ(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit, Qubit), QVoid> __Body__ => (args) => + { + var (angle, qubit1, qubit2) = args; + var paulis = new Pauli[]{ Pauli.PauliZ, Pauli.PauliZ }; + var targets = new QArray(new Qubit[]{ qubit1, qubit2 }); + CheckAngle(angle); + Simulator.CheckQubits(targets); + + Exp(Simulator.Id, (uint)targets.Length, paulis, angle * 2.0, targets.GetIds()); + + return QVoid.Instance; + }; + + public override Func<(double, Qubit, Qubit), QVoid> __AdjointBody__ => (args) => + { + var (angle, qubit1, qubit2) = args; + + return this.__Body__.Invoke((-angle, qubit1, qubit2)); + }; + + public override Func<(IQArray, (double, Qubit, Qubit)), QVoid> __ControlledBody__ => (args) => + { + var (ctrls, (angle, qubit1, qubit2)) = args; + + if (ctrls == null || ctrls.Length == 0) + { + this.__Body__.Invoke((angle, qubit1, qubit2)); + } + else + { + var targets = new QArray(new Qubit[]{ qubit1, qubit2 }); + var paulis = new Pauli[]{ Pauli.PauliZ, Pauli.PauliZ }; + CheckAngle(angle); + Simulator.CheckQubits(QArray.Add(ctrls, targets)); + + MCExp(Simulator.Id, (uint)targets.Length, paulis, angle * 2.0, (uint)ctrls.Length, ctrls.GetIds(), targets.GetIds()); + } + + return QVoid.Instance; + }; + + public override Func<(IQArray, (double, Qubit, Qubit)), QVoid> __ControlledAdjointBody__ => (args) => + { + var (ctrls, (angle, qubit1, qubit2)) = args; + + return this.__ControlledBody__.Invoke((ctrls, (-angle, qubit1, qubit2))); + }; + } + } +} diff --git a/src/Simulation/Simulators/QuantumSimulator/M.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/M.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/M.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/M.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/Measure.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Measure.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/Measure.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Measure.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/QuantumSimulator.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/QuantumSimulator.cs similarity index 99% rename from src/Simulation/Simulators/QuantumSimulator/QuantumSimulator.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/QuantumSimulator.cs index acf8fdf29b5..08a7c3a9b87 100644 --- a/src/Simulation/Simulators/QuantumSimulator/QuantumSimulator.cs +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/QuantumSimulator.cs @@ -43,7 +43,8 @@ public QuantumSimulator( bool disableBorrowing = false) : base( new QSimQubitManager(throwOnReleasingQubitsNotInZeroState, disableBorrowing : disableBorrowing), - (int?)randomNumberGeneratorSeed + (int?)randomNumberGeneratorSeed, + true ) { Id = Init(); diff --git a/src/Simulation/Simulators/QuantumSimulator/Qubit.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Qubit.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/Qubit.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Qubit.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/QubitManager.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/QubitManager.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/QubitManager.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/QubitManager.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/R.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/R.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/R.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/R.cs diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/Reset.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Reset.cs new file mode 100644 index 00000000000..9f6d2d6501e --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/Reset.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + public partial class QuantumSimulator + { + public class QSimReset : Intrinsic.Reset + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "X")] + private static extern void X(uint id, uint qubit); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "M")] + private static extern uint M(uint id, uint q); + + private QuantumSimulator Simulator { get; } + + + public QSimReset(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func __Body__ => (q1) => + { + // The native simulator doesn't have a reset operation, so simulate + // it via an M follow by a conditional X. + Simulator.CheckQubit(q1); + var res = M(Simulator.Id, (uint)q1.Id); + if (res == 1) + { + X(Simulator.Id, (uint)q1.Id); + } + + return QVoid.Instance; + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/Rx.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Rx.cs new file mode 100644 index 00000000000..11a3f0775a1 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/Rx.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + public class QSimRx : Intrinsic.Rx + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "R")] + private static extern void R(uint id, Pauli basis, double angle, uint qubit); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCR")] + private static extern void MCR(uint id, Pauli basis, double angle, uint count, uint[] ctrls, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimRx(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit), QVoid> __Body__ => (args) => + { + var (angle, target) = args; + Simulator.CheckQubit(target, nameof(target)); + CheckAngle(angle); + R(Simulator.Id, Pauli.PauliX, angle, (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(double, Qubit), QVoid> __AdjointBody__ => (_args) => + { + var (angle, q1) = _args; + + return this.__Body__.Invoke((-angle, q1)); + }; + + public override Func<(IQArray, (double, Qubit)), QVoid> __ControlledBody__ => (args) => + { + var (ctrls, (angle, target)) = args; + Simulator.CheckQubits(ctrls, target); + CheckAngle(angle); + MCR(Simulator.Id, Pauli.PauliX, angle, (uint)ctrls.Length, ctrls.GetIds(), (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(IQArray, (double, Qubit)), QVoid> __ControlledAdjointBody__ => (_args) => + { + var (ctrls, (angle, q1)) = _args; + + return this.__ControlledBody__.Invoke((ctrls, (-angle, q1))); + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/Ry.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Ry.cs new file mode 100644 index 00000000000..5e27feb2d22 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/Ry.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + public class QSimRy : Intrinsic.Ry + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "R")] + private static extern void R(uint id, Pauli basis, double angle, uint qubit); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCR")] + private static extern void MCR(uint id, Pauli basis, double angle, uint count, uint[] ctrls, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimRy(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit), QVoid> __Body__ => (args) => + { + var (angle, target) = args; + Simulator.CheckQubit(target, nameof(target)); + CheckAngle(angle); + R(Simulator.Id, Pauli.PauliY, angle, (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(double, Qubit), QVoid> __AdjointBody__ => (_args) => + { + var (angle, q1) = _args; + + return this.__Body__.Invoke((-angle, q1)); + }; + + public override Func<(IQArray, (double, Qubit)), QVoid> __ControlledBody__ => (args) => + { + var (ctrls, (angle, target)) = args; + Simulator.CheckQubits(ctrls, target); + CheckAngle(angle); + MCR(Simulator.Id, Pauli.PauliY, angle, (uint)ctrls.Length, ctrls.GetIds(), (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(IQArray, (double, Qubit)), QVoid> __ControlledAdjointBody__ => (_args) => + { + var (ctrls, (angle, q1)) = _args; + + return this.__ControlledBody__.Invoke((ctrls, (-angle, q1))); + }; + } + } +} diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/Rz.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Rz.cs new file mode 100644 index 00000000000..305bee227c1 --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/Rz.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + public class QSimRz : Intrinsic.Rz + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "R")] + private static extern void R(uint id, Pauli basis, double angle, uint qubit); + + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCR")] + private static extern void MCR(uint id, Pauli basis, double angle, uint count, uint[] ctrls, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimRz(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(double, Qubit), QVoid> __Body__ => (args) => + { + var (angle, target) = args; + Simulator.CheckQubit(target, nameof(target)); + CheckAngle(angle); + R(Simulator.Id, Pauli.PauliZ, angle, (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(double, Qubit), QVoid> __AdjointBody__ => (_args) => + { + var (angle, q1) = _args; + + return this.__Body__.Invoke((-angle, q1)); + }; + + public override Func<(IQArray, (double, Qubit)), QVoid> __ControlledBody__ => (args) => + { + var (ctrls, (angle, target)) = args; + Simulator.CheckQubits(ctrls, target); + CheckAngle(angle); + MCR(Simulator.Id, Pauli.PauliZ, angle, (uint)ctrls.Length, ctrls.GetIds(), (uint)target.Id); + return QVoid.Instance; + }; + + public override Func<(IQArray, (double, Qubit)), QVoid> __ControlledAdjointBody__ => (_args) => + { + var (ctrls, (angle, q1)) = _args; + + return this.__ControlledBody__.Invoke((ctrls, (-angle, q1))); + }; + } + } +} diff --git a/src/Simulation/Simulators/QuantumSimulator/S.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/S.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/S.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/S.cs diff --git a/src/Simulation/Simulators.Impl/QuantumSimulator/SWAP.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/SWAP.cs new file mode 100644 index 00000000000..011dd26545f --- /dev/null +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/SWAP.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators +{ + + public partial class QuantumSimulator + { + public class QSimSWAP : Intrinsic.SWAP + { + [DllImport(QSIM_DLL_NAME, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, EntryPoint = "MCX")] + private static extern void MCX(uint id, uint count, uint[] ctrls, uint qubit); + + private QuantumSimulator Simulator { get; } + + public QSimSWAP(QuantumSimulator m) : base(m) + { + this.Simulator = m; + } + + public override Func<(Qubit, Qubit), QVoid> __Body__ => (args) => + { + var (qubit1, qubit2) = args; + var ctrls1 = new QArray(qubit1); + var ctrls2 = new QArray(qubit2); + Simulator.CheckQubits(ctrls1, qubit2); + + MCX(Simulator.Id, (uint)ctrls1.Length, ctrls1.GetIds(), (uint)qubit2.Id); + MCX(Simulator.Id, (uint)ctrls2.Length, ctrls2.GetIds(), (uint)qubit1.Id); + MCX(Simulator.Id, (uint)ctrls1.Length, ctrls1.GetIds(), (uint)qubit2.Id); + + return QVoid.Instance; + }; + + public override Func<(IQArray, (Qubit, Qubit)), QVoid> __ControlledBody__ => (args) => + { + var (ctrls, (qubit1, qubit2)) = args; + + if ((ctrls == null) || (ctrls.Count == 0)) + { + this.Apply((qubit1, qubit2)); + } + else + { + var ctrls_1 = QArray.Add(ctrls, new QArray(qubit1)); + var ctrls_2 = QArray.Add(ctrls, new QArray(qubit2)); + Simulator.CheckQubits(ctrls_1, qubit2); + + MCX(Simulator.Id, (uint)ctrls_1.Length, ctrls_1.GetIds(), (uint)qubit2.Id); + MCX(Simulator.Id, (uint)ctrls_2.Length, ctrls_2.GetIds(), (uint)qubit1.Id); + MCX(Simulator.Id, (uint)ctrls_1.Length, ctrls_1.GetIds(), (uint)qubit2.Id); + } + + return QVoid.Instance; + }; + + } + } +} diff --git a/src/Simulation/Common/SimulatorBase.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/SimulatorBase.cs similarity index 97% rename from src/Simulation/Common/SimulatorBase.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/SimulatorBase.cs index 4b7d4e25945..e12051f5fa8 100644 --- a/src/Simulation/Common/SimulatorBase.cs +++ b/src/Simulation/Simulators.Impl/QuantumSimulator/SimulatorBase.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.Quantum.Simulation.Core; @@ -14,20 +13,6 @@ namespace Microsoft.Quantum.Simulation.Common { - /// - /// A class that implements exception to be thrown when Operation is not supported. - /// - public class UnsupportedOperationException : PlatformNotSupportedException - { - public UnsupportedOperationException(string text = "", - [CallerFilePath] string file = "", - [CallerMemberName] string member = "", - [CallerLineNumber] int line = 0) - : base($"{file}::{line}::[{member}]:{text}") - { - } - } - /// /// A Base class for Simulators. /// It provides the infrastructure that makes it easy for a Simulator @@ -81,7 +66,7 @@ public abstract class SimulatorBase : Factory, IOperationFacto /// public StackFrame[]? CallStack { get; private set; } - public SimulatorBase(IQubitManager? qubitManager = null, int? seed = null) + public SimulatorBase(IQubitManager? qubitManager = null, int? seed = null, bool onlyOverrideBodyIntrinsic = false) { this.randomSeed = seed ?? Guid.NewGuid().GetHashCode(); this.randomGenerator = new Lazy( @@ -89,7 +74,7 @@ public SimulatorBase(IQubitManager? qubitManager = null, int? seed = null) ); this.QubitManager = qubitManager; - this.InitBuiltinOperations(this.GetType()); + this.InitBuiltinOperations(this.GetType(), onlyOverrideBodyIntrinsic); EnableLogToConsole(); EnableExceptionPrinting(); diff --git a/src/Simulation/Common/StackTrace.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/StackTrace.cs similarity index 100% rename from src/Simulation/Common/StackTrace.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/StackTrace.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/StateDumper.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/StateDumper.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/StateDumper.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/StateDumper.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/T.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/T.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/T.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/T.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/X.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/X.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/X.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/X.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/Y.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Y.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/Y.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Y.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/Z.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/Z.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/Z.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/Z.cs diff --git a/src/Simulation/Simulators/QuantumSimulator/random.cs b/src/Simulation/Simulators.Impl/QuantumSimulator/random.cs similarity index 100% rename from src/Simulation/Simulators/QuantumSimulator/random.cs rename to src/Simulation/Simulators.Impl/QuantumSimulator/random.cs diff --git a/src/Simulation/Simulators/ResourcesEstimator/ResourcesEstimator.cs b/src/Simulation/Simulators.Impl/ResourcesEstimator/ResourcesEstimator.cs similarity index 99% rename from src/Simulation/Simulators/ResourcesEstimator/ResourcesEstimator.cs rename to src/Simulation/Simulators.Impl/ResourcesEstimator/ResourcesEstimator.cs index 84fc8ca8f2d..71f11f80e34 100644 --- a/src/Simulation/Simulators/ResourcesEstimator/ResourcesEstimator.cs +++ b/src/Simulation/Simulators.Impl/ResourcesEstimator/ResourcesEstimator.cs @@ -123,7 +123,7 @@ public virtual DataTable Data var results = collector.Results.ToTable(); Debug.Assert(results.keyColumnNames.Length > 2 && results.keyColumnNames[2] == "Caller"); - var roots = results.rows.Where(r => r.KeyRow[2] == CallGraphEdge.CallGraphRootHashed); + var roots = results.rows.Where(r => r.KeyRow[2] == CallGraphEdge.CallGraphRootHashed); var s_idx = Array.FindIndex(results.statisticsNames, n => n == "Sum"); for (var m_idx = 0; m_idx < results.metricNames.Length; m_idx++) @@ -135,14 +135,14 @@ public virtual DataTable Data row["Metric"] = label; if (m_idx >= 0 && s_idx >= 0) - { - Double sum = 0; - Double max = 0; // all our metrics are positive + { + Double sum = 0; + Double max = 0; // all our metrics are positive foreach (var r in roots) - { - Double metric_value = r.DataRow[m_idx, s_idx]; - sum += metric_value; - max = System.Math.Max(max, metric_value); + { + Double metric_value = r.DataRow[m_idx, s_idx]; + sum += metric_value; + max = System.Math.Max(max, metric_value); } row["Sum"] = sum; row["Max"] = max; diff --git a/src/Simulation/Simulators/ToffoliSimulator/Assert.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Assert.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Assert.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Assert.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/AssertProb.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/AssertProb.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/AssertProb.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/AssertProb.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/Dump.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Dump.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Dump.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Dump.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/Exp.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Exp.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Exp.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Exp.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/ExpFrac.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/ExpFrac.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/ExpFrac.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/ExpFrac.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/Extensions.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Extensions.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Extensions.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Extensions.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/H.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/H.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/H.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/H.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/M.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/M.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/M.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/M.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/Measure.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Measure.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Measure.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Measure.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/R.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/R.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/R.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/R.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/RFrac.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/RFrac.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/RFrac.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/RFrac.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/Random.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Random.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Random.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Random.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/S.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/S.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/S.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/S.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/SWAP.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/SWAP.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/SWAP.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/SWAP.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/T.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/T.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/T.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/T.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/ToffoliSimulator.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/ToffoliSimulator.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/ToffoliSimulator.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/ToffoliSimulator.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/X.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/X.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/X.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/X.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/Y.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Y.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Y.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Y.cs diff --git a/src/Simulation/Simulators/ToffoliSimulator/Z.cs b/src/Simulation/Simulators.Impl/ToffoliSimulator/Z.cs similarity index 100% rename from src/Simulation/Simulators/ToffoliSimulator/Z.cs rename to src/Simulation/Simulators.Impl/ToffoliSimulator/Z.cs diff --git a/src/Simulation/Simulators.Tests/App.config b/src/Simulation/Simulators.Tests/App.config index 94ce1a2b94f..b65f2762470 100644 --- a/src/Simulation/Simulators.Tests/App.config +++ b/src/Simulation/Simulators.Tests/App.config @@ -3,4 +3,7 @@ - + + + + diff --git a/src/Simulation/Simulators.Tests/Circuits/VerifyUnitary.qs b/src/Simulation/Simulators.Tests/Circuits/VerifyUnitary.qs index e44783a32d6..afde45b0c3b 100644 --- a/src/Simulation/Simulators.Tests/Circuits/VerifyUnitary.qs +++ b/src/Simulation/Simulators.Tests/Circuits/VerifyUnitary.qs @@ -6,7 +6,7 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { open Microsoft.Quantum.Intrinsic; open Microsoft.Quantum.Math; open Microsoft.Quantum.Diagnostics; - open Microsoft.Quantum.Simulation.TestSuite; + open Microsoft.Quantum.Measurement; /// @@ -20,7 +20,7 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { /// then it tests Controlled with different number of control qubits, also verifying that /// Adjoint Controlled works. /// - operation VerifyUnitary (gate : (Qubit => Unit : Adjoint, Controlled), start : (Pauli, Result), expected : (Complex, Complex)) : Unit { + operation VerifyUnitary (gate : (Qubit => Unit is Adj + Ctl), start : (Pauli, Result), expected : (Complex, Complex)) : Unit { using (qubits = Qubit[1]) { @@ -28,14 +28,14 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { let q1 = qubits[0]; let (a, b) = expected; let (p, r) = start; - SetQubit(r, q1); + SetToBasisState(r, q1); if (p == PauliX) { H(q1); } // Make sure we start in correct state. - Assert([p], [q1], r, $"Qubit in invalid state."); + AssertMeasurement([p], [q1], r, $"Qubit in invalid state."); // Apply the gate, make sure it's in the right state gate(q1); @@ -43,7 +43,7 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { // Apply Adjoint, back to Zero: Adjoint gate(q1); - Assert([p], [q1], r, $"Qubit in invalid state."); + AssertMeasurement([p], [q1], r, $"Qubit in invalid state."); // When no control qubits, it should be equivalent to just calling the gate: Controlled gate(new Qubit[0], q1); @@ -51,7 +51,7 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { // Apply Adjoint, back to Zero: Controlled (Adjoint gate)(new Qubit[0], q1); - Assert([p], [q1], r, $"Qubit in invalid state."); + AssertMeasurement([p], [q1], r, $"Qubit in invalid state."); // Now test control... We'll have 3 control qubits. // We will run the test with 1..3 controls at a time. @@ -62,18 +62,18 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { for (i in 0 .. ctrlsCount - 1) { // We're starting fresh - Assert([p], [q1], r, $"Qubit in invalid state."); + AssertMeasurement([p], [q1], r, $"Qubit in invalid state."); // Get a subset for control and initialize them to zero: let c = ctrls[0 .. i]; for (j in 0 .. i) { - SetQubit(Zero, c[j]); + SetToBasisState(Zero, c[j]); } // Noop when ctrls are all zero. Controlled gate(c, q1); - Assert([p], [q1], r, $"Qubit in invalid state."); + AssertMeasurement([p], [q1], r, $"Qubit in invalid state."); // turn on each of the controls one by one for (j in 1 .. Length(c)) { @@ -85,7 +85,7 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { AssertQubitIsInStateWithinTolerance(expected, q1, tolerance); } else { - Assert([p], [q1], r, $"Qubit in invalid state."); + AssertMeasurement([p], [q1], r, $"Qubit in invalid state."); } Adjoint Controlled gate(c, q1); @@ -96,8 +96,8 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { } // We're back where we started. - Assert([p], [q1], r, $"Qubit in invalid state."); - SetQubit(r, q1); + AssertMeasurement([p], [q1], r, $"Qubit in invalid state."); + SetToBasisState(r, q1); ResetAll(qubits); } } diff --git a/src/Simulation/Simulators.Tests/DebuggingToolsTests.cs b/src/Simulation/Simulators.Tests/DebuggingToolsTests.cs index 279a6185f00..0ef42022ab6 100644 --- a/src/Simulation/Simulators.Tests/DebuggingToolsTests.cs +++ b/src/Simulation/Simulators.Tests/DebuggingToolsTests.cs @@ -23,7 +23,7 @@ public void ToStringTests() => Helper.RunWithMultipleSimulators(qsim => { var _ = AbstractCallable._; - var dump = qsim.Get(typeof(Microsoft.Quantum.Extensions.Diagnostics.DumpMachine<>)); + var dump = qsim.Get(typeof(Microsoft.Quantum.Diagnostics.DumpMachine<>)); var trace = qsim.Get(typeof(Circuits.Generics.Trace<>)); var x = qsim.Get(); var q2 = new FreeQubit(2) as Qubit; @@ -223,7 +223,7 @@ public void GenericDebuggerProxy() { Helper.RunWithMultipleSimulators((qsim) => { - var dump = qsim.Get(typeof(Microsoft.Quantum.Extensions.Diagnostics.DumpMachine<>)) as GenericCallable; + var dump = qsim.Get(typeof(Microsoft.Quantum.Diagnostics.DumpMachine<>)) as GenericCallable; var trace = qsim.Get(typeof(Circuits.Generics.Trace<>)) as GenericCallable; var gen3 = qsim.Get(typeof(Circuits.Generics.Gen3<,,>)) as GenericCallable; @@ -231,7 +231,7 @@ public void GenericDebuggerProxy() TestOneProxy("Trace", "Microsoft.Quantum.Simulation.Simulators.Tests.Circuits.Generics.Trace", OperationFunctor.Adjoint, "T => () : Adjoint, Controlled", trace.Adjoint); TestOneProxy("Trace", "Microsoft.Quantum.Simulation.Simulators.Tests.Circuits.Generics.Trace", OperationFunctor.Controlled, "(Qubit[],T) => () : Adjoint, Controlled", trace.Controlled); TestOneProxy("Trace", "Microsoft.Quantum.Simulation.Simulators.Tests.Circuits.Generics.Trace", OperationFunctor.ControlledAdjoint, "(Qubit[],T) => () : Adjoint, Controlled", trace.Adjoint.Controlled); - TestOneProxy("DumpMachine", "Microsoft.Quantum.Extensions.Diagnostics.DumpMachine", OperationFunctor.Body, "T => ()", dump); + TestOneProxy("DumpMachine", "Microsoft.Quantum.Diagnostics.DumpMachine", OperationFunctor.Body, "T => ()", dump); TestOneProxy("Gen3", "Microsoft.Quantum.Simulation.Simulators.Tests.Circuits.Generics.Gen3", OperationFunctor.Body, "(__T1,(__T2,__T3),Result) => () : Controlled", gen3); TestOneProxy("Gen3", "Microsoft.Quantum.Simulation.Simulators.Tests.Circuits.Generics.Gen3", OperationFunctor.Controlled, "(Qubit[],(__T1,(__T2,__T3),Result)) => () : Controlled", gen3.Controlled); }); @@ -252,7 +252,7 @@ public void GenericPartialDebuggerProxy() { var _ = AbstractCallable._; - var dump = qsim.Get(typeof(Microsoft.Quantum.Extensions.Diagnostics.DumpMachine<>)) as GenericCallable; + var dump = qsim.Get(typeof(Microsoft.Quantum.Diagnostics.DumpMachine<>)) as GenericCallable; var trace = qsim.Get(typeof(Circuits.Generics.Trace<>)) as GenericCallable; var gen3 = qsim.Get(typeof(Circuits.Generics.Gen3<,,>)) as GenericCallable; diff --git a/src/Simulation/Simulators.Tests/OperationsTestHelper.cs b/src/Simulation/Simulators.Tests/OperationsTestHelper.cs index bde77e602d8..b8ae21270e9 100644 --- a/src/Simulation/Simulators.Tests/OperationsTestHelper.cs +++ b/src/Simulation/Simulators.Tests/OperationsTestHelper.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using Microsoft.Quantum.Simulation.Common; using Microsoft.Quantum.Simulation.Core; @@ -14,6 +13,18 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests { + public static class Extensions + { + /// + /// This method is a wrapper to let the tests keep using a one Type parameter + /// method to fetch for Gates. + /// + public static T Get(this SimulatorBase sim) where T : AbstractCallable + { + return sim.Get(); + } + } + public class Log { public Dictionary _log = new Dictionary(); @@ -88,75 +99,8 @@ private void OnStart(ICallable arg1, IApplyData arg2) } } - static class OperationsTestHelper + static partial class OperationsTestHelper { - public static TraceImpl GetTracer(this SimulatorBase s) - { - return s.Get(typeof(Tests.Circuits.Generics.Trace<>)).FindCallable(typeof(T), typeof(QVoid)) as TraceImpl; - } - - - public class TracerImpl : Tests.Circuits.ClosedType.Trace - { - public TracerImpl(IOperationFactory m) : base(m) - { - this.Log = new Log(); - } - - public override Func __Body__ => (tag) => this.Log.Record(OperationFunctor.Body, tag); - public override Func __AdjointBody__ => (tag) => this.Log.Record(OperationFunctor.Adjoint, tag); - public override Func<(IQArray, string), QVoid> __ControlledBody__ => (args) => this.Log.Record(OperationFunctor.Controlled, args.Item2); - public override Func<(IQArray, string), QVoid> __ControlledAdjointBody__ => (args) => this.Log.Record(OperationFunctor.ControlledAdjoint, args.Item2); - - public Log Log { get; } - } - - public class TraceImpl : Tests.Circuits.Generics.Trace - { - public TraceImpl(IOperationFactory m) : base(m) - { - this.Log = new Log(); - } - - public override Func __Body__ => (tag) => this.Log.Record(OperationFunctor.Body, tag); - public override Func __AdjointBody__ => (tag) => this.Log.Record(OperationFunctor.Adjoint, tag); - public override Func<(IQArray, T), QVoid> __ControlledBody__ => (args) => this.Log.Record(OperationFunctor.Controlled, args.Item2); - public override Func<(IQArray, T), QVoid> __ControlledAdjointBody__ => (args) => this.Log.Record(OperationFunctor.ControlledAdjoint, args.Item2); - - public int GetNumberOfCalls(OperationFunctor functor, T tag) => this.Log.GetNumberOfCalls(functor, tag); - - public Log Log { get; } - } - - private static void InitSimulator(SimulatorBase sim) - { - sim.InitBuiltinOperations(typeof(OperationsTestHelper)); - sim.Register(typeof(Tests.Circuits.Generics.Trace<>), typeof(TraceImpl<>), typeof(IUnitary)); - - // For Toffoli, replace H with I. - if (sim is ToffoliSimulator) - { - sim.Register(typeof(Intrinsic.H), typeof(Intrinsic.I), typeof(IUnitary)); - } - } - - public static void RunWithMultipleSimulators(Action test) - { - var simulators = new SimulatorBase[] { new QuantumSimulator(), new ToffoliSimulator() }; - - foreach (var s in simulators) - { - InitSimulator(s); - - test(s); - - if (s is IDisposable sim) - { - sim.Dispose(); - } - } - } - /// /// A shell for simple Apply tests. /// @@ -189,13 +133,13 @@ internal static void ctrlErrorConditionsTests(SimulatorBase sim, Action<(IQArray /// /// A shell for simple Controlled tests. It calls the controlled operation with 0..4 control qubits - /// set to all possible combination of 1 & 0. + /// set to all possible combination of 1 and 0. /// internal static void ctrlTestShell(SimulatorBase sim, Action<(IQArray, Qubit)> operationControlled, Action, Qubit> test) { var allocate = sim.Get(); var release = sim.Get(); - var set = sim.Get(); + var set = sim.Get(); // Number of control bits to use for (int n = 0; n < 4; n++) diff --git a/src/Simulation/Simulators.Tests/OperationsTestHelperSimSupport.cs b/src/Simulation/Simulators.Tests/OperationsTestHelperSimSupport.cs new file mode 100644 index 00000000000..bef48e8bf27 --- /dev/null +++ b/src/Simulation/Simulators.Tests/OperationsTestHelperSimSupport.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Microsoft.Quantum.Simulation.Common; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators.Tests +{ + static partial class OperationsTestHelper + { + public static bool ShouldPerformQubitUniquenessTest = true; + + private static void InitSimulator(SimulatorBase sim) + { + sim.InitBuiltinOperations(typeof(OperationsTestHelper)); + sim.Register(typeof(Tests.Circuits.Generics.Trace<>), typeof(TraceImpl<>), typeof(IUnitary)); + + // For Toffoli, replace H with I. + if (sim is ToffoliSimulator) + { + sim.Register(typeof(Intrinsic.H), typeof(Intrinsic.I), typeof(IUnitary)); + } + } + + public static void RunWithMultipleSimulators(Action test) + { + var simulators = new SimulatorBase[] { new QuantumSimulator(), new ToffoliSimulator() }; + + foreach (var s in simulators) + { + try + { + InitSimulator(s); + + test(s); + } + finally + { + if (s is IDisposable sim) + { + sim.Dispose(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Simulation/Simulators.Tests/QuantumSimulatorTests/BasicTests.cs b/src/Simulation/Simulators.Tests/QuantumSimulatorTests/BasicTests.cs index 682e35e7630..fbc2fcd5fbd 100644 --- a/src/Simulation/Simulators.Tests/QuantumSimulatorTests/BasicTests.cs +++ b/src/Simulation/Simulators.Tests/QuantumSimulatorTests/BasicTests.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.Quantum.Simulation.Core; using Microsoft.Quantum.Simulation.Simulators.Exceptions; -using Microsoft.Quantum.Simulation.Simulators.Tests.Circuits; using Xunit; namespace Microsoft.Quantum.Simulation.Simulators.Tests @@ -60,7 +59,7 @@ public void QSimX() { var x = sim.Get(); var measure = sim.Get(); - var set = sim.Get(); + var set = sim.Get(); var ctrlX = x.__ControlledBody__.AsAction(); OperationsTestHelper.ctrlTestShell(sim, ctrlX, (enabled, ctrls, q) => @@ -220,9 +219,14 @@ private static void TestControllable(IControllable gate, IQArray c TestCallable(gate.Controlled.Partial(nullTarget), target); TestCallable(gate.Controlled.Partial(nullCtrl), ctrls[0]); - Assert.Throws(() => gate.Controlled.Apply((dupeTarget, target))); - Assert.Throws(() => gate.Controlled.Apply((dupeCtrls1, target))); - Assert.Throws(() => gate.Controlled.Apply((dupeCtrls2, target))); + // Some decompositions actually allow for duplications in controls, so these tests + // should be skipped for those packages. + if (OperationsTestHelper.ShouldPerformQubitUniquenessTest) + { + Assert.Throws(() => gate.Controlled.Apply((dupeTarget, target))); + Assert.Throws(() => gate.Controlled.Apply((dupeCtrls1, target))); + Assert.Throws(() => gate.Controlled.Apply((dupeCtrls2, target))); + } } private static void TestUnitary(IUnitary gate, IQArray ctrls, IQArray target) @@ -238,8 +242,10 @@ private static void TestMultiCallable(ICallable, O> gate, IQAr var mapper = new Func>(q => new QArray(q, targets[1], targets[2])); var dupTargets = new QArray(targets[0], targets[1], targets[0]); - Assert.Throws(() => gate.Apply(null)); - Assert.Throws(() => gate.Apply(dupTargets)); + if (OperationsTestHelper.ShouldPerformQubitUniquenessTest) + { + Assert.Throws(() => gate.Apply(dupTargets)); + } TestCallable(gate.Partial(mapper), targets[0]); } @@ -280,22 +286,21 @@ private void TestOne(QuantumSimulator qsim, T gate, Action, [Fact] public void TestSimpleGateCheckQubits() { - using (var qsim = new QuantumSimulator(throwOnReleasingQubitsNotInZeroState: false)) + // Single Qubit gates: { + var gateTypes = new Type[] + { + typeof(Intrinsic.H), + typeof(Intrinsic.S), + typeof(Intrinsic.T), + typeof(Intrinsic.X), + typeof(Intrinsic.Y), + typeof(Intrinsic.Z) + }; - // Single Qubit gates: + foreach (var t in gateTypes) { - var gateTypes = new Type[] - { - typeof(Intrinsic.H), - typeof(Intrinsic.S), - typeof(Intrinsic.T), - typeof(Intrinsic.X), - typeof(Intrinsic.Y), - typeof(Intrinsic.Z) - }; - - foreach (var t in gateTypes) + using (var qsim = new QuantumSimulator(throwOnReleasingQubitsNotInZeroState: false)) { var gate = qsim.Get>(t); TestOne(qsim, gate, TestUnitary); @@ -324,7 +329,7 @@ public void TestExpCheckQubits() { // Exp { - var mapper = new Func, (IQArray, Double, IQArray)>(qubits => (new QArray(Pauli.PauliZ, Pauli.PauliI, Pauli.PauliI), 1.0, qubits)); + var mapper = new Func, (IQArray, Double, IQArray)>(qubits => (new QArray(Pauli.PauliZ, Pauli.PauliX, Pauli.PauliY), 1.0, qubits)); var gate = qsim.Get(); var p = gate.Partial(mapper); TestOne(qsim, p, TestMultiUnitary); @@ -332,7 +337,7 @@ public void TestExpCheckQubits() // ExpFrac { - var mapper = new Func, (IQArray, long, long, IQArray)>(qubits => (new QArray(Pauli.PauliZ, Pauli.PauliI, Pauli.PauliI), 1, 2, qubits)); + var mapper = new Func, (IQArray, long, long, IQArray)>(qubits => (new QArray(Pauli.PauliZ, Pauli.PauliX, Pauli.PauliY), 1, 2, qubits)); var gate = qsim.Get(); var p = gate.Partial(mapper); TestOne(qsim, p, TestMultiUnitary); @@ -357,6 +362,9 @@ public void TestMeasureCheckQubits() var gate = qsim.Get(); var mapper = new Func, (IQArray, IQArray)>(qubits => (new QArray(Pauli.PauliZ, Pauli.PauliI, Pauli.PauliI), qubits)); var p = gate.Partial(mapper); + + // On systems that decompose joint measurement a qubit can actually be duplictated in + // the targets, so skip the duplicate qubit check. TestOne(qsim, p, (g, ctrls, t) => TestMultiCallable(p, t)); } } diff --git a/src/Simulation/Simulators.Tests/QuantumSimulatorTests/VerifyGates.cs b/src/Simulation/Simulators.Tests/QuantumSimulatorTests/VerifyGates.cs index 0cc32328fdf..170b19ad508 100644 --- a/src/Simulation/Simulators.Tests/QuantumSimulatorTests/VerifyGates.cs +++ b/src/Simulation/Simulators.Tests/QuantumSimulatorTests/VerifyGates.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.Threading.Tasks; using Microsoft.Quantum.Simulation.Core; using Microsoft.Quantum.Simulation.Simulators.Tests.Circuits; using Xunit; @@ -324,7 +323,7 @@ public void QSimVerifyR() Func mapper = (q) => (Pauli.PauliI, angle, q); Func<(double, Qubit), (Pauli, double, Qubit)> needsAngle = (__arg) - => (Pauli.PauliI, __arg.Item1, __arg.Item2); + => (Pauli.PauliX, __arg.Item1, __arg.Item2); using (var sim = new QuantumSimulator()) { @@ -374,8 +373,10 @@ private void VerifyExp(Pauli pauli) Func<(double, Qubit), (IQArray, double, IQArray)> needsAngle = (__arg) => (new QArray (pauli), __arg.Item1, new QArray (__arg.Item2)); var angleGate = sim.Get().Partial(needsAngle); - - VerifyInvalidAngles(sim, angleGate); + if (pauli != Pauli.PauliI) + { + VerifyInvalidAngles(sim, angleGate); + } } } diff --git a/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertProbMultiQubit.qs b/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertProbMultiQubit.qs index 49392e3aa0c..e16b4ca64aa 100644 --- a/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertProbMultiQubit.qs +++ b/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertProbMultiQubit.qs @@ -8,6 +8,41 @@ namespace Microsoft.Quantum.Simulation.TestSuite { open Microsoft.Quantum.Simulation.TestSuite.Math; + internal operation FlipToBasis (basis : Int[], qubits : Qubit[]) : Unit is Adj + Ctl { + if (Length(qubits) != Length(basis)) + { + fail "qubits and stateIds must have the same length"; + } + + for (i in 0 .. Length(qubits) - 1) + { + let id = basis[i]; + let qubit = qubits[i]; + + if (id < 0 or id > 3) { + fail $"Invalid basis. Must be between 0 and 3, it was {basis}"; + } + + if (id == 0) + { + I(qubit); + } + elif (id == 1) + { + X(qubit); + } + elif (id == 2) + { + H(qubit); + } + else + { + H(qubit); + S(qubit); + } + } + } + operation AssertProbMultiQubitTest () : Unit { @@ -51,15 +86,14 @@ namespace Microsoft.Quantum.Simulation.TestSuite { } using (qubits = Qubit[l]) { - _flipToBasis(stateId, qubits); + FlipToBasis(stateId, qubits); let expectedZeroProbability = 0.5 + 0.5 * ExpectedValueForMultiPauliByStateId(observable, stateId); let expectedOneProbability = 1.0 - expectedZeroProbability; - AssertProb(observable, qubits, Zero, expectedZeroProbability, $"", Accuracy()); - AssertProb(observable, qubits, One, expectedOneProbability, $"", Accuracy()); - Adjoint _flipToBasis(stateId, qubits); + AssertMeasurementProbability(observable, qubits, Zero, expectedZeroProbability, $"", Accuracy()); + AssertMeasurementProbability(observable, qubits, One, expectedOneProbability, $"", Accuracy()); + Adjoint FlipToBasis(stateId, qubits); } } } - diff --git a/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertQubitUnitary.qs b/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertQubitUnitary.qs index 82f4009c77b..a88314630ed 100644 --- a/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertQubitUnitary.qs +++ b/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertQubitUnitary.qs @@ -15,7 +15,7 @@ namespace Microsoft.Quantum.Simulation.TestSuite { for (stateId in 0 .. maxId) { let expectedState = ApplyMatrix(unitaryMatrix, StateIdToVector(stateId)); - _flipToBasis([stateId], [qubit]); + FlipToBasis([stateId], [qubit]); unitaryOp(qubit); let alpha = Microsoft.Quantum.Math.Complex((expectedState![0])!); let beta = Microsoft.Quantum.Math.Complex((expectedState![1])!); diff --git a/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertUnitary.qs b/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertUnitary.qs index 22a38acbe2b..03e216e8072 100644 --- a/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertUnitary.qs +++ b/src/Simulation/Simulators.Tests/QuantumTestSuite/AssertUnitary.qs @@ -10,7 +10,7 @@ namespace Microsoft.Quantum.Simulation.TestSuite { operation AssertUnitaryHelper (stateIds : Int[], unitaryMatrix : RowMajorMatrix, unitaryOp : (Qubit[] => Unit), qubits : Qubit[]) : Unit { let expectedState = ApplyMatrix(unitaryMatrix, StateById(stateIds)); - _flipToBasis(stateIds, qubits); + FlipToBasis(stateIds, qubits); unitaryOp(qubits); AssertState(expectedState, qubits); ResetAll(qubits); diff --git a/src/Simulation/Simulators.Tests/QuantumTestSuite/JointOneQubitTests.qs b/src/Simulation/Simulators.Tests/QuantumTestSuite/JointOneQubitTests.qs index 137ea806f31..6c29af44a74 100644 --- a/src/Simulation/Simulators.Tests/QuantumTestSuite/JointOneQubitTests.qs +++ b/src/Simulation/Simulators.Tests/QuantumTestSuite/JointOneQubitTests.qs @@ -23,7 +23,7 @@ namespace Microsoft.Quantum.Simulation.TestSuite { } mutable states = new Vector[numQubits]; - _flipToBasis(inputStateId, qubits); + FlipToBasis(inputStateId, qubits); for (i in 0 .. numQubits - 1) { let (op, matrix) = operationsToTest[i]!; diff --git a/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs b/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs index 19cec9f9f7d..15d9a324fd6 100644 --- a/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs +++ b/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs @@ -99,8 +99,8 @@ public void ToTSVTest() var cliffords = rows.First(r => r.StartsWith("QubitClifford")).Split('\t'); Assert.Equal(3, cliffords.Length); Assert.Equal("2", cliffords[1]); - } - + } + /// /// Shows that T gates on different qubits are counted for depth purposes as /// executing in parallel. @@ -117,8 +117,8 @@ public void DepthDifferentQubitsTest() Assert.Equal(4.0, data.Rows.Find("T")["Sum"]); Assert.Equal(3.0, data.Rows.Find("Width")["Sum"]); Assert.Equal(2.0, data.Rows.Find("Depth")["Sum"]); - } - + } + /// /// Documents that the QubitCount and Depth statistics reflect independent lower /// bounds for each (two T gates cannot be combined into a circuit of depth diff --git a/src/Simulation/Simulators.Tests/SimulatorBaseTests.cs b/src/Simulation/Simulators.Tests/SimulatorBaseTests.cs index da983d1e352..50b10a18478 100644 --- a/src/Simulation/Simulators.Tests/SimulatorBaseTests.cs +++ b/src/Simulation/Simulators.Tests/SimulatorBaseTests.cs @@ -10,18 +10,6 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests { - public static class Extensions - { - /// - /// This method is a wrapper to let the tests keep using a one Type parameter - /// method to fetch for Gates. - /// - public static T Get(this SimulatorBase sim) where T : AbstractCallable - { - return sim.Get(); - } - } - public class SimulatorBaseTests { private readonly ITestOutputHelper output; diff --git a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj index 0ac78267fc2..03b93ebf6b0 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj @@ -3,7 +3,6 @@ netcoreapp3.1 false - true false false @@ -11,7 +10,6 @@ - diff --git a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj index 7e3f9d41998..77901309b05 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/Hello.qs b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/Hello.qs index 8e5d87f77a8..4d8cd71c3b1 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/Hello.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/Hello.qs @@ -1,16 +1,16 @@ -// Used for a unit test; -// do not change the name of this namespace! -namespace Microsoft.Quantum.Library { - - open Microsoft.Quantum.Intrinsic; - - // Used for a unit test; - // do not change the name or namespace of this type! - newtype Token = Unit; - - // Used for a unit test; - // do not change the name or namespace of this callable! - operation Hello(dummy : Token) : Unit { - Message("Hello!"); - } +// Used for a unit test; +// do not change the name of this namespace! +namespace Microsoft.Quantum.Library { + + open Microsoft.Quantum.Intrinsic; + + // Used for a unit test; + // do not change the name or namespace of this type! + newtype Token = Unit; + + // Used for a unit test; + // do not change the name or namespace of this callable! + operation Hello(dummy : Token) : Unit { + Message("Hello!"); + } } \ No newline at end of file diff --git a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj index 927e6f19089..d5c39225a5e 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj @@ -11,7 +11,6 @@ - diff --git a/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj index 093d36e4e83..37d10ab508e 100644 --- a/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj @@ -1,15 +1,6 @@  - - - - - - netcoreapp3.1 - false - false - false - + @@ -18,8 +9,7 @@ - - + false @@ -28,16 +18,6 @@ - - - - - - - - - - <_ExeDir>$(MSBuildThisFileDirectory)TestProjects\QsharpExe\built\ diff --git a/src/Simulation/Simulators.Tests/TracerHelper.cs b/src/Simulation/Simulators.Tests/TracerHelper.cs new file mode 100644 index 00000000000..96520317852 --- /dev/null +++ b/src/Simulation/Simulators.Tests/TracerHelper.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Microsoft.Quantum.Simulation.Common; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators.Tests +{ + static partial class OperationsTestHelper + { + public static TraceImpl GetTracer(this SimulatorBase s) + { + return s.Get(typeof(Tests.Circuits.Generics.Trace<>)).FindCallable(typeof(T), typeof(QVoid)) as TraceImpl; + } + + + public class TracerImpl : Tests.Circuits.ClosedType.Trace + { + public TracerImpl(IOperationFactory m) : base(m) + { + this.Log = new Log(); + } + + public override Func __Body__ => (tag) => this.Log.Record(OperationFunctor.Body, tag); + public override Func __AdjointBody__ => (tag) => this.Log.Record(OperationFunctor.Adjoint, tag); + public override Func<(IQArray, string), QVoid> __ControlledBody__ => (args) => this.Log.Record(OperationFunctor.Controlled, args.Item2); + public override Func<(IQArray, string), QVoid> __ControlledAdjointBody__ => (args) => this.Log.Record(OperationFunctor.ControlledAdjoint, args.Item2); + + public Log Log { get; } + } + + public class TraceImpl : Tests.Circuits.Generics.Trace + { + public TraceImpl(IOperationFactory m) : base(m) + { + this.Log = new Log(); + } + + public override Func __Body__ => (tag) => this.Log.Record(OperationFunctor.Body, tag); + public override Func __AdjointBody__ => (tag) => this.Log.Record(OperationFunctor.Adjoint, tag); + public override Func<(IQArray, T), QVoid> __ControlledBody__ => (args) => this.Log.Record(OperationFunctor.Controlled, args.Item2); + public override Func<(IQArray, T), QVoid> __ControlledAdjointBody__ => (args) => this.Log.Record(OperationFunctor.ControlledAdjoint, args.Item2); + + public int GetNumberOfCalls(OperationFunctor functor, T tag) => this.Log.GetNumberOfCalls(functor, tag); + + public Log Log { get; } + } + + } +} \ No newline at end of file diff --git a/src/Simulation/Simulators.Type1.Tests/App.config b/src/Simulation/Simulators.Type1.Tests/App.config new file mode 100644 index 00000000000..b65f2762470 --- /dev/null +++ b/src/Simulation/Simulators.Type1.Tests/App.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Simulation/Simulators.Type1.Tests/OperationsTestHelperSimSupport.cs b/src/Simulation/Simulators.Type1.Tests/OperationsTestHelperSimSupport.cs new file mode 100644 index 00000000000..418ccdc8176 --- /dev/null +++ b/src/Simulation/Simulators.Type1.Tests/OperationsTestHelperSimSupport.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; +using Microsoft.Quantum.Simulation.Common; + +namespace Microsoft.Quantum.Simulation.Simulators.Tests +{ + static partial class OperationsTestHelper + { + public static bool ShouldPerformQubitUniquenessTest = false; + + private static void InitSimulator(SimulatorBase sim) + { + sim.InitBuiltinOperations(typeof(OperationsTestHelper)); + } + + public static void RunWithMultipleSimulators(Action test) + { + var simulators = new SimulatorBase[] { new QuantumSimulator() }; + + foreach (var s in simulators) + { + try + { + InitSimulator(s); + + test(s); + } + finally + { + if (s is IDisposable sim) + { + sim.Dispose(); + } + } + } + } + } +} diff --git a/src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj b/src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj new file mode 100644 index 00000000000..c2e06520874 --- /dev/null +++ b/src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/Simulators.Type1/.gitignore b/src/Simulation/Simulators.Type1/.gitignore new file mode 100644 index 00000000000..1624c7f7e14 --- /dev/null +++ b/src/Simulation/Simulators.Type1/.gitignore @@ -0,0 +1 @@ +Microsoft.Quantum.Simulators.Type1.nuspec \ No newline at end of file diff --git a/src/Simulation/Simulators.Type1/FindNuspecReferences.ps1 b/src/Simulation/Simulators.Type1/FindNuspecReferences.ps1 new file mode 100644 index 00000000000..9f0fdbaa3d0 --- /dev/null +++ b/src/Simulation/Simulators.Type1/FindNuspecReferences.ps1 @@ -0,0 +1,101 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +######################################## +# .Description +# When creating a package with dotnet pack, nuget changes every ProjectReference to be itself +# a PackageReference (without checking if that project has a corresponding package). +# This is problematic because we currently don't want to create a package for every dll. +# +# On the other hand, when creating a package using nuget pack, nuget does not +# identify PackageReferences defined in the csproj, so all the dependencies +# are not listed and the package doesn't work. +# +# We don't want to hardcode the list of dependencies on the .nuspec, as they can +# quickly become out-of-sync. +# This script will find the PackageReferences recursively on the simulation projects and add them +# to the nuspec, so we can then create the package using nuget pack with the corresponding +# dependencies listed. +# +# nuget is tracking this problem at: https://github.com/NuGet/Home/issues/4491 +######################################## + +$target = Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.Type1.nuspec" + +if (Test-Path $target) { + Write-Host "$target exists. Skipping generating new one." + exit + } + + +# Start with the nuspec template +$nuspec = [xml](Get-Content (Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.Type1.nuspec.template")) +$dep = $nuspec.CreateElement('dependencies', $nuspec.package.metadata.NamespaceURI) + +function Add-PackageReferenceIfNew($ref) { + # Identify package's id either from "Include" or "Update" attribute: + $id = $ref.Include + $version = $ref.Version + + if ($id -eq $null -or $id -eq "") { + $id = $ref.Update + } + if ($id.EndsWith('.csproj') -or $id.EndsWith('.fsproj')) { + $id = [System.IO.Path]::GetFileNameWithoutExtension($id) + } + + if ("$version" -eq "") { + $version = '$version$' + } + + # Check if package already added as dependency, only add if new: + $added = $dep.dependency | Where { $_.id -eq $id } + if (!$added) { + Write-Host "Adding $id (version: $version)" + $onedependency = $dep.AppendChild($nuspec.CreateElement('dependency', $nuspec.package.metadata.NamespaceURI)) + $onedependency.SetAttribute('id', $id) + $onedependency.SetAttribute('version', $version) + } +} + +# Recursively find PackageReferences on all ProjectReferences: +function Add-NuGetDependencyFromCsprojToNuspec($PathToCsproj) { + Write-Host "`nFinding dependencies for $PathToCsproj" + $csproj = [xml](Get-Content $PathToCsproj) + + # Find all PackageReferences nodes: + $packageDependency = $csproj.Project.ItemGroup.PackageReference | Where-Object { $null -ne $_ } + $packageDependency | ForEach-Object { + $id = $_.Include + Write-Host "Detected package dependencies: $id" + } + + $packageDependency | ForEach-Object { + Add-PackageReferenceIfNew $_ + } + + $projectDependency = $csproj.Project.ItemGroup.ProjectReference | Where-Object { $null -ne $_ } + $projectDependency | ForEach-Object { + $id = $_.Include + Write-Host "Detected project dependencies: $id" + } + + # Assume there is a package for project references that are not tagged as to be included in the simulator package: + $projectDependency | Where-Object {$_.IncludeInSimulatorPackage -ne 'true' -and $_.IsQscReference -ne 'true'} | ForEach-Object { + Add-PackageReferenceIfNew $_ + } + + # Recursively check on project references if they are private: + $projectDependency | Where-Object {$_.IncludeInSimulatorPackage -eq 'true' -and $_.IsQscReference -ne 'true'} | ForEach-Object { + $id = $_.Include + Write-Host "Recurring for $id" + Add-NuGetDependencyFromCsprojToNuspec $_.Include + } +} + +# Find all dependencies packaged as part of Microsoft.Quantum.Simulators.Type1 +Add-NuGetDependencyFromCsprojToNuspec "Microsoft.Quantum.Simulators.Type1.csproj" + +# Save into .nuspec file: +$nuspec.package.metadata.AppendChild($dep) +$nuspec.Save($target) diff --git a/src/Simulation/Simulators.Type1/Microsoft.Quantum.Simulators.Type1.csproj b/src/Simulation/Simulators.Type1/Microsoft.Quantum.Simulators.Type1.csproj new file mode 100644 index 00000000000..d9cec682ccc --- /dev/null +++ b/src/Simulation/Simulators.Type1/Microsoft.Quantum.Simulators.Type1.csproj @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Simulation/Simulators.Type1/Microsoft.Quantum.Simulators.Type1.nuspec.template b/src/Simulation/Simulators.Type1/Microsoft.Quantum.Simulators.Type1.nuspec.template new file mode 100644 index 00000000000..1d7a7445bfc --- /dev/null +++ b/src/Simulation/Simulators.Type1/Microsoft.Quantum.Simulators.Type1.nuspec.template @@ -0,0 +1,31 @@ + + + + Microsoft.Quantum.Simulators.Type1 + $version$ + $title$ + Microsoft + QuantumEngineering, Microsoft + MIT + https://docs.microsoft.com/en-us/quantum + images\qdk-nuget-icon.png + false + Type1 simulators of quantum computers for the Q# programming language. + See: https://docs.microsoft.com/en-us/quantum/relnotes/ + © Microsoft Corporation. All rights reserved. + Quantum Q# Qsharp + + + + + + + + + + + + + + + diff --git a/src/Simulation/Simulators.Type1/Properties/AssemblyInfo.cs b/src/Simulation/Simulators.Type1/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..ed47130ca02 --- /dev/null +++ b/src/Simulation/Simulators.Type1/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allow the test assembly to use our internal methods +[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulators.Type1" + SigningConstants.PUBLIC_KEY)] \ No newline at end of file diff --git a/src/Simulation/Simulators.Type2.Tests/App.config b/src/Simulation/Simulators.Type2.Tests/App.config new file mode 100644 index 00000000000..b65f2762470 --- /dev/null +++ b/src/Simulation/Simulators.Type2.Tests/App.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Simulation/Simulators.Type2.Tests/OperationsTestHelperSimSupport.cs b/src/Simulation/Simulators.Type2.Tests/OperationsTestHelperSimSupport.cs new file mode 100644 index 00000000000..47fd980d979 --- /dev/null +++ b/src/Simulation/Simulators.Type2.Tests/OperationsTestHelperSimSupport.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Microsoft.Quantum.Simulation.Common; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.Simulation.Simulators.Tests +{ + static partial class OperationsTestHelper + { + public static bool ShouldPerformQubitUniquenessTest = false; + + private static void InitSimulator(SimulatorBase sim) + { + sim.InitBuiltinOperations(typeof(OperationsTestHelper)); + } + + public static void RunWithMultipleSimulators(Action test) + { + var simulators = new SimulatorBase[] { new QuantumSimulator() }; + + foreach (var s in simulators) + { + try + { + InitSimulator(s); + + test(s); + } + finally + { + if (s is IDisposable sim) + { + sim.Dispose(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj b/src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj new file mode 100644 index 00000000000..641e39b990b --- /dev/null +++ b/src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/Simulators.Type2/.gitignore b/src/Simulation/Simulators.Type2/.gitignore new file mode 100644 index 00000000000..a9a143aa9ce --- /dev/null +++ b/src/Simulation/Simulators.Type2/.gitignore @@ -0,0 +1 @@ +Microsoft.Quantum.Simulators.Type2.nuspec \ No newline at end of file diff --git a/src/Simulation/Simulators.Type2/FindNuspecReferences.ps1 b/src/Simulation/Simulators.Type2/FindNuspecReferences.ps1 new file mode 100644 index 00000000000..80ec6dd6238 --- /dev/null +++ b/src/Simulation/Simulators.Type2/FindNuspecReferences.ps1 @@ -0,0 +1,101 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +######################################## +# .Description +# When creating a package with dotnet pack, nuget changes every ProjectReference to be itself +# a PackageReference (without checking if that project has a corresponding package). +# This is problematic because we currently don't want to create a package for every dll. +# +# On the other hand, when creating a package using nuget pack, nuget does not +# identify PackageReferences defined in the csproj, so all the dependencies +# are not listed and the package doesn't work. +# +# We don't want to hardcode the list of dependencies on the .nuspec, as they can +# quickly become out-of-sync. +# This script will find the PackageReferences recursively on the simulation projects and add them +# to the nuspec, so we can then create the package using nuget pack with the corresponding +# dependencies listed. +# +# nuget is tracking this problem at: https://github.com/NuGet/Home/issues/4491 +######################################## + +$target = Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.Type2.nuspec" + +if (Test-Path $target) { + Write-Host "$target exists. Skipping generating new one." + exit + } + + +# Start with the nuspec template +$nuspec = [xml](Get-Content (Join-Path $PSScriptRoot "Microsoft.Quantum.Simulators.Type2.nuspec.template")) +$dep = $nuspec.CreateElement('dependencies', $nuspec.package.metadata.NamespaceURI) + +function Add-PackageReferenceIfNew($ref) { + # Identify package's id either from "Include" or "Update" attribute: + $id = $ref.Include + $version = $ref.Version + + if ($id -eq $null -or $id -eq "") { + $id = $ref.Update + } + if ($id.EndsWith('.csproj') -or $id.EndsWith('.fsproj')) { + $id = [System.IO.Path]::GetFileNameWithoutExtension($id) + } + + if ($version -eq $null -or $version -eq "") { + $version = '$version$' + } + + # Check if package already added as dependency, only add if new: + $added = $dep.dependency | Where { $_.id -eq $id } + if (!$added) { + Write-Host "Adding $id (version: $version)" + $onedependency = $dep.AppendChild($nuspec.CreateElement('dependency', $nuspec.package.metadata.NamespaceURI)) + $onedependency.SetAttribute('id', $id) + $onedependency.SetAttribute('version', $version) + } +} + +# Recursively find PackageReferences on all ProjectReferences: +function Add-NuGetDependencyFromCsprojToNuspec($PathToCsproj) { + Write-Host "`nFinding dependencies for $PathToCsproj" + $csproj = [xml](Get-Content $PathToCsproj) + + # Find all PackageReferences nodes: + $packageDependency = $csproj.Project.ItemGroup.PackageReference | Where-Object { $null -ne $_ } + $packageDependency | ForEach-Object { + $id = $_.Include + Write-Host "Detected package dependencies: $id" + } + + $packageDependency | ForEach-Object { + Add-PackageReferenceIfNew $_ + } + + $projectDependency = $csproj.Project.ItemGroup.ProjectReference | Where-Object { $null -ne $_ } + $projectDependency | ForEach-Object { + $id = $_.Include + Write-Host "Detected project dependencies: $id" + } + + # Assume there is a package for project references that are not tagged as to be included in the simulator package: + $projectDependency | Where-Object {$_.IncludeInSimulatorPackage -ne 'true' -and $_.IsQscReference -ne 'true'} | ForEach-Object { + Add-PackageReferenceIfNew $_ + } + + # Recursively check on project references if they are private: + $projectDependency | Where-Object {$_.IncludeInSimulatorPackage -eq 'true' -and $_.IsQscReference -ne 'true'} | ForEach-Object { + $id = $_.Include + Write-Host "Recurring for $id" + Add-NuGetDependencyFromCsprojToNuspec $_.Include + } +} + +# Find all dependencies packaged as part of Microsoft.Quantum.Simulators.Type2 +Add-NuGetDependencyFromCsprojToNuspec "Microsoft.Quantum.Simulators.Type2.csproj" + +# Save into .nuspec file: +$nuspec.package.metadata.AppendChild($dep) +$nuspec.Save($target) diff --git a/src/Simulation/Simulators.Type2/Microsoft.Quantum.Simulators.Type2.csproj b/src/Simulation/Simulators.Type2/Microsoft.Quantum.Simulators.Type2.csproj new file mode 100644 index 00000000000..3fb63e0fb7d --- /dev/null +++ b/src/Simulation/Simulators.Type2/Microsoft.Quantum.Simulators.Type2.csproj @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Simulation/Simulators.Type2/Microsoft.Quantum.Simulators.Type2.nuspec.template b/src/Simulation/Simulators.Type2/Microsoft.Quantum.Simulators.Type2.nuspec.template new file mode 100644 index 00000000000..aa78d359d19 --- /dev/null +++ b/src/Simulation/Simulators.Type2/Microsoft.Quantum.Simulators.Type2.nuspec.template @@ -0,0 +1,31 @@ + + + + Microsoft.Quantum.Simulators.Type2 + $version$ + $title$ + Microsoft + QuantumEngineering, Microsoft + MIT + https://docs.microsoft.com/en-us/quantum + images\qdk-nuget-icon.png + false + Type2 simulators of quantum computers for the Q# programming language. + See: https://docs.microsoft.com/en-us/quantum/relnotes/ + © Microsoft Corporation. All rights reserved. + Quantum Q# Qsharp + + + + + + + + + + + + + + + diff --git a/src/Simulation/Simulators.Type2/Properties/AssemblyInfo.cs b/src/Simulation/Simulators.Type2/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..a11422cdc41 --- /dev/null +++ b/src/Simulation/Simulators.Type2/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allow the test assembly to use our internal methods +[assembly: InternalsVisibleTo("Tests.Microsoft.Quantum.Simulators.Type2" + SigningConstants.PUBLIC_KEY)] \ No newline at end of file diff --git a/src/Simulation/Simulators/FindNuspecReferences.ps1 b/src/Simulation/Simulators/FindNuspecReferences.ps1 index 993f4b0948e..fecd108c923 100644 --- a/src/Simulation/Simulators/FindNuspecReferences.ps1 +++ b/src/Simulation/Simulators/FindNuspecReferences.ps1 @@ -7,7 +7,7 @@ # This is problematic because we currently don't want to create a package for every dll. # # On the other hand, when creating a package using nuget pack, nuget does not -# identifies PackageReferences defined in the csproj, so all the dependencies +# identify PackageReferences defined in the csproj, so all the dependencies # are not listed and the package doesn't work. # # We don't want to hardcode the list of dependencies on the .nuspec, as they can @@ -97,7 +97,7 @@ function Add-NuGetDependencyFromCsprojToNuspec($PathToCsproj) # Find all dependencies packaged as part of Microsoft.Quantum.Simulators Add-NuGetDependencyFromCsprojToNuspec "../QCTraceSimulator/Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj" # has a dependency on Common, need to list this because it is listed only in an imported props file ... -Add-NuGetDependencyFromCsprojToNuspec "../Simulators/Microsoft.Quantum.Simulators.csproj" +Add-NuGetDependencyFromCsprojToNuspec "Microsoft.Quantum.Simulators.csproj" # Save into .nuspec file: $nuspec.package.metadata.AppendChild($dep) diff --git a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj index 598b15cabc8..d52904d18e8 100644 --- a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj @@ -1,45 +1,18 @@  - - - - - - netstandard2.1 - false - false - - - - 8.0 - enable - - - - - - + - + + + + + - - runtimes\win-x64\native\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - false - - - runtimes\osx-x64\native\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - false - - - runtimes\linux-x64\native\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - false - + + diff --git a/src/Simulation/Simulators/QuantumSimulator/ExpFrac.cs b/src/Simulation/Simulators/QuantumSimulator/ExpFrac.cs deleted file mode 100644 index 83bfd33862b..00000000000 --- a/src/Simulation/Simulators/QuantumSimulator/ExpFrac.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -using Microsoft.Quantum.Simulation.Core; - -namespace Microsoft.Quantum.Simulation.Simulators -{ - - public partial class QuantumSimulator - { - public class QSimExpFrac : Intrinsic.ExpFrac - { - public QSimExpFrac(QuantumSimulator m) : base(m) - { - } - - public static double Angle(long numerator, long power) => - (System.Math.PI * numerator) / (1 << (int)power); - - public override Func<(IQArray, long, long, IQArray), QVoid> __Body__ => (args) => - { - var (paulis, numerator, power, qubits) = args; - var angle = Angle(numerator, power); - return Exp__.Apply((paulis, angle, qubits)); - }; - - public override Func<(IQArray, long, long, IQArray), QVoid> __AdjointBody__ => (args) => - { - var (paulis, numerator, power, qubits) = args; - var angle = Angle(numerator, power); - return Exp__.Adjoint.Apply((paulis, angle, qubits)); - }; - - public override Func<(IQArray, (IQArray, long, long, IQArray)), QVoid> __ControlledBody__ => (args) => - { - var (ctrls, (paulis, numerator, power, qubits)) = args; - var angle = Angle(numerator, power); - return Exp__.Controlled.Apply((ctrls, (paulis, angle, qubits))); - }; - - public override Func<(IQArray, (IQArray, long, long, IQArray)), QVoid> __ControlledAdjointBody__ => (args) => - { - var (ctrls, (paulis, numerator, power, qubits)) = args; - var angle = Angle(numerator, power); - return Exp__.Adjoint.Controlled.Apply((ctrls, (paulis, angle, qubits))); - }; - } - } -} diff --git a/src/Simulation/Simulators/QuantumSimulator/RFrac.cs b/src/Simulation/Simulators/QuantumSimulator/RFrac.cs deleted file mode 100644 index 7e09e5a6b5a..00000000000 --- a/src/Simulation/Simulators/QuantumSimulator/RFrac.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -using Microsoft.Quantum.Simulation.Core; - -namespace Microsoft.Quantum.Simulation.Simulators -{ - - public partial class QuantumSimulator - { - public class QSimRFrac : Intrinsic.RFrac - { - public QSimRFrac(QuantumSimulator m) : base(m) - { - } - - public static double Angle(long numerator, long power) => - (-2.0 * System.Math.PI * numerator) / (1 << (int)power); - - public override Func<(Pauli, long, long, Qubit), QVoid> __Body__ => (args) => - { - var (pauli, numerator, power, qubit) = args; - var angle = Angle(numerator, power); - return R__.Apply((pauli, angle, qubit)); - }; - - public override Func<(Pauli, long, long, Qubit), QVoid> __AdjointBody__ => (args) => - { - var (pauli, numerator, power, qubit) = args; - var angle = Angle(numerator, power); - return R__.Adjoint.Apply((pauli, angle, qubit)); - }; - - public override Func<(IQArray, (Pauli, long, long, Qubit)), QVoid> __ControlledBody__ => (args) => - { - var (ctrls, (pauli, numerator, power, qubit)) = args; - var angle = Angle(numerator, power); - return R__.Controlled.Apply((ctrls, (pauli, angle, qubit))); - }; - - public override Func<(IQArray, (Pauli, long, long, Qubit)), QVoid> __ControlledAdjointBody__ => (args) => - { - var (ctrls, (pauli, numerator, power, qubit)) = args; - var angle = Angle(numerator, power); - return R__.Adjoint.Controlled.Apply((ctrls, (pauli, angle, qubit))); - }; - } - } -} diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyControlledX.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyControlledX.qs new file mode 100644 index 00000000000..4bf60fd83dd --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyControlledX.qs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the controlled-X (or CNOT) gate to a pair of qubits. Note that the Controlled + /// functor is not supported. + /// + /// # 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 + /// CNOT(control, target); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyControlledX") + internal operation ApplyControlledX (control : Qubit, target : Qubit) : Unit is Adj { + CNOT(control, target); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyControlledZ.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyControlledZ.qs new file mode 100644 index 00000000000..70cb2a6d068 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyControlledZ.qs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the controlled-Z (CZ) gate to a pair of qubits. Note that the Controlled + /// functor is not supported. + /// + /// $$ + /// \begin{align} + /// 1 & 0 & 0 & 0 \\\\ + /// 0 & 1 & 0 & 0 \\\\ + /// 0 & 0 & 1 & 0 \\\\ + /// 0 & 0 & 0 & -1 + /// \end{align}, + /// $$ + /// where rows and columns are organized as in the quantum concepts guide. + /// + /// # Input + /// ## control + /// Control qubit for the CZ gate. + /// ## target + /// Target qubit for the CZ gate. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// Controlled Z([control], target); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyControlledZ") + internal operation ApplyControlledZ (control : Qubit, target : Qubit) : Unit is Adj { + Controlled Z([control], target); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledH.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledH.qs new file mode 100644 index 00000000000..74a4e5f61fa --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledH.qs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Hadamard transformation to a single qubit. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// H \mathrel{:=} + /// \frac{1}{\sqrt{2}} + /// \begin{bmatrix} + /// 1 & 1 \\\\ + /// 1 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledH") + internal operation ApplyUncontrolledH (qubit : Qubit) : Unit is Adj { + H(qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRx.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRx.qs new file mode 100644 index 00000000000..8db8b3733a1 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRx.qs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $x$-axis by a given angle. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// R_x(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_x / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -i\sin \frac{\theta}{2} \\\\ + /// -i\sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliX, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledRx") + internal operation ApplyUncontrolledRx (theta : Double, qubit : Qubit) : Unit is Adj { + Rx(theta, qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRy.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRy.qs new file mode 100644 index 00000000000..bd72cde1e7e --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRy.qs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $y$-axis by a given angle. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// R_y(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_y / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -\sin \frac{\theta}{2} \\\\ + /// \sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliY, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledRy") + internal operation ApplyUncontrolledRy (theta : Double, qubit : Qubit) : Unit is Adj { + Ry(theta, qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRz.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRz.qs new file mode 100644 index 00000000000..5c864aae74f --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledRz.qs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $z$-axis by a given angle. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// R_z(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_z / 2} = + /// \begin{bmatrix} + /// e^{-i \theta / 2} & 0 \\\\ + /// 0 & e^{i \theta / 2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliZ, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledRz") + internal operation ApplyUncontrolledRz (theta : Double, qubit : Qubit) : Unit is Adj { + Rz(theta, qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledS.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledS.qs new file mode 100644 index 00000000000..1b64c5e7839 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledS.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/4 phase gate to a single qubit. Note that the Controlled functor + /// is not supported. + /// + /// # Description + /// \begin{align} + /// S \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & i + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledS") + internal operation ApplyUncontrolledS (qubit : Qubit) : Unit is Adj { + S(qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledT.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledT.qs new file mode 100644 index 00000000000..60cf1ecd7b8 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledT.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/8 gate to a single qubit. Note that the Controlled functor is + /// not supported. + /// + /// # Description + /// \begin{align} + /// T \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & e^{i \pi / 4} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledT") + internal operation ApplyUncontrolledT (qubit : Qubit) : Unit is Adj { + T(qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledX.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledX.qs new file mode 100644 index 00000000000..08a566bc840 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledX.qs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $X$ gate. Note that the Controlled functor is not supported. + /// + /// # Description + /// \begin{align} + /// \sigma_x \mathrel{:=} + /// \begin{bmatrix} + /// 0 & 1 \\\\ + /// 1 & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledX") + internal operation ApplyUncontrolledX (qubit : Qubit) : Unit is Adj { + X(qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledY.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledY.qs new file mode 100644 index 00000000000..bee6d1fb7b3 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledY.qs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Y$ gate. Note that the Controlled functor is not supported. + /// + /// # Description + /// \begin{align} + /// \sigma_y \mathrel{:=} + /// \begin{bmatrix} + /// 0 & -i \\\\ + /// i & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledY") + internal operation ApplyUncontrolledY (qubit : Qubit) : Unit is Adj { + Y(qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledZ.qs b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledZ.qs new file mode 100644 index 00000000000..ffb10e7e364 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ApplyUncontrolledZ.qs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Z$ gate. Note that the Controlled functor is not supported. + /// + /// # Description + /// \begin{align} + /// \sigma_z \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledZ") + internal operation ApplyUncontrolledZ (qubit : Qubit) : Unit is Adj { + Z(qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/QsharpCore/Diagnostics/AssertOperationsEqualInPlace.qs b/src/Simulation/TargetDefinitions/Decompositions/AssertOperationsEqualInPlace.qs similarity index 86% rename from src/Simulation/QsharpCore/Diagnostics/AssertOperationsEqualInPlace.qs rename to src/Simulation/TargetDefinitions/Decompositions/AssertOperationsEqualInPlace.qs index 33bfdd67896..427e3c50451 100644 --- a/src/Simulation/QsharpCore/Diagnostics/AssertOperationsEqualInPlace.qs +++ b/src/Simulation/TargetDefinitions/Decompositions/AssertOperationsEqualInPlace.qs @@ -9,7 +9,7 @@ namespace Microsoft.Quantum.Diagnostics { /// Iterates a variable through a Cartesian product /// [ 0, bounds[0]-1 ] × [ 0, bounds[1]-1 ] × [ 0, bounds[Length(bounds)-1]-1 ] /// and calls op(arr) for every element of the Cartesian product - operation _iterateThroughCartesianPower (length : Int, value : Int, op : (Int[] => Unit)) : Unit { + internal operation IterateThroughCartesianPower (length : Int, value : Int, op : (Int[] => Unit)) : Unit { mutable bounds = new Int[length]; for (i in 0 .. length - 1) @@ -67,12 +67,10 @@ namespace Microsoft.Quantum.Diagnostics { /// ## basis /// Array of single-qubit basis state IDs (0 <= id <= 3), one for each element of /// qubits. - operation _flipToBasis (basis : Int[], qubits : Qubit[]) : Unit - is Adj + Ctl { - + internal operation FlipToBasis (basis : Int[], qubits : Qubit[]) : Unit is Adj + Ctl { if (Length(qubits) != Length(basis)) { - fail $"qubits and stateIds must have the same length"; + fail "qubits and stateIds must have the same length"; } for (i in 0 .. Length(qubits) - 1) @@ -108,7 +106,7 @@ namespace Microsoft.Quantum.Diagnostics { /// # Summary /// Checks if the result of applying two operations `givenU` and `expectedU` to /// a basis state is the same. The basis state is described by `basis` parameter. - /// See function for more details on this + /// See function for more details on this /// description. /// /// # Input @@ -119,15 +117,15 @@ namespace Microsoft.Quantum.Diagnostics { /// Operation on $n$ qubits to be checked. /// ## expectedU /// Reference operation on $n$ qubits that givenU is to be compared against. - operation _assertEqualOnBasisVector (basis : Int[], givenU : (Qubit[] => Unit), expectedU : (Qubit[] => Unit is Adj)) : Unit { + internal operation AssertEqualOnBasisVector (basis : Int[], givenU : (Qubit[] => Unit), expectedU : (Qubit[] => Unit is Adj)) : Unit { let tolerance = 1e-5; using (qubits = Qubit[Length(basis)]) { AssertAllZeroWithinTolerance(qubits, tolerance); - _flipToBasis(basis, qubits); + FlipToBasis(basis, qubits); givenU(qubits); Adjoint expectedU(qubits); - Adjoint _flipToBasis(basis, qubits); + Adjoint FlipToBasis(basis, qubits); AssertAllZeroWithinTolerance(qubits, tolerance); } } @@ -157,8 +155,8 @@ namespace Microsoft.Quantum.Diagnostics { /// described in [ *I. L. Chuang, M. A. Nielsen* ](https://arxiv.org/abs/quant-ph/9610001). operation AssertOperationsEqualInPlace(nQubits : Int, givenU : (Qubit[] => Unit), expectedU : (Qubit[] => Unit is Adj)) : Unit { - let checkOperation = _assertEqualOnBasisVector(_, givenU, expectedU); - _iterateThroughCartesianPower(nQubits, 4, checkOperation); + let checkOperation = AssertEqualOnBasisVector(_, givenU, expectedU); + IterateThroughCartesianPower(nQubits, 4, checkOperation); } /// # Summary @@ -177,8 +175,8 @@ namespace Microsoft.Quantum.Diagnostics { /// Reference operation on $n$ qubits that `givenU` is to be compared against. operation AssertOperationsEqualInPlaceCompBasis (nQubits : Int, givenU : (Qubit[] => Unit), expectedU : (Qubit[] => Unit is Adj)) : Unit { - let checkOperation = _assertEqualOnBasisVector(_, givenU, expectedU); - _iterateThroughCartesianPower(nQubits, 2, checkOperation); + let checkOperation = AssertEqualOnBasisVector(_, givenU, expectedU); + IterateThroughCartesianPower(nQubits, 2, checkOperation); } } diff --git a/src/Simulation/QsharpCore/Diagnostics/AssertOperationsEqualReferenced.qs b/src/Simulation/TargetDefinitions/Decompositions/AssertOperationsEqualReferenced.qs similarity index 93% rename from src/Simulation/QsharpCore/Diagnostics/AssertOperationsEqualReferenced.qs rename to src/Simulation/TargetDefinitions/Decompositions/AssertOperationsEqualReferenced.qs index 1b17f67b92f..eed629789a1 100644 --- a/src/Simulation/QsharpCore/Diagnostics/AssertOperationsEqualReferenced.qs +++ b/src/Simulation/TargetDefinitions/Decompositions/AssertOperationsEqualReferenced.qs @@ -17,7 +17,7 @@ namespace Microsoft.Quantum.Diagnostics { /// A qubit array in the $\ket{0\cdots 0}$ state /// ## right /// A qubit array in the $\ket{0\cdots 0}$ state - operation _prepareEntangledState (left : Qubit[], right : Qubit[]) : Unit + internal operation PrepareEntangledState (left : Qubit[], right : Qubit[]) : Unit is Adj + Ctl { for (idxQubit in 0 .. Length(left) - 1) @@ -56,10 +56,10 @@ namespace Microsoft.Quantum.Diagnostics { operation AssertOperationsEqualReferenced (nQubits : Int, actual : (Qubit[] => Unit), expected : (Qubit[] => Unit is Adj)) : Unit { // Prepare a reference register entangled with the target register. using ((reference, target) = (Qubit[nQubits], Qubit[nQubits])) { - _prepareEntangledState(reference, target); + PrepareEntangledState(reference, target); actual(target); Adjoint expected(target); - Adjoint _prepareEntangledState(reference, target); + Adjoint PrepareEntangledState(reference, target); AssertAllZero(reference + target); ResetAll(target); ResetAll(reference); diff --git a/src/Simulation/TargetDefinitions/Decompositions/CCNOT.qs b/src/Simulation/TargetDefinitions/Decompositions/CCNOT.qs new file mode 100644 index 00000000000..99772e845a0 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/CCNOT.qs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the doubly controlled–NOT (CCNOT) gate to three qubits. + /// + /// # Input + /// ## control1 + /// First control qubit for the CCNOT gate. + /// ## control2 + /// Second control qubit for the CCNOT gate. + /// ## target + /// Target qubit for the CCNOT gate. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// Controlled X([control1, control2], target); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.CCNOT") + operation CCNOT (control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj + Ctl { + body (...) { + Controlled X([control1, control2], target); + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/CCNOTFromCCZ.qs b/src/Simulation/TargetDefinitions/Decompositions/CCNOTFromCCZ.qs new file mode 100644 index 00000000000..5b1601c799b --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/CCNOTFromCCZ.qs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the doubly controlled–NOT (CCNOT) gate to three qubits. + /// + /// # Input + /// ## control1 + /// First control qubit for the CCNOT gate. + /// ## control2 + /// Second control qubit for the CCNOT gate. + /// ## target + /// Target qubit for the CCNOT gate. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// Controlled X([control1, control2], target); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.CCNOT") + operation CCNOT (control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj + Ctl { + body (...) { + // [Page 15 of arXiv:1206.0758v3](https://arxiv.org/pdf/1206.0758v3.pdf#page=15) + within { + H(target); + } + apply { + Controlled Z([control1, control2], target); + } + } + controlled (ctls, ...) { + Controlled X (ctls + [control1, control2], target); + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/CNOT.qs b/src/Simulation/TargetDefinitions/Decompositions/CNOT.qs new file mode 100644 index 00000000000..7817f4fd480 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/CNOT.qs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # 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); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.CNOT") + operation CNOT (control : Qubit, target : Qubit) : Unit is Adj + Ctl { + body (...) { + Controlled X([control], target); + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ExpFrac.qs b/src/Simulation/TargetDefinitions/Decompositions/ExpFrac.qs new file mode 100644 index 00000000000..5a0bdeeb3f1 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ExpFrac.qs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Math; + open Microsoft.Quantum.Convert; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the exponential of a multi-qubit Pauli operator + /// with an argument given by a dyadic fraction. + /// + /// # Description + /// \begin{align} + /// e^{i \pi k [P_0 \otimes P_1 \cdots P_{N-1}] / 2^n}, + /// \end{align} + /// where $P_i$ is the $i$th element of `paulis`, and where + /// $N = $`Length(paulis)`. + /// + /// # Input + /// ## paulis + /// Array of single-qubit Pauli values indicating the tensor product + /// factors on each qubit. + /// ## numerator + /// Numerator ($k$) in the dyadic fraction representation of the angle + /// by which the qubit register is to be rotated. + /// ## power + /// Power of two ($n$) specifying the denominator of the angle by which + /// the qubit register is to be rotated. + /// ## qubits + /// Register to apply the given rotation to. + @EnableTestingViaName("Test.TargetDefinitions.ExpFrac") + operation ExpFrac (paulis : Pauli[], numerator : Int, power : Int, qubits : Qubit[]) : Unit is Adj + Ctl { + // Note that power must be converted to a double and used with 2.0 instead of 2 to allow for + // negative exponents that result in a fractional denominator. + let angle = (PI() * IntAsDouble(numerator)) / (2.0 ^ IntAsDouble(power)); + Exp(paulis, angle, qubits); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ExpFracFromExpUtil.qs b/src/Simulation/TargetDefinitions/Decompositions/ExpFracFromExpUtil.qs new file mode 100644 index 00000000000..226630ffb79 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ExpFracFromExpUtil.qs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Math; + open Microsoft.Quantum.Convert; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the exponential of a multi-qubit Pauli operator + /// with an argument given by a dyadic fraction. + /// + /// # Description + /// \begin{align} + /// e^{i \pi k [P_0 \otimes P_1 \cdots P_{N-1}] / 2^n}, + /// \end{align} + /// where $P_i$ is the $i$th element of `paulis`, and where + /// $N = $`Length(paulis)`. + /// + /// # Input + /// ## paulis + /// Array of single-qubit Pauli values indicating the tensor product + /// factors on each qubit. + /// ## numerator + /// Numerator ($k$) in the dyadic fraction representation of the angle + /// by which the qubit register is to be rotated. + /// ## power + /// Power of two ($n$) specifying the denominator of the angle by which + /// the qubit register is to be rotated. + /// ## qubits + /// Register to apply the given rotation to. + @EnableTestingViaName("Test.TargetDefinitions.ExpFrac") + operation ExpFrac (paulis : Pauli[], numerator : Int, power : Int, qubits : Qubit[]) : Unit is Adj + Ctl { + body (...) { + if (Length(paulis) != Length(qubits)) { fail "Arrays 'pauli' and 'target' must have the same length"; } + + if (Length(paulis) != 0) { + let indices = IndicesOfNonIdentity(paulis); + let newPaulis = Subarray(indices, paulis); + let newQubits = Subarray(indices, qubits); + + if (Length(indices) != 0) { + let (kModPositive, n) = ReducedDyadicFractionPeriodic(numerator, power); // k is odd, in the range [1,2*2^n-1] or (k,n) are both 0 + let numeratorD = PI() * IntAsDouble(kModPositive); + let theta = numeratorD * PowD(2.0, IntAsDouble(-n)); + ExpUtil(newPaulis, theta, newQubits, RFrac(_, numerator, power, _)); + } + else { + ApplyGlobalPhaseFracWithR1Frac(numerator, power); + } + } + } + adjoint(...) { + ExpFrac(paulis, -numerator, power, qubits); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ExpFromExpUtil.qs b/src/Simulation/TargetDefinitions/Decompositions/ExpFromExpUtil.qs new file mode 100644 index 00000000000..6bd54f9a036 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ExpFromExpUtil.qs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the exponential of a multi-qubit Pauli operator. + /// + /// # Description + /// \begin{align} + /// e^{i \theta [P_0 \otimes P_1 \cdots P_{N-1}]}, + /// \end{align} + /// where $P_i$ is the $i$th element of `paulis`, and where + /// $N = $`Length(paulis)`. + /// + /// # Input + /// ## paulis + /// Array of single-qubit Pauli values indicating the tensor product + /// factors on each qubit. + /// ## theta + /// Angle about the given multi-qubit Pauli operator by which the + /// target register is to be rotated. + /// ## qubits + /// Register to apply the given rotation to. + @EnableTestingViaName("Test.TargetDefinitions.Exp") + operation Exp (paulis : Pauli[], theta : Double, qubits : Qubit[]) : Unit is Adj + Ctl { + body (...) { + if (Length(paulis) != Length(qubits)) { fail "Arrays 'pauli' and 'qubits' must have the same length"; } + let (newPaulis, newQubits) = RemovePauliI(paulis, qubits); + + if (Length(newPaulis) != 0) { + ExpUtil(newPaulis, theta , newQubits, R(_, -2.0 * theta, _)); + } + else { + ApplyGlobalPhase(theta); + } + } + adjoint(...) { + Exp(paulis, -theta, qubits); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ExpUtil.qs b/src/Simulation/TargetDefinitions/Decompositions/ExpUtil.qs new file mode 100644 index 00000000000..5131ac27048 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ExpUtil.qs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + @EnableTestingViaName("Test.TargetDefinitions.ExpUtil") + internal operation ExpUtil (paulis : Pauli[], theta : Double, qubits : Qubit[], rotation : ((Pauli, Qubit) => Unit is Adj + Ctl)) : Unit is Ctl { + if (Length(paulis) != Length(qubits)) { fail "Arrays 'paulis' and 'qubits' must have the same length"; } + if (Length(paulis) == 1) { + rotation(paulis[0], qubits[0]); + } + else { // Length(paulis) > 1 + within { + for (i in 0 .. Length(paulis) - 1) { + MapPauli(qubits[i], PauliZ, paulis[i]); + } + } + apply { + within { + SpreadZ(qubits[0], qubits[ 1 .. Length(qubits) - 1]); + } + apply { + rotation(PauliZ, qubits[0]); + } + } + } + } + + +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ExpUtilFromIsing.qs b/src/Simulation/TargetDefinitions/Decompositions/ExpUtilFromIsing.qs new file mode 100644 index 00000000000..b1bbc9d0dc4 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ExpUtilFromIsing.qs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + @EnableTestingViaName("Test.TargetDefinitions.ExpUtil") + internal operation ExpUtil (paulis : Pauli[], theta : Double, qubits : Qubit[], rotation : ((Pauli, Qubit) => Unit is Adj + Ctl)) : Unit is Ctl { + if (Length(paulis) != Length(qubits)) { fail "Arrays 'paulis' and 'qubits' must have the same length"; } + if (Length(paulis) == 1) { + rotation(paulis[0], qubits[0]); + } + elif (Length(paulis) == 2) { + within { + MapPauli(qubits[1], paulis[0], paulis[1]); + } + apply { + if (paulis[0] == PauliX) { + IsingXX(theta / 2.0, qubits[0], qubits[1]); + } elif (paulis[0] == PauliY) { + IsingYY(theta / 2.0, qubits[0], qubits[1]); + } elif (paulis[0] == PauliZ) { + IsingZZ(theta / 2.0, qubits[0], qubits[1]); + } else { + fail "Type2 decompositions do not support PauliI as an input to Exp"; + } + } + } + else { // Length(paulis) > 2 + within { + for (i in 0 .. Length(paulis) - 1) { + MapPauli(qubits[i], PauliZ, paulis[i]); + } + } + apply { + within { + SpreadZ(qubits[1], qubits[2 .. Length(qubits) - 1]); + } + apply { + IsingZZ(theta / 2.0, qubits[0], qubits[1]); + } + } + } + } + +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/HFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/HFromSinglyControlled.qs new file mode 100644 index 00000000000..ff638cc18d9 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/HFromSinglyControlled.qs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Hadamard transformation to a single qubit. + /// + /// # Description + /// \begin{align} + /// H \mathrel{:=} + /// \frac{1}{\sqrt{2}} + /// \begin{bmatrix} + /// 1 & 1 \\\\ + /// 1 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.H") + operation H (qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledH(qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledH(qubit); + } + elif (Length(ctls) == 1) { + within{ + S(qubit); + H(qubit); + T(qubit); + } apply { + CNOT(ctls[0], qubit); + } + } + else { + ApplyWithLessControlsA(Controlled H, (ctls, qubit)); + } + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/IsingXX.qs b/src/Simulation/TargetDefinitions/Decompositions/IsingXX.qs new file mode 100644 index 00000000000..2c4b93c4ad1 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/IsingXX.qs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the two qubit Ising $XX$ rotation gate. + /// + /// # Description + /// \begin{align} + /// XX(\theta) \mathrel{:=} + /// \begin{bmatrix} + /// \cos \theta & 0 & 0 & -i\sin \theta \\\\ + /// 0 & \cos \theta & -i\sin \theta & 0 \\\\ + /// 0 & -i\sin \theta & \cos \theta & 0 \\\\ + /// -i\sin \theta & 0 & 0 & \cos \theta + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// The angle about which the qubits are rotated. + /// ## qubit0 + /// The first qubit input to the gate. + /// ## qubit1 + /// The second qubit input to the gate. + @EnableTestingViaName("Test.TargetDefinitions.IsingXX") + internal operation IsingXX (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + Exp([PauliX, PauliX], theta * 2.0, [qubit0, qubit1]); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/IsingYY.qs b/src/Simulation/TargetDefinitions/Decompositions/IsingYY.qs new file mode 100644 index 00000000000..51d3a76c929 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/IsingYY.qs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the two qubit Ising $YY$ rotation gate. + /// + /// # Description + /// \begin{align} + /// YY(\theta) \mathrel{:=} + /// \begin{bmatrix} + /// \cos \theta & 0 & 0 & i\sin \theta \\\\ + /// 0 & \cos \theta & -i\sin \theta & 0 \\\\ + /// 0 & -i\sin \theta & \cos \theta & 0 \\\\ + /// i\sin \theta & 0 & 0 & \cos \theta + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// The angle about which the qubits are rotated. + /// ## qubit0 + /// The first qubit input to the gate. + /// ## qubit1 + /// The second qubit input to the gate. + @EnableTestingViaName("Test.TargetDefinitions.IsingYY") + internal operation IsingYY (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + Exp([PauliY, PauliY], theta * 2.0, [qubit0, qubit1]); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/IsingZZ.qs b/src/Simulation/TargetDefinitions/Decompositions/IsingZZ.qs new file mode 100644 index 00000000000..16649bcffd6 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/IsingZZ.qs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the two qubit Ising $ZZ$ rotation gate. + /// + /// # Description + /// \begin{align} + /// ZZ(\theta) \mathrel{:=} + /// \begin{bmatrix} + /// e^{-i \theta / 2} & 0 & 0 & 0 \\\\ + /// 0 & e^{-i \theta / 2} & 0 & 0 \\\\ + /// 0 & 0 & e^{-i \theta / 2} & 0 \\\\ + /// 0 & 0 & 0 & e^{i \theta / 2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// The angle about which the qubits are rotated. + /// ## qubit0 + /// The first qubit input to the gate. + /// ## qubit1 + /// The second qubit input to the gate. + @EnableTestingViaName("Test.TargetDefinitions.IsingZZ") + internal operation IsingZZ (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + Exp([PauliZ, PauliZ], theta * 2.0, [qubit0, qubit1]); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/M.qs b/src/Simulation/TargetDefinitions/Decompositions/M.qs new file mode 100644 index 00000000000..a8fb33939a2 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/M.qs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Performs a measurement of a single qubit in the + /// Pauli $Z$ basis. + /// + /// # Description + /// The output result is given by + /// the distribution + /// \begin{align} + /// \Pr(\texttt{Zero} | \ket{\psi}) = + /// \braket{\psi | 0} \braket{0 | \psi}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to be measured. + /// + /// # Output + /// `Zero` if the $+1$ eigenvalue is observed, and `One` if + /// the $-1$ eigenvalue is observed. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// Measure([PauliZ], [qubit]); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.M") + operation M (qubit : Qubit) : Result { + return Measure([PauliZ], [qubit]); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetX.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetX.qs new file mode 100644 index 00000000000..183fbbfd0e3 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetX.qs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + open Microsoft.Quantum.Targeting; + + /// # Summary + /// Measures a single qubit in the X basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $X$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $X$ basis. + @RequiresCapability( + "BasicQuantumFunctionality", + "MResetX is replaced by a supported implementation on all execution targets." + ) + @EnableTestingViaName("Test.TargetDefinitions.MResetX") + operation MResetX (target : Qubit) : Result { + let result = Measure([PauliX], [target]); + + // We must return the qubit to the Z basis as well. + H(target); + + if (result == One) { + // Recall that the +1 eigenspace of a measurement operator corresponds to + // the Result case Zero. Thus, if we see a One case, we must reset the state + // have +1 eigenvalue. + X(target); + } + + return result; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetXExplicit.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetXExplicit.qs new file mode 100644 index 00000000000..d853dc9e8e5 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetXExplicit.qs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Measures a single qubit in the X basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $X$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $X$ basis. + @EnableTestingViaName("Test.TargetDefinitions.MResetX") + operation MResetX (target : Qubit) : Result { + MapPauli(target, PauliZ, PauliX); + let result = M(target); + Reset(target); + return result; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetXWithNoReuse.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetXWithNoReuse.qs new file mode 100644 index 00000000000..0db2613018d --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetXWithNoReuse.qs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Measures a single qubit in the X basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $X$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $X$ basis. + @EnableTestingViaName("Test.TargetDefinitions.MResetX") + operation MResetX (target : Qubit) : Result { + // Because the qubit cannot be reused after measurement, no actual + // reset is required. + return Measure([PauliX], [target]); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetY.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetY.qs new file mode 100644 index 00000000000..290b1fb8352 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetY.qs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + open Microsoft.Quantum.Targeting; + + /// # Summary + /// Measures a single qubit in the Y basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $Y$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $Y$ basis. + @RequiresCapability( + "BasicQuantumFunctionality", + "MResetY is replaced by a supported implementation on all execution targets." + ) + @EnableTestingViaName("Test.TargetDefinitions.MResetY") + operation MResetY (target : Qubit) : Result { + let result = Measure([PauliY], [target]); + + // We must return the qubit to the Z basis as well. + Adjoint S(target); + H(target); + + if (result == One) { + // Recall that the +1 eigenspace of a measurement operator corresponds to + // the Result case Zero. Thus, if we see a One case, we must reset the state + // have +1 eigenvalue. + X(target); + } + + return result; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetYExplicit.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetYExplicit.qs new file mode 100644 index 00000000000..1bb586cfb8e --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetYExplicit.qs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Measures a single qubit in the Y basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $Y$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $Y$ basis. + @EnableTestingViaName("Test.TargetDefinitions.MResetY") + operation MResetY (target : Qubit) : Result { + MapPauli(target, PauliZ, PauliY); + let result = M(target); + Reset(target); + return result; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetYWithNoReuse.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetYWithNoReuse.qs new file mode 100644 index 00000000000..a2337edb403 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetYWithNoReuse.qs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Measures a single qubit in the Y basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $Y$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $Y$ basis. + @EnableTestingViaName("Test.TargetDefinitions.MResetY") + operation MResetY (target : Qubit) : Result { + // Because the qubit cannot be reused after measurement, no actual + // reset is required. + return Measure([PauliY], [target]); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetZ.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetZ.qs new file mode 100644 index 00000000000..8bb4a8849ec --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetZ.qs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + open Microsoft.Quantum.Targeting; + + /// # Summary + /// Measures a single qubit in the Z basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $Z$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $Z$ basis. + @RequiresCapability( + "BasicQuantumFunctionality", + "MResetZ is replaced by a supported implementation on all execution targets." + ) + @EnableTestingViaName("Test.TargetDefinitions.MResetZ") + operation MResetZ (target : Qubit) : Result { + let result = M(target); + + if (result == One) { + // Recall that the +1 eigenspace of a measurement operator corresponds to + // the Result case Zero. Thus, if we see a One case, we must reset the state + // have +1 eigenvalue. + X(target); + } + + return result; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetZExplicit.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetZExplicit.qs new file mode 100644 index 00000000000..53dac30786f --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetZExplicit.qs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Measures a single qubit in the Z basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $Z$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $Z$ basis. + @EnableTestingViaName("Test.TargetDefinitions.MResetZ") + operation MResetZ (target : Qubit) : Result { + let result = M(target); + Reset(target); + return result; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MResetZWithNoReuse.qs b/src/Simulation/TargetDefinitions/Decompositions/MResetZWithNoReuse.qs new file mode 100644 index 00000000000..a18daeb426b --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MResetZWithNoReuse.qs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Measures a single qubit in the Z basis, + /// and resets it to a fixed initial state + /// following the measurement. + /// + /// # Description + /// Performs a single-qubit measurement in the $Z$-basis, + /// and ensures that the qubit is returned to $\ket{0}$ + /// following the measurement. + /// + /// # Input + /// ## target + /// A single qubit to be measured. + /// + /// # Output + /// The result of measuring `target` in the Pauli $Z$ basis. + @EnableTestingViaName("Test.TargetDefinitions.MResetZ") + operation MResetZ (target : Qubit) : Result { + // Because the qubit cannot be reused after measurement, no actual + // reset is required. + return M(target); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/Measure.qs b/src/Simulation/TargetDefinitions/Decompositions/Measure.qs new file mode 100644 index 00000000000..06f83119c47 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/Measure.qs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Performs a joint measurement of one or more qubits in the + /// specified Pauli bases. + /// + /// # Description + /// The output result is given by the distribution: + /// \begin{align} + /// \Pr(\texttt{Zero} | \ket{\psi}) = + /// \frac12 \braket{ + /// \psi \mid| + /// \left( + /// \boldone + P_0 \otimes P_1 \otimes \cdots \otimes P_{N-1} + /// \right) \mid| + /// \psi + /// }, + /// \end{align} + /// where $P_i$ is the $i$th element of `bases`, and where + /// $N = \texttt{Length}(\texttt{bases})$. + /// That is, measurement returns a `Result` $d$ such that the eigenvalue of the + /// observed measurement effect is $(-1)^d$. + /// + /// # Input + /// ## bases + /// Array of single-qubit Pauli values indicating the tensor product + /// factors on each qubit. + /// ## qubits + /// Register of qubits to be measured. + /// + /// # Output + /// `Zero` if the $+1$ eigenvalue is observed, and `One` if + /// the $-1$ eigenvalue is observed. + /// + /// # Remarks + /// If the basis array and qubit array are different lengths, then the + /// operation will fail. + @EnableTestingViaName("Test.TargetDefinitions.Measure") + operation Measure (bases : Pauli[], qubits : Qubit[]) : Result { + if (Length(bases) != Length(qubits)) { fail "Arrays 'bases' and 'qubits' must be of the same length."; } + mutable res = One; + if( Length(bases) == 1 ) { + within { + MapPauli(qubits[0], PauliZ, bases[0]); + } + apply { + set res = M(qubits[0]); + PreparePostM(res, qubits[0]); + } + } + else { + using( q = Qubit() ) { + H(q); + for( k in 0 .. Length(bases) - 1 ) { + if( bases[k] == PauliX ) { Controlled X ([qubits[k]], q); } + if( bases[k] == PauliZ ) { Controlled Z ([qubits[k]], q); } + if( bases[k] == PauliY ) { Controlled Y ([qubits[k]], q); } + } + H(q); + set res = M(q); + Reset(q); + } + } + return res; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/MeasureWithNoReuse.qs b/src/Simulation/TargetDefinitions/Decompositions/MeasureWithNoReuse.qs new file mode 100644 index 00000000000..1bac07a8550 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/MeasureWithNoReuse.qs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Performs a joint measurement of one or more qubits in the + /// specified Pauli bases. + /// + /// # Description + /// The output result is given by the distribution: + /// \begin{align} + /// \Pr(\texttt{Zero} | \ket{\psi}) = + /// \frac12 \braket{ + /// \psi \mid| + /// \left( + /// \boldone + P_0 \otimes P_1 \otimes \cdots \otimes P_{N-1} + /// \right) \mid| + /// \psi + /// }, + /// \end{align} + /// where $P_i$ is the $i$th element of `bases`, and where + /// $N = \texttt{Length}(\texttt{bases})$. + /// That is, measurement returns a `Result` $d$ such that the eigenvalue of the + /// observed measurement effect is $(-1)^d$. + /// + /// # Input + /// ## bases + /// Array of single-qubit Pauli values indicating the tensor product + /// factors on each qubit. + /// ## qubits + /// Register of qubits to be measured. + /// + /// # Output + /// `Zero` if the $+1$ eigenvalue is observed, and `One` if + /// the $-1$ eigenvalue is observed. + /// + /// # Remarks + /// If the basis array and qubit array are different lengths, then the + /// operation will fail. + @EnableTestingViaName("Test.TargetDefinitions.Measure") + operation Measure (bases : Pauli[], qubits : Qubit[]) : Result { + if (Length(bases) != Length(qubits)) { fail "Arrays 'bases' and 'qubits' must be of the same length."; } + if (Length(bases) == 1) { + // Because the qubit cannot be reused after measurement, there is no + // need to unprepare the Pauli mapping. + MapPauli(qubits[0], PauliZ, bases[0]); + return M(qubits[0]); + } + else { + using (q = Qubit()) { + within { + H(q); + } + apply { + for (k in 0 .. Length(bases) - 1) { + if (bases[k] == PauliX) { Controlled X([qubits[k]], q); } + if (bases[k] == PauliZ) { Controlled Z([qubits[k]], q); } + if (bases[k] == PauliY) { Controlled Y([qubits[k]], q); } + } + } + return M(q); + } + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/PreparePostM.qs b/src/Simulation/TargetDefinitions/Decompositions/PreparePostM.qs new file mode 100644 index 00000000000..680d9d74faf --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/PreparePostM.qs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + @EnableTestingViaName("Test.TargetDefinitions.PreparePostM") + internal operation PreparePostM(result : Result, qubit : Qubit) : Unit { + // This platform requires reset after measurement, and then must + // re-prepare the measured state in the qubit. + Reset(qubit); + if (result == One) { + X(qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/PreparePostMNoop.qs b/src/Simulation/TargetDefinitions/Decompositions/PreparePostMNoop.qs new file mode 100644 index 00000000000..fb5dc304282 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/PreparePostMNoop.qs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + @EnableTestingViaName("Test.TargetDefinitions.PreparePostM") + internal operation PreparePostM(result : Result, qubit : Qubit) : Unit { + // This platform does not require any post-measurement reset, so + // no additional work is needed. + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/R.qs b/src/Simulation/TargetDefinitions/Decompositions/R.qs new file mode 100644 index 00000000000..bd3f376d6d4 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/R.qs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the given Pauli axis. + /// + /// # Description + /// \begin{align} + /// R_{\mu}(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_{\mu} / 2}, + /// \end{align} + /// where $\mu \in \{I, X, Y, Z\}$. + /// + /// # Input + /// ## pauli + /// Pauli operator ($\mu$) to be exponentiated to form the rotation. + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// When called with `pauli = PauliI`, this operation applies + /// a *global phase*. This phase can be significant + /// when used with the `Controlled` functor. + @EnableTestingViaName("Test.TargetDefinitions.R") + operation R (pauli : Pauli, theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + if (pauli == PauliX) { + Rx(theta, qubit); + } + elif (pauli == PauliY) { + Ry(theta, qubit); + } + elif (pauli == PauliZ) { + Rz(theta, qubit); + } + else { // PauliI + ApplyGlobalPhase( - theta / 2.0 ); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/R1.qs b/src/Simulation/TargetDefinitions/Decompositions/R1.qs new file mode 100644 index 00000000000..02ed51439bd --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/R1.qs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $\ket{1}$ state by a given angle. + /// + /// # Description + /// \begin{align} + /// R_1(\theta) \mathrel{:=} + /// \operatorname{diag}(1, e^{i\theta}). + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliZ, theta, qubit); + /// R(PauliI, -theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.R1") + operation R1 (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + R(PauliZ, theta, qubit); + R(PauliI, -theta, qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/R1Frac.qs b/src/Simulation/TargetDefinitions/Decompositions/R1Frac.qs new file mode 100644 index 00000000000..056e0ba9e54 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/R1Frac.qs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $\ket{1}$ state by an angle specified + /// as a dyadic fraction. + /// + /// # Description + /// \begin{align} + /// R_1(n, k) \mathrel{:=} + /// \operatorname{diag}(1, e^{i \pi k / 2^n}). + /// \end{align} + /// + /// > [!WARNING] + /// > This operation uses the **opposite** sign convention from + /// > @"microsoft.quantum.intrinsic.r", and does not include the + /// > factor of $1/ 2$ included by @"microsoft.quantum.intrinsic.r1". + /// + /// # Input + /// ## numerator + /// Numerator in the dyadic fraction representation of the angle + /// by which the qubit is to be rotated. + /// ## power + /// Power of two specifying the denominator of the angle by which + /// the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// RFrac(PauliZ, -numerator, denominator + 1, qubit); + /// RFrac(PauliI, numerator, denominator + 1, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.R1Frac") + operation R1Frac (numerator : Int, power : Int, qubit : Qubit) : Unit is Adj + Ctl { + RFrac(PauliZ, -numerator, power + 1, qubit); + RFrac(PauliI, numerator, power + 1, qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/RFrac.qs b/src/Simulation/TargetDefinitions/Decompositions/RFrac.qs new file mode 100644 index 00000000000..2c1e1b7be37 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/RFrac.qs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Math; + open Microsoft.Quantum.Convert; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the given Pauli axis by an angle specified + /// as a dyadic fraction. + /// + /// # Description + /// \begin{align} + /// R_{\mu}(n, k) \mathrel{:=} + /// e^{i \pi n \sigma_{\mu} / 2^k}, + /// \end{align} + /// where $\mu \in \{I, X, Y, Z\}$. + /// + /// > [!WARNING] + /// > This operation uses the **opposite** sign convention from + /// > @"microsoft.quantum.intrinsic.r". + /// + /// # Input + /// ## pauli + /// Pauli operator to be exponentiated to form the rotation. + /// ## numerator + /// Numerator in the dyadic fraction representation of the angle + /// by which the qubit is to be rotated. + /// ## power + /// Power of two specifying the denominator of the angle by which + /// the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// // PI() is a Q# function that returns an approximation of π. + /// R(pauli, -PI() * IntAsDouble(numerator) / IntAsDouble(2 ^ (power - 1)), qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.RFrac") + operation RFrac (pauli : Pauli, numerator : Int, power : Int, qubit : Qubit) : Unit is Adj + Ctl { + // Note that power must be converted to a double and used with 2.0 instead of 2 to allow for + // negative exponents that result in a fractional denominator. + let angle = ((-2.0 * PI()) * IntAsDouble(numerator)) / (2.0 ^ IntAsDouble(power)); + R(pauli, angle, qubit); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/Reset.qs b/src/Simulation/TargetDefinitions/Decompositions/Reset.qs new file mode 100644 index 00000000000..ded33c160e8 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/Reset.qs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + open Microsoft.Quantum.Targeting; + + /// # Summary + /// Given a single qubit, measures it and ensures it is in the |0⟩ state + /// such that it can be safely released. + /// + /// # Input + /// ## qubit + /// The qubit whose state is to be reset to $\ket{0}$. + @RequiresCapability( + "BasicQuantumFunctionality", + "Reset is replaced by a supported implementation on all execution targets." + ) + @EnableTestingViaName("Test.TargetDefinitions.Reset") + operation Reset (target : Qubit) : Unit { + if (M(target) == One) { + X(target); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ResetAll.qs b/src/Simulation/TargetDefinitions/Decompositions/ResetAll.qs new file mode 100644 index 00000000000..6a520c85bb7 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ResetAll.qs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Given an array of qubits, measure them and ensure they are in the |0⟩ state + /// such that they can be safely released. + /// + /// # Input + /// ## qubits + /// An array of qubits whose states are to be reset to $\ket{0}$. + @EnableTestingViaName("Test.TargetDefinitions.ResetAll") + operation ResetAll (qubits : Qubit[]) : Unit { + for (qubit in qubits) { + Reset(qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ResetWithoutReuse.qs b/src/Simulation/TargetDefinitions/Decompositions/ResetWithoutReuse.qs new file mode 100644 index 00000000000..bf7d0512f54 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ResetWithoutReuse.qs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Given a single qubit, measures it and ensures it is in the |0⟩ state + /// such that it can be safely released. + /// + /// # Input + /// ## qubit + /// The qubit whose state is to be reset to $\ket{0}$. + @EnableTestingViaName("Test.TargetDefinitions.Reset") + operation Reset (target : Qubit) : Unit { + // This platform doesn't support use of a qubit after measurement, so + // `Reset` is really just marking the qubit as measured. + let r = M(target); + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/Rx.qs b/src/Simulation/TargetDefinitions/Decompositions/Rx.qs new file mode 100644 index 00000000000..e7cf9c8be1c --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/Rx.qs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $x$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_x(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_x / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -i\sin \frac{\theta}{2} \\\\ + /// -i\sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliX, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Rx") + operation Rx (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + R(PauliX, theta, qubit); + } + adjoint (...) { + R(PauliX, -theta, qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/RxFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/RxFromSinglyControlled.qs new file mode 100644 index 00000000000..e964eb00297 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/RxFromSinglyControlled.qs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # SummaRx + /// Applies a rotation about the $x$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_x(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_x / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -i\sin \frac{\theta}{2} \\\\ + /// -i\sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliX, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Rx") + operation Rx (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledRx(theta, qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledRx(theta, qubit); + } + elif (Length(ctls) == 1) { + within { + MapPauli(qubit, PauliZ, PauliX); + } + apply { + Controlled Rz(ctls, (theta, qubit)); + } + } + else { + ApplyWithLessControlsA(Controlled Rx, (ctls, (theta, qubit))); + } + } + adjoint (...) { + Rx(-theta, qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/Ry.qs b/src/Simulation/TargetDefinitions/Decompositions/Ry.qs new file mode 100644 index 00000000000..ac1cb18dcfa --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/Ry.qs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $y$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_y(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_y / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -\sin \frac{\theta}{2} \\\\ + /// \sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliY, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Ry") + operation Ry (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + R(PauliY, theta, qubit); + } + adjoint (...) { + R(PauliY, -theta, qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/RyFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/RyFromSinglyControlled.qs new file mode 100644 index 00000000000..5b6d46032b0 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/RyFromSinglyControlled.qs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $y$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_y(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_y / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -\sin \frac{\theta}{2} \\\\ + /// \sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliY, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Ry") + operation Ry (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledRy(theta, qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledRy(theta, qubit); + } + elif (Length(ctls) == 1) { + within { + MapPauli(qubit, PauliZ, PauliY); + } + apply { + Controlled Rz(ctls, (theta, qubit)); + } + } + else { + ApplyWithLessControlsA(Controlled Ry, (ctls, (theta, qubit))); + } + } + adjoint (...) { + Ry(-theta, qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/Rz.qs b/src/Simulation/TargetDefinitions/Decompositions/Rz.qs new file mode 100644 index 00000000000..08d0e2b239b --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/Rz.qs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $z$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_z(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_z / 2} = + /// \begin{bmatrix} + /// e^{-i \theta / 2} & 0 \\\\ + /// 0 & e^{i \theta / 2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliZ, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Rz") + operation Rz (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + R(PauliZ, theta, qubit); + } + adjoint (...) { + R(PauliZ, -theta, qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/RzFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/RzFromSinglyControlled.qs new file mode 100644 index 00000000000..09bfa6aec51 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/RzFromSinglyControlled.qs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $z$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_z(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_z / 2} = + /// \begin{bmatrix} + /// e^{-i \theta / 2} & 0 \\\\ + /// 0 & e^{i \theta / 2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliZ, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Rz") + operation Rz (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledRz(theta, qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + Rz(theta, qubit); + } + elif (Length(ctls) == 1) { + Rz(theta/2.0, qubit); + CNOT(ctls[0], qubit); + Rz(-theta/2.0, qubit); + CNOT(ctls[0], qubit); + } + else { + ApplyWithLessControlsA(Controlled Rz, (ctls, (theta, qubit))); + } + } + adjoint (...) { + Rz(-theta, qubit); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/SFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/SFromSinglyControlled.qs new file mode 100644 index 00000000000..09655566e04 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/SFromSinglyControlled.qs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/4 phase gate to a single qubit. + /// + /// # Description + /// \begin{align} + /// S \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & i + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.S") + operation S (qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledS(qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledS(qubit); + } + elif (Length(ctls) == 1) { + T(ctls[0]); + T(qubit); + CNOT(ctls[0], qubit); + Adjoint T(qubit); + CNOT(ctls[0], qubit); + } + else { + ApplyWithLessControlsA(Controlled S, (ctls, qubit)); + } + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/SWAP.qs b/src/Simulation/TargetDefinitions/Decompositions/SWAP.qs new file mode 100644 index 00000000000..6952df79af6 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/SWAP.qs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the SWAP gate to a pair of qubits. + /// + /// # Description + /// \begin{align} + /// \operatorname{SWAP} \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 & 0 & 0 \\\\ + /// 0 & 0 & 1 & 0 \\\\ + /// 0 & 1 & 0 & 0 \\\\ + /// 0 & 0 & 0 & 1 + /// \end{bmatrix}, + /// \end{align} + /// + /// where rows and columns are ordered as in the quantum concepts guide. + /// + /// # Input + /// ## qubit1 + /// First qubit to be swapped. + /// ## qubit2 + /// Second qubit to be swapped. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// CNOT(qubit1, qubit2); + /// CNOT(qubit2, qubit1); + /// CNOT(qubit1, qubit2); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.SWAP") + operation SWAP (qubit1 : Qubit, qubit2 : Qubit) : Unit is Adj + Ctl { + body (...) { + CNOT(qubit1, qubit2); + CNOT(qubit2, qubit1); + CNOT(qubit1, qubit2); + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/SetToBasisState.qs b/src/Simulation/TargetDefinitions/Decompositions/SetToBasisState.qs new file mode 100644 index 00000000000..740925d833c --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/SetToBasisState.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Measurement { + open Microsoft.Quantum.Intrinsic; + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Sets a qubit to a given computational basis state by measuring the + /// qubit and applying a bit flip if needed. + /// + /// # Input + /// ## desired + /// The basis state that the qubit should be set to. + /// ## target + /// The qubit whose state is to be set. + /// + /// # Remarks + /// As an invariant of this operation, calling `M(q)` immediately + /// after `SetToBasisState(result, q)` will return `result`. + @EnableTestingViaName("Test.TargetDefinitions.SetToBasisState") + operation SetToBasisState(desired : Result, target : Qubit) : Unit { + if (desired != M(target)) { + X(target); + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/TFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/TFromSinglyControlled.qs new file mode 100644 index 00000000000..222ef97d9e1 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/TFromSinglyControlled.qs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/8 gate to a single qubit. + /// + /// # Description + /// \begin{align} + /// T \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & e^{i \pi / 4} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.T") + operation T (qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledT(qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledT(qubit); + } + elif (Length(ctls) == 1) { + R1Frac(1, 3, ctls[0]); + R1Frac(1, 3, qubit); + CNOT(ctls[0], qubit); + Adjoint R1Frac(1, 3, qubit); + CNOT(ctls[0], qubit); + } + else { + ApplyWithLessControlsA(Controlled T, (ctls, qubit)); + } + } + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/Utils.qs b/src/Simulation/TargetDefinitions/Decompositions/Utils.qs new file mode 100644 index 00000000000..d2808323a0d --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/Utils.qs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + @EnableTestingViaName("Test.TargetDefinitions.SpreadZ") + internal operation SpreadZ (from : Qubit, to : Qubit[]) : Unit is Adj { + if (Length(to) > 0) { + CNOT(to[0], from); + if (Length(to) > 1) { + let half = Length(to) / 2; + SpreadZ(to[0], to[half + 1 .. Length(to) - 1]); + SpreadZ(from, to[1 .. half]); + } + } + } + + @EnableTestingViaName("Test.TargetDefinitions.ApplyGlobalPhase") + internal operation ApplyGlobalPhase (theta : Double) : Unit is Ctl + Adj { + body (...) {} + controlled (controls, (...)) { + if (Length(controls) > 0) { + let qubit = controls[0]; + let rest = controls[1...]; + // Invoke Controlled R1, which will recursively call back into ApplyGlobalPhase. + // Each time the controls is one shorter, until it is empty and the recursion stops. + Controlled R1(rest, (theta, qubit)); + } + } + } + + @EnableTestingViaName("Test.TargetDefinitions.ApplyGlobalPhaseFracWithR1Frac") + internal operation ApplyGlobalPhaseFracWithR1Frac (numerator : Int, power : Int) : Unit is Adj + Ctl { + body (...) {} + controlled (ctrls, ...) { + let numControls = Length(ctrls); + if (numControls > 0 ) { + // Invoke Controlled R1Frac, which will recursively call back into ApplyGlobalPhase. + // Each time the controls is one shorter, until it is empty and the recursion stops. + Controlled R1Frac(ctrls[1 .. numControls - 1], (numerator, power, ctrls[0])); + } + } + } + + @EnableTestingViaName("Test.TargetDefinitions.MapPauli") + internal operation MapPauli (qubit : Qubit, from : Pauli, to : Pauli) : Unit is Adj { + if (from == to) { + } + elif ((from == PauliZ and to == PauliX) or (from == PauliX and to == PauliZ)) { + H(qubit); + } + elif (from == PauliZ and to == PauliY) { + H(qubit); + S(qubit); + H(qubit); + } + elif (from == PauliY and to == PauliZ) { + H(qubit); + Adjoint S(qubit); + H(qubit); + } + elif (from == PauliY and to == PauliX) { + S(qubit); + } + elif (from == PauliX and to == PauliY) { + Adjoint S(qubit); + } + else { + fail "Unsupported input"; + } + } + + /// Given a multiply-controlled operation that requires k controls + /// applies it using ceiling(k/2) controls and using floor(k/2) temporary qubits + @EnableTestingViaName("Test.TargetDefinitions.ApplyWithLessControlsA") + internal operation ApplyWithLessControlsA<'T> (op : ((Qubit[],'T) => Unit is Adj), (controls : Qubit[], arg : 'T)) : Unit is Adj { + let numControls = Length(controls); + let numControlPairs = numControls / 2; + using (temps = Qubit[numControlPairs]) { + within { + for (numPair in 0 .. numControlPairs - 1) { // constant depth + PhaseCCX(controls[2*numPair], controls[2*numPair + 1], temps[numPair]); + } + } + apply { + let newControls = numControls % 2 == 0 ? temps | temps + [controls[numControls - 1]]; + op(newControls, arg); + } + } + } + + @EnableTestingViaName("Test.TargetDefinitions.PhaseCCX") + internal operation PhaseCCX (control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj { + // https://arxiv.org/pdf/1210.0974.pdf#page=2 + H(target); + CNOT(target,control1); + CNOT(control1,control2); + T(control2); + Adjoint T(control1); + T(target); + CNOT(target,control1); + CNOT(control1,control2); + Adjoint T(control2); + CNOT(target,control2); + H(target); + } + + @EnableTestingViaName("Test.TargetDefinitions.ReducedDyadicFraction") + internal function ReducedDyadicFraction (numerator : Int, denominatorPowerOfTwo : Int) : (Int, Int) { + if (numerator == 0) { return (0,0); } + mutable num = numerator; + mutable denPow = denominatorPowerOfTwo; + while(num % 2 == 0) { + set num /= 2; + set denPow += 1; + } + return (num,denPow); + } + + @EnableTestingViaName("Test.TargetDefinitions.ReducedDyadicFractionPeriodic") + internal function ReducedDyadicFractionPeriodic (numerator : Int, denominatorPowerOfTwo : Int) : (Int, Int) { + let (k,n) = ReducedDyadicFraction(numerator,denominatorPowerOfTwo); // k is odd, or (k,n) are both 0 + let period = 2*2^n; // \pi k / 2^n is 2\pi periodic, therefore k is 2 * 2^n periodic + let kMod = k % period; // if k was negative, we get kMod in a range [-period + 1, 0] + let kModPositive = kMod >= 0 ? kMod | kMod + period; // kModPositive is in the range [0, period - 1] + return (kModPositive, n); + } + + // TODO(swernli): Consider removing this in favor of pulling Microsoft.Quantum.Arrays.Subarray + // into the runtime. + @EnableTestingViaName("Test.TargetDefinitions.Subarray") + internal function Subarray<'T> (indices : Int[], array : 'T[]) : 'T[] { + let nSliced = Length(indices); + mutable sliced = new 'T[nSliced]; + + for (idx in 0 .. nSliced - 1) { + set sliced w/= idx <- array[indices[idx]]; + } + + return sliced; + } + + @EnableTestingViaName("Test.TargetDefinitions.IndicesOfNonIdentity") + internal function IndicesOfNonIdentity (paulies : Pauli[]) : Int[] { + mutable nonIdPauliCount = 0; + + for (i in 0 .. Length(paulies) - 1) { + if (paulies[i] != PauliI) { set nonIdPauliCount += 1; } + } + + mutable indices = new Int[nonIdPauliCount]; + mutable index = 0; + + for (i in 0 .. Length(paulies) - 1) { + if (paulies[i] != PauliI) { + set indices w/= index <- i; + set index = index + 1; + } + } + + return indices; + } + + @EnableTestingViaName("Test.TargetDefinitions.RemovePauliI") + internal function RemovePauliI (paulis : Pauli[], qubits : Qubit[]) : (Pauli[], Qubit[]) { + let indices = IndicesOfNonIdentity(paulis); + let newPaulis = Subarray(indices, paulis); + let newQubits = Subarray(indices, qubits); + return (newPaulis, newQubits); + } + +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/XFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/XFromSinglyControlled.qs new file mode 100644 index 00000000000..e33e1c88263 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/XFromSinglyControlled.qs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $X$ gate. + /// + /// # Description + /// \begin{align} + /// \sigma_x \mathrel{:=} + /// \begin{bmatrix} + /// 0 & 1 \\\\ + /// 1 & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.X") + operation X (qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledX(qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledX(qubit); + } + elif (Length(ctls) == 1) { + ApplyControlledX(ctls[0], qubit); + } + elif (Length(ctls) == 2) { + CCNOT(ctls[0], ctls[1], qubit); + } + else { + ApplyWithLessControlsA(Controlled X, (ctls, qubit)); + } + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/YFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/YFromSinglyControlled.qs new file mode 100644 index 00000000000..7636e127f22 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/YFromSinglyControlled.qs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Y$ gate. + /// + /// # Description + /// \begin{align} + /// \sigma_y \mathrel{:=} + /// \begin{bmatrix} + /// 0 & -i \\\\ + /// i & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.Y") + operation Y (qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledY(qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledY(qubit); + } + elif (Length(ctls) == 1) { + within { + MapPauli(qubit, PauliX, PauliY); + } + apply { + CNOT(ctls[0], qubit); + } + } + elif (Length(ctls) == 2) { + within { + MapPauli(qubit, PauliZ, PauliY); + } + apply { + Controlled Z(ctls, qubit); + } + } + else { + ApplyWithLessControlsA(Controlled Y, (ctls, qubit)); + } + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Decompositions/ZFromSinglyControlled.qs b/src/Simulation/TargetDefinitions/Decompositions/ZFromSinglyControlled.qs new file mode 100644 index 00000000000..146bfc5da6d --- /dev/null +++ b/src/Simulation/TargetDefinitions/Decompositions/ZFromSinglyControlled.qs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Z$ gate. + /// + /// # Description + /// \begin{align} + /// \sigma_z \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.Z") + operation Z (qubit : Qubit) : Unit is Adj + Ctl { + body (...) { + ApplyUncontrolledZ(qubit); + } + controlled (ctls, ...) { + if (Length(ctls) == 0) { + ApplyUncontrolledZ(qubit); + } + elif (Length(ctls) == 1) { + ApplyControlledZ(ctls[0], qubit); + } + elif (Length(ctls) == 2) { + // [Page 15 of arXiv:1206.0758v3](https://arxiv.org/pdf/1206.0758v3.pdf#page=15) + Adjoint T(ctls[0]); + Adjoint T(ctls[1]); + CNOT(qubit, ctls[0]); + T(ctls[0]); + CNOT(ctls[1], qubit); + CNOT(ctls[1], ctls[0]); + T(qubit); + Adjoint T(ctls[0]); + CNOT(ctls[1], qubit); + CNOT(qubit, ctls[0]); + Adjoint T(qubit); + T(ctls[0]); + CNOT(ctls[1], ctls[0]); + } + else { + ApplyWithLessControlsA(Controlled Z, (ctls, qubit)); + } + } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyControlledX.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyControlledX.qs new file mode 100644 index 00000000000..0c5417ada18 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyControlledX.qs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the controlled-X (or CNOT) gate to a pair of qubits. Does not support + /// the Controlled functor. + /// + /// # 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 + /// CNOT(control, target); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyControlledX") + internal operation ApplyControlledX (control : Qubit, target : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyControlledZ.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyControlledZ.qs new file mode 100644 index 00000000000..c91154afdab --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyControlledZ.qs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the controlled-Z (CZ) gate to a pair of qubits. + /// + /// $$ + /// \begin{align} + /// 1 & 0 & 0 & 0 \\\\ + /// 0 & 1 & 0 & 0 \\\\ + /// 0 & 0 & 1 & 0 \\\\ + /// 0 & 0 & 0 & -1 + /// \end{align}, + /// $$ + /// where rows and columns are organized as in the quantum concepts guide. + /// + /// # Input + /// ## control + /// Control qubit for the CZ gate. + /// ## target + /// Target qubit for the CZ gate. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// Controlled Z([control], target); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyControlledZ") + internal operation ApplyControlledZ (control : Qubit, target : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledH.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledH.qs new file mode 100644 index 00000000000..8b0f82af9c2 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledH.qs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Hadamard transformation to a single qubit. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// H \mathrel{:=} + /// \frac{1}{\sqrt{2}} + /// \begin{bmatrix} + /// 1 & 1 \\\\ + /// 1 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledH") + internal operation ApplyUncontrolledH (qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRx.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRx.qs new file mode 100644 index 00000000000..215b8014710 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRx.qs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $x$-axis by a given angle. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// R_x(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_x / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -i\sin \frac{\theta}{2} \\\\ + /// -i\sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliX, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledRx") + internal operation ApplyUncontrolledRx (theta : Double, qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRy.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRy.qs new file mode 100644 index 00000000000..7f70a7f60d5 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRy.qs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $y$-axis by a given angle. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// R_y(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_y / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -\sin \frac{\theta}{2} \\\\ + /// \sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliY, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledRy") + internal operation ApplyUncontrolledRy (theta : Double, qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRz.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRz.qs new file mode 100644 index 00000000000..14e5d95a414 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledRz.qs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $z$-axis by a given angle. Note that the Controlled + /// functor is not supported. + /// + /// # Description + /// \begin{align} + /// R_z(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_z / 2} = + /// \begin{bmatrix} + /// e^{-i \theta / 2} & 0 \\\\ + /// 0 & e^{i \theta / 2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliZ, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledRz") + internal operation ApplyUncontrolledRz (theta : Double, qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledS.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledS.qs new file mode 100644 index 00000000000..530c0e3397b --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledS.qs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/4 phase gate to a single qubit. Note that the Controlled functor + /// is not supported. + /// + /// # Description + /// \begin{align} + /// S \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & i + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledS") + internal operation ApplyUncontrolledS (qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledT.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledT.qs new file mode 100644 index 00000000000..820b5cb7eda --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledT.qs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/8 gate to a single qubit. Note that the Controlled functor is + /// not supported. + /// + /// # Description + /// \begin{align} + /// T \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & e^{i \pi / 4} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledT") + internal operation ApplyUncontrolledT (qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledX.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledX.qs new file mode 100644 index 00000000000..45a27d9a5f6 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledX.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $X$ gate. Note that the Controlled functor is not supported. + /// + /// # Description + /// \begin{align} + /// \sigma_x \mathrel{:=} + /// \begin{bmatrix} + /// 0 & 1 \\\\ + /// 1 & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledX") + internal operation ApplyUncontrolledX (qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledY.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledY.qs new file mode 100644 index 00000000000..8e9a2fe20bb --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledY.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Y$ gate. Note that the Controlled functor is not supported. + /// + /// # Description + /// \begin{align} + /// \sigma_y \mathrel{:=} + /// \begin{bmatrix} + /// 0 & -i \\\\ + /// i & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledY") + internal operation ApplyUncontrolledY (qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledZ.qs b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledZ.qs new file mode 100644 index 00000000000..302252cf68e --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/ApplyUncontrolledZ.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Z$ gate. Note that the Controlled functor is not supported. + /// + /// # Description + /// \begin{align} + /// \sigma_z \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.ApplyUncontrolledZ") + internal operation ApplyUncontrolledZ (qubit : Qubit) : Unit is Adj { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Exp.qs b/src/Simulation/TargetDefinitions/Intrinsic/Exp.qs new file mode 100644 index 00000000000..df58c4a3f3c --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Exp.qs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the exponential of a multi-qubit Pauli operator. + /// + /// # Description + /// \begin{align} + /// e^{i \theta [P_0 \otimes P_1 \cdots P_{N-1}]}, + /// \end{align} + /// where $P_i$ is the $i$th element of `paulis`, and where + /// $N = $`Length(paulis)`. + /// + /// # Input + /// ## paulis + /// Array of single-qubit Pauli values indicating the tensor product + /// factors on each qubit. + /// ## theta + /// Angle about the given multi-qubit Pauli operator by which the + /// target register is to be rotated. + /// ## qubits + /// Register to apply the given rotation to. + @EnableTestingViaName("Test.TargetDefinitions.Exp") + operation Exp (paulis : Pauli[], theta : Double, qubits : Qubit[]) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/H.qs b/src/Simulation/TargetDefinitions/Intrinsic/H.qs new file mode 100644 index 00000000000..740796ddd0b --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/H.qs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Hadamard transformation to a single qubit. + /// + /// # Description + /// \begin{align} + /// H \mathrel{:=} + /// \frac{1}{\sqrt{2}} + /// \begin{bmatrix} + /// 1 & 1 \\\\ + /// 1 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.H") + operation H (qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/I.qs b/src/Simulation/TargetDefinitions/Intrinsic/I.qs new file mode 100644 index 00000000000..39ddebc3797 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/I.qs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Performs the identity operation (no-op) on a single qubit. + /// + /// # Remarks + /// This is a no-op. It is provided for completeness and because + /// sometimes it is useful to call the identity in an algorithm or to pass it as a parameter. + @EnableTestingViaName("Test.TargetDefinitions.I") + operation I (target : Qubit) : Unit is Adj + Ctl { + body (...) { } + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/IsingXX.qs b/src/Simulation/TargetDefinitions/Intrinsic/IsingXX.qs new file mode 100644 index 00000000000..c20f4c56731 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/IsingXX.qs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the two qubit Ising $XX$ rotation gate. + /// + /// # Description + /// \begin{align} + /// XX(\theta) \mathrel{:=} + /// \begin{bmatrix} + /// \cos \theta & 0 & 0 & -i\sin \theta \\\\ + /// 0 & \cos \theta & -i\sin \theta & 0 \\\\ + /// 0 & -i\sin \theta & \cos \theta & 0 \\\\ + /// -i\sin \theta & 0 & 0 & \cos \theta + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// The angle about which the qubits are rotated. + /// ## qubit0 + /// The first qubit input to the gate. + /// ## qubit1 + /// The second qubit input to the gate. + @EnableTestingViaName("Test.TargetDefinitions.IsingXX") + internal operation IsingXX (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/IsingYY.qs b/src/Simulation/TargetDefinitions/Intrinsic/IsingYY.qs new file mode 100644 index 00000000000..39fe3a24ff5 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/IsingYY.qs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the two qubit Ising $YY$ rotation gate. + /// + /// # Description + /// \begin{align} + /// YY(\theta) \mathrel{:=} + /// \begin{bmatrix} + /// \cos \theta & 0 & 0 & i\sin \theta \\\\ + /// 0 & \cos \theta & -i\sin \theta & 0 \\\\ + /// 0 & -i\sin \theta & \cos \theta & 0 \\\\ + /// i\sin \theta & 0 & 0 & \cos \theta + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// The angle about which the qubits are rotated. + /// ## qubit0 + /// The first qubit input to the gate. + /// ## qubit1 + /// The second qubit input to the gate. + @EnableTestingViaName("Test.TargetDefinitions.IsingYY") + internal operation IsingYY (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/IsingZZ.qs b/src/Simulation/TargetDefinitions/Intrinsic/IsingZZ.qs new file mode 100644 index 00000000000..c800c2b92f2 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/IsingZZ.qs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the two qubit Ising $ZZ$ rotation gate. + /// + /// # Description + /// \begin{align} + /// ZZ(\theta) \mathrel{:=} + /// \begin{bmatrix} + /// e^{-i \theta / 2} & 0 & 0 & 0 \\\\ + /// 0 & e^{-i \theta / 2} & 0 & 0 \\\\ + /// 0 & 0 & e^{-i \theta / 2} & 0 \\\\ + /// 0 & 0 & 0 & e^{i \theta / 2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// The angle about which the qubits are rotated. + /// ## qubit0 + /// The first qubit input to the gate. + /// ## qubit1 + /// The second qubit input to the gate. + @EnableTestingViaName("Test.TargetDefinitions.IsingZZ") + internal operation IsingZZ (theta : Double, qubit0 : Qubit, qubit1 : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/M.qs b/src/Simulation/TargetDefinitions/Intrinsic/M.qs new file mode 100644 index 00000000000..7c44f88a5d1 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/M.qs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Performs a measurement of a single qubit in the + /// Pauli $Z$ basis. + /// + /// # Description + /// The output result is given by + /// the distribution + /// \begin{align} + /// \Pr(\texttt{Zero} | \ket{\psi}) = + /// \braket{\psi | 0} \braket{0 | \psi}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to be measured. + /// + /// # Output + /// `Zero` if the $+1$ eigenvalue is observed, and `One` if + /// the $-1$ eigenvalue is observed. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// Measure([PauliZ], [qubit]); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.M") + operation M (qubit : Qubit) : Result { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Measure.qs b/src/Simulation/TargetDefinitions/Intrinsic/Measure.qs new file mode 100644 index 00000000000..ada792ca5f4 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Measure.qs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Performs a joint measurement of one or more qubits in the + /// specified Pauli bases. + /// + /// # Description + /// The output result is given by the distribution: + /// \begin{align} + /// \Pr(\texttt{Zero} | \ket{\psi}) = + /// \frac12 \braket{ + /// \psi \mid| + /// \left( + /// \boldone + P_0 \otimes P_1 \otimes \cdots \otimes P_{N-1} + /// \right) \mid| + /// \psi + /// }, + /// \end{align} + /// where $P_i$ is the $i$th element of `bases`, and where + /// $N = \texttt{Length}(\texttt{bases})$. + /// That is, measurement returns a `Result` $d$ such that the eigenvalue of the + /// observed measurement effect is $(-1)^d$. + /// + /// # Input + /// ## bases + /// Array of single-qubit Pauli values indicating the tensor product + /// factors on each qubit. + /// ## qubits + /// Register of qubits to be measured. + /// + /// # Output + /// `Zero` if the $+1$ eigenvalue is observed, and `One` if + /// the $-1$ eigenvalue is observed. + /// + /// # Remarks + /// If the basis array and qubit array are different lengths, then the + /// operation will fail. + @EnableTestingViaName("Test.TargetDefinitions.Measure") + operation Measure (bases : Pauli[], qubits : Qubit[]) : Result { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/R.qs b/src/Simulation/TargetDefinitions/Intrinsic/R.qs new file mode 100644 index 00000000000..8deee174ebb --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/R.qs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the given Pauli axis. + /// + /// # Description + /// \begin{align} + /// R_{\mu}(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_{\mu} / 2}, + /// \end{align} + /// where $\mu \in \{I, X, Y, Z\}$. + /// + /// # Input + /// ## pauli + /// Pauli operator ($\mu$) to be exponentiated to form the rotation. + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// When called with `pauli = PauliI`, this operation applies + /// a *global phase*. This phase can be significant + /// when used with the `Controlled` functor. + @EnableTestingViaName("Test.TargetDefinitions.R") + operation R (pauli : Pauli, theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Reset.qs b/src/Simulation/TargetDefinitions/Intrinsic/Reset.qs new file mode 100644 index 00000000000..7531b828982 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Reset.qs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Given a single qubit, measures it and ensures it is in the |0⟩ state + /// such that it can be safely released. + /// + /// # Input + /// ## qubit + /// The qubit whose state is to be reset to $\ket{0}$. + @EnableTestingViaName("Test.TargetDefinitions.Reset") + operation Reset (target : Qubit) : Unit { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Rx.qs b/src/Simulation/TargetDefinitions/Intrinsic/Rx.qs new file mode 100644 index 00000000000..20aa42633b7 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Rx.qs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $x$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_x(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_x / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -i\sin \frac{\theta}{2} \\\\ + /// -i\sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliX, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Rx") + operation Rx (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Ry.qs b/src/Simulation/TargetDefinitions/Intrinsic/Ry.qs new file mode 100644 index 00000000000..e8df5d1fe88 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Ry.qs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $y$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_y(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_y / 2} = + /// \begin{bmatrix} + /// \cos \frac{\theta}{2} & -\sin \frac{\theta}{2} \\\\ + /// \sin \frac{\theta}{2} & \cos \frac{\theta}{2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliY, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Ry") + operation Ry (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Rz.qs b/src/Simulation/TargetDefinitions/Intrinsic/Rz.qs new file mode 100644 index 00000000000..ca7c2d4d74c --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Rz.qs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies a rotation about the $z$-axis by a given angle. + /// + /// # Description + /// \begin{align} + /// R_z(\theta) \mathrel{:=} + /// e^{-i \theta \sigma_z / 2} = + /// \begin{bmatrix} + /// e^{-i \theta / 2} & 0 \\\\ + /// 0 & e^{i \theta / 2} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## theta + /// Angle about which the qubit is to be rotated. + /// ## qubit + /// Qubit to which the gate should be applied. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// R(PauliZ, theta, qubit); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.Rz") + operation Rz (theta : Double, qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/S.qs b/src/Simulation/TargetDefinitions/Intrinsic/S.qs new file mode 100644 index 00000000000..816c8771b31 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/S.qs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/4 phase gate to a single qubit. + /// + /// # Description + /// \begin{align} + /// S \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & i + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.S") + operation S (qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/SWAP.qs b/src/Simulation/TargetDefinitions/Intrinsic/SWAP.qs new file mode 100644 index 00000000000..9b9c80138ed --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/SWAP.qs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the SWAP gate to a pair of qubits. + /// + /// # Description + /// \begin{align} + /// \operatorname{SWAP} \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 & 0 & 0 \\\\ + /// 0 & 0 & 1 & 0 \\\\ + /// 0 & 1 & 0 & 0 \\\\ + /// 0 & 0 & 0 & 1 + /// \end{bmatrix}, + /// \end{align} + /// + /// where rows and columns are ordered as in the quantum concepts guide. + /// + /// # Input + /// ## qubit1 + /// First qubit to be swapped. + /// ## qubit2 + /// Second qubit to be swapped. + /// + /// # Remarks + /// Equivalent to: + /// ```qsharp + /// CNOT(qubit1, qubit2); + /// CNOT(qubit2, qubit1); + /// CNOT(qubit1, qubit2); + /// ``` + @EnableTestingViaName("Test.TargetDefinitions.SWAP") + operation SWAP (qubit1 : Qubit, qubit2 : Qubit) : Unit is Adj + Ctl { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/T.qs b/src/Simulation/TargetDefinitions/Intrinsic/T.qs new file mode 100644 index 00000000000..dc3affe449a --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/T.qs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the π/8 gate to a single qubit. + /// + /// # Description + /// \begin{align} + /// T \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & e^{i \pi / 4} + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.T") + operation T (qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/X.qs b/src/Simulation/TargetDefinitions/Intrinsic/X.qs new file mode 100644 index 00000000000..8b5f8feb62b --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/X.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $X$ gate. + /// + /// # Description + /// \begin{align} + /// \sigma_x \mathrel{:=} + /// \begin{bmatrix} + /// 0 & 1 \\\\ + /// 1 & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.X") + operation X (qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Y.qs b/src/Simulation/TargetDefinitions/Intrinsic/Y.qs new file mode 100644 index 00000000000..92b28478843 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Y.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Y$ gate. + /// + /// # Description + /// \begin{align} + /// \sigma_y \mathrel{:=} + /// \begin{bmatrix} + /// 0 & -i \\\\ + /// i & 0 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.Y") + operation Y (qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/Intrinsic/Z.qs b/src/Simulation/TargetDefinitions/Intrinsic/Z.qs new file mode 100644 index 00000000000..a05f34c60c8 --- /dev/null +++ b/src/Simulation/TargetDefinitions/Intrinsic/Z.qs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Quantum.Intrinsic { + open Microsoft.Quantum.Diagnostics; + + /// # Summary + /// Applies the Pauli $Z$ gate. + /// + /// # Description + /// \begin{align} + /// \sigma_z \mathrel{:=} + /// \begin{bmatrix} + /// 1 & 0 \\\\ + /// 0 & -1 + /// \end{bmatrix}. + /// \end{align} + /// + /// # Input + /// ## qubit + /// Qubit to which the gate should be applied. + @EnableTestingViaName("Test.TargetDefinitions.Z") + operation Z (qubit : Qubit) : Unit is Adj + Ctl { + body intrinsic; + adjoint self; + } +} \ No newline at end of file diff --git a/src/Simulation/TargetDefinitions/TargetPackages/Common.Package.props b/src/Simulation/TargetDefinitions/TargetPackages/Common.Package.props new file mode 100644 index 00000000000..3f0557d6b92 --- /dev/null +++ b/src/Simulation/TargetDefinitions/TargetPackages/Common.Package.props @@ -0,0 +1,43 @@ + + + + + + + + netstandard2.1 + true + false + false + + + + Microsoft + See: https://docs.microsoft.com/en-us/quantum/relnotes/ + MIT + https://github.com/microsoft/qsharp-runtime + qdk-nuget-icon.png + Quantum Q# Qsharp + true + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/TargetDefinitions/TargetPackages/QsharpCore.Package.props b/src/Simulation/TargetDefinitions/TargetPackages/QsharpCore.Package.props new file mode 100644 index 00000000000..33a63966ab4 --- /dev/null +++ b/src/Simulation/TargetDefinitions/TargetPackages/QsharpCore.Package.props @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/TargetDefinitions/TargetPackages/Type1.Package.props b/src/Simulation/TargetDefinitions/TargetPackages/Type1.Package.props new file mode 100644 index 00000000000..0351c0d5f97 --- /dev/null +++ b/src/Simulation/TargetDefinitions/TargetPackages/Type1.Package.props @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/TargetDefinitions/TargetPackages/Type2.Package.props b/src/Simulation/TargetDefinitions/TargetPackages/Type2.Package.props new file mode 100644 index 00000000000..c03e57a61e5 --- /dev/null +++ b/src/Simulation/TargetDefinitions/TargetPackages/Type2.Package.props @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj b/src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj new file mode 100644 index 00000000000..b98e6ace566 --- /dev/null +++ b/src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj @@ -0,0 +1,10 @@ + + + + + + Type1 Targeting support for the Q# programming language. + + + + diff --git a/src/Simulation/Type1Core/Properties/AssemblyInfo.cs b/src/Simulation/Type1Core/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..0420d9b3e57 --- /dev/null +++ b/src/Simulation/Type1Core/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allow the simulator assembly to use our internal methods +[assembly: InternalsVisibleTo("Microsoft.Quantum.Simulators.Type1" + SigningConstants.PUBLIC_KEY)] \ No newline at end of file diff --git a/src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj b/src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj new file mode 100644 index 00000000000..5a27272a4cc --- /dev/null +++ b/src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj @@ -0,0 +1,10 @@ + + + + + + Type2 Targeting support for the Q# programming language. + + + + diff --git a/src/Simulation/Type2Core/Properties/AssemblyInfo.cs b/src/Simulation/Type2Core/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..39993b2efbb --- /dev/null +++ b/src/Simulation/Type2Core/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allow the simulator assembly to use our internal methods +[assembly: InternalsVisibleTo("Microsoft.Quantum.Simulators.Type2" + SigningConstants.PUBLIC_KEY)] \ No newline at end of file