Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cb74501a322d
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8e78f5119d6c
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Dec 5, 2020

  1. Termination check.

    pleroy committed Dec 5, 2020
    Copy the full SHA
    6e1b3d1 View commit details

Commits on Dec 6, 2020

  1. Merge pull request #2812 from pleroy/Termination

    Termination check in frequency analysis
    pleroy authored Dec 6, 2020
    Copy the full SHA
    8e78f51 View commit details
Showing with 9 additions and 1 deletion.
  1. +9 −1 numerics/frequency_analysis_body.hpp
10 changes: 9 additions & 1 deletion numerics/frequency_analysis_body.hpp
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ using base::uninitialized;
using geometry::Hilbert;
using geometry::Vector;
using quantities::Inverse;
using quantities::IsFinite;
using quantities::Sqrt;
using quantities::Square;
using quantities::SquareRoot;
@@ -149,8 +150,9 @@ IncrementalProjection(Function const& function,
aperiodic_degree, periodic_degree,
Evaluator>> q;

auto const a₀ = basis[0];
auto const& a₀ = basis[0];
auto const r₀₀ = a₀.Norm(weight, t_min, t_max);
CHECK(IsFinite(r₀₀)) << a₀;
q.push_back(a₀ / r₀₀);

auto const A₀ = InnerProduct(function, q[0], weight, t_min, t_max);
@@ -171,6 +173,12 @@ IncrementalProjection(Function const& function,
}

auto const rₘₘ = aₘ⁽ᵏ⁾.Norm(weight, t_min, t_max);
if (!IsFinite(rₘₘ)) {
// Call the calculator here just to evaluate how far we are from the
// truth.
calculator(f);
return F;
}
q.push_back(aₘ⁽ᵏ⁾ / rₘₘ);
DCHECK_EQ(m + 1, q.size());