Finally managed to write a generic templates cov() function. Struggled a lot with convering templated expressions and blocks to/from Matrix/Array objects. Found this solution online…