This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
module Main ( main ) where | |
import LLVM.General | |
import LLVM.General.Analysis | |
import LLVM.General.Context | |
import Control.Monad.Trans.Error | |
main :: IO () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef callback_t .....; // callback function | |
int run_export(int numX, int numU, callback_t * ode, callback_t * ref, .........){ | |
vector<DifferentialState> xvec; | |
vector<Control> uvec; | |
for (int k=0; k<numX; k++){ | |
DifferentialState x; | |
xvec.push_back(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# result of symbolic differentaition | |
def f_sym(x): | |
f = exp(k*x) | |
fd = k*exp(k*x) | |
return (f,fd) | |
# result of AD | |
def f_ad(x): | |
f = exp(k*x) | |
fd = k*f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
{-# Language RankNTypes #-} | |
{-# Language DeriveFunctor #-} | |
{-# Language DeriveGeneric #-} | |
module Dyno.Nlp ( Nlp(..) ) where | |
import Dyno.Vectorize | |
import Dyno.TypeVecs | |
import Dyno.TypeNats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from casadi import * | |
##### lets integrate something 100 timesteps with 3 different methods ##### | |
# this is whate we want to integrate | |
def dynamics_fun(x): | |
xdot = # some complicated shit | |
return xdot | |
## 1: inline everything, standard approach to AD afaik | |
def rk4(x0, h): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghorn@adler:~$ cat .xsession | |
# .xsesssion | |
# nicer looking cursor | |
xsetroot -cursor_name left_ptr | |
# background image | |
xloadimage -onroot -fullscreen ~/Dropbox/desktop_backgrounds/trex_aviators.jpg | |
# key repeat delay to 250ms, repeat rate to 35Hz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghorn@adler:~$ cat .xmonad/xmonad.hs | |
{-# OPTIONS_GHC -Wall #-} | |
module Main ( main ) where | |
import XMonad | |
import qualified XMonad.StackSet as SS | |
import XMonad.Util.EZConfig ( additionalKeys ) | |
import XMonad.Prompt.Shell ( shellPrompt ) | |
import XMonad.Prompt ( defaultXPConfig ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- put these two files in a directory and the compile with | |
-- ghc -fforce-recomp -O2 -prof -fprof-auto-calls Woo.hs | |
-- Vectorize.hs | |
{-# OPTIONS_GHC -Wall #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Vectorize | |
( GVectorize(..) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- multiple shooting | |
data MsPoint x u a = MsPoint (x a) (u a) | |
data MsTraj x u n a = MsTraj (Vec n (MsPoint x u a)) (x a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from casadi import * | |
x0 = MX.sym('x',10,1); | |
u = MX.sym('u',10,1); | |
f = MXFunction([x0,u],[x0]) | |
f.setOption('name','f') | |
f.init() | |
h = MX.sym('h',1,1); |
OlderNewer