Algorithm for checking the triviality of mixed ideals