Skip to content

Instantly share code, notes, and snippets.

@ghorn
ghorn / gist:b4a94b16c803480c6a14da21a1aae17c
Created July 5, 2017 22:24
switch dimension mismatch
from casadi import *
x = MX.sym('x')
c = MX.sym('c')
z0 = conditional(c, [0, 1], 3)
#z0 = conditional(c, [x, x], 3) # works
f = z0 + x
#f = z0 # works
@ghorn
ghorn / bug.py
Created July 5, 2017 22:25
switch dimension mismatch
from casadi import *
x = MX.sym('x')
c = MX.sym('c')
z0 = conditional(c, [0, 1], 3)
#z0 = conditional(c, [x, x], 3) # works
f = z0 + x
#f = z0 # works
@ghorn
ghorn / gist:724f24b48dc8b9dd6105fe3bdd9b732a
Created May 9, 2018 22:27
SBV interpolation wrap stand-along example
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.List ( intercalate )
import qualified Data.Vector as V
import qualified Data.Vector.Storable as SV
import qualified Data.Vector.Storable.Mutable as SVM
import Data.SBV
import Data.SBV.Tools.CodeGen
WARNING: Stepsize is 0.000000000000000e+00
################# qpOASES -- QP NO. 1 ##################
Iter | StepLength | Info | nFX
----------+------------------+------------------+---------
0 | 0.000000e+00 | REM BND 0 | 20
1 | 9.750226e-01 | REM BND 13 | 19
2 | 9.006699e-01 | REM BND 14 | 18