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
Get["https://raw.githubusercontent.com/lucainnocenti/quantum-gate-learning-1803.07119-Mathematica-code/master/QPauliAlgebra.m"] | |
HTildeToff = \[Pi]/8 QPauliExpr[ | |
(1 + 4 (\[Nu]1 + \[Nu]2 + \[Nu]3 + \[Nu]4)) | |
+ 2 (4 (\[Nu]1 - \[Nu]2) - 1) x[3] | |
- (z[1] + z[2]) (1 - x[3]) | |
+ (1 + 4 (\[Nu]1 + \[Nu]2 - \[Nu]3 - \[Nu]4)) z[1] z[2] | |
+ Sqrt[-((1 - | |
4 (\[Nu]1 - \[Nu]2))^2 - (4 (\[Nu]3 - \[Nu]4))^2)] (z[1] - | |
z[2]) z[3] | |
]; |
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
displacedFockProbs[n_, mu_, k_] := Times[ | |
k! / n! * mu^(k - n), | |
Exp[-mu], | |
Sum[Binomial[n, j] (-mu)^j / (k - n + j)!, {j, n - k, n}]^2 | |
]; |
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
(* Create the expressions that must be satisfied by the d_s coefficients to generate a specific target | |
state after the coin is projected onto the + state. *) | |
generateConditionsForDs[n_, s_] := Sum[ | |
Conjugate[u[i] - d[i]] (u[i + n - s] - d[i + n - s]) + Conjugate[d[i + 1]] d[i + n - s + 1], | |
{i, 1, s} | |
] /. {d[1] -> 0, d[n + 1] -> u[n + 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
#!/bin/sh | |
arg=${1:-.} | |
exts="aux bbl blg brf idx ilg ind lof log lol lot out toc synctex.gz fls fdb_latexmk run.xml bcf" | |
if [ -d $arg ]; then | |
for ext in $exts; do | |
rm -f $arg/*.$ext | |
done | |
rm -f $arg/*Notes.bib |
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 argparse | |
import os | |
import sys | |
import re | |
def printBold(msg): | |
HEADER = '\033[95m' | |
BOLD = '\033[1m' | |
print(HEADER + BOLD + msg + '\x1b[0m') |
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 progressbar | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import qutip | |
def average_fidelity(U, V, sample_size): | |
total = 0 | |
for idx in range(sample_size): | |
psi = qutip.rand_ket_haar(8) | |
total += np.abs((psi.dag() * U.dag() * V * psi)[0, 0])**2 |
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
var script = document.createElement('script'); | |
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
map = {'Cmd-I': function(cm) { | |
var s = cm.getSelection(), | |
t = s.slice(0, 1) === '*' && s.slice(-1) === '*'; | |
cm.replaceSelection(t ? s.slice(1, -1) : '*' + s + '*', 'around'); | |
}}; | |
$('.CodeMirror').each(function() { | |
$(this)[0].CodeMirror.addKeyMap(map); |
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 tensorflow as tf | |
import numpy as np | |
import os | |
import zconfig | |
import utils | |
class RBM(object): |
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
base6ToBase10Conversion[n_Integer] := | |
ToExpression[StringJoin["6^^", ToString@n]] | |
labelToIndex[label_String] := With[{ | |
elementsConversionRules = {"H" -> 0, "V" -> 1, "D" -> 2, "A" -> 3, | |
"L" -> 4, "R" -> 5} | |
}, | |
If[ | |
StringLength@label == 4, | |
-(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
#!/usr/bin/python3 | |
import struct | |
import os | |
import time | |
start_time = time.time() | |
# ============ CONSTANTS TO (OPTIONALLY) SET ============= | |
WINDOW_SIZE = 100 | |
INPUT_FILE_NAME = 'data_lab\\timetags5byte.bin' | |
# OUTPUT_FILE_NAME = 'output.txt' |