What is difference between `mathlib` and `matrix` libraries

I’m looking into the options for writing modules that need math/matrix operations. Part of the PX4 Firmware are both:

  1. src/lib/matrix
  2. src/lib/mathlib

Looking at the ekf2 or attitude_estimator_q, it looks like mathlib is being used.

Is there a difference between matrix and mathlib? Is one a superset of the other? If you have thoughts on which is better to use I’d appreciate knowing them.

Thank you in advance.

Matrix is a new standalone template based library. https://github.com/PX4/matrix

Thank you @dagar. So to confirm:

  1. mathlib evolved first, and then the matrix component was stripped out into as a separate standalone matrix library
  2. For PX4 modules development mathlib is probably the way to go

Does that sound right?

I believe the plan is to gradually replace the portions of mathlib with what’s available in matrix.
Matrix is widely used across the codebase.