Support high-precision scale management
Some techniques for managing scale, for example Algorithm 2 of BMPH20 which powers the scale management in Lattigo and is particularly important for their bootsrtapping algorithm, require full precision on the scaling factor being analyzed. In HEIR currently we only support analyzing scaling in the log2 domain.
I ran into this issue when trying to reproduce Lattigo's scale management for a particular lowering of chebyshev polynomial evaluation in https://github.com/google/heir/pull/2338, and also it showed up as a todo in #1640
This issue is to replace the log2-based scaling factors with APInt scaling factors. That will unlock a more precise scale management system for future work.
One thing I've determined, at least, is that we won't be able to reproduce lattigo's chebyshev polynomial evaluation exactly without high-precision scale analysis. This is because it requires setting the scale of plaintexts to quantities involving the particular primes used in the modulus chain (see section 3.2 of https://eprint.iacr.org/2020/1203).