Skip to content

Instantly share code, notes, and snippets.

View friguzzi's full-sized avatar

Fabrizio Riguzzi friguzzi

View GitHub Profile
@friguzzi
friguzzi / Driver.cs
Last active September 20, 2020 09:50
using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
using System.Collections.Generic;
namespace Quantum.Search
{
class Driver
{
static void Main(string[] args)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
using System.Collections.Generic;
namespace Quantum.Search
{
class Driver
{
static void Main(string[] args)
using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
namespace Quantum.Sample
{
class Driver
{
static void Main(string[] args)
namespace Quantum.Sample
{
open Microsoft.Quantum.Primitive;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Extensions.Convert;
open Microsoft.Quantum.Extensions.Math;
operation SprinklerAnc (queryRegister: Qubit[], target : Qubit,ancilla: Qubit[]) : Unit {
body (...) {
X(queryRegister[2]);
@friguzzi
friguzzi / eruption.pl
Last active June 11, 2017 06:42
test cases for mode directed tabling/answer subsumption
:- use_module(library(tabling)).
:- table eruption(prob_sum),sudden_energy_release/0,fault_rupture(_,prob_sum).
eruption(P) :-
sudden_energy_release,
fault_rupture(_,P0),
P is P0*0.6.
% If there is a sudden energy release under the island and there is a fault
% rupture, then there can be an eruption of the volcano on the island with
% probability 0.6
:- use_module(library(tabling)).
:- table sneezing(_,prob_sum),flu(_,prob_sum),hay_fever(_,prob_sum).
sneezing(X,P) :- flu(X,P0), P is P0*0.3.
% if X has the flu, there is a probability of 0.3 that he sneezes
sneezing(X,P) :- hay_fever(X,P0), P is P0*0.2.
% if X has hay fever, there is a probability of 0.2 that he sneezes
flu(bob,0.2).