add c-wrapper for distributed_matrix::generate to take function pointer