The tensor package has the ads::SquareMatrix
class which, as the name suggests, implements square matrices. Through template specialization, I have implemented optimized versions for 1x1, 2x2 and 3x3 matrices.
Use this package by including the file tensor.h.