You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
After having done the steps on the "Writing first program page" my codes (macOS) look like this:
Bell.qs
namespace Quantum.Bell
{
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
operation Set (desired: Result, q1: Qubit) : Unit {
if (desired != M(q1)) {
X(q1);
}
}
operation BellTest (count : Int, initial: Result) : (Int, Int) {
mutable numOnes = 0;
using (qubit = Qubit()) {
for (test in 1..count) {
Set (initial, qubit);
let res = M (qubit);
// Count the number of ones we saw:
if (res == One) {
set numOnes += 1;
}
}
Set(Zero, qubit);
}
// Return number of times we saw a |0> and number of times we saw a |1>
return (count-numOnes, numOnes);
}
}
and the Driver.cs looks like this:
using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
namespace BellTest
{
class Driver
{
static void Main(string[] args)
{
using (var qsim = new QuantumSimulator())
{
// Try initial values
Result[] initials = new Result[] { Result.Zero, Result.One };
foreach (Result initial in initials)
{
var res = BellTest.Run(qsim, 1000, initial).Result;
var (numZeros, numOnes) = res;
System.Console.WriteLine(
$"Init:{initial,-4} 0s={numZeros,-4} 1s={numOnes,-4}");
}
}
System.Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
}
However, I get the following error messages upon running:
Restore completed in 26.27 ms for /Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj.
/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Driver.cs(18,31): error CS0234: The type or namespace name 'Run' does not exist in the namespace 'BellTest' (are you missing an assembly reference?) [/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj]
/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Driver.cs(19,26): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numZeros'. [/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj]
/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Driver.cs(19,36): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numOnes'. [/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj]
The terminal process terminated with exit code: 1
Any help will be greatly appreciated.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: e984fdb6-63e6-92ac-f794-8a15a5092559
Version Independent ID: bcd9a2e2-0b07-514e-5b43-8b3e092669ce
After having done the steps on the "Writing first program page" my codes (macOS) look like this:
Bell.qs
and the Driver.cs looks like this:
However, I get the following error messages upon running:
Any help will be greatly appreciated.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: