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: 5cf0c5b65361
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 11ae5704c55a
Choose a head ref

Commits on May 31, 2021

  1. templatization

    eggrobin committed May 31, 2021
    Copy the full SHA
    eceb1e5 View commit details

Commits on Jun 1, 2021

  1. Copy the full SHA
    0f24cbe View commit details
  2. implementation

    eggrobin committed Jun 1, 2021
    Copy the full SHA
    1799d9a View commit details

Commits on Jun 2, 2021

  1. all hail the typechecking

    eggrobin committed Jun 2, 2021
    Copy the full SHA
    58fc455 View commit details
  2. Copy the full SHA
    5429255 View commit details
  3. Copy the full SHA
    6016e2f View commit details
  4. condition

    eggrobin committed Jun 2, 2021
    Copy the full SHA
    0c5c09c View commit details
  5. Copy the full SHA
    b6b9d4f View commit details
  6. Copy the full SHA
    747ffe6 View commit details
  7. apparently FORCE_INLINE works best on the definition, and if the comp…

    …iler does not inline that it fails at common subexpression elimination and we are in unpcklpd hell
    eggrobin committed Jun 2, 2021
    Copy the full SHA
    b3e2194 View commit details

Commits on Jun 6, 2021

  1. Copy the full SHA
    a79ef1d View commit details
  2. declaration

    eggrobin committed Jun 6, 2021
    Copy the full SHA
    0d857c7 View commit details
  3. order

    eggrobin committed Jun 6, 2021
    Copy the full SHA
    cdb0098 View commit details
  4. no assembly

    eggrobin committed Jun 6, 2021
    Copy the full SHA
    86f33e5 View commit details
  5. name

    eggrobin committed Jun 6, 2021
    Copy the full SHA
    495b89a View commit details

Commits on Jun 7, 2021

  1. expectations

    eggrobin committed Jun 7, 2021
    Copy the full SHA
    4ee0cf7 View commit details
  2. lint

    eggrobin committed Jun 7, 2021
    Copy the full SHA
    f43b4a2 View commit details
  3. tolerances

    eggrobin committed Jun 7, 2021
    Copy the full SHA
    c682331 View commit details
  4. sort

    eggrobin committed Jun 7, 2021
    Copy the full SHA
    250b28e View commit details
  5. Copy the full SHA
    045b15e View commit details
  6. formatting

    eggrobin committed Jun 7, 2021
    Copy the full SHA
    bc3ac5e View commit details
  7. elsif

    eggrobin committed Jun 7, 2021
    Copy the full SHA
    9f43c96 View commit details

Commits on Jun 8, 2021

  1. Merge pull request #3023 from eggrobin/fma-polynomials

    FMA in polynomial evaluation
    eggrobin authored Jun 8, 2021
    Copy the full SHA
    11ae570 View commit details
8 changes: 4 additions & 4 deletions astronomy/orbital_elements_test.cpp
Original file line number Diff line number Diff line change
@@ -173,7 +173,7 @@ TEST_F(OrbitalElementsTest, KeplerOrbit) {
AbsoluteErrorFrom(*initial_osculating.period, Lt(510 * Micro(Second))));
EXPECT_THAT(
elements.nodal_period(),
AbsoluteErrorFrom(*initial_osculating.period, Lt(4.1 * Milli(Second))));
AbsoluteErrorFrom(*initial_osculating.period, Lt(4.2 * Milli(Second))));
EXPECT_THAT(
elements.sidereal_period(),
AbsoluteErrorFrom(*initial_osculating.period, Lt(1.9 * Micro(Second))));
@@ -192,10 +192,10 @@ TEST_F(OrbitalElementsTest, KeplerOrbit) {
Lt(0.64 * Micro(ArcSecond))));
EXPECT_THAT(elements.mean_longitude_of_ascending_node_interval().midpoint(),
AbsoluteErrorFrom(initial_osculating.longitude_of_ascending_node,
Lt(64 * ArcSecond)));
Lt(66 * ArcSecond)));
EXPECT_THAT(elements.mean_argument_of_periapsis_interval().midpoint(),
AbsoluteErrorFrom(*initial_osculating.argument_of_periapsis,
Lt(62 * ArcSecond)));
Lt(74 * ArcSecond)));

