Taking Static Type-Safety to the Next Level - Physical Units for Matrices - Daniel Withopf CppCon 22

Discover how to take your linear algebra library to the next level with a fully type-safe matrix design that introduces physical units for vectors and matrices, ensuring accurate and consistent calculations.

Key takeaways
  • Fully type-safe matrix design for physical units in vectors and matrices
  • Introduce physical units for matrices and vectors, not just valid values
  • Overcome the limitations of classical linear algebra libraries by introducing named index tracks and enforce units consistency
  • Introduce a generic matrix type that can handle both types of matrices and enforce units consistency
  • Allow for non-uniform units in vectors and matrices and automatically infer the units from the indices
  • Provide a library that checks for invalid operations at compile-time and prevents out-of-bounds access
  • Introduce a static assertion system that alerts the user when an operation is invalid or mathematically incorrect
  • Introduce a taxonomy of physical units for vectors and matrices, including energy, entropy, temperature, etc.
  • Allow for the creation of vectors and matrices with named index tracks, which can identify the physical units of the entries
  • Allow for the annotation of the physical units in the elements of vectors and matrices
  • Introduce a new type-safe matrix and vector design that can handle complex operations
  • Allow for the creation of vectors and matrices with explicit physical units and units inference