lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 431bdbb 01/11: Do not include PETE in any hea


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 431bdbb 01/11: Do not include PETE in any header except "et_vector.hpp"
Date: Tue, 16 Feb 2021 13:06:21 -0500 (EST)

branch: master
commit 431bdbb026193cc6b4c4d87ba6fdd49f5f8309e0
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Do not include PETE in any header except "et_vector.hpp"
    
    PETE should be included only by deliberate intention because of its
    size. No other header included it except 'math_functions.hpp', which
    used it only for assign_midpoint<>(); removed it thence, and rewrote
    that function template to use the C++ standard library. Including PETE
    in a header was worse than making a single statement more verbose.
---
 gpt_test.cpp            |  1 +
 irc7702_tables_test.cpp |  1 +
 math_functions.hpp      | 13 +++++++++----
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/gpt_test.cpp b/gpt_test.cpp
index 6750852..00b30b6 100644
--- a/gpt_test.cpp
+++ b/gpt_test.cpp
@@ -26,6 +26,7 @@
 
 #include "assert_lmi.hpp"
 #include "cso_table.hpp"
+#include "et_vector.hpp"
 #include "irc7702_interest.hpp"         // iglp(), igsp()
 #include "materially_equal.hpp"
 #include "math_functions.hpp"
diff --git a/irc7702_tables_test.cpp b/irc7702_tables_test.cpp
index 6a92e11..da8175e 100644
--- a/irc7702_tables_test.cpp
+++ b/irc7702_tables_test.cpp
@@ -23,6 +23,7 @@
 
 #include "irc7702_tables.hpp"
 
+#include "et_vector.hpp"
 #include "materially_equal.hpp"
 #include "math_functions.hpp"
 #include "ssize_lmi.hpp"
diff --git a/math_functions.hpp b/math_functions.hpp
index 059f4b7..a33a0ea 100644
--- a/math_functions.hpp
+++ b/math_functions.hpp
@@ -25,10 +25,9 @@
 #include "config.hpp"
 
 #include "assert_lmi.hpp"
-#include "et_vector.hpp"
 
-#include <algorithm>                    // max(), min()
-#include <cmath>                        // expm1(), log1p()
+#include <algorithm>                    // max(), min(), transform()
+#include <cmath>                        // expm1l(), log1pl()
 #include <limits>
 #include <stdexcept>
 #include <type_traits>
@@ -347,7 +346,13 @@ void assign_midpoint
 {
     LMI_ASSERT(in_0.size() == in_1.size());
     out.resize(in_0.size());
-    assign(out, apply_binary(mean<T>(), in_0, in_1));
+    std::transform
+        (in_0.begin()
+        ,in_0.end()
+        ,in_1.begin()
+        ,out.begin()
+        ,mean<double>()
+        );
 }
 
 #endif // math_functions_hpp



reply via email to

[Prev in Thread] Current Thread [Next in Thread]