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

Commits on Aug 28, 2020

  1. Retrofit godbolt code.

    pleroy committed Aug 28, 2020
    Copy the full SHA
    6b1f3ca View commit details
  2. Merge pull request #2697 from pleroy/Hilbert

    A version of Hilbert that may be more palatable to Clang
    pleroy authored Aug 28, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ea6fc2a View commit details
Showing with 9 additions and 7 deletions.
  1. +4 −3 geometry/hilbert.hpp
  2. +5 −4 geometry/hilbert_body.hpp
7 changes: 4 additions & 3 deletions geometry/hilbert.hpp
Original file line number Diff line number Diff line change
@@ -26,15 +26,16 @@ struct Hilbert;

template<typename T1, typename T2>
struct Hilbert<T1, T2,
std::void_t<std::enable_if_t<
std::conjunction_v<is_quantity<T1>, is_quantity<T2>>>>>
std::enable_if_t<
std::conjunction_v<is_quantity<T1>, is_quantity<T2>,
std::negation<std::is_same<T1, T2>>>>>
: base::not_constructible {
using InnerProductType = Product<T1, T2>;
static InnerProductType InnerProduct(T1 const& t1, T2 const& t2);
};

template<typename T>
struct Hilbert<T, T, std::void_t<std::enable_if_t<is_quantity_v<T>>>>
struct Hilbert<T, T, std::enable_if_t<is_quantity_v<T>>>
: base::not_constructible {
using InnerProductType = Square<T>;
static InnerProductType InnerProduct(T const& t1, T const& t2);
9 changes: 5 additions & 4 deletions geometry/hilbert_body.hpp
Original file line number Diff line number Diff line change
@@ -14,20 +14,21 @@ using quantities::Abs;

template<typename T1, typename T2>
auto Hilbert<T1, T2,
std::void_t<std::enable_if_t<
std::conjunction_v<is_quantity<T1>, is_quantity<T2>>>>>::
std::enable_if_t<
std::conjunction_v<is_quantity<T1>, is_quantity<T2>,
std::negation<std::is_same<T1, T2>>>>>::
InnerProduct(T1 const& t1, T2 const& t2) -> InnerProductType {
return t1 * t2;
}

template<typename T>
auto Hilbert<T, T, std::void_t<std::enable_if_t<is_quantity_v<T>>>>::
auto Hilbert<T, T, std::enable_if_t<is_quantity_v<T>>>::
InnerProduct(T const& t1, T const& t2) -> InnerProductType {
return t1 * t2;
}

template<typename T>
auto Hilbert<T, T, std::void_t<std::enable_if_t<is_quantity_v<T>>>>::Norm(
auto Hilbert<T, T, std::enable_if_t<is_quantity_v<T>>>::Norm(
T const& t) -> NormType {
return Abs(t);
}