Skip to content

Instantly share code, notes, and snippets.

View nathanshammah's full-sized avatar

Nathan Shammah nathanshammah

View GitHub Profile
@nathanshammah
nathanshammah / quarc.C
Created February 6, 2023 20:02
quarc pseudocode
int main() {
int x;
read_input(&x); // read input and store it in x
if (x == 100) {
return 1;
}
return 0;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am nathanshammah on github.
  • I am nathanshammah (https://keybase.io/nathanshammah) on keybase.
  • I have a public key ASDCTJHOXDemljHB37kn_7jn_-EcLd_B4uxHoEqXjnDzgAo

To claim this, I am signing this object:

@nathanshammah
nathanshammah / unitary_fund_microgrants.ipynb
Last active May 27, 2020 10:42
Unitary Fund microgrants data.
Unitary Fund microgrants data. GPL v.3 license.
from qutip import *
import matplotlib.pyplot as plt
import numpy as np
N = 20
rho_coherent = coherent_dm(N, np.sqrt(2))
rho_thermal = thermal_dm(N, 2)
rho_fock = fock_dm(N, 2)
fig, axes = plt.subplots(1, 3, figsize=(12,3))
plot_fock_distribution(rho_coherent, fig=fig, ax=axes[0], title="Coherent state");
@nathanshammah
nathanshammah / stochastic
Created June 19, 2019 08:08
stochastic quantum dynamics with QuTiP's mcsolve
#!/usr/bin/env python
# coding: utf-8
# # Stochastic Quantum Dynamics with QuTiP
#
#
# We use QuTiP's solvers to study the open dynamics of a quantum system evolving in time.
# In[12]:
@nathanshammah
nathanshammah / rhs77050.pyx
Created June 4, 2019 15:04
qutip cython compiled file
#!python
#cython: language_level=3
# This file is generated automatically by QuTiP.
# (C) 2011 and later, QuSTaR
import numpy as np
cimport numpy as np
cimport cython
np.import_array()
cdef extern from "numpy/arrayobject.h" nogil:
from qutip import *
q = QubitCircuit(3, reverse_states=False)
q.add_gate("TOFFOLI", controls=[0, 2], targets=[1])
q.add_gate("CNOT", targets=[1], controls=[0])
display("q",q.png)
q.add_gate("TOFFOLI", controls=[0, 2], targets=[1])
display("q updated",q.png)
q2 = QubitCircuit(3, reverse_states=False)