Skip to content

Instantly share code, notes, and snippets.

View adbuerger's full-sized avatar

Adrian Bürger adbuerger

View GitHub Profile
@adbuerger
adbuerger / cov.py
Last active August 29, 2015 14:20
import casadi as ca
import pylab as pl
# [...]
# A is of type SX, column vector, shape (788, 1), dense
# B is of type sx, column vector, shape (984, 1), dense
# V is of type struct_symSX, shape (1594, 1), dense
# W is a numpy array, matrix with shape (788, 788), almost diagonal
~/casadi/build(branch:006fe55) » cmake -DWITH_PYTHON=ON -DWITH_CLANG=ON .. ab@esprimo
-- Flag needed for enabling C++11 features: -std=gnu++11
-- x86_64 architecture detected - setting flag -fPIC
-- Could not find HSL; looking in environmental variable HSL ()
-- Could not find WSMP; looking in environmental variable WSMP ()
-- Could not find METIS; looking in environmental variable METIS ()
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Looking for clang 3.4.2
-- Detected an IPOPT configuration without sIPOPT headers. Build will proceed, but without sIPOPT functionality.
import numpy as np
# Tested with CasADi 2.4.4
import casadi as ca
# Optimization variables
x = ca.MX.sym("x", 1, 2)
@adbuerger
adbuerger / par_dgb.py
Last active April 11, 2016 06:05
for CasADi 3.0
import casadi as ca
import pylab as pl
N = 50
WORKING_EXAMPLE = False
if WORKING_EXAMPLE:
x = ca.MX.sym("x", 2)
import casadi as ca
import pylab as pl
from time import time
# Run with CasADi 2.4.3
OPTNUMDIR = True
if OPTNUMDIR:
@adbuerger
adbuerger / A.cpp
Created November 15, 2018 15:26
Interrupt C++ function from Python (place pybind11 into the same folder, then compile using cmake . && cmake --build .)
#include "A.hpp"
A::A(int a_init)
: a(a_init),
interrupted(false)
{
}