Skip to content

Bug: homomorphic DFT correctness error when decomposition level has multiple matrices for a single prime #561

@Pro7ech

Description

@Pro7ech

This bug is at the origin of #560

Cause

func (eval *Evaluator) dft(ctIn *rlwe.Ciphertext, matrices []ltcommon.LinearTransformation, opOut *rlwe.Ciphertext) (err error) {

// dft evaluates a series of [lintrans.LinearTransformation] sequentially on the ctIn and stores the result in opOut.
func (eval *Evaluator) dft(ctIn *rlwe.Ciphertext, matrices []ltcommon.LinearTransformation, opOut *rlwe.Ciphertext) (err error) {

	inputLogSlots := ctIn.LogDimensions

	// Sequentially multiplies w with the provided dft matrices.
	if err = eval.LTEvaluator.EvaluateSequential(ctIn, matrices, opOut); err != nil {
		return
	}

	// Encoding matrices are a special case of `fractal` linear transform
	// that doesn't change the underlying plaintext polynomial Y = X^{N/n}
	// of the input ciphertext.
	opOut.LogDimensions = inputLogSlots

	return
}

Does not take into account that multiples matrices can be evaluated for a single prime.

Fix

Algorithm shouldn't call EvaluateSequential, but sequentially evaluate each matrice and only rescale after all the matrices of a same level have been evaluated (this can be derived from the Level field of MatrixLiteral).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions