fixed density computation and removed temporary test

This commit is contained in:
Christian Mouchet
2023-06-15 14:20:34 +02:00
parent aff591c3a8
commit 7ab1ef7904
2 changed files with 1 additions and 28 deletions

View File

@@ -380,7 +380,7 @@ func (p Parameters) XsHammingWeight() int {
if xs.H != 0 {
return xs.H
} else {
return int(math.Ceil(float64(p.N()) * (1 - xs.P)))
return int(math.Ceil(float64(p.N()) * xs.P))
}
case ring.DiscreteGaussian:
return int(math.Ceil(float64(p.N()) * float64(xs.Sigma) * math.Sqrt(2.0/math.Pi)))

View File

@@ -35,33 +35,6 @@ type DumDum struct {
B float64
}
func TestParameters(t *testing.T) {
b, err := json.Marshal(ParametersLiteral{
LogN: 10,
LogQ: []int{30, 40, 60},
LogP: []int{30},
Xe: ring.DiscreteGaussian{Sigma: 3.14, Bound: 12},
Xs: ring.Ternary{H: 128},
})
fmt.Println(string(b))
fmt.Println(err)
var p ParametersLiteral
err = json.Unmarshal(b, &p)
fmt.Println(p)
fmt.Println(err)
s, err := json.Marshal(p)
fmt.Println(string(s))
fmt.Println(err)
params, err := NewParametersFromLiteral(p)
fmt.Println(err)
fmt.Println(LatticeEstimatorSageMathCell(params))
}
func TestRLWE(t *testing.T) {
var err error