A computable error bound for matrix functionals