The Mat class template is used for small vectors and matricies. It is just a wrapper class for an actual storage, for calculations the armadillo library is used, in combination with inlining and expression templates all auxiliary constructors and data copy are usually optimized out leaving just optimal code for the desired calculation.
When deducing template parameters for the function templates the compiler consider only exact type match with possible const conversion and conversion to the parent. In particular implicit conversions are not considered. This makes transition between Armor and armadillo a bit complicated. In order to make everythink as smooth as possible we use several tricks: 1) defining a friend function inside of the class template creates an explicit function instance. As the instance is already created the implicit conversion is considered. See: https://stackoverflow.com/questions/9787593/implicit-type-conversion-with-template At least with GCC it seems, that this approach works for operators. Argument dependent lookup (ADL) finds the operator or function if at least one of its parameters is Mat template. However for operators the implicit conversion of the other argument is applied, while for the function it is not.
2) In order to consturct Mat<Type, nr, 1> and Mat<Type, 1, 1> also from arma::Col and from the Type variable, we use specialization that is derived from the generic case with nr>1, nc>1.
3) In order to prevent ambiguous method resolution, we can have just single TODO: try to transpose storage format used in Armor (prefered row first) and Armadillo (column first).