Taking Static Type-Safety to the Next Level - Physical Units for Matrices
summary
Provides a concrete C++ library design that attaches a named index and per-entry physical-unit annotation to Eigen-style matrices so each element’s unit and coordinate frame are in the type system, enforces row/column exponents for jacobians/covariances, and rejects invalid additions/multiplications at compile time. Uses lvalue/rvalue-qualified overloads to prevent dangling-expression bugs, forwards runtime math to Eigen/Blaze, and supports mp-units/Boost bindings. Measured costs: ~20–30% more compile time, about 1–2% runtime overhead.
AI-written summary · about
chapters (24)
- 0:00Introduction and goals
- 2:01Physical units in C++
- 4:04Combining units and matrices
- 7:30Matrix unit structure
- 9:01Linear algebra challenges
- 11:18Library wishlist
- 12:44Named index design
- 15:07Type safe matrix class
- 17:28Element access and assignment
- 20:51Complex matrix construction
- 23:02Determining unit of entries
- 25:54Matrix type taxonomy
- 27:17Operations and safety checks
- 29:55Multi-matrix multiplication
- 32:05Implementation details
- 36:10C++20 concepts
- 37:40Comparing approaches
- 39:06Preventing invalid operations
- 42:56Coordinate frame transformations
- 44:50Velocity and frame safety
- 46:56Preventing C++ specific bugs
- 51:26Overloading for safety
- 55:33Summary and conclusions
- 57:46Q&A and closing
related talks
55mTaking Static Type-safety to the Next Level: Physical Units for Matrices
01h 31mImplementing Physical Units Library for C++
01h 30mEnhancing Safety in C++ Code With Modern C++ Quantities and Units Library
01h 08mA Physical Units Library For the Next C++
01h 00mIntroducing a matrix class to the C++ standard library
51mThe C++ Type System is your Friend
01h 02mA Physical Units Library For C++
01h 03mHow to Improve the Safety of C++ Code With a Quantities & Units Library
