Design Notes

There is no ‘one size fits all’ solution when it comes to math libraries. The CML is simply intended to serve as an additional alternative for developers in need of a math library, while perhaps offering a few features not found elsewhere.

Following are a few notes regarding design decisions made in the development of the CML.


The CML is written in C++. If the library proves to be useful to developers, ports to other languages may be possible in the future.

Template-based architecture

The CML was intended to be generic and highly customizable, and makes extensive use of templates and template metaprogramming.

In most cases, the details are hidden from the user. The CML supplies typedef‘s for the most common configurations of the vector, matrix, and quaternion classes, so direct interaction with the template syntax is not required unless additional customization is needed.

The CML should compile on any reasonably up-to-date compiler (see the compiler notes page for a list of systems on which it’s been tested).

Platform-specific optimizations

The CML is intended to be cross-platform and portable, and as such incorporates no platform-specific or assembly-level optimizations.

Vector and matrix operations are implemented using expression templates, and our tests have shown performance to be comparable to hand-written C code when the library is compiled with the highest optimization levels. At lower optimization levels, performance may or may not match the equivalent non-templated code.

We are aware that for some users, assembly-level optimization is a must. If the CML generates sufficient interest, it may be possible to develop implementations optimized for specific platforms in the future.