Skip to content

Instantly share code, notes, and snippets.

View bstellato's full-sized avatar

Bartolomeo Stellato bstellato

View GitHub Profile
@bstellato
bstellato / MITaly privacy policy
Created March 11, 2019 14:28
mitaly_privacy_policy.html
<h1>Privacy Policy</h1>
<p>Effective date: March 11, 2019</p>
<p>MITaly - Italian Association at MIT ("us", "we", or "our") operates the http://mitaly.mit.edu website (the "Service").</p>
<p>This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our Service and the choices you have associated with that data. Our Privacy Policy for MITaly - Italian Association at MIT is created with the help of the <a href="https://www.freeprivacypolicy.com/">Free Privacy Policy website</a>.</p>
@bstellato
bstellato / pgfplots_example.tex
Created February 12, 2020 22:38
Create PGFPlots lines from csv file
\begin{figure}
\begin{tikzpicture}
\begin{axis}
[
axis x line=bottom,
axis y line=left,
enlarge y limits=0.1, % Enlarge limits by 10%
% ymode=log, % If you want to be logarithmic
width=\textwidth,
height=0.33\textheight,
@bstellato
bstellato / julia_parallel.jl
Created March 27, 2020 17:05
Julia example of parallel execution
using ProgressMeter
using Distributed
addprocs(2)
@everywhere using LinearAlgebra
@everywhere function myfunc(theta)
for i in 1:100000
dot(theta, theta)
end
return Dict(["A" => norm(theta, 2), "B" => norm(theta, 1)])
@bstellato
bstellato / bootabs_table.tex
Created February 1, 2021 14:38
Booktabs table from csv
\usepackage{booktabs}
\usepackage{csvsimple}
...
...
\begin{table}
\centering
\caption{Example table.}
\label{tab:tablelabel}
\begin{tabular}{ll}
@bstellato
bstellato / random_mat_condition_number.py
Last active October 11, 2022 20:52
Generate matrix with predefined condition number
# Construct random matrix P with specified condition number
#
# Bierlaire, M., Toint, P., and Tuyttens, D. (1991).
# On iterative algorithms for linear ls problems with bound constraints.
# Linear Algebra and Its Applications, 143, 111–143.
#
cond_P = 10**2 # Condition number
log_cond_P = np.log(cond_P)
exp_vec = np.arange(-log_cond_P/4., log_cond_P * (n + 1)/(4 * (n - 1)), log_cond_P/(2.*(n-1)))