Skip to content

Instantly share code, notes, and snippets.


Marek marekyggdrasil

View GitHub Profile
marekyggdrasil /
Last active Dec 1, 2020
CNF files for online tutorial covering the concept of Elliptic Curve Cryptography and Diffie-Hellman Key Exchange, tutorial available under
import numpy as np
# ECC addition in R
def eccContAddition(Px, Py, Qx, Qy, a, b):
if np.isclose([Px], [Qx])[0]:
m = (3.*Px**2.+a)/(2.*Py)
m = (Py-Qy)/(Px-Qx)
Rx = m**2 - Px - Qx
marekyggdrasil / phi1.cnf
Last active Jul 13, 2020
CNF files for online tutorial covering the concept of SAT and boolean satisfiability in general, tutorial available under
View phi1.cnf
p cnf 3 3
1 -2 3 0
1 2 -3 0
-1 -2 3 0
marekyggdrasil /
Last active Jun 25, 2020
Code repository for tutorial on constraint programming available on
from constraint import Problem
problem = Problem()
problem.addVariable('x', range(1, 10))
problem.addVariable('y', range(1, 10))
problem.addVariable('z', range(1, 10))
def constraintCheck(x, y, z):
marekyggdrasil /
Created May 28, 2020
An example of a raw livestream pipeline generated from numpy array, based on and to put it in context, I made this example for this issue
#!/usr/bin/env python
# -*- coding:utf-8 vi:ts=4:noexpandtab
# Simple RTSP server. Run as-is or with a command-line to replace the default pipeline
import time
import sys
import abc
import numpy as np
import typing as typ
from fractions import Fraction

This is code repository for Quantum Adiabatic Optimization article.

Start by running that will build list-based definiton of the graph from its set-based definition, this will let you keep consistent indices between all the runs.

The is the adiabatic optimization code.

Energy spectrum can be examined by running with single command line argument being one of HMVC, HMVC_, HMIS or HMIS_. I don't suggest running all the diagonalizations in single run, graphs are big and you are likely to get a segmentation fault error. This is why it is good to keep consistent indices and store your graph using lists and not sets.

You can plot figures using


Keybase proof

I hereby claim:

  • I am marekyggdrasil on github.
  • I am renzokuken ( on keybase.
  • I have a public key ASBlmYD61f2p1NbjpbpO7pCJH_4zOEmIbMry26gc4P7lIAo

To claim this, I am signing this object:

marekyggdrasil /
Last active Mar 22, 2020
A brief tutorial how to simulate quantum teleportation with QuTip quantum computing library in Python. More detailed explanation available here:
import numpy as np
import itertools
from qutip import basis, tensor, rand_ket, snot, cnot, rx, rz, qeye
# create random state
psi = rand_ket(2)
# initial state
marekyggdrasil / plot_file_a.png
Last active Dec 2, 2019
Inconsistent Matplotlib behaviour, running script multiple times leads to different outcomes. Posted as question on StackOverflow under URL:
You can’t perform that action at this time.