5 ms·
> I use sympy to (i) compute these big vectors, expressed in a very declarative way, (ii) compute the jacobian and (iii) export the results in C-code, immediate
by sampo 3y ago
> I use sympy to (i) compute these big vectors, expressed in a very declarative way, (ii) compute the jacobian and (iii) export the results in C-code, immediately importable in my code case.
You could maybe calculate the Jacobian in C code using automatic differentiation. Might be less C-code, might be less elementary operations done in the C code, and you would not need to be copy-pasting complex symbolically derived formulas from Python to C.
https://en.wikipedia.org/wiki/Automatic_differentiation https://en.wikipedia.org/wiki/Automatic_differentiation
- whatshisface 3y agoI could be wrong, but I seriously doubt C macros can do this.
- sampo 3y agoWhy are you thinking of macros?
- whatshisface 3y agoIn an embedded environment you would want it to be pre-compiled and optimized.