find weight enumerator polynomial given a generator matrix