**Go backward to** Hierarchical Iterators and Algorithms

*Matt Austern*

**Go up to** Programming Methodology

**Go forward to** Generative Programming: Beyond Generic Programming

*Ulrich Eisenecker*

### Generic Programming in C++: Matrix Case Study

*Krzysztof Czarnecki*

This talk presents a concrete example of a complete generative development
method for libraries of reusable algorithmic components and its application
to the domain of matrix computations. The overall method is a specialization
of the domain engineering method ODM by Simos et al. In the analysis phase,
an extended version of so-called feature diagrams is used to model the features
of the domain as well as the features of the key concepts and constraints between
features are recorded in constraint tables. In the design
phase, domain specific languages (DSL) and the implementation component
architecture are derived from the domain analysis model. The concrete matrix
computation example involves defining a matrix configuration DSL and a matrix
expression DSL. The implementation architecture is based on the layered GenVoca model,
where the valid combinations of the implementation components are described by
an implementation components configuration language (ICCL). Finally, template metaprogramming
is used to implement a generator component translating matrix descriptions
in the configuration DSL into concrete configurations in the ICCL.
The expression DSL is implemented using expression templates to achieve loop
fusing and eliminating temporaries. The generative matrix component currently
covers 1840 different types of matrices using about 6000 lines of code.
The performance of the generated matrices corresponds to the performance
of hand-optimized matrix variants.