move matrix_powers to optical flow package