From acd5b3fe01a1554b4a5d0597c8e317d1f38db5f2 Mon Sep 17 00:00:00 2001 From: pleroy Date: Sat, 10 Aug 2024 11:50:50 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Use=20Nguy=E1=BB=85n-Stehle=CC=81=20in=20th?= =?UTF-8?q?e=20accurate=20table=20generation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/accurate_table_generator_body.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/accurate_table_generator_body.hpp b/functions/accurate_table_generator_body.hpp index c5b03c6c56..d4144cebfc 100644 --- a/functions/accurate_table_generator_body.hpp +++ b/functions/accurate_table_generator_body.hpp @@ -278,7 +278,7 @@ absl::StatusOr 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 From 3347d5683117e8b52cf40439528ecff7438a63b1 Mon Sep 17 00:00:00 2001 From: pleroy Date: Sat, 10 Aug 2024 12:16:25 +0200 Subject: [PATCH 2/3] Optimize the remainders. --- functions/accurate_table_generator_test.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/functions/accurate_table_generator_test.cpp b/functions/accurate_table_generator_test.cpp index d387ecd9b5..bbd7b82aae 100644 --- a/functions/accurate_table_generator_test.cpp +++ b/functions/accurate_table_generator_test.cpp @@ -457,17 +457,21 @@ TEST_F(AccurateTableGeneratorTest, DISABLED_SECULAR_SinCos18) { -cpp_rational(Cos(x₀) / 2)}, x₀); + // The remainder 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(Δx * Δx * Δx); - return -Δx³ * -Cos(std::min(x, x₀)) / Factorial(3); + [x₀ = static_cast(cpp_rational(x₀))]( + cpp_rational const& x) { + auto const Δx = static_cast(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(Δx * Δx * Δx); - return Δx³ * Sin(std::max(x, x₀)) / Factorial(3); + [x₀ = static_cast(cpp_rational(x₀))]( + cpp_rational const& x) { + auto const Δx = static_cast(x) - x₀; + auto const Δx³ = Δx * Δx * Δx; + return Δx³ * std::sin(std::max(x₀ + Δx, x₀)) / Factorial(3); }; starting_arguments.push_back(x₀); From babf2cc204e3c399b98688a1afa3919ce5957b9e Mon Sep 17 00:00:00 2001 From: pleroy Date: Sat, 10 Aug 2024 12:19:06 +0200 Subject: [PATCH 3/3] Typo. --- functions/accurate_table_generator_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/accurate_table_generator_test.cpp b/functions/accurate_table_generator_test.cpp index bbd7b82aae..5b9d2e4fc3 100644 --- a/functions/accurate_table_generator_test.cpp +++ b/functions/accurate_table_generator_test.cpp @@ -457,8 +457,8 @@ TEST_F(AccurateTableGeneratorTest, DISABLED_SECULAR_SinCos18) { -cpp_rational(Cos(x₀) / 2)}, x₀); - // The remainder don't need to be extremely precise, so for speed they - // are computed using double. + // The remainders don't need to be extremely precise, so for speed + // they are computed using double. auto const remainder_sin_taylor2 = [x₀ = static_cast(cpp_rational(x₀))]( cpp_rational const& x) {