Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Build/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
@{
Packages = @(
"Microsoft.Quantum.Standard",
"Microsoft.Quantum.Standard.Visualization",
"Microsoft.Quantum.Chemistry",
"Microsoft.Quantum.Numerics",
"Microsoft.Quantum.MachineLearning"
);
Assemblies = @(
".\Standard\src\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Standard.dll",
".\Visualization\src\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Standard.Visualization.dll",
".\Numerics\src\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Numerics.dll",
".\MachineLearning\src\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.MachineLearning.dll",
".\Chemistry\src\DataModel\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Chemistry.DataModel.dll",
Expand Down
3 changes: 3 additions & 0 deletions Build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ function Pack-Wheel() {
Write-Host "##[info]Pack Standard library"
Pack-One '../Standard/src/Standard.csproj'

Write-Host "##[info]Pack Standard visualization library"
Pack-One '../Visualization/src/Visualization.csproj'

Write-Host "##[info]Pack Chemistry library"
Pack-One '../Chemistry/src/Runtime/Runtime.csproj'
Pack-One '../Chemistry/src/DataModel/DataModel.csproj'
Expand Down
6 changes: 3 additions & 3 deletions Chemistry/src/DataModel/DataModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="YamlDotNet" Version="8.1.2" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
Expand Down
52 changes: 0 additions & 52 deletions Chemistry/src/DataModel/Logging.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Chemistry/src/Jupyter/Jupyter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


<ItemGroup>
<PackageReference Include="Microsoft.Jupyter.Core" Version="1.3.52077" />
<PackageReference Include="Microsoft.Jupyter.Core" Version="1.4.80531" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Chemistry/src/Runtime/Runtime.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20081417-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082035-beta">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
Expand Down Expand Up @@ -36,7 +36,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Simulators" Version="0.12.20081417-beta" />
<PackageReference Include="Microsoft.Quantum.Simulators" Version="0.12.20082035-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 3 additions & 4 deletions Chemistry/tests/ChemistryTests/InitialStatePrepTests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.Quantum.Chemistry.Tests {
open Microsoft.Quantum.Arithmetic;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Diagnostics as Diag;
open Microsoft.Quantum.Convert;
open Microsoft.Quantum.Chemistry.JordanWigner;
open Microsoft.Quantum.Arrays;
Expand Down Expand Up @@ -109,16 +109,15 @@ namespace Microsoft.Quantum.Chemistry.Tests {


// Prepare multiple excitations with complex weights
operation PrepareSparseMultiConfigurationalState4Test () : Unit {

operation PrepareSparseMultiConfigurationalState4Test () : Unit {
let nQubits = 1;
let intTest = [39, 21, 10];
let phase = 2.453;
let excitations = [JordanWignerInputState((0.1, 0.0), new Int[0]), JordanWignerInputState((0.1 * Cos(phase), 0.1 * Sin(phase)), [0])];

using (qubits = Qubit[nQubits]) {
PrepareSparseMultiConfigurationalState(NoOp<Qubit[]>, excitations, qubits);
AssertPhase(-phase / 2.0, qubits[0], 1E-09);
Diag.AssertPhase(-phase / 2.0, qubits[0], 1E-09);
ResetAll(qubits);
}
}
Expand Down
72 changes: 32 additions & 40 deletions Chemistry/tests/ChemistryTests/MajoranaOperatorTests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.Quantum.Chemistry.Tests {
open Microsoft.Quantum.Arithmetic;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Diagnostics as Diag;
open Microsoft.Quantum.Convert;
open Microsoft.Quantum.Chemistry.JordanWigner;
open Microsoft.Quantum.Math;
Expand Down Expand Up @@ -41,7 +41,7 @@ namespace Microsoft.Quantum.Chemistry.Tests {
// |0> -> |0>
// |+> -> |->
Message($"Test Z Pauli on qubit {idxTest}");
AssertProb([PauliZ], [testQubit], Zero, 1.0, $"Error: Test {idxTest} {idxTest} Z Pauli |0>", 1E-10);
Diag.AssertMeasurementProbability([PauliZ], [testQubit], Zero, 1.0, $"Error: Test {idxTest} {idxTest} Z Pauli |0>", 1E-10);
}
elif (targetIndex == idxTest) {

Expand All @@ -53,15 +53,15 @@ namespace Microsoft.Quantum.Chemistry.Tests {
// |0> -> i|1>
// |+> -> -i|->
Message($"Test X or Y Pauli on qubit {idxTest}");
AssertProb([PauliZ], [testQubit], One, 1.0, $"Error: Test {idxTest} X or Y Pauli |0>", 1E-10);
Diag.AssertMeasurementProbability([PauliZ], [testQubit], One, 1.0, $"Error: Test {idxTest} X or Y Pauli |0>", 1E-10);
}
else {

// Test Identitfy Pauli
// |0> -> |0>
// |+> -> |+>
Message($"Test ZI Pauli on qubit {idxTest}");
AssertProb([PauliZ], [testQubit], Zero, 1.0, $"Error: Test {idxTest} I Pauli |0>", 1E-10);
Diag.AssertMeasurementProbability([PauliZ], [testQubit], Zero, 1.0, $"Error: Test {idxTest} I Pauli |0>", 1E-10);
}
}

Expand Down Expand Up @@ -109,23 +109,23 @@ namespace Microsoft.Quantum.Chemistry.Tests {
// |0> -> |0>
// |+> -> |->
Message($"Test Z Pauli on qubit {idxTest}");
AssertProb([PauliX], [testQubit], One, 1.0, $"Error: Test {idxTest} Z Pauli |+>", 1e-10);
Diag.AssertMeasurementProbability([PauliX], [testQubit], One, 1.0, $"Error: Test {idxTest} Z Pauli |+>", 1e-10);
}
elif(targetIndex == idxTest){
// Test X Pauli
// |0> -> |1>
// |+> -> |+>
if(pauliBasis == PauliX){
Message($"Test X Pauli on qubit {idxTest}");
AssertProb([PauliX], [testQubit], Zero, 1.0, $"Error: Test {idxTest} X Pauli |+>", 1e-10);
Diag.AssertMeasurementProbability([PauliX], [testQubit], Zero, 1.0, $"Error: Test {idxTest} X Pauli |+>", 1e-10);
}

// Test Y Pauli
// |0> -> i|1>
// |+> -> -i|->
if(pauliBasis == PauliY){
Message($"Test Y Pauli on qubit {idxTest}");
AssertProb([PauliX], [testQubit], One, 1.0, $"Error: Test {idxTest} Y Pauli |+>", 1e-10);
Diag.AssertMeasurementProbability([PauliX], [testQubit], One, 1.0, $"Error: Test {idxTest} Y Pauli |+>", 1e-10);
}

}
Expand All @@ -134,7 +134,7 @@ namespace Microsoft.Quantum.Chemistry.Tests {
// |0> -> |0>
// |+> -> |+>
Message($"Test I Pauli on qubit {idxTest}");
AssertProb([PauliX], [testQubit], Zero, 1.0, $"Error: Test {idxTest} I Pauli |+>", 1e-10);
Diag.AssertMeasurementProbability([PauliX], [testQubit], Zero, 1.0, $"Error: Test {idxTest} I Pauli |+>", 1e-10);
}
}
OptimizedBEXY(pauliBasisQubit[0], LittleEndian(indexRegister), targetRegister);
Expand Down Expand Up @@ -188,8 +188,10 @@ namespace Microsoft.Quantum.Chemistry.Tests {


// Test phase of controlled OptimizedBEXY operator.
operation ControlledOptimizedBEOperatorTestHelper (pauliBasis : Pauli, targetRegisterSize : Int, targetIndex : Int) : Unit {

operation ControlledOptimizedBEOperatorTestHelper(
pauliBasis : Pauli, targetRegisterSize : Int, targetIndex : Int
)
: Unit {
let indexRegisterSize = Ceiling(Lg(IntAsDouble(targetRegisterSize)));

using (pauliBasisQubit = Qubit[1]) {
Expand All @@ -202,37 +204,27 @@ namespace Microsoft.Quantum.Chemistry.Tests {
let testQubit = targetRegister[targetIndex];

// Create indexRegister state.
ApplyXorInPlace(targetIndex, LittleEndian(indexRegister));

// Initialize control in |+> state.
H(controlRegister[0]);
within {
ApplyXorInPlace(targetIndex, LittleEndian(indexRegister));

// Choose X or Y operator.
if (pauliBasis == PauliX) {

// Initialize testQubit state in X +1 eigenstate
H(testQubit);
Controlled OptimizedBEXY(controlRegister, (pauliBasisQubit[0], LittleEndian(indexRegister), targetRegister));
AssertPhase(0.0, controlRegister[0], 1E-10);
Adjoint Controlled OptimizedBEXY(controlRegister, (pauliBasisQubit[0], LittleEndian(indexRegister), targetRegister));
H(testQubit);
}
elif (pauliBasis == PauliY) {
X(pauliBasisQubit[0]);

// Initialize testQubit state Y +1 eigenstate
H(testQubit);
S(testQubit);
Controlled OptimizedBEXY(controlRegister, (pauliBasisQubit[0], LittleEndian(indexRegister), targetRegister));
AssertPhase(0.0, controlRegister[0], 1E-10);
Adjoint Controlled OptimizedBEXY(controlRegister, (pauliBasisQubit[0], LittleEndian(indexRegister), targetRegister));
Adjoint S(testQubit);
H(testQubit);
X(pauliBasisQubit[0]);
// Initialize control in |+> state.
H(controlRegister[0]);

// Choose X or Y operator.
if (pauliBasis == PauliX) {
// Initialize testQubit state in X +1 eigenstate
H(testQubit);
Controlled OptimizedBEXY(controlRegister, (pauliBasisQubit[0], LittleEndian(indexRegister), targetRegister));
} elif (pauliBasis == PauliY) {
// Initialize testQubit state Y +1 eigenstate
X(pauliBasisQubit[0]);
H(testQubit);
S(testQubit);
Controlled OptimizedBEXY(controlRegister, (pauliBasisQubit[0], LittleEndian(indexRegister), targetRegister));
}
} apply {
Diag.AssertPhase(0.0, controlRegister[0], 1E-10);
}

H(controlRegister[0]);
Adjoint ApplyXorInPlace(targetIndex, LittleEndian(indexRegister));
}
}
}
Expand Down Expand Up @@ -265,7 +257,7 @@ namespace Microsoft.Quantum.Chemistry.Tests {
H(targetRegister[idxTest]);
ApplyXorInPlace(idxTest, LittleEndian(indexRegister));
SelectZ(LittleEndian(indexRegister), targetRegister);
AssertProb([PauliX], [targetRegister[idxTest]], One, 1.0, $"Error: Test {idxTest} X Pauli |+>", 1E-10);
Diag.AssertMeasurementProbability([PauliX], [targetRegister[idxTest]], One, 1.0, $"Error: Test {idxTest} X Pauli |+>", 1E-10);
Z(targetRegister[idxTest]);
Adjoint ApplyXorInPlace(idxTest, LittleEndian(indexRegister));
H(targetRegister[idxTest]);
Expand Down
2 changes: 1 addition & 1 deletion Chemistry/tests/ChemistryTests/QSharpTests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20081417-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082035-beta">

<Import Project="..\..\..\Build\props\tests.props" />

Expand Down
2 changes: 1 addition & 1 deletion Chemistry/tests/SystemTests/SystemTests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20081417-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082035-beta">

<Import Project="..\..\..\Build\props\tests.props" />

Expand Down
2 changes: 1 addition & 1 deletion MachineLearning/src/MachineLearning.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20081417-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082035-beta">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Microsoft.Quantum.MachineLearning</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion MachineLearning/tests/MachineLearningTests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20081417-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082035-beta">

<Import Project="..\..\Build\props\tests.props" />

Expand Down
4 changes: 2 additions & 2 deletions Numerics/src/Numerics.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20081417-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082035-beta">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
Expand Down Expand Up @@ -40,7 +40,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Simulators" Version="0.12.20081417-beta" />
<PackageReference Include="Microsoft.Quantum.Simulators" Version="0.12.20082035-beta" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Numerics/tests/NumericsTests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20081417-beta">
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20082035-beta">

<Import Project="..\..\Build\props\tests.props" />

Expand Down
11 changes: 11 additions & 0 deletions Standard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Standard", "Standard\src\St
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Standard.Tests", "Standard\tests\Standard.Tests.csproj", "{DEDA9681-2C11-492F-B1C9-D772BB45730A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualization", "Visualization", "{2C5BF171-7D32-4DEC-BD08-9667A55A36FF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Visualization", "Visualization\src\Visualization.csproj", "{AC5462CC-F249-48E4-BFBE-93FC5AAC0D4E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -26,6 +30,10 @@ Global
{DEDA9681-2C11-492F-B1C9-D772BB45730A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEDA9681-2C11-492F-B1C9-D772BB45730A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEDA9681-2C11-492F-B1C9-D772BB45730A}.Release|Any CPU.Build.0 = Release|Any CPU
{AC5462CC-F249-48E4-BFBE-93FC5AAC0D4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC5462CC-F249-48E4-BFBE-93FC5AAC0D4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC5462CC-F249-48E4-BFBE-93FC5AAC0D4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC5462CC-F249-48E4-BFBE-93FC5AAC0D4E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -39,4 +47,7 @@ Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AC5462CC-F249-48E4-BFBE-93FC5AAC0D4E} = {2C5BF171-7D32-4DEC-BD08-9667A55A36FF}
EndGlobalSection
EndGlobal
Loading