close
The Wayback Machine - https://web.archive.org/web/20201218085313/https://github.com/st-gille/semt
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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.

About

compile time symbolic differentiation via C++ template expressions

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.