Skip to content

Instantly share code, notes, and snippets.

View TheDataLeek's full-sized avatar

Zoë TheDataLeek

View GitHub Profile
def bastard_svd(A, k, p): # function [U,D,V] = LOCAL_rsft(A,k,p)
m, n = A.shape # n = size(A,2);
# Create diagonal matrix of random numbers #
dd = np.exp(1j * 2 * np.pi * np.random.random(size=n)) # dd = exp(1i*2*pi*rand(1,n));
Y = A @ np.diag(dd) # Y = A*diag(dd);
# Apply full FFT to rows of AD, extract k + p columns #
Y = np.fft.fft(A, axis=1) # Axis0 is columns, Axis1 is Rows # Y = fft(Y,[],2);
# Create vector J of length k + p from the set {1, 2, ..., n} #
J = np.random.choice(np.arange(n), # [~,ind] = sort(rand(1,n));
size=(k + p), # J = ind(1:(k+p));
def bastard_svd(A, k, p):
########################
# Stage A #
########################
m, n = A.shape
assert(k + p <= n)
# (1)
# Create diagonal matrix of random numbers
D = np.diag(np.random.normal(size=n))
# Create vector J of length k + p from the set {1, 2, ..., n}
. /home/william/.config/fish/vi-mode.fish
function pip2_update_all
sudo pip2 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U
end
function pip3_update_all
sudo pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U
end
@TheDataLeek
TheDataLeek / init.vim
Created February 15, 2016 22:30
init.vim for NeoVim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Initialize Vundle
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin('~/.config/nvim/bundle')
╰─>$ gcc code.c -O0 -o code ; ./code
Total time elapsed for strcpy1 size 10: 0 us
Total time elapsed for strcpy2 size 10: 0 us
Total time elapsed for strcpy3 size 10: 0 us
Total time elapsed for strcpy1 size 100: 1 us
Total time elapsed for strcpy2 size 100: 0 us
Total time elapsed for strcpy3 size 100: 0 us
Total time elapsed for strcpy1 size 1000: 2 us
Total time elapsed for strcpy2 size 1000: 2 us
Total time elapsed for strcpy3 size 1000: 3 us
\documentclass[10pt]{article}
\input{./tex/header.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beginning of document items - headers, title, toc, etc...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{fancy} % Establishes that the headers will be defined
\fancyhead[LE,LO]{New Paper} % Adds header to left
\fancyhead[RE,RO]{William Farmer} % Adds header to right
\cfoot{\mlptikz[size=0.25in, text=on, textposx=0, textposy=0, textvalue=\thepage, textscale=0.75in]{applejack}}
\documentclass[12pt, landscape, twocolumn]{article}
\usepackage{genmpage}
\usepackage{pgfpages}
\usepackage[margin=0.25in]{geometry}
\input{./tex/header.tex}
\input{./tex/pgfpage9.tex}
\pgfpagesphysicalpageoptions%
{
logical pages=9,
physical height=\paperwidth,
physical width=\paperheight,
}
\pgfpageslogicalpageoptions{1}
{
resized width=.38\pgfphysicalwidth,
resized height=0.25\pgfphysicalheight,
\documentclass[10pt]{article}
\input{./tex/header.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beginning of document items - headers, title, toc, etc...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{fancy} % Establishes that the headers will be defined
\fancyhead[LE,LO]{Numerical Analysis Notes} % Adds header to left
\fancyhead[RE,RO]{William Farmer} % Adds header to right
\cfoot{\mlptikz[size=0.25in, text=on, textposx=0, textposy=0, textvalue=\thepage, textscale=0.75in]{applejack}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LaTeX Imports
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsfonts} % Math fonts
\usepackage{amsmath} % Math formatting
\usepackage{amssymb} % Math formatting
\usepackage{amsthm} % Math Theorems
%\usepackage{arydshln} % Dashed hlines
\usepackage{attachfile} % AttachFiles
\usepackage{cancel} % Cancelled math