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
38 changes: 0 additions & 38 deletions .github/workflows/automerge.yml

This file was deleted.

2 changes: 1 addition & 1 deletion AdvantageBenchmark/privateBuild/host.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">
<!-- Add project references to Simulator and other required packages: -->
<Import Project="..\..\src\Simulation\Common\Simulators.Dev.props" />

Expand Down
2 changes: 1 addition & 1 deletion AdvantageBenchmark/releasedBuild/quantum/quantum.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<ItemGroup>
<QSharpCompile Include="..\..\privateBuild\quantum.qs" />
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"msbuild-sdks": {
"Microsoft.Quantum.Sdk": "0.15.210324735-alpha"
}
}
15 changes: 15 additions & 0 deletions src/Qir/Runtime/build-qir-runtime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@
if (-not (Build-CMakeProject $PSScriptRoot "QIR Runtime")) {
throw "At least one project failed to compile. Check the logs."
}

# Copy the results of runtime compilation and the corresponding headers to the drops folder so
# they can be included in pipeline artifacts.
$qirDropsFolder = (Join-Path $Env:DROPS_DIR QIR)
$qirDropsBin = (Join-Path $qirDropsFolder bin)
$qirDropsInclude = (Join-Path $qirDropsFolder include)
if (-not (Test-Path $qirDropsFolder)) {
New-Item -Path $qirDropsFolder -ItemType "directory"
New-Item -Path $qirDropsBin -ItemType "directory"
New-Item -Path $qirDropsInclude -ItemType "directory"
}
$qirBinaries = (Join-Path $PSScriptRoot build $Env:BUILD_CONFIGURATION bin *)
$qirIncludes = (Join-Path $PSScriptRoot public *)
Copy-Item $qirBinaries $qirDropsBin
Copy-Item $qirIncludes $qirDropsInclude
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Tests/QIR-dynamic/qsharp/qir-test-random.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
6 changes: 6 additions & 0 deletions src/Qir/Tests/QIR-static/qir-test-math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ TEST_CASE("QIR: Math.DrawRandomInt", "[qir.math][qir.Math.DrawRandomInt]")
REQUIRE(0 == strcmp(exc.what(), Quantum::Qis::Internal::excStrDrawRandomVal));
}

// Test equal minimum and maximum:
for(uint64_t num: { -5, 0, 3 } )
{
REQUIRE(Microsoft__Quantum__Testing__QIR__Math__TestDrawRandomInt__body(num, num) == num);
}

// There is a strong difference in the opinions about how the random number generator must be tested.
// More or less agreed-upon items are:
// * The test must be 100% deterministic, i.e. must not fail, even with a very low probability.
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Tests/QIR-static/qsharp/qir-gen.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Tests/QIR-tracer/qsharp/tracer-qir.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\Common\AssemblyCommon.props" />
<Import Project="..\Common\Simulators.Dev.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">
<Import Project="..\TargetDefinitions\TargetPackages\QSharpCore.Package.props" />

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\Common\AssemblyCommon.props" />
<Import Project="..\Common\DebugSymbols.props" />
Expand Down
4 changes: 2 additions & 2 deletions src/Simulation/QSharpFoundation/Random/Intrinsic.qs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.Quantum.Random {
/// probability.
///
/// # Remarks
/// Fails if `max <= min`.
/// Fails if `max < min`.
///
/// # Example
/// The following Q# snippet randomly rolls a six-sided die:
Expand Down Expand Up @@ -45,7 +45,7 @@ namespace Microsoft.Quantum.Random {
/// uniform probability.
///
/// # Remarks
/// Fails if `max <= min`.
/// Fails if `max < min`.
///
/// # Example
/// The following Q# snippet randomly draws an angle between $0$ and $2 \pi$:
Expand Down
8 changes: 4 additions & 4 deletions src/Simulation/QSharpFoundation/Random/Uniform.qs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Microsoft.Quantum.Random {
/// interval from `min` to `max` with uniform probability.
///
/// # Remarks
/// Fails if `max <= min`.
/// Fails if `max < min`.
///
/// # Example
/// The following Q# snippet randomly draws an angle between $0$ and $2 \pi$:
Expand All @@ -34,7 +34,7 @@ namespace Microsoft.Quantum.Random {
function ContinuousUniformDistribution(
min : Double, max : Double
) : ContinuousDistribution {
Fact(max > min, $"Max must be larger than min, but {max} <= {min}.");
Fact(max >= min, $"Max must be greater than or equal to min, but {max} < {min}.");
return ContinuousDistribution(Delay(DrawRandomDouble, (min, max), _));
}

Expand All @@ -52,7 +52,7 @@ namespace Microsoft.Quantum.Random {
/// range from `min` to `max` with uniform probability.
///
/// # Remarks
/// Fails if `max <= min`.
/// Fails if `max < min`.
///
/// # Example
/// The following Q# snippet randomly rolls a six-sided die:
Expand All @@ -64,7 +64,7 @@ namespace Microsoft.Quantum.Random {
/// # See Also
/// - Microsoft.Quantum.DrawRandomDouble
function DiscreteUniformDistribution(min : Int, max : Int) : DiscreteDistribution {
Fact(max > min, $"Max must be larger than min, but {max} <= {min}.");
Fact(max >= min, $"Max must be greater than or equal to min, but {max} < {min}.");
return DiscreteDistribution(Delay(DrawRandomInt, (min, max), _));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,25 @@ namespace Microsoft.Quantum.Tests {
@Test("QuantumSimulator")
@Test("ToffoliSimulator")
operation CheckDrawRandomIntObeysRanges() : Unit {
let randomInt = DrawRandomInt(0, 45);
mutable randomInt = DrawRandomInt(0, 45);
if (randomInt > 45 or randomInt < 0) {
fail $"DrawRandomInt(0, 45) returned {randomInt}, outside the allowed range.";
}

set randomInt = DrawRandomInt(0, 0);
if (randomInt > 0 or randomInt < 0) {
fail $"DrawRandomInt(0, 0) returned {randomInt}, outside the allowed range.";
}

set randomInt = DrawRandomInt(-3, -3);
if (randomInt > -3 or randomInt < -3) {
fail $"DrawRandomInt(-3, -3) returned {randomInt}, outside the allowed range.";
}

set randomInt = DrawRandomInt(3, 3);
if (randomInt > 3 or randomInt < 3) {
fail $"DrawRandomInt(3, 3) returned {randomInt}, outside the allowed range.";
}
}

/// # Summary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<CSharpGeneration>false</CSharpGeneration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\Common\Simulators.Test.props" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\Common\Simulators.Test.props" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\Common\Simulators.Test.props" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\Common\Simulators.Test.props" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\Common\AssemblyCommon.props" />
<Import Project="..\Common\DebugSymbols.props" />
Expand Down
10 changes: 5 additions & 5 deletions src/Simulation/Simulators/QuantumSimulator/SimulatorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,16 @@ public DrawRandomInt(SimulatorBase m) : base(m) =>
public override Func<(long, long), long> __Body__ => arg =>
{
var (min, max) = arg;
if (max <= min)
if (max < min)
{
throw new ExecutionFailException($"Max must be greater than min, but {max} <= {min}.");
throw new ExecutionFailException($"Max must be greater than or equal to min, but {max} < {min}.");
}
return sim.RandomGenerator.NextLong(min, max);
};
}

/// <summary>
/// Implements the DrawRandomInt operation from the
/// Implements the DrawRandomDouble operation from the
/// Microsoft.Quantum.Random namespace.
/// </summary>
public class DrawRandomDouble : Random.DrawRandomDouble
Expand All @@ -490,9 +490,9 @@ public DrawRandomDouble(SimulatorBase m) : base(m) =>
public override Func<(double, double), double> __Body__ => arg =>
{
var (min, max) = arg;
if (max <= min)
if (max < min)
{
throw new ExecutionFailException($"Max must be greater than min, but {max} <= {min}.");
throw new ExecutionFailException($"Max must be greater than or equal to min, but {max} < {min}.");
}
var delta = max - min;
return min + delta * sim.RandomGenerator.NextDouble();
Expand Down
4 changes: 1 addition & 3 deletions src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">

<Project Sdk="Microsoft.Quantum.Sdk">
<Import Project="..\TargetDefinitions\TargetPackages\Type1.Package.props" />

<PropertyGroup>
<Description>Type1 Targeting support for the Q# programming language.</Description>
<GenerateConcreteIntrinsic>true</GenerateConcreteIntrinsic>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\TargetDefinitions\TargetPackages\Type2.Package.props" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.15.210324735-alpha">
<Project Sdk="Microsoft.Quantum.Sdk">

<Import Project="..\TargetDefinitions\TargetPackages\Type3.Package.props" />

Expand Down