Skip to content

Instantly share code, notes, and snippets.

# OT solution classes
class OTResults(): # class for exact ot and small pre-computed problems
def __init__(self,duals,loss,loss_linear,primal=None,log=None):
self.duals=duals # dual solutions
self.primal=primal # primal solution
self.log=log# log stuff from the solver
self.loss=loss# total loss (with entropy if reg)
@rflamary
rflamary / nbview
Created January 22, 2021 07:37
Jupyter Notebook viewer
#!/bin/bash
tfile=$(mktemp /tmp/nbview_XXXXXXXXXXX)
jupyter-nbconvert --to html --output "$tfile.html" "$1"
xdg-open "$tfile.html"
from bs4 import BeautifulSoup
import urllib
def parse_scholar_page(url,paper_list=False):
response = urllib.request.urlopen(url)
webContent = response.read()
@rflamary
rflamary / dft.m
Created March 26, 2015 08:00
discrete fourier transform
function [Xk] = dft(xn,N)
% Computes Discrete Fourier Transform
% -----------------------------------
% [Xk] = dft(xn,N)
% Xk = DFT coeff. array over 0 <= k <= N-1