mirror of
https://github.com/tuneinsight/lattigo.git
synced 2025-09-13 03:27:14 +00:00
added bootstrapping example to make test target
This commit is contained in:
25
Makefile
25
Makefile
@@ -26,16 +26,21 @@ test_lint:
|
||||
fi \
|
||||
}
|
||||
|
||||
test_local:
|
||||
go test -v -short -p=1 ./... -timeout=0
|
||||
@echo Running the exemples
|
||||
go run ./examples/bfv/examples_bfv.go > /dev/null
|
||||
go run ./examples/ckks/euler/euler.go > /dev/null
|
||||
go run ./examples/ckks/sigmoid/sigmoid.go > /dev/null
|
||||
go run ./examples/dbfv/pir/pir.go &> /dev/null
|
||||
go run ./examples/dbfv/psi/psi.go &> /dev/null
|
||||
test_examples:
|
||||
@echo Running the examples
|
||||
go run ./examples/bfv > /dev/null
|
||||
go run ./examples/ckks/euler > /dev/null
|
||||
go run ./examples/ckks/sigmoid > /dev/null
|
||||
go run ./examples/dbfv/pir &> /dev/null
|
||||
go run ./examples/dbfv/psi &> /dev/null
|
||||
@echo ok
|
||||
@echo Building resources-heavy examples
|
||||
go build -o /dev/null ./examples/ckks/bootstrapping
|
||||
@echo ok
|
||||
|
||||
test: test_fmt test_local
|
||||
test_gotest:
|
||||
go test -v -short -p=1 ./... -timeout=0
|
||||
|
||||
local: test_fmt test_lint test_local
|
||||
test: test_fmt test_gotest test_examples
|
||||
|
||||
local: test_fmt test_lint test_gotest test_examples
|
||||
|
||||
@@ -349,6 +349,7 @@ var DefaultBootstrappParams = []*BootstrappParams{
|
||||
MaxN1N2Ratio: 16.0,
|
||||
},
|
||||
|
||||
// Set VI
|
||||
{
|
||||
H: 192,
|
||||
SinType: Cos,
|
||||
|
||||
@@ -35,8 +35,8 @@ func main() {
|
||||
// LogSlots is hardcoded to 15 in the parameters, but can be changed from 1 to 15.
|
||||
// When changing logSlots make sure that the number of levels allocated to CtS and StC is
|
||||
// smaller or equal to logSlots.
|
||||
params := ckks.DefaultBootstrappSchemeParams[4]
|
||||
btpParams := ckks.DefaultBootstrappParams[4]
|
||||
params := ckks.DefaultBootstrappSchemeParams[5]
|
||||
btpParams := ckks.DefaultBootstrappParams[5]
|
||||
|
||||
fmt.Println()
|
||||
fmt.Printf("CKKS parameters : logN = %d, logSlots = %d, h = %d, logQP = %d, levels = %d, scale= 2^%f, sigma = %f \n", params.LogN(), params.LogSlots(), btpParams.H, params.LogQP(), params.Levels(), math.Log2(params.Scale()), params.Sigma())
|
||||
@@ -50,9 +50,6 @@ func main() {
|
||||
decryptor = ckks.NewDecryptor(params, sk)
|
||||
encryptor = ckks.NewEncryptorFromPk(params, pk)
|
||||
|
||||
// Bootstrapp context (generates public evaluation keys and relevant parameters)
|
||||
// TODO : seperate the key-generation from the rest, since those evaluation keys only need to be generated once.
|
||||
// Make it so they can be given as input to the bootstrapp.
|
||||
fmt.Println()
|
||||
fmt.Println("Generating bootstrappign keys...")
|
||||
btpKey := kgen.GenBootstrappingKey(params.LogSlots(), btpParams, sk)
|
||||
@@ -1,102 +0,0 @@
|
||||
=========================================
|
||||
INSTANTIATING SCHEME
|
||||
=========================================
|
||||
|
||||
Done in 95.2339ms
|
||||
|
||||
CKKS parameters : logN = 14, logSlots = 13, logQP = 426, levels = 8, scale= 1099511627776.000000, sigma = 3.200000
|
||||
|
||||
=========================================
|
||||
PLAINTEXT CREATION
|
||||
=========================================
|
||||
|
||||
Done in 5.9478ms
|
||||
|
||||
=========================================
|
||||
ENCRYPTION
|
||||
=========================================
|
||||
|
||||
Done in 22.9943ms
|
||||
|
||||
ValuesTest : (6.2831844188+0.0000028379i) (6.2831853232+0.0000001035i) (6.2831849281+0.0000004304i) (6.2831853058+0.0000000013i)...
|
||||
ValuesWant : (6.2831853072+0.0000000000i) (6.2831853072+0.0000000000i) (6.2831853072+0.0000000000i) (6.2831853072+0.0000000000i)...
|
||||
|
||||
Minimum precision : (19.56, 18.43) bits
|
||||
Maximum precision : (37.69, 36.72) bits
|
||||
Mean precision : (25.03, 24.99) bits
|
||||
Median precision : (25.58, 25.58) bits
|
||||
|
||||
|
||||
===============================================
|
||||
EVALUATION OF i*x on 8192 values
|
||||
===============================================
|
||||
|
||||
Done in 1.8163ms
|
||||
|
||||
ValuesTest : (0.0000028379+6.2831844188i) (0.0000001035+6.2831853232i) (0.0000004304+6.2831849281i) (0.0000000013+6.2831853058i)...
|
||||
ValuesWant : (0.0000000000+6.2831853072i) (0.0000000000+6.2831853072i) (0.0000000000+6.2831853072i) (0.0000000000+6.2831853072i)...
|
||||
|
||||
Minimum precision : (18.43, 19.56) bits
|
||||
Maximum precision : (36.72, 37.69) bits
|
||||
Mean precision : (24.99, 25.03) bits
|
||||
Median precision : (25.58, 25.58) bits
|
||||
|
||||
|
||||
===============================================
|
||||
EVALUATION of x/r on 8192 values
|
||||
===============================================
|
||||
|
||||
Done in 0s
|
||||
|
||||
ValuesTest : (0.0000001774+0.3926990262i) (0.0000000065+0.3926990827i) (0.0000000269+0.3926990580i) (0.0000000001+0.3926990816i)...
|
||||
ValuesWant : (0.0000000000+0.3926990817i) (0.0000000000+0.3926990817i) (0.0000000000+0.3926990817i) (0.0000000000+0.3926990817i)...
|
||||
|
||||
Minimum precision : (22.43, 23.56) bits
|
||||
Maximum precision : (40.72, 41.69) bits
|
||||
Mean precision : (28.99, 29.03) bits
|
||||
Median precision : (29.58, 29.58) bits
|
||||
|
||||
|
||||
===============================================
|
||||
EVALUATION of e^x on 8192 values
|
||||
===============================================
|
||||
|
||||
Done in 241.1064ms
|
||||
|
||||
ValuesTest : (0.9238793769+0.3826833131i) (0.9238795117+0.3826834299i) (0.9238795087+0.3826834015i) (0.9238795172+0.3826834281i)...
|
||||
ValuesWant : (0.9238795325+0.3826834324i) (0.9238795325+0.3826834324i) (0.9238795325+0.3826834324i) (0.9238795325+0.3826834324i)...
|
||||
|
||||
Minimum precision : (22.62, 23.00) bits
|
||||
Maximum precision : (34.60, 40.35) bits
|
||||
Mean precision : (26.09, 28.17) bits
|
||||
Median precision : (26.09, 28.70) bits
|
||||
|
||||
|
||||
===============================================
|
||||
EVALUATION of x^r on 8192 values
|
||||
===============================================
|
||||
|
||||
Done in 84.5117ms
|
||||
|
||||
ValuesTest : (0.9999969632-0.0000008293i) (0.9999996766+0.0000000916i) (0.9999994651-0.0000003385i) (0.9999997437+0.0000000265i)...
|
||||
ValuesWant : (1.0000000000+0.0000000000i) (1.0000000000+0.0000000000i) (1.0000000000+0.0000000000i) (1.0000000000+0.0000000000i)...
|
||||
|
||||
Minimum precision : (18.33, 19.70) bits
|
||||
Maximum precision : (31.94, 33.24) bits
|
||||
Mean precision : (22.17, 23.40) bits
|
||||
Median precision : (22.18, 23.58) bits
|
||||
|
||||
|
||||
=========================================
|
||||
DECRYPTION & DECODING
|
||||
=========================================
|
||||
|
||||
Done in 24.0009ms
|
||||
|
||||
ValuesTest : (0.9999969632-0.0000008293i) (0.9999996766+0.0000000916i) (0.9999994651-0.0000003385i) (0.9999997437+0.0000000265i)...
|
||||
ValuesWant : (1.0000000000+0.0000000000i) (1.0000000000+0.0000000000i) (1.0000000000+0.0000000000i) (1.0000000000+0.0000000000i)...
|
||||
|
||||
Minimum precision : (18.33, 19.70) bits
|
||||
Maximum precision : (31.94, 33.24) bits
|
||||
Mean precision : (22.17, 23.40) bits
|
||||
Median precision : (22.18, 23.58) bits
|
||||
Reference in New Issue
Block a user