Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Nguyễn-Stehlé in the accurate table generation #4062

Merged
merged 3 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion functions/accurate_table_generator_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ absl::StatusOr<cpp_rational> StehléZimmermannSimultaneousSearch(
// The lattice really has integer coefficients, but this is inconvenient to
// propagate through the matrix algorithms. (It would require copies instead
// of views for all the types, not just the ones we use here.)
Lattice const V = ToInt(LenstraLenstraLovász(ToRational(L)));
Lattice const V = NguyễnStehlé(L);
VLOG(2) << "V = " << V;

// Step 8: find the three shortest vectors of the reduced lattice. We sort
Expand Down
20 changes: 12 additions & 8 deletions functions/accurate_table_generator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,17 +457,21 @@ TEST_F(AccurateTableGeneratorTest, DISABLED_SECULAR_SinCos18) {
-cpp_rational(Cos(x₀) / 2)},
x₀);

// The remainders don't need to be extremely precise, so for speed
// they are computed using double.
auto const remainder_sin_taylor2 =
[x₀ = cpp_rational(x₀)](cpp_rational const& x) {
auto const Δx = x - x₀;
auto const Δx³ = static_cast<cpp_bin_float_50>(Δx * Δx * Δx);
return -Δx³ * -Cos(std::min(x, x₀)) / Factorial(3);
[x₀ = static_cast<double>(cpp_rational(x₀))](
cpp_rational const& x) {
auto const Δx = static_cast<double>(x) - x₀;
auto const Δx³ = Δx * Δx * Δx;
return -Δx³ * -std::cos(std::min(x₀ + Δx, x₀)) / Factorial(3);
};
auto const remainder_cos_taylor2 =
[x₀ = cpp_rational(x₀)](cpp_rational const& x) {
auto const Δx = x - x₀;
auto const Δx³ = static_cast<cpp_bin_float_50>(Δx * Δx * Δx);
return Δx³ * Sin(std::max(x, x₀)) / Factorial(3);
[x₀ = static_cast<double>(cpp_rational(x₀))](
cpp_rational const& x) {
auto const Δx = static_cast<double>(x) - x₀;
auto const Δx³ = Δx * Δx * Δx;
return Δx³ * std::sin(std::max(x₀ + Δx, x₀)) / Factorial(3);
};

starting_arguments.push_back(x₀);
Expand Down
Loading