matrix.fun function

Evaluate a matrix function