// Mean element stability.
EXPECT_THAT(elements.mean_semimajor_axis_interval().measure(),
@@ -207,7 +207,7 @@ TEST_F(OrbitalElementsTest, KeplerOrbit) {
EXPECT_THAT(elements.mean_longitude_of_ascending_node_interval().measure(),
Lt(2.3 * ArcMinute));
EXPECT_THAT(elements.mean_argument_of_periapsis_interval().measure(),
Lt(2.2 * ArcMinute));
Lt(2.4 * ArcMinute));

mathematica::Logger logger(
SOLUTION_DIR / "mathematica" / "unperturbed_elements.generated.wl",
2 changes: 1 addition & 1 deletion numerics/frequency_analysis_test.cpp
Original file line number Diff line number Diff line change
@@ -516,7 +516,7 @@ TEST_F(FrequencyAnalysisTest, PoissonSeriesIncrementalProjectionSecular) {
: ω_index == 3 ? AllOf(Ge(5.9e-15 * Metre),
Lt(1.7e-10 * Metre))
: AllOf(Ge(0 * Metre),
Lt(2.7e-14 * Metre)))
Lt(3.6e-14 * Metre)))
<< ω_index;
}
if (ω_index == ωs.size()) {
19 changes: 14 additions & 5 deletions numerics/newhall_test.cpp
Original file line number Diff line number Diff line change
@@ -180,7 +180,9 @@ class NewhallTest : public ::testing::Test {
ApproximateQuantity<Difference<Value>> const&
expected_value_absolute_error,
ApproximateQuantity<Variation<Value>> const&
expected_variation_absolute_error) {
expected_variation_absolute_error,
std::optional<ApproximateQuantity<Difference<Value>>> const&
expected_value_absolute_error_with_fma = std::nullopt) {
std::vector<Value> arguments;
std::vector<Variation<Value>> variations;
for (Instant t = t_min_; t <= t_max_; t += 0.5 * Second) {
@@ -212,8 +214,13 @@ class NewhallTest : public ::testing::Test {

EXPECT_THAT(Abs(argument_error_estimate),
IsNear(expected_value_error_estimate));
EXPECT_THAT(argument_absolute_error,
IsNear(expected_value_absolute_error));
if (expected_value_absolute_error_with_fma.has_value() && UseHardwareFMA) {
EXPECT_THAT(argument_absolute_error,
IsNear(*expected_value_absolute_error_with_fma));
} else {
EXPECT_THAT(argument_absolute_error,
IsNear(expected_value_absolute_error));
}
EXPECT_THAT(variation_absolute_error,
IsNear(expected_variation_absolute_error));
}
@@ -674,7 +681,8 @@ TEST_F(NewhallTest, ApproximationInMonomialBasis_2_7) {
speed_function_2_,
/*expected_value_error_estimate=*/6.2e-4_⑴ * Metre,
/*expected_value_absolute_error=*/2.9e-14_⑴ * Metre,
/*expected_variation_absolute_error=*/2.5e-14_⑴ * Metre / Second);
/*expected_variation_absolute_error=*/2.5e-14_⑴ * Metre / Second,
/*expected_value_absolute_error_with_fma=*/1.7e-14_⑴ * Metre);
}

TEST_F(NewhallTest, ApproximationInMonomialBasis_2_8) {
@@ -692,7 +700,8 @@ TEST_F(NewhallTest, ApproximationInMonomialBasis_2_9) {
speed_function_2_,
/*expected_value_error_estimate=*/4.8e-16_⑴ * Metre,
/*expected_value_absolute_error=*/1.0e-13_⑴ * Metre,
/*expected_variation_absolute_error=*/4.8e-13_⑴ * Metre / Second);
/*expected_variation_absolute_error=*/4.8e-13_⑴ * Metre / Second,
/*expected_value_absolute_error_with_fma=*/1.1e-13_⑴ * Metre);
}

TEST_F(NewhallTest, ApproximationInMonomialBasis_2_10) {
15 changes: 9 additions & 6 deletions numerics/poisson_series_test.cpp
Original file line number Diff line number Diff line change
@@ -402,7 +402,7 @@ TEST_F(PoissonSeriesTest, PoorlyConditionedInnerProduct2) {
(t_max - t_min);
EXPECT_THAT(
product,
RelativeErrorFrom(+2.0267451184776034270e-11, IsNear(4010_⑴)));
RelativeErrorFrom(+2.0267451184776034270e-11, IsNear(4.0e3_⑴)));
}
}

@@ -597,9 +597,11 @@ TEST_F(PoissonSeriesTest, PoorlyConditionedInnerProduct3) {
InnerProduct(f, g,
apodization::Dirichlet<EstrinEvaluator>(t_min, t_max),
t_min, t_max);
EXPECT_THAT(product,
RelativeErrorFrom(expected_product,
AnyOf(IsNear(0.0013_⑴), IsNear(0.0015_⑴))));
EXPECT_THAT(
product,
RelativeErrorFrom(
expected_product,
AnyOf(IsNear(0.00069_⑴), IsNear(0.0013_⑴), IsNear(0.0015_⑴))));
}
// This test demonstrates how bad Integrate can be, for products that arise in
// practice. Exact integration of the result of PointwiseInnerProduct yields
@@ -613,8 +615,9 @@ TEST_F(PoissonSeriesTest, PoorlyConditionedInnerProduct3) {
.Integrate(t_min, t_max) /
(t_max - t_min);
EXPECT_THAT(product,
RelativeErrorFrom(expected_product,
AnyOf(IsNear(7.7e6_⑴), IsNear(1.0e7_⑴))));
RelativeErrorFrom(
expected_product,
AnyOf(IsNear(7.7e6_⑴), IsNear(8.8e6_⑴), IsNear(1.0e7_⑴))));
}
}

12 changes: 11 additions & 1 deletion numerics/polynomial_evaluators.hpp
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ using quantities::Square;
// We use FORCE_INLINE because we have to write this recursively, but we really
// want linear code.

template<typename Value, typename Argument, int degree>
template<typename Value, typename Argument, int degree, bool allow_fma = true>
struct EstrinEvaluator {
// The fully qualified name below designates the template, not the current
// instance.
@@ -35,6 +35,10 @@ struct EstrinEvaluator {
};

template<typename Value, typename Argument, int degree>
using EstrinEvaluatorWithoutFMA =
EstrinEvaluator<Value, Argument, degree, /*allow_fma=*/false>;

template<typename Value, typename Argument, int degree, bool allow_fma = true>
struct HornerEvaluator {
// The fully qualified name below designates the template, not the current
// instance.
@@ -51,10 +55,16 @@ struct HornerEvaluator {
Argument const& argument);
};

template<typename Value, typename Argument, int degree>
using HornerEvaluatorWithoutFMA =
HornerEvaluator<Value, Argument, degree, /*allow_fma=*/false>;

} // namespace internal_polynomial_evaluators

using internal_polynomial_evaluators::EstrinEvaluator;
using internal_polynomial_evaluators::EstrinEvaluatorWithoutFMA;
using internal_polynomial_evaluators::HornerEvaluator;
using internal_polynomial_evaluators::HornerEvaluatorWithoutFMA;

} // namespace numerics
} // namespace principia
Loading