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: 24ce4f5000cc
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9faa43c363fd
Choose a head ref
  • 6 commits
  • 12 files changed
  • 1 contributor

Commits on Oct 26, 2020

  1. Change the header file.

    pleroy committed Oct 26, 2020
    Copy the full SHA
    f05c809 View commit details
  2. Change the body file.

    pleroy committed Oct 26, 2020
    Copy the full SHA
    e166527 View commit details
  3. Friends.

    pleroy committed Oct 26, 2020
    Copy the full SHA
    a4fbd08 View commit details
  4. Copy the full SHA
    c28f80a View commit details
  5. Fix the clients.

    pleroy committed Oct 26, 2020
    Copy the full SHA
    18d45f6 View commit details
  6. Merge pull request #2773 from pleroy/TwoPiecewise

    Support for distinct degrees in piecewise Poisson series
    pleroy authored Oct 26, 2020
    Copy the full SHA
    9faa43c View commit details
4 changes: 2 additions & 2 deletions mathematica/mathematica.hpp
Original file line number Diff line number Diff line change
@@ -212,10 +212,10 @@ template<typename V, int ad, int pd,
std::string ToMathematica(PoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in = std::nullopt);

template<typename V, int d,
template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn = std::nullopt_t>
std::string ToMathematica(PiecewisePoissonSeries<V, d, E> const& series,
std::string ToMathematica(PiecewisePoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in = std::nullopt);

template<typename OptionalExpressIn = std::nullopt_t>
8 changes: 4 additions & 4 deletions mathematica/mathematica_body.hpp
Original file line number Diff line number Diff line change
@@ -145,11 +145,11 @@ std::string ToMathematicaExpression(PoissonSeries<V, ad, pd, E> const& series,
return Apply("Plus", components);
}

template<typename V, int d,
template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn>
std::string ToMathematicaExpression(
PiecewisePoissonSeries<V, d, E> const& series,
PiecewisePoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in) {
std::vector<std::string> conditions_and_functions;
for (int i = 0; i < series.series_.size(); ++i) {
@@ -394,10 +394,10 @@ std::string ToMathematica(PoissonSeries<V, ad, pd, E> const& series,
return Apply("Function", {ToMathematicaExpression(series, express_in)});
}

template<typename V, int d,
template<typename V, int ad, int pd,
template<typename, typename, int> class E,
typename OptionalExpressIn>
std::string ToMathematica(PiecewisePoissonSeries<V, d, E> const& series,
std::string ToMathematica(PiecewisePoissonSeries<V, ad, pd, E> const& series,
OptionalExpressIn express_in) {
return Apply("Function", {ToMathematicaExpression(series, express_in)});
}
3 changes: 2 additions & 1 deletion mathematica/mathematica_test.cpp
Original file line number Diff line number Diff line change
@@ -390,7 +390,8 @@ TEST_F(MathematicaTest, ToMathematica) {
ToMathematica(series));
}
{
using PiecewiseSeries = PiecewisePoissonSeries<double, 0, HornerEvaluator>;
using PiecewiseSeries =
PiecewisePoissonSeries<double, 0, 0, HornerEvaluator>;
using Series = PiecewiseSeries::Series;
Instant const t0 = Instant() + 3 * Second;
Series series(Series::AperiodicPolynomial({1.5}, t0),
15 changes: 4 additions & 11 deletions numerics/frequency_analysis_body.hpp
Original file line number Diff line number Diff line change
@@ -135,21 +135,14 @@ IncrementalProjection(Function const& function,
aperiodic_degree, periodic_degree,
Evaluator>> q;

using FType = PoissonSeries<Value,
aperiodic_degree, aperiodic_degree,
Evaluator>;
using QType = PoissonSeries<Normalized,
aperiodic_degree, aperiodic_degree,
Evaluator>;

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

auto const A₀ = InnerProduct(function, QType(q[0]), weight, t_min, t_max);
auto const A₀ = InnerProduct(function, q[0], weight, t_min, t_max);

Series F = A₀ * q[0];
auto f = function - FType(F);
auto f = function - F;

int m_begin = 1;
for (;;) {
@@ -164,9 +157,9 @@ IncrementalProjection(Function const& function,
q.push_back(aₘ⁽ᵏ⁾ / rₘₘ);
DCHECK_EQ(m + 1, q.size());

Norm const Aₘ = InnerProduct(f, QType(q[m]), weight, t_min, t_max);
Norm const Aₘ = InnerProduct(f, q[m], weight, t_min, t_max);

f -= FType(Aₘ * q[m]);
f -= Aₘ * q[m];
F += Aₘ * q[m];
}

8 changes: 5 additions & 3 deletions numerics/frequency_analysis_test.cpp
Original file line number Diff line number Diff line change
@@ -115,7 +115,8 @@ TEST_F(FrequencyAnalysisTest, PreciseModeScalar) {
std::uniform_real_distribution<> amplitude_distribution(-0.1, 0.1);
std::uniform_real_distribution<> frequency_distribution(-100.0, 100.0);

using PiecewiseSeries0 = PiecewisePoissonSeries<Length, 0, HornerEvaluator>;
using PiecewiseSeries0 =
PiecewisePoissonSeries<Length, 0, 0, HornerEvaluator>;
using Series0 = PiecewiseSeries0::Series;
Series0::PolynomialsByAngularFrequency polynomials;

@@ -172,7 +173,7 @@ TEST_F(FrequencyAnalysisTest, PreciseModeVector) {
Time const Δt = 1 * Second;

using PiecewiseSeries0 =
PiecewisePoissonSeries<Displacement<World>, 0, HornerEvaluator>;
PiecewisePoissonSeries<Displacement<World>, 0, 0, HornerEvaluator>;
using Series0 = PiecewiseSeries0::Series;
Series0::PolynomialsByAngularFrequency polynomials;

@@ -348,7 +349,8 @@ TEST_F(FrequencyAnalysisTest, PiecewisePoissonSeriesProjection) {
std::uniform_real_distribution<> amplitude_distribution(-10.0, 10.0);
std::uniform_real_distribution<> perturbation_distribution(-1e-6, 1e-6);

using PiecewiseSeries4 = PiecewisePoissonSeries<Length, 4, HornerEvaluator>;
using PiecewiseSeries4 =
PiecewisePoissonSeries<Length, 4, 4, HornerEvaluator>;

auto const sin = random_polynomial4_(t0_, random, amplitude_distribution);
auto const cos = random_polynomial4_(t0_, random, amplitude_distribution);
Loading