Skip to content

Instantly share code, notes, and snippets.

View bstellato's full-sized avatar

Bartolomeo Stellato bstellato

View GitHub Profile
@bstellato
bstellato / mpl_latex.py
Created May 15, 2017 10:10
Matplotlib python helper function to generate latex plots
import matplotlib as mpl
mpl.use('pgf') # Export pgf figures
import matplotlib.pylab as plt
# Text width in pt
# -> Get this from LaTeX using \the\textwidth
text_width = 469.75
@bstellato
bstellato / paper.mplstyle
Created May 15, 2017 10:01
Matplotlib paper stylesheet
# Matplotlib paper stylesheet to be integrated with LaTeX
# To put in .matplotlib/stylelib/paper.mplstyle
pgf.texsystem: pdflatex
text.usetex: True
font.family: "serif"
font.serif: []
font.sans-serif: []
font.monospace: []
@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)))
#!/bin/bash
# arXiv uses an outdated TexLive distribution. This script is used to package
# all neccesary files so my paper can be compiled on arXiv...
# path to the texlive distribution
TEXLIVE=/usr/local/texlive/2015
# prepare the diretory for my submission
rm arxiv_package.zip
@bstellato
bstellato / installIPOPTjl.log
Created February 28, 2016 11:31
Segmentation Fault Backtrace from BinDeps.debug("Ipopt") in Julia
(lldb) bt
* thread #1: tid = 0x2993f, 0x00000003114b7e25, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3114b7e25)
* frame #0: 0x00000003114b7e25
frame #1: 0x00007fff9734762f libsystem_pthread.dylib`_pthread_fork_prepare + 85
frame #2: 0x00007fff9db2ca74 libSystem.B.dylib`libSystem_atfork_prepare + 24
frame #3: 0x00007fff927f7f9c libsystem_c.dylib`fork + 12
frame #4: 0x000000010016e9c7 libjulia-debug.dylib`uv_spawn + 455
frame #5: 0x000000010013b3e3 libjulia-debug.dylib`jl_spawn(name="/Users/sidereus/.julia/v0.4/Homebrew/deps/usr/bin/brew", argv=0x0000000109a9de00, loop=0x0000000100c3eca0, proc=0x0000000101734840, julia_struct=0x000000010a3bd810, stdin_type=UV_STREAM, stdin_pipe=0x0000000000000000, stdout_type=UV_STREAM, stdout_pipe=0x0000000101736620, stderr_type=UV_STREAM, stderr_pipe=0x0000000101108f40, detach=0, env=0x0000000000000000, cwd=0x0000000000000000, cb=(sys-debug.dylib`jlcapi_uv_return_spawn_19196)) + 403 at jl_uv.c:240
frame #6: 0x000