Skip to content

Commit

Permalink
correctly set scale of bgv plaintext after binary operation
Browse files Browse the repository at this point in the history
  • Loading branch information
qantik committed Jun 5, 2024
1 parent 2a58dd8 commit 2fa2bac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions schemes/bgv/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ func (eval Evaluator) evaluateInPlace(level int, el0 *rlwe.Ciphertext, el1 *rlwe
evaluate(el0.Value[i], el1.Value[i], elOut.Value[i])
}

elOut.Scale = el0.Scale.Max(el1.Scale)

// If the inputs degrees differ, it copies the remaining degree on the receiver.
if largest != nil && largest != elOut.El() { // checks to avoid unnecessary work.
for i := smallest.Degree() + 1; i < largest.Degree()+1; i++ {
Expand Down

0 comments on commit 2fa2bac

Please sign in to comment.