Skip to content

Use SwitchModulus for ScaleAndRoundPOverQ#993

Merged
yspolyakov merged 1 commit intodevfrom
fix-scale-p-over-q
Jun 2, 2025
Merged

Use SwitchModulus for ScaleAndRoundPOverQ#993
yspolyakov merged 1 commit intodevfrom
fix-scale-p-over-q

Conversation

@ZenithalHourlyRate
Copy link
Collaborator

Fixes #992

With changes to bfv-mult-bug.cpp using EXTENDED encryption mode, we can observe the following trace before and after this commit

Before this commit

$ ./bin/extras/pke/bfv-mult-bug
Plaintext #1: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ... )
Plaintext #2: (3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, ... )

Results of homomorphic computations
#1:      (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ... )
#1 * #2: (3, 4, 3, 16, 25, 36, 49, 64, 81, 100, 121, 144, ... )
logQ: 2220
noise: 69.265
logQ: 2220
noise: 5.70044

After

$ ./bin/extras/pke/bfv-mult-bug
Plaintext #1: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ... )
Plaintext #2: (3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, ... )

Results of homomorphic computations
#1:      (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ... )
#1 * #2: (3, 4, 3, 16, 25, 36, 49, 64, 81, 100, 121, 144, ... )
logQ: 2220
noise: 69.4396
logQ: 2220
noise: 4.58496

Note that the noise in the last line is one bit smaller, as expected.

@yspolyakov yspolyakov added this to the Release 1.3.1 milestone Jun 2, 2025
@yspolyakov yspolyakov requested a review from dsuponitskiy June 2, 2025 14:31
Signed-off-by: Hongren Zheng <i@zenithal.me>
@yspolyakov yspolyakov added the bug Something isn't working label Jun 2, 2025
@yspolyakov yspolyakov linked an issue Jun 2, 2025 that may be closed by this pull request
@yspolyakov yspolyakov merged commit 68b5b60 into dev Jun 2, 2025
10 of 11 checks passed
@ZenithalHourlyRate ZenithalHourlyRate deleted the fix-scale-p-over-q branch June 3, 2025 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix a bug in ScaleAndRoundPOverQ

4 participants