This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 () |
NewerOlder