Thank you for the reply.
That is exactly what I’m talking about. But your code in OpenFHE seems to be the opposite, that is computing
Sum{(Q_hat_inverse)DigitDecompose(c2), KeySwitchKey[(Q_hat)Ps2]}
See openfhe-development/keyswitch-hybrid.cpp at 122f470e0dbf94688051ab852131ccc5d26be934 · openfheorg/openfhe-development · GitHub for Key-Switch Keys generation with multiplication by PartQHatModq
And openfhe-development/keyswitch-hybrid.cpp at 122f470e0dbf94688051ab852131ccc5d26be934 · openfheorg/openfhe-development · GitHub for digit extraction in OpenFHE. It seems that the multiplication by QHatInvModq is executed when every digit is extracted from c2.