From 6b5d17d19091386a5d9aa2b38f3952aeb2bc5d6a Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Wed, 2 Mar 2022 18:17:45 +0100
Subject: [PATCH] Fix bug in method RealTuple::log

Calling log(a,b) returned a-b instead of b-a.

Also, enable unit tests for the RealTuple class.  The current test
will not trigger the bug in the log method: that will come shortly.

Finally, this commit is the first that mentions its user-facing
changes in the newly introduced CHANGELOG.md file.
---
 CHANGELOG.md            | 5 +++++
 dune/gfe/realtuple.hh   | 5 +++--
 test/targetspacetest.cc | 5 +++--
 3 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 CHANGELOG.md

diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..7731162b
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Master
+
+- Fix bug in the `RealTuple::log` method: Calling `log(a,b)`returned `a-b`
+  instead of `b-a`.
+
diff --git a/dune/gfe/realtuple.hh b/dune/gfe/realtuple.hh
index e4bc4df8..7f28cc85 100644
--- a/dune/gfe/realtuple.hh
+++ b/dune/gfe/realtuple.hh
@@ -110,10 +110,11 @@ public:
     }
 
     /** \brief The logarithmic map
-     * Simply the difference vector for RealTuple
+     *
+     * \result A vector in the tangent space of a, viz: b-a
      * */
     static auto log(const RealTuple& a, const RealTuple& b) {
-        return a.data_ - b.data_;
+        return b.data_ - a.data_;
     }
 
 #if ADOLC_ADOUBLE_H
diff --git a/test/targetspacetest.cc b/test/targetspacetest.cc
index 34b5a285..a677cd0e 100644
--- a/test/targetspacetest.cc
+++ b/test/targetspacetest.cc
@@ -355,8 +355,9 @@ void test()
 
 int main() try
 {
-//     test<RealTuple<double,1> >();
-//     test<RealTuple<double,3> >();
+    // Test the RealTuple class
+    test<RealTuple<double,1> >();
+    test<RealTuple<double,3> >();
     
     test<UnitVector<double,2> >();
     test<UnitVector<double,3> >();
-- 
GitLab