Skip to content

Commit

Permalink
Fixed problem with glibc using an inaccurate implementation of
Browse files Browse the repository at this point in the history
std::pow<complex> for computing powers of primitive root in ckks.cpp.
  • Loading branch information
kimlaine committed Aug 14, 2019
1 parent e1c63a8 commit bdad6ab
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions native/src/seal/ckks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ namespace seal

roots_ = allocate<complex<double>>(coeff_count, pool_);
inv_roots_ = allocate<complex<double>>(coeff_count, pool_);
complex<double> psi{ cos((2 * PI_) / static_cast<double>(m)),
sin((2 * PI_) / static_cast<double>(m)) };
double psi_arg = 2 * PI_ / static_cast<double>(m);
for (size_t i = 0; i < coeff_count; i++)
{
roots_[i] = pow(psi, static_cast<double>(reverse_bits(i, logn)));
roots_[i] = polar<double>(1.0, psi_arg * static_cast<double>(reverse_bits(i, logn)));
inv_roots_[i] = 1.0 / roots_[i];
}
}
Expand Down

0 comments on commit bdad6ab

Please sign in to comment.