You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's unclear which way to associate product rings for optimal efficiency without inspecting our code. This makes it difficult for users to write the best code. Is there some way we can improve this situation?
For example, if I do a keySwitch where zq ~ b and zq' ~ (a,b), we end up calling the optimized Cyc.RescaleCyc instance. However, if I choose zq' ~ (b,a), I end up with the generic, less efficient Cyc.RescaleCyc instance. One way to resolve this particular idiosyncrasy is to add a third Cyc.RescaleCyc instance for (a,b) to a.
However, another overlapping instance only compounds this problem: The overlapping RescaleCyc instances means that some valid rescales are not allowed. Take for example, rescaling from three moduli to one like this: ((a,b), c) -> c. This matches the instance head for the optimized instance, but not the instance constraints, since we don't have, e.g. Unbox (LiftOf (a,b)) ~ Unbox Integer. Thus the compiler throws an error. If we instead remove the optimized instance altogether, the compiler picks the generic instance and accepts the code, since the generic instance doesn't require Unbox Integer.
The text was updated successfully, but these errors were encountered:
Currently it's unclear which way to associate product rings for optimal efficiency without inspecting our code. This makes it difficult for users to write the best code. Is there some way we can improve this situation?
For example, if I do a keySwitch where
zq ~ b
andzq' ~ (a,b)
, we end up calling the optimizedCyc.RescaleCyc
instance. However, if I choosezq' ~ (b,a)
, I end up with the generic, less efficientCyc.RescaleCyc
instance. One way to resolve this particular idiosyncrasy is to add a thirdCyc.RescaleCyc
instance for(a,b)
toa
.However, another overlapping instance only compounds this problem: The overlapping
RescaleCyc
instances means that some valid rescales are not allowed. Take for example, rescaling from three moduli to one like this:((a,b), c) -> c
. This matches the instance head for the optimized instance, but not the instance constraints, since we don't have, e.g.Unbox (LiftOf (a,b)) ~ Unbox Integer
. Thus the compiler throws an error. If we instead remove the optimized instance altogether, the compiler picks the generic instance and accepts the code, since the generic instance doesn't requireUnbox Integer
.The text was updated successfully, but these errors were encountered: