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: 7703d37468cd
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 91d0a7cfc564
Choose a head ref
  • 5 commits
  • 8 files changed
  • 1 contributor

Commits on Jul 4, 2019

  1. Implementation.

    pleroy committed Jul 4, 2019
    Copy the full SHA
    a1c7c5c View commit details
  2. Tests passing.

    pleroy committed Jul 4, 2019

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d795033 View commit details
  3. A benchmark.

    pleroy committed Jul 4, 2019
    Copy the full SHA
    c3ddc5c View commit details
  4. Use ᴨ instead of pi.

    pleroy committed Jul 4, 2019
    Copy the full SHA
    ba12ced View commit details
  5. Merge pull request #2235 from pleroy/EFPi

    Support for E, F, and Π
    pleroy authored Jul 4, 2019
    Copy the full SHA
    91d0a7c View commit details
36 changes: 35 additions & 1 deletion benchmarks/elliptic_integrals_benchmark.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// .\Release\x64\benchmarks.exe --benchmark_repetitions=10 --benchmark_min_time=2 --benchmark_filter=FukushimaEllipticBDJ // NOLINT(whitespace/line_length)
// .\Release\x64\benchmarks.exe --benchmark_repetitions=10 --benchmark_min_time=2 --benchmark_filter=Elliptic // NOLINT(whitespace/line_length)

#include <random>
#include <vector>
@@ -16,6 +16,39 @@ using quantities::si::Radian;

namespace numerics {

void BM_EllipticEFΠ(benchmark::State& state) {
constexpr int size = 20;

std::mt19937_64 random(42);
std::uniform_real_distribution<> distribution_φ(0.0, π / 2);
std::uniform_real_distribution<> distribution_n(0.0, 1.0);
std::uniform_real_distribution<> distribution_mc(0.0, 1.0);
std::vector<Angle> φs;
std::vector<double> ns;
std::vector<double> mcs;
for (int i = 0; i < size; ++i) {
φs.push_back(distribution_φ(random) * Radian);
ns.push_back(distribution_n(random));
mcs.push_back(distribution_mc(random));
}

while (state.KeepRunningBatch(size * size * size)) {
double e;
double f;
double ᴨ;
for (Angle const φ : φs) {
for (double const n : ns) {
for (double const mc : mcs) {
EllipticEFΠ(φ, n, mc, e, f, ᴨ);
}
}
}
benchmark::DoNotOptimize(e);
benchmark::DoNotOptimize(f);
benchmark::DoNotOptimize(ᴨ);
}
}

void BM_FukushimaEllipticBDJ(benchmark::State& state) {
constexpr int size = 20;

@@ -49,6 +82,7 @@ void BM_FukushimaEllipticBDJ(benchmark::State& state) {
}
}

BENCHMARK(BM_EllipticEFΠ);
BENCHMARK(BM_FukushimaEllipticBDJ);

} // namespace numerics
14 changes: 11 additions & 3 deletions mathematica/elliptic_integrals.wl
Original file line number Diff line number Diff line change
@@ -66,7 +66,9 @@
(*fukushimaB[#[[1]],#[[2]]]],*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaD[#[[1]],m],m->0],*)
(*fukushimaD[#[[1]],#[[2]]]]}&,*)
(*fukushimaD[#[[1]],#[[2]]]],*)
(*EllipticE[#[[1]],#[[2]]],*)
(*EllipticF[#[[1]],#[[2]]]}&,*)
(*randomargs2];*)


@@ -76,6 +78,8 @@
(*" argument: "<>decimalFloatLiteral[#[[2]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[3]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[4]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[5]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[6]],2]<>*)
(*"}"*)
(*&,*)
(*Join[randomargs2,randomvals2,2]];*)
@@ -121,7 +125,8 @@
(*{*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaJ[#[[1]],n,#[[3]]],n->0],*)
(*fukushimaJ[#[[1]],#[[2]],#[[3]]]]}&,*)
(*fukushimaJ[#[[1]],#[[2]],#[[3]]]],*)
(*EllipticPi[#[[2]],#[[1]],#[[3]]]}&,*)
(*randomargs3];*)


@@ -131,6 +136,7 @@
(*" argument: "<>decimalFloatLiteral[#[[2]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[3]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[4]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[5]],2]<>*)
(*"}"*)
(*&,*)
(*Join[randomargs3,randomvals3,2]];*)
@@ -165,7 +171,8 @@
(*{*)
(*If[#[[2]]==0,*)
(*Limit[fukushimaJ[#[[1]],n,#[[3]]],n->0],*)
(*fukushimaJ[#[[1]],#[[2]],#[[3]]]]}&,*)
(*fukushimaJ[#[[1]],#[[2]],#[[3]]]],*)
(*EllipticPi[#[[2]],#[[1]],#[[3]]]}&,*)
(*random1args3];*)


@@ -175,6 +182,7 @@
(*" argument: "<>decimalFloatLiteral[#[[2]],2]<>*)
(*" argument: "<>decimalFloatLiteral[#[[3]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[4]],2]<>*)
(*" value: "<>decimalFloatLiteral[#[[5]],2]<>*)
(*"}"*)
(*&,*)
(*Join[random1args3,random1vals3,2]];*)
Loading