This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts #-} | |
-- QReg type class and instances | |
class QReg a where | |
mapIndices :: a -> (Int -> Int) -> a | |
indices :: a -> [Int] | |
data Qubit = Qubit { index :: Int } deriving (Eq, Show) | |
instance QReg Qubit where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// QReg interface and implementations | |
interface QReg<T : QReg<T>> { | |
fun mapIndices(mapper: (Int) -> Int): T | |
fun indices(): List<Int> | |
} | |
data class Qubit(val index: Int) : QReg<Qubit> { | |
override fun mapIndices(mapper: (Int) -> Int) = Qubit(mapper(index)) | |
override fun indices() = listOf(index) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing collected packages: sortedcontainers, pytz, ply, mpmath, wrapt, urllib3, tzdata, typing_extensions, types-protobuf, types-deprecated, tqdm, toolz, tomli, sympy, sniffio, six, ruamel.yaml.clib, pyzmq, python-rapidjson, pyparsing, pyasn1, psutil, protobuf, pillow, packaging, ordered-set, opt_einsum, numpy, networkx, mypy_extensions, msgpack, llvmlite, kiwisolver, idna, h11, grpcio, fonttools, exceptiongroup, duet, cython, cycler, charset-normalizer, certifi, cachetools, autoray, attrs, types-requests, typedunits, scipy, ruamel.yaml, rsa, requests, quil, python-dateutil, pylatex, pyasn1-modules, proto-plus, numba, mypy, httpcore, grpc-interceptor, googleapis-common-protos, deprecated, cytoolz, cotengra, contourpy, anyio, rpcq, quimb, pandas, matplotlib, httpx, grpcio-status, google-auth, qcs-api-client-common, google-api-core, qcs-sdk-python, pyquil | |
Successfully installed anyio-4.9.0 attrs-25.3.0 autoray-0.7.1 cachetools-5.5.2 certifi-2025.4.26 charset-normalizer-3.4.2 contourpy-1.3.2 cotengra-0.7.2 c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tableau {} | |
class SV {} | |
class DM {} | |
class Stabilizer {} | |
class Unitary {} | |
class Channel {} | |
fun apply(stabilizer: Stabilizer, tableau: Tableau) {} | |
fun apply(unitary: Unitary, sv: SV) {} | |
fun apply(channel: Channel, dm: DM) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Mathlib.Tactic | |
import Mathlib.Data.Real.Basic | |
import Mathlib.Data.Vector.Zip | |
theorem reverse_get_kth (n: Nat) (k: Fin n) (v: Vector Nat n): | |
v.get k = v.reverse.get (Fin.revPerm k) := by | |
cases n with | |
| zero => exact k.elim0 | |
| succ => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
namespace ConsoleApp6 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
while (true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<startup> | |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | |
</startup> | |
<runtime> | |
<gcServer enabled="true"/> | |
</runtime> | |
</configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AlgorithmW | |
// HINDLEY-MILNER TYPE INFERENCE | |
// Based on http://catamorph.de/documents/AlgorithmW.pdf | |
type Lit = | |
| LInt of int | |
| LBool of bool | |
type Exp = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Program | |
// A simple service | |
module PrinterService = | |
open System | |
// Helper functions first | |
// They can be public for easy unit testing, so long as they don't leave things inconsistent | |
let isObscene s = String.length s = 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let addChild updateNode addNode value parent = | |
match withNewChild value parent with | |
| None -> async.Return None | |
| Some (newParent, child) as path -> | |
async { do! addNode child | |
do! updateNode newParent | |
return Some child } | |
let addChildById getNode updateNode addNode logAction value parentId = | |
async { let! parent = getNode parentId |
NewerOlder