Template functions for MNEMath