Allow scalar or list context for ratio_factorize().