first run on matrix function