Skip to content

Instantly share code, notes, and snippets.

{-# OPTIONS_GHC -Wall #-}
{-# Language RankNTypes #-}
{-# Language DeriveFunctor #-}
{-# Language DeriveGeneric #-}
module Dyno.Nlp ( Nlp(..) ) where
import Dyno.Vectorize
import Dyno.TypeVecs
import Dyno.TypeNats
# 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
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);
@ghorn
ghorn / gist:6242691
Last active December 21, 2015 03:29
llvm AST checker
{-# 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 ()