NUMCXX
0.13.20181108
Numerical library for small projects and teaching purposes
|
Demonstrate the basic usage of arrays and expression templates in numcxx.Compile it with
This invokes cmake to find the installation of the numcxx library, to set up the a small cmake project and then to compile the code.
Run with
Epression templates provide two advantages: they allow to work with vectors using the common mathematical notations. Furthermore, for complex expressions, they allow to avoid intermediate storage of results in vectors, providing a possible speed advantage.
One potential pitfall for expression templates is the use of auto to detect the type of result from an expression template, see e.g. https://eigen.tuxfamily.org/dox/TopicPitfalls.html If you try to do this, please use numcxx::arrayexpr to obtain the proper data type.