Improve merging of terms
Improve merging of terms

Previously, merging of term is based on the `get_amp_factors` method of
terms.  However, here the desired semantics might deviate a lot from
that method, which is more designed for purpose of canonicalization.
For instance, all factors with dummies are considered special, which
does not make much sense in merging.

As a result, the invocation is replaced by in-house implementation in
the core function.  Although this does introduce a bit code repetition,
it can be helpful for the ease of later improvement of merge semantics.

tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge