Skip to content

Commit

Permalink
fix: Rename ctKeySwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
sp301415 committed Sep 23, 2024
1 parent 7600bc6 commit 9257b27
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions mktfhe/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func (e *Evaluator[T]) BootstrapLUT(ct LWECiphertext[T], lut tfhe.LookUpTable[T]
func (e *Evaluator[T]) BootstrapLUTAssign(ct LWECiphertext[T], lut tfhe.LookUpTable[T], ctOut LWECiphertext[T]) {
switch e.Parameters.BootstrapOrder() {
case tfhe.OrderKeySwitchBlindRotate:
e.KeySwitchForBootstrapAssign(ct, e.buffer.ctKeySwitch)
e.BlindRotateAssign(e.buffer.ctKeySwitch, lut, e.buffer.ctRotate)
e.KeySwitchForBootstrapAssign(ct, e.buffer.ctKeySwitchForBootstrap)
e.BlindRotateAssign(e.buffer.ctKeySwitchForBootstrap, lut, e.buffer.ctRotate)
e.buffer.ctRotate.ToLWECiphertextAssign(0, ctOut)
case tfhe.OrderBlindRotateKeySwitch:
e.BlindRotateAssign(ct, lut, e.buffer.ctRotate)
Expand Down Expand Up @@ -63,8 +63,8 @@ func (e *Evaluator[T]) BootstrapLUTParallel(ct LWECiphertext[T], lut tfhe.LookUp
func (e *Evaluator[T]) BootstrapLUTParallelAssign(ct LWECiphertext[T], lut tfhe.LookUpTable[T], ctOut LWECiphertext[T]) {
switch e.Parameters.BootstrapOrder() {
case tfhe.OrderKeySwitchBlindRotate:
e.KeySwitchForBootstrapAssign(ct, e.buffer.ctKeySwitch)
e.BlindRotateParallelAssign(e.buffer.ctKeySwitch, lut, e.buffer.ctRotate)
e.KeySwitchForBootstrapAssign(ct, e.buffer.ctKeySwitchForBootstrap)
e.BlindRotateParallelAssign(e.buffer.ctKeySwitchForBootstrap, lut, e.buffer.ctRotate)
e.buffer.ctRotate.ToLWECiphertextAssign(0, ctOut)
case tfhe.OrderBlindRotateKeySwitch:
e.BlindRotateParallelAssign(ct, lut, e.buffer.ctRotate)
Expand Down
10 changes: 5 additions & 5 deletions mktfhe/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ type evaluationBuffer[T tfhe.TorusInt] struct {
ctRotate GLWECiphertext[T]
// ctExtract is the extracted LWE ciphertext after Blind Rotation.
ctExtract LWECiphertext[T]
// ctKeySwitch is the LWEDimension sized ciphertext from keyswitching.
ctKeySwitch LWECiphertext[T]
// ctKeySwitchForBootstrap is the LWEDimension sized ciphertext from keyswitching for bootstrapping.
ctKeySwitchForBootstrap LWECiphertext[T]

// lut is an empty lut, used for BlindRotateFunc.
lut tfhe.LookUpTable[T]
Expand Down Expand Up @@ -156,9 +156,9 @@ func newEvaluationBuffer[T tfhe.TorusInt](params Parameters[T]) evaluationBuffer
ctAccs: ctAccs,
ctFourierAccs: ctFourierAccs,

ctRotate: NewGLWECiphertext(params),
ctExtract: NewLWECiphertextCustom[T](params.GLWEDimension()),
ctKeySwitch: NewLWECiphertextCustom[T](params.LWEDimension()),
ctRotate: NewGLWECiphertext(params),
ctExtract: NewLWECiphertextCustom[T](params.GLWEDimension()),
ctKeySwitchForBootstrap: NewLWECiphertextCustom[T](params.LWEDimension()),

lut: tfhe.NewLookUpTable(params.Parameters),
}
Expand Down
4 changes: 2 additions & 2 deletions tfhe/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func (e *Evaluator[T]) BootstrapLUT(ct LWECiphertext[T], lut LookUpTable[T]) LWE
func (e *Evaluator[T]) BootstrapLUTAssign(ct LWECiphertext[T], lut LookUpTable[T], ctOut LWECiphertext[T]) {
switch e.Parameters.bootstrapOrder {
case OrderKeySwitchBlindRotate:
e.KeySwitchForBootstrapAssign(ct, e.buffer.ctKeySwitchBootstrap)
e.BlindRotateAssign(e.buffer.ctKeySwitchBootstrap, lut, e.buffer.ctRotate)
e.KeySwitchForBootstrapAssign(ct, e.buffer.ctKeySwitchForBootstrap)
e.BlindRotateAssign(e.buffer.ctKeySwitchForBootstrap, lut, e.buffer.ctRotate)
e.buffer.ctRotate.ToLWECiphertextAssign(0, ctOut)
case OrderBlindRotateKeySwitch:
e.BlindRotateAssign(ct, lut, e.buffer.ctRotate)
Expand Down
10 changes: 5 additions & 5 deletions tfhe/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ type evaluationBuffer[T TorusInt] struct {
ctRotate GLWECiphertext[T]
// ctExtract is the extracted LWE ciphertext after Blind Rotation.
ctExtract LWECiphertext[T]
// ctKeySwitchBootstrap is the LWEDimension sized ciphertext from keyswitching for bootstrapping.
ctKeySwitchBootstrap LWECiphertext[T]
// ctKeySwitchForBootstrap is the LWEDimension sized ciphertext from keyswitching for bootstrapping.
ctKeySwitchForBootstrap LWECiphertext[T]

// lut is an empty lut, used for BlindRotateFunc.
lut LookUpTable[T]
Expand Down Expand Up @@ -141,9 +141,9 @@ func newEvaluationBuffer[T TorusInt](params Parameters[T]) evaluationBuffer[T] {
ctAccFourierDecomposed: ctAccFourierDecomposed,
fMono: poly.NewFourierPoly(params.polyDegree),

ctRotate: NewGLWECiphertext(params),
ctExtract: NewLWECiphertextCustom[T](params.glweDimension),
ctKeySwitchBootstrap: NewLWECiphertextCustom[T](params.lweDimension),
ctRotate: NewGLWECiphertext(params),
ctExtract: NewLWECiphertextCustom[T](params.glweDimension),
ctKeySwitchForBootstrap: NewLWECiphertextCustom[T](params.lweDimension),

lut: NewLookUpTable(params),
}
Expand Down

0 comments on commit 9257b27

Please sign in to comment.