SEMT - Compile-time symbolic differentiation via C++ templates
The SEMT library provides an easy way to define arbitrary functions and obtain their derivatives via C++ expression templates.
This is an extension of Zvi Guttermans original work accompanying his master thesis "Symbolic Pre-computation for Numerical Applications".
Additional features include:
- partial differentiation
- easy-to-use objects for multi-valued functions
- basic expression substitution that will simplify generated expressions
- advanced facilities to create expressions
Because of this origin, all code is free, see the LICENSE file for details.
Simple example
DVAR(x, 0);
auto f = pow(x, INT(3)) + sin(x);
cout << f << endl;
cout << deriv_t(f, x) << endl;will print
((x0)^(3) + sin(x0))
((3 * (x0)^(2)) + cos(x0))
to your console.
Usage
Run make doc to create the documentation with doxygen.
You can view the documentation here or download it here.
There you will find an introductory example and the comprehensive API documentation.
There are several example programs:
semt_examples- These are used in the documentation.semt_speed- A test run on a mapping R^10 -> R^10.semt_newton- Implementation of Newton's method.semt_check- Some crude tests.
You can run
make [release | gprof | gcov] <binary>
to compile a corresponding binary.
Using release mode enables compiler optimizations and places the binary in the Release folder.
Using gprof creates a call graph and with timings in gprof/<binary>_<arguments>, where you can supply arguments via the ${ARGS} make variable.
Using gcov outputs coverage results into gcov.
Contact me at gille@numasoft.de for any questions.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
