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

Commits on Oct 7, 2020

  1. Fix a bug in the computation of eigenvalues of matrixes that are very…

    … close to a multiple of the identity.
    pleroy committed Oct 7, 2020
    Copy the full SHA
    ccaec69 View commit details
  2. Cleanup.

    pleroy committed Oct 7, 2020
    Copy the full SHA
    96cb477 View commit details
  3. More cleanup.

    pleroy committed Oct 7, 2020
    Copy the full SHA
    a6d0855 View commit details
  4. Merge pull request #2753 from pleroy/2716

    Computation of eigenvalues of matrices that are very close to a multiple of the identity
    pleroy authored Oct 7, 2020
    Copy the full SHA
    3614764 View commit details
Showing with 46 additions and 12 deletions.
  1. +10 −2 geometry/symmetric_bilinear_form_body.hpp
  2. +26 −0 geometry/symmetric_bilinear_form_test.cpp
  3. +2 −2 journal/player_test.cpp
  4. +8 −8 stacktrace_decoder/stacktrace_decoder.cs
12 changes: 10 additions & 2 deletions geometry/symmetric_bilinear_form_body.hpp
Original file line number Diff line number Diff line change
@@ -185,15 +185,23 @@ typename SymmetricBilinearForm<Scalar, Frame, Multivector>::
// the singularity.
auto const m₁ = A_minus_α₂I * A_minus_α₀I;
std::unique_ptr<Rotation<Eigenframe, Frame> const> rotation;
if (α₁ - α₀ < α₂ - α₁) {
if (α₀ == α₂) {
// This can happen even if p != zero because of errors in the computation of
// the αs.
SymmetricBilinearForm<Scalar, Eigenframe, Multivector> form(
R3x3Matrix<Scalar>({q, zero, zero},
{zero, q, zero},
{zero, zero, q}));
return {form, Rotation<Eigenframe, Frame>::Identity()};
} else if (α₁ - α₀ < α₂ - α₁) {
auto const m₂ = A_minus_α₀I * A_minus_α₁I;
auto const v₂ =
Normalize(Vector<Square<Scalar>, Frame>(PickEigenvector(m₂)));
auto const v₁ = Normalize(Vector<Square<Scalar>, Frame>(PickEigenvector(m₁))
.OrthogonalizationAgainst(v₂));
rotation =
std::make_unique<Rotation<Eigenframe, Frame>>(Wedge(v₁, v₂), v₁, v₂);
} else {
} else { // α₁ - α₀ >= α₂ - α₁
auto const m₀ = A_minus_α₁I * A_minus_α₂I;
auto const v₀ =
Normalize(Vector<Square<Scalar>, Frame>(PickEigenvector(m₀)));
26 changes: 26 additions & 0 deletions geometry/symmetric_bilinear_form_test.cpp
Original file line number Diff line number Diff line change
@@ -511,6 +511,32 @@ TEST_F(SymmetricBilinearFormTest, Diagonalize) {
AbsoluteErrorFrom(+0.92732994849715299942, IsNear(1.6_⑴)),
AbsoluteErrorFrom(-0.30863053191969508327, IsNear(0.3_⑴))));
}

// A matrix whose eigenvalues are computed to be identical, even though p is
// not zero (#2716).
{
auto const f = MakeSymmetricBilinearForm<World>(
R3x3Matrix<double>({{+8.37592291645705700e-01,
-2.08166817117216851e-17,
+1.38777878078144568e-17},
{-2.08166817117216851e-17,
+8.37592291645705700e-01,
+0.00000000000000000e+00},
{+1.38777878078144568e-17,
+0.00000000000000000e+00,
+8.37592291645705700e-01}}));
auto const f_eigensystem = f.Diagonalize<Eigenworld>();

EXPECT_THAT(f_eigensystem.rotation.quaternion().Norm(),
AlmostEquals(1.0, 0)) << f;
Vector<double, Eigenworld> const e₀({1, 0, 0});
Vector<double, Eigenworld> const e₁({0, 1, 0});
Vector<double, Eigenworld> const e₂({0, 0, 1});

EXPECT_THAT(f_eigensystem.rotation(e₀), Componentwise(1, 0, 0));
EXPECT_THAT(f_eigensystem.rotation(e₁), Componentwise(0, 1, 0));
EXPECT_THAT(f_eigensystem.rotation(e₂), Componentwise(0, 0, 1));
}
}

} // namespace internal_symmetric_bilinear_form
4 changes: 2 additions & 2 deletions journal/player_test.cpp
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ TEST_F(PlayerTest, DISABLED_SECULAR_Debug) {
// An example of how journaling may be used for debugging. You must set
// |path| and fill the |method_in| and |method_out_return| protocol buffers.
std::string path =
R"(P:\Public Mockingbird\Principia\Crashes\2611\JOURNAL.20200623-194313)"; // NOLINT
R"(P:\Public Mockingbird\Principia\Crashes\2716\JOURNAL.20200911-141451)"; // NOLINT
Player player(path);
int count = 0;
while (player.Play(count)) {
@@ -109,7 +109,7 @@ TEST_F(PlayerTest, DISABLED_SECULAR_Debug) {
auto* extension = method_in.MutableExtension(
serialization::CatchUpLaggingVessels::extension);
auto* in = extension->mutable_in();
in->set_plugin(2899402431696);
in->set_plugin(2075974762432);
}
serialization::Method method_out_return;
{
16 changes: 8 additions & 8 deletions stacktrace_decoder/stacktrace_decoder.cs
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ private static Int64 GetBaseAddress(bool unity_crash,
StreamReader stream) {
var base_address_regex =
new Regex(unity_crash ? unity_regex
: @"^I.*" + principia_cpp_regex +
: @"^[EI].*" + principia_cpp_regex +
@":.*\] Base address is ([0-9A-F]+)$");
Match base_address_match;
do {
@@ -126,7 +126,7 @@ private static void Main(string[] args) {
Encoding.UTF8);
if (!unity_crash) {
var version_regex = new Regex(
@"^I.*\] Principia version " +
@"^[EI].*\] Principia version " +
@"([0-9]{10}-\w+)-[0-9]+-g([0-9a-f]{40})(-dirty)? built");
Match version_match;
do {
@@ -141,12 +141,12 @@ private static void Main(string[] args) {
$"Warning: version is dirty; line numbers may be incorrect."));
}
}
Int64 principia_base_address =
GetBaseAddress(unity_crash,
@"GameData\\Principia\\x64\\principia.dll:principia.dll " +
@"\(([0-9A-F]+)\)",
"interface\\.cpp",
stream);
Int64 principia_base_address = GetBaseAddress(
unity_crash,
@"GameData\\Principia\\x64\\principia.dll:principia.dll " +
@"\(([0-9A-F]+)\)",
"interface\\.cpp",
stream);
Console.Write(
comment($"Using Principia base address {principia_base_address:X}"));
var stack_regex = new Regex(