This file contains 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
from typing import Iterable, Tuple | |
import time | |
import numpy as np | |
def to_mask(word: str) -> int: | |
"""Converts a word into a bitmask where each bit indicates presence of a letter.""" | |
t = 0 | |
for c in word: |
This file contains 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
from typing import List | |
import stim | |
def circuit_to_tableau(circuit: stim.Circuit) -> stim.Tableau: | |
s = stim.TableauSimulator() | |
s.do_circuit(circuit) | |
return s.current_inverse_tableau() ** -1 |
This file contains 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
from typing import Optional, Dict | |
import cirq | |
def compose(*gates: cirq.Gate) -> cirq.Gate: | |
matrix = cirq.unitary(gates[0]) | |
for g in gates[1:]: | |
matrix = cirq.unitary(g) @ matrix | |
return cirq.MatrixGate(matrix) |
This file contains 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 csv | |
import pathlib | |
import time | |
from dataclasses import dataclass | |
from typing import Callable, List, Dict, Any, Set, FrozenSet, Iterable, Tuple | |
import math | |
import pymatching | |
import networkx as nx | |
import stim | |
import matplotlib.pyplot as plt |
This file contains 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
<html> | |
<body> | |
<script> | |
let canvas = document.createElement('canvas'); | |
document.body.appendChild(canvas); | |
let gl = canvas.getContext('webgl'); | |
if (!gl) { | |
throw new Error("!gl") | |
} |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>WebXR Testing</title> | |
</head> | |
<body> | |
<input id="button_enter" type="button" value="Loading..." disabled/> | |
<script> | |
const GL = WebGLRenderingContext; |
This file contains 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
from typing import Optional, List, Dict, Callable, Any | |
from collections import defaultdict | |
import fractions | |
import math | |
import random | |
import sys | |
import matplotlib.pyplot as plt |
This file contains 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
def persistence(n): | |
t = 0 | |
while n >= 10: | |
t += 1 | |
n2 = 1 | |
for d in str(n): | |
n2 *= int(d) | |
n = n2 | |
return t |
This file contains 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
from itertools import * | |
import string | |
from numpy import * | |
from scipy import * | |
from scipy.linalg import * | |
#Script for setting up transfer matrix describing the evolution of diagonal | |
#elements of the density matrix given a list of three variable clauses. | |
# | |
#The Transfer matrix maps the vector of state populations (diagonal elements of |
This file contains 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 numpy as np | |
import cv2 | |
import itertools | |
import math | |
import cmath | |
w = h = 1024 | |
deg = 11 | |
# The root phases to sample frame, and the color that goes with each. |