mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-10 04:35:03 -05:00
feat(cpp_interface): add Options struct
This commit is contained in:
@@ -17,10 +17,17 @@ const double PRECISION_16B = 16;
|
||||
const double WOP_FALLBACK_LOG_NORM = 8;
|
||||
const double NOISE_DEVIATION_COEFF = 1.0;
|
||||
|
||||
concrete_optimizer::Options default_options() {
|
||||
concrete_optimizer::Options options;
|
||||
options.security_level = SECURITY_128B;
|
||||
options.maximum_acceptable_error_probability = P_ERROR;
|
||||
return options;
|
||||
}
|
||||
|
||||
void test_v0() {
|
||||
concrete_optimizer::v0::Solution solution =
|
||||
concrete_optimizer::v0::optimize_bootstrap(
|
||||
PRECISION_1B, SECURITY_128B, NOISE_DEVIATION_COEFF, P_ERROR);
|
||||
PRECISION_1B, NOISE_DEVIATION_COEFF, default_options());
|
||||
|
||||
assert(solution.glwe_polynomial_size == 1024);
|
||||
}
|
||||
@@ -43,7 +50,7 @@ void test_dag_no_lut() {
|
||||
concrete_optimizer::dag::OperatorIndex node2 =
|
||||
dag->add_dot(slice(inputs), std::move(weights));
|
||||
|
||||
auto solution = dag->optimize_v0(SECURITY_128B, P_ERROR);
|
||||
auto solution = dag->optimize_v0(default_options());
|
||||
assert(solution.glwe_polynomial_size == 1024);
|
||||
}
|
||||
|
||||
@@ -59,7 +66,7 @@ void test_dag_lut() {
|
||||
concrete_optimizer::dag::OperatorIndex node2 =
|
||||
dag->add_lut(input, slice(table), PRECISION_8B);
|
||||
|
||||
auto solution = dag->optimize(SECURITY_128B, P_ERROR, WOP_FALLBACK_LOG_NORM);
|
||||
auto solution = dag->optimize(default_options());
|
||||
assert(solution.glwe_dimension == 1);
|
||||
assert(solution.glwe_polynomial_size == 8192);
|
||||
assert(!solution.use_wop_pbs);
|
||||
@@ -77,7 +84,7 @@ void test_dag_lut_wop() {
|
||||
concrete_optimizer::dag::OperatorIndex node2 =
|
||||
dag->add_lut(input, slice(table), PRECISION_16B);
|
||||
|
||||
auto solution = dag->optimize(SECURITY_128B, P_ERROR, WOP_FALLBACK_LOG_NORM);
|
||||
auto solution = dag->optimize(default_options());
|
||||
assert(solution.glwe_dimension == 2);
|
||||
assert(solution.glwe_polynomial_size == 1024);
|
||||
assert(solution.use_wop_pbs);
|
||||
|
||||
Reference in New Issue
Block a user