AMen+Krylov method for matrix functions