Skip to content

Instantly share code, notes, and snippets.

View robbiemccorkell's full-sized avatar
💭
yeah baby!

Robbie McCorkell robbiemccorkell

💭
yeah baby!
  • Leap Labs
  • London
View GitHub Profile
# Import the Qiskit SDK
import math, argparse, warnings
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute, register
warnings.filterwarnings("ignore")
MAX_QUBITS = 5
QX_URL = "https://quantumexperience.ng.bluemix.net/api"
def parse_input():
def parse_input():
parser = argparse.ArgumentParser()
parser.add_argument('max', metavar='n', type=int, nargs='?', default=16, help='a maximum integer to generate')
parser.add_argument('--remote', action='store_true', default=False, help='run command on real remote quantum processor')
parser.add_argument('--qx-token', nargs='?', help='api token for IBM Q Experience remote backend')
args = parser.parse_args()
if args.remote and args.qx_token is None:
parser.error("--remote requires --qx-token")
def next_power_of_2(n):
return int(math.pow(2, math.ceil(math.log(n, 2))))
def random_int(max):
bits = ''
for x in range(num_bits(max)):
q = QuantumRegister(1)
c = ClassicalRegister(1)
qc = QuantumCircuit(q, c)
qc.h(q[0])
qc.measure(q, c)
import math
def num_bits(n):
return math.floor(math.log(n, 2)) + 1
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
q = QuantumRegister(1)
c = ClassicalRegister(1)
qc = QuantumCircuit(q, c)
qc.h(q[0])
qc.measure(q, c)
job_sim = execute(qc, "local_qasm_simulator", shots=1)
@robbiemccorkell
robbiemccorkell / xorshift128+.c
Created September 24, 2018 17:34
xorshift128+
uint64_t state0 = 1;
uint64_t state1 = 2;
uint64_t xorshift128plus() {
uint64_t s1 = state0;
uint64_t s0 = state1;
state0 = s0;
s1 ^= s1 << 23;
s1 ^= s1 >> 17;
s1 ^= s0;
s1 ^= s0 >> 26;

Keybase proof

I hereby claim:

  • I am robbiemccorkell on github.
  • I am robbiemccorkell (https://keybase.io/robbiemccorkell) on keybase.
  • I have a public key whose fingerprint is 143F 195B 5688 B11B 9822 EC09 931B 49D7 A5A5 6882

To claim this, I am signing this object:

@robbiemccorkell
robbiemccorkell / TappyButtonApp.js
Last active February 13, 2016 03:22
React Native - Tappy Button
/**
* @providesModule TappyButtonApp
* @flow
*/
'use strict';
var React = require('react-native/addons');
var {
Bundler,
StyleSheet,