lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5934] Refactor, favoring expression templates


From: Greg Chicares
Subject: [lmi-commits] [5934] Refactor, favoring expression templates
Date: Wed, 06 Aug 2014 13:13:17 +0000

Revision: 5934
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5934
Author:   chicares
Date:     2014-08-06 13:13:16 +0000 (Wed, 06 Aug 2014)
Log Message:
-----------
Refactor, favoring expression templates

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/ihs_basicval.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-08-06 13:12:42 UTC (rev 5933)
+++ lmi/trunk/ChangeLog 2014-08-06 13:13:16 UTC (rev 5934)
@@ -34037,3 +34037,13 @@
   input_xml_io.cpp
 Expunge some idiosyncratic code that is no longer useful.
 
+20140806T1312Z <address@hidden> [534]
+
+  loads.cpp
+Improve documentation.
+
+20140806T1313Z <address@hidden> [534]
+
+  ihs_basicval.cpp
+Refactor, favoring expression templates.
+

Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp  2014-08-06 13:12:42 UTC (rev 5933)
+++ lmi/trunk/ihs_basicval.cpp  2014-08-06 13:13:16 UTC (rev 5934)
@@ -544,51 +544,23 @@
         }
 */
 
-    // ET !! Mly7702iGlp = i_upper_12_over_12_from_i(max(.04, guar_int) - 
SpreadFor7702_);
-    Mly7702iGlp.assign(Length, 0.04);
-    std::transform
-        (guar_int.begin()
-        ,guar_int.end()
-        ,Mly7702iGlp.begin()
-        ,Mly7702iGlp.begin()
-        ,greater_of<double>()
+    Mly7702iGlp.assign(Length, 0.0);
+    assign
+        (Mly7702iGlp
+        ,apply_unary
+            (i_upper_12_over_12_from_i<double>()
+            ,apply_binary(greater_of<double>(), 0.04, guar_int) - 
SpreadFor7702_
+            )
         );
-    std::transform
-        (Mly7702iGlp.begin()
-        ,Mly7702iGlp.end()
-        ,SpreadFor7702_.begin()
-        ,Mly7702iGlp.begin()
-        ,std::minus<double>()
-        );
-    std::transform
-        (Mly7702iGlp.begin()
-        ,Mly7702iGlp.end()
-        ,Mly7702iGlp.begin()
-        ,i_upper_12_over_12_from_i<double>()
-        );
 
-    // ET !! Mly7702iGsp = i_upper_12_over_12_from_i(max(.06, guar_int) - 
SpreadFor7702_);
-    Mly7702iGsp.assign(Length, 0.06);
-    std::transform
-        (guar_int.begin()
-        ,guar_int.end()
-        ,Mly7702iGsp.begin()
-        ,Mly7702iGsp.begin()
-        ,greater_of<double>()
+    Mly7702iGsp.assign(Length, 0.0);
+    assign
+        (Mly7702iGsp
+        ,apply_unary
+            (i_upper_12_over_12_from_i<double>()
+            ,apply_binary(greater_of<double>(), 0.06, guar_int) - 
SpreadFor7702_
+            )
         );
-    std::transform
-        (Mly7702iGsp.begin()
-        ,Mly7702iGsp.end()
-        ,SpreadFor7702_.begin()
-        ,Mly7702iGsp.begin()
-        ,std::minus<double>()
-        );
-    std::transform
-        (Mly7702iGsp.begin()
-        ,Mly7702iGsp.end()
-        ,Mly7702iGsp.begin()
-        ,i_upper_12_over_12_from_i<double>()
-        );
 
     Database_->Query(Mly7702ig, DB_NaarDiscount);
 
@@ -896,14 +868,8 @@
             break;
         case mce_survive_to_expectancy:
             {
-            std::vector<double> z(MortalityRates_->PartialMortalityQ());
-            // ET !! z = 1.0 - z;
-            std::transform
-                (z.begin()
-                ,z.end()
-                ,z.begin()
-                ,std::bind1st(std::minus<double>(), 1.0)
-                );
+            std::vector<double> z(Length);
+            assign(z, 1.0 - MortalityRates_->PartialMortalityQ());
             // ET !! In APL, this would be [writing multiplication as '*']
             //   +/*\1-z
             // It would be nice to have a concise representation for that.




reply via email to

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