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: f6590f49e711
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 76ecf0205088
Choose a head ref
  • 14 commits
  • 3 files changed
  • 2 contributors

Commits on Aug 2, 2020

  1. Copy the full SHA
    7f4a7b9 View commit details
  2. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    6b6efbf View commit details
  3. All member functions.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    0b4c4ca View commit details
  4. Operator bodies.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    ae953fd View commit details
  5. Friend all the things.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    b3fb2e1 View commit details
  6. Implementation of operators.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    06d8c1a View commit details
  7. Dot product.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    e71ef76 View commit details
  8. A simple test.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    6fa1c43 View commit details
  9. Continuity.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    9b9117a View commit details
  10. No continuity.

    pleroy committed Aug 2, 2020
    Copy the full SHA
    3f54304 View commit details

Commits on Aug 4, 2020

  1. Operator tests.

    pleroy committed Aug 4, 2020
    Copy the full SHA
    714b556 View commit details
  2. Test all the things.

    pleroy committed Aug 4, 2020
    Copy the full SHA
    e71b31d View commit details
  3. Lint.

    pleroy committed Aug 4, 2020
    Copy the full SHA
    5933052 View commit details

Commits on Aug 5, 2020

  1. Merge pull request #2663 from pleroy/Piecewise

    Piecewise Poisson series
    pleroy authored Aug 5, 2020
    Copy the full SHA
    76ecf02 View commit details
Showing with 567 additions and 0 deletions.
  1. +184 −0 numerics/poisson_series.hpp
  2. +249 −0 numerics/poisson_series_body.hpp
  3. +134 −0 numerics/poisson_series_test.cpp
184 changes: 184 additions & 0 deletions numerics/poisson_series.hpp
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@

#include <algorithm>
#include <map>
#include <vector>

#include "geometry/interval.hpp"
#include "geometry/named_quantities.hpp"
#include "numerics/polynomial.hpp"
#include "quantities/named_quantities.hpp"
@@ -14,6 +16,7 @@ namespace numerics {
namespace internal_poisson_series {

using geometry::Instant;
using geometry::Interval;
using quantities::AngularFrequency;
using quantities::Primitive;
using quantities::Product;
@@ -162,8 +165,189 @@ Dot(PoissonSeries<LValue, ldegree_, Evaluator> const& left,
Instant const& t_min,
Instant const& t_max);

// A function defined by Poisson series piecewise. Each of the Poisson series
// making up the function applies over the semi-open interval
// [internal.min, interval.max[. It's not required that the function be
// continuous.
template<typename Value, int degree_,
template<typename, typename, int> class Evaluator>
class PiecewisePoissonSeries {
public:
using Series = PoissonSeries<Value, degree_, Evaluator>;

PiecewisePoissonSeries(Interval<Instant> const& interval,
Series const& series);

// The intervals for successive calls to Append must be consecutive. For the
// first call, the interval must be consecutive with the one passed at
// construction.
void Append(Interval<Instant> const& interval,
Series const& series);

Instant t_min() const;
Instant t_max() const;

// t must be in the interval [t_min, t_max[.
Value Evaluate(Instant const& t) const;

private:
PiecewisePoissonSeries(std::vector<Instant> const& bounds,
std::vector<Series> const& series);

std::vector<Instant> bounds_;
std::vector<Series> series_;

template<typename V, int r, template<typename, typename, int> class E>
PiecewisePoissonSeries<V, r, E>
friend operator-(PiecewisePoissonSeries<V, r, E> const& right);
template<typename S, typename V, int d,
template<typename, typename, int> class E>
PiecewisePoissonSeries<Product<S, V>, d, E>
friend operator*(S const& left,
PiecewisePoissonSeries<V, d, E> const& right);
template<typename S, typename V, int d,
template<typename, typename, int> class E>
PiecewisePoissonSeries<Product<V, S>, d, E>
friend operator*(PiecewisePoissonSeries<V, d, E> const& left,
S const& right);
template<typename S, typename V, int d,
template<typename, typename, int> class E>
PiecewisePoissonSeries<Quotient<V, S>, d, E>
friend operator/(PiecewisePoissonSeries<V, d, E> const& left,
S const& right);
template<typename V, int l, int r, template<typename, typename, int> class E>
PiecewisePoissonSeries<V, std::max(l, r), E>
friend operator+(PoissonSeries<V, l, E> const& left,
PiecewisePoissonSeries<V, r, E> const& right);
template<typename V, int l, int r, template<typename, typename, int> class E>
PiecewisePoissonSeries<V, std::max(l, r), E>
friend operator+(PiecewisePoissonSeries<V, l, E> const& left,
PoissonSeries<V, r, E> const& right);
template<typename V, int l, int r, template<typename, typename, int> class E>
PiecewisePoissonSeries<V, std::max(l, r), E>
friend operator-(PoissonSeries<V, l, E> const& left,
PiecewisePoissonSeries<V, r, E> const& right);
template<typename V, int l, int r, template<typename, typename, int> class E>
PiecewisePoissonSeries<V, std::max(l, r), E>
friend operator-(PiecewisePoissonSeries<V, l, E> const& left,
PoissonSeries<V, r, E> const& right);
template<typename L, typename R, int l, int r,
template<typename, typename, int> class E>
PiecewisePoissonSeries<Product<L, R>, l + r, E>
friend operator*(PoissonSeries<L, l, E> const& left,
PiecewisePoissonSeries<R, r, E> const& right);
template<typename L, typename R, int l, int r,
template<typename, typename, int> class E>
PiecewisePoissonSeries<Product<L, R>, l + r, E>
friend operator*(PiecewisePoissonSeries<L, l, E> const& left,
PoissonSeries<R, r, E> const& right);
template<typename L, typename R, int l, int r, int w,
template<typename, typename, int> class E>
quantities::Primitive<Product<L, R>, Time>
friend Dot(PoissonSeries<L, l, E> const& left,
PiecewisePoissonSeries<R, r, E> const& right,
PoissonSeries<double, w, E> const& weight);
template<typename L, typename R, int l, int r, int w,
template<typename, typename, int> class E>
quantities::Primitive<Product<L, R>, Time>
friend Dot(PiecewisePoissonSeries<L, l, E> const& left,
PoissonSeries<R, r, E> const& right,
PoissonSeries<double, w, E> const& weight);
};

// Some of the vector space operations for piecewise Poisson series. Note that
// while piecewise Poisson series have an algebra structure, we do not need it.

template<typename Value, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Value, rdegree_, Evaluator>
operator+(PiecewisePoissonSeries<Value, rdegree_, Evaluator> const& right);

template<typename Value, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Value, rdegree_, Evaluator>
operator-(PiecewisePoissonSeries<Value, rdegree_, Evaluator> const& right);

template<typename Scalar,
typename Value, int degree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Product<Scalar, Value>, degree_, Evaluator>
operator*(Scalar const& left,
PiecewisePoissonSeries<Value, degree_, Evaluator> const& right);

template<typename Scalar,
typename Value, int degree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Product<Value, Scalar>, degree_, Evaluator>
operator*(PiecewisePoissonSeries<Value, degree_, Evaluator> const& left,
Scalar const& right);

template<typename Scalar,
typename Value, int degree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Quotient<Value, Scalar>, degree_, Evaluator>
operator/(PiecewisePoissonSeries<Value, degree_, Evaluator> const& left,
Scalar const& right);

// Action of Poisson series on piecewise Poisson series.

template<typename Value, int ldegree_, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Value, std::max(ldegree_, rdegree_), Evaluator>
operator+(PoissonSeries<Value, ldegree_, Evaluator> const& left,
PiecewisePoissonSeries<Value, rdegree_, Evaluator> const& right);

template<typename Value, int ldegree_, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Value, std::max(ldegree_, rdegree_), Evaluator>
operator+(PiecewisePoissonSeries<Value, ldegree_, Evaluator> const& left,
PoissonSeries<Value, rdegree_, Evaluator> const& right);

template<typename Value, int ldegree_, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Value, std::max(ldegree_, rdegree_), Evaluator>
operator-(PoissonSeries<Value, ldegree_, Evaluator> const& left,
PiecewisePoissonSeries<Value, rdegree_, Evaluator> const& right);

template<typename Value, int ldegree_, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Value, std::max(ldegree_, rdegree_), Evaluator>
operator-(PiecewisePoissonSeries<Value, ldegree_, Evaluator> const& left,
PoissonSeries<Value, rdegree_, Evaluator> const& right);

template<typename LValue, typename RValue,
int ldegree_, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Product<LValue, RValue>, ldegree_ + rdegree_, Evaluator>
operator*(PoissonSeries<LValue, ldegree_, Evaluator> const& left,
PiecewisePoissonSeries<RValue, rdegree_, Evaluator> const& right);

template<typename LValue, typename RValue,
int ldegree_, int rdegree_,
template<typename, typename, int> class Evaluator>
PiecewisePoissonSeries<Product<LValue, RValue>, ldegree_ + rdegree_, Evaluator>
operator*(PiecewisePoissonSeries<LValue, ldegree_, Evaluator> const& left,
PoissonSeries<RValue, rdegree_, Evaluator> const& right);

template<typename LValue, typename RValue,
int ldegree_, int rdegree_, int wdegree_,
template<typename, typename, int> class Evaluator>
Primitive<Product<LValue, RValue>, Time>
Dot(PoissonSeries<LValue, ldegree_, Evaluator> const& left,
PiecewisePoissonSeries<RValue, rdegree_, Evaluator> const& right,
PoissonSeries<double, wdegree_, Evaluator> const& weight);

template<typename LValue, typename RValue,
int ldegree_, int rdegree_, int wdegree_,
template<typename, typename, int> class Evaluator>
Primitive<Product<LValue, RValue>, Time>
Dot(PiecewisePoissonSeries<LValue, ldegree_, Evaluator> const& left,
PoissonSeries<RValue, rdegree_, Evaluator> const& right,
PoissonSeries<double, wdegree_, Evaluator> const& weight);

} // namespace internal_poisson_series

using internal_poisson_series::PiecewisePoissonSeries;
using internal_poisson_series::PoissonSeries;

} // namespace numerics
Loading