Advanced expression templates programming

  • J. Härdtlein
  • C. PflaumEmail author
  • A. Linke
  • C. H. Wolters
Regular Article


Expression Templates (ET) are a powerful tool for development of user-friendly numerical libraries. By this concept and by operator overloading in C++, numerical algorithms can be implemented in a mathematical notation without decreasing the performance in comparison to optimized C or FORTRAN codes. In this paper, we present new Expression Template techniques. First, we explain the concept of “Easy Expression Templates”, which are easier to implement than classical ET. Then, we explain “Fast Expression Templates”. This concept leads to an optimal performance even on special architectures like vector machines. Furthermore, concepts for storing expressions and code optimizing are presented. In order to verify the usability of these programming techniques in real applications, we discuss a template library which calculates local stiffness matrices arising from Finite Element discretizations.


Reference Element Return Type Expression Tree Local Stiffness Assignment Operator 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Basetti, F., Davis, K., Quinlan, D.: C++ Expression Templates Performance Issues in Scientific Computing. CRPC-TR97705-S (1997)Google Scholar
  2. 2.
    Ciarlet, P.G.: The Finite Element Method for Elliptic Problems. SIAM (2002)Google Scholar
  3. 3.
    Haney S.: Beating the abstraction penalty in C++ using expression templates. In: Dubois, P. (eds) Computers in Physics, vol 10, No. 6, pp. 552–557. American Institute Of Physics, USA (1996)Google Scholar
  4. 4.
    Haney, S., Crotinger, J., Karmesin, S., Smith, S.: PETE: the portable expression templates engine. Dr. Dobb’s J. Softw. Tools, 24(10):88, pp. 90–92, 94–95 (1998)Google Scholar
  5. 5.
    Härdtlein, J., Linke, A., Pflaum, C.: Fast expression templates. In: Suneram, V.S., Albada, G.D.V., Sloot, P.M.A., Dongarra, J.J. (eds.), Computational Science—ICCS 2005, volume 3515 of LNCS. Springer, ISBN-10 3-540-26043-9, ISBN-13 978-3-540-26043-1, ISSN 03-2-9743. pp. 1055–1063 (2005)Google Scholar
  6. 6.
    Härdtlein, J., Pflaum, C.: Efficient and user-friendly computation of local stiffness matrices. In: Hülsemann, F., Kowarschik, M., Rüde, U. (eds.), 18th Symposium Simulationstechnique ASIM 2005 Proceedings, volume 15 of Frontiers in Simulation. ASIM, SCS Publishing House, ISBN 3-936150-41. pp. 748–753 (2005)Google Scholar
  7. 7.
    Kirby, R.C., Logg, A.: Efficient compilation of a class of variational forms. ACM Trans. Math. Softw. 33(3), Article 17 (2007)Google Scholar
  8. 8.
    Los Alamos National Laboratories. POOMA.
  9. 9.
    Linke, A., Pflaum, C.: Fast expression templates for the SR 8000 supercomputer. In: Stiegritz, J., Davis K. (eds.) Proceedings of the Workshop on Parallel/High-Performance Object-Oriented Scientific Computing (POOSC). Technical Report, FZJ-ZAM-IB-2003-09, (2003)Google Scholar
  10. 10.
    Pflaum C.: Expression templates for partial differential equations. Comput. Visual. Sci. 4, 1–8 (2001)zbMATHCrossRefGoogle Scholar
  11. 11.
    High Performance Center Stuttgart: The NEC SX-6 Cluster Documentation. (2005)
  12. 12.
    Veldhuizen T.: Expression templates. C++ Report 7(5), 26–31 (1995)Google Scholar
  13. 13.
    Veldhuizen, T.: Techniques for Scientific C++. Indiana University Computer Science Technical Report No 542, Version 0.4 (2000)Google Scholar
  14. 14.
    Veldhuizen, T.: Blitz++ User’s Guide—Version 1.2. (2001)
  15. 15.
    Vandevoorde D., Josuttis N.: C++ Templates—The Complete Guide. Addison-Wesley, Reading (2003)Google Scholar
  16. 16.
    Walter, J., Koch, M.: uBLAS, Boost C++ Libraries - Basic Linear Algebra. (2002)
  17. 17.
    Wolters C.H., Köstler H., Möller C., Härdtlein J., Grasedyck L., Hackbusch W.: Numerical mathematics of the subtraction method for the modeling of a current dipole in EEG source reconstruction using finite element head models. SIAM J. Sci. Comput 30(1), 24–45 (2007)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag 2009

Authors and Affiliations

  • J. Härdtlein
    • 1
  • C. Pflaum
    • 1
    Email author
  • A. Linke
    • 2
  • C. H. Wolters
    • 3
  1. 1.Department of Computer Science 10University of Erlangen-NurembergErlangenGermany
  2. 2.Weierstrass Institute for Applied Analysis and StochasticsBerlinGermany
  3. 3.Institute for Biomagnetism and BiosignalanalysisUniversity of MuensterMuensterGermany

Personalised recommendations