Skip to content

Commit

Permalink
repo-sync-2025-01-14T19:22:17+0800
Browse files Browse the repository at this point in the history
  • Loading branch information
huocun-ant committed Jan 14, 2025
1 parent 049d079 commit e306ac9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions psi/algorithm/spiral/spiral_pir_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TEST_P(SpiralPirTest, Works) {
SPDLOG_INFO("GenRandomDatabase, time cost: {} ms", timer.CountMs());

// get a SpiralParams
auto spiral_params = util::GetPerformanceImproveParam();
auto spiral_params = util::GetDefaultParam();
spiral_params.UpdateByDatabaseInfo(database_info);

SPDLOG_INFO("MaxByteLenofPt: {}, MaxBitLenOfPt: {}",
Expand Down Expand Up @@ -173,4 +173,4 @@ INSTANTIATE_TEST_SUITE_P(Works_Instances, SpiralPirTest,
TestParams{10000, 8193, true},
TestParams{1000, 8192 * 10, true}));

} // namespace psi::spiral
} // namespace psi::spiral
13 changes: 13 additions & 0 deletions psi/algorithm/spiral/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ Params GetPerformanceImproveParam() {
std::move(poly_matrix_params), std::move(query_params));
}

Params GetDefaultParam() {
std::size_t poly_len{2048};
std::vector<std::uint64_t> moduli{268369921, 249561089};

double noise_width{6.4};

PolyMatrixParams poly_matrix_params(2, 256, 21, 4, 8, 8, 6);
QueryParams query_params(9, 6, 1);

return Params(poly_len, std::move(moduli), noise_width,
std::move(poly_matrix_params), std::move(query_params));
}

Params GetFastExpansionTestingParam() {
std::size_t poly_len{2048};
std::vector<std::uint64_t> moduli{268369921, 249561089};
Expand Down
3 changes: 3 additions & 0 deletions psi/algorithm/spiral/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ Params GetFastExpansionTestingParam();

Params GetTestParam();

// this params has the best performance, but has smallest noise budget
Params GetPerformanceImproveParam();

Params GetDefaultParam();

Params GetLargerParam();

// calc multi-dimension position in 1-deimension's position
Expand Down

0 comments on commit e306ac9

Please sign in to comment.