Skip to main content

The Reference

This is a reference on the construction of correct, fast numerical and generic software in modern C++. Its subject is the passage from a mathematical statement to a program whose cost is understood and whose behaviour on real hardware has been measured.

Scope​

Three bodies of material are treated as one subject rather than three.

The first is the mathematics: algebraic structures, vector spaces, analytic notions of approximation and error, and the numerical methods built on them. This material fixes what a computation is supposed to produce and under what hypotheses.

The second is the language. C++ is treated here as a notation for stating abstractions with their admissible domains attached: templates parameterised over types, concepts constraining those parameters, and a translation-time sublanguage in which substantial computation can be performed before the program runs.

The third is the machine. Asymptotic complexity is necessary and insufficient. A dense matrix product and a sparse triangular solve of comparable operation count differ by an order of magnitude in achieved throughput, and the difference is explained by memory traffic, vector width and dependence structure, not by operation counts.

An entry belongs in this reference when all three can be joined: when a structure can be stated, encoded as a constrained interface, implemented generically, costed, mapped onto hardware, and measured.

The derivation​

  1. AbstractionThe object under study and the structure it carries.
  2. SpecificationOperations, laws, and the domain on which they hold.
  3. Type / conceptThat specification encoded as a C++ constrained interface.
  4. ImplementationAn algorithm written against the concept rather than a type.
  5. ComplexityOperation count and working set under a declared cost model.
  6. Hardware mappingLayout, locality, vector width, parallel decomposition.
  7. MeasurementTimings with machine, compiler, flags and method reported.

The sequence is not a formality. Each step constrains the next, and a failure at any step is informative: a structure that resists formal statement usually resists a stable interface; a concept that cannot be satisfied by two genuinely different types is a type in disguise; an implementation whose measured throughput is far from its cost model has an unmodelled bottleneck that the model should be extended to include.

Organisation​

The reference is divided into five parts and two collections of supporting material.

PartSubject
Modern C++Templates, concepts, constraints, metaprogramming, translation-time computation
MathematicsAlgebraic, linear-algebraic, analytic and probabilistic structure
High PerformanceCost models, memory hierarchy, layout, vectorization, parallelism
Scientific ComputingFactorizations, sparse structure, quadrature, evolution equations, differentiation
Formal C++Types as abstractions, concepts as predicates, semantic obligation, correctness
ExamplesComplete derivations from statement to measurement
BenchmarksMethod, hardware, and results

Language revisions are not part of this structure. C++20, C++23 and C++26 appear as compatibility metadata on the entries they affect, in the form used at the head of every entry that has revision-dependent behaviour:

Language revisions

C++20
Concepts, constrained templates, and the requires-expression are introduced.
C++23
Deducing this, static operator(), and a substantially larger constexpr subset.P0847R7
C++26
Static reflection and expansion statements alter how generic code is generated.P2996

This keeps entries stable as the language evolves. A revision adds a row; it does not reorganise the reference.

Reading order​

The reference is written to be entered at any point, but three paths through it are coherent.

For a reader interested primarily in generic programming, the order is Types as Abstractions, Generic Programming, Concepts, Constraints, Concepts as Predicates, Semantic Requirements.

For a reader interested in numerical work, the order is Algebra, Linear Algebra, Numerical Analysis, Numerical Linear Algebra, Sparse Computation.

For a reader interested in performance, the order is Computational Complexity, Memory, Cache Locality, Data Layout, SIMD, Parallelism.

Conventions​

Notation, code style, cost models and measurement practice are stated once in Conventions and assumed throughout. Production details are recorded in the colophon.