Skip to content

Instantly share code, notes, and snippets.

Avatar

Jack Valmadre jvlmdr

View GitHub Profile
View smooth_periodic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View benchmark.txt
---------------------------------------------------------------------------------- benchmark 'test_benchmark_assign_3x3': 6 tests ---------------------------------------------------------------------------------
Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_assign_3x3[lapsolver] 21.8828 (1.0) 382.6180 (1.0) 27.1516 (1.0) 13.0945 (1.0) 23.1010 (1.0) 1.3541 (1.0) 1014;2011 36.8302 (1.0) 11318 1
test_benchmark_assign_3x3[lap] 41.3780 (1.89) 887.3888 (2.32) 52.0903 (1.92) 23.1687 (1.77) 45.7240 (1.98) 1.9629 (1.45) 853;1701 19
@jvlmdr
jvlmdr / download.sh
Created May 3, 2017
Downloads OTB dataset
View download.sh
#!/bin/bash
baseurl="http://cvlab.hanyang.ac.kr/tracker_benchmark"
wget "$baseurl/datasets.html"
cat datasets.html | grep '\.zip' | sed -e 's/\.zip".*/.zip/' | sed -e s'/.*"//' >files.txt
cat files.txt | xargs -n 1 -P 8 -I {} wget -c "$baseurl/{}"
@jvlmdr
jvlmdr / smooth.py
Created Feb 8, 2017
Generate smooth functions in numpy
View smooth.py
import numpy as np
def covar1(m, s):
s = float(s)
r = np.arange(m, dtype=np.float)
d = np.reshape(r, (m, 1)) - np.reshape(r, (1, m))
k = np.exp(-(0.5/s**2) * (d * d))
return k
def smooth1(m, s):
View benchmark_mul_circ_covar.m
function benchmark()
test();
m1 = 32;
m2 = 48;
k = 24;
x = randn(m1, m2, k);
af = covar1(randn(m1, m2, k));
a = ifft2(af, 'symmetric');
t = time_func(@() mul1(af, x));
View mul_circ_covar.m
% Computes circulant covariance of a and then multiplies x by covariance.
% Both images are of size (m1, m2) with k channels.
%
% size(a) is [m1, m2, k]
% size(x) is [m1, m2, k]
function b = mul_circ_covar(a, x)
[m1, m2, k] = size(x);
% compute circulant covariance from shifts of a
% sf(u1,u2,p,q) = conj(af(u1,u2,q)) * af(u1,u2,p)
View solve_rect.m
function [x, mul_dx_dA, mul_dx_db] = solve_rect(A, b)
% solve_rect returns x that minimises |A x - b|^2
% x = (A' A)^-1 A' b
% and operators that compute derivatives with respect to A and b.
% It uses a QR decomposition of A.
%
% Parameters:
% A has size [m, n] with m >= n and rank(A) = n.
% b has size [m, 1].
%
View solve_square.m
function [x, mul_dx_dA, mul_dx_db] = solve_square(A, b)
% solve_square returns x = A^-1 b and operators that compute products with
% derivatives with respect to A and b. It uses an LU decomposition of A.
%
% Parameters:
% A has size [n, n] and rank(A) = n.
% b has size [n, 1].
%
% Returns:
% x has size [n, 1].
View deriv_lsq_nonlin.m
function dy_dx = deriv_lsq_nonlin(rfun, x, y_hat, m, n)
% deriv_lsq_nonlin estimates the derivative of
% y(x) = argmin_y |r(x, y)|^2 .
%
% Parameters:
% [r, dr_dx, dr_dy, d2r_dxdy] = rfun(x, y)
% x has size [m, 1].
% y has size [n, 1].
% r has size [p, 1].
% dr_dx has size [p, m] and dr_dx(i, j) = dr(i) / dx(j).
@jvlmdr
jvlmdr / rip_svd.m
Last active Aug 29, 2015
Estimate RIP constant of matrix
View rip_svd.m
n = 100;
m = 50;
A = 1/sqrt(m) * randn(m, n);
K = 10;
rmin = ones(K, 1);
rmax = ones(K, 1);
trials = 1e4;
for k = 1:K
for i = 1:trials
You can’t perform that action at this time.