[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 46b9de9 5/8: Regularize compositing of non-ad
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 46b9de9 5/8: Regularize compositing of non-additive vectors |
Date: |
Thu, 9 Apr 2020 18:33:05 -0400 (EDT) |
branch: master
commit 46b9de94a0d07c7523305747ba7f501490597c6e
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Regularize compositing of non-additive vectors
Formerly, these vectors had potentially different lengths than the
additive vectors in a composite, and most were all zero. Now, at
least they all have the appropriate length, so that accessing the
value in the year preceding maturity won't cause a crash. The value
for each (yearly) element is overwritten by the last addend that
contains such an element; that's what 'LedgerVariant' does for such
vectors already, and it's arguably the best simple, uniform method
that can be devised.
---
ledger_invariant.cpp | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 35120d3..627c13b 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -766,22 +766,28 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant
const& a_Addend)
SmokerDistinct = a_Addend.SmokerDistinct;
SmokerBlended = a_Addend.SmokerBlended;
- PartMortTableMult = a_Addend.PartMortTableMult;
- TotalIMF = a_Addend.TotalIMF;
- RefundableSalesLoad = a_Addend.RefundableSalesLoad;
-
- // PDF !! This is the logic used in the variant ledger class.
- // It's not a very good idea, but until it can be replaced
- // everywhere, at least it ensures that the composite value
- // isn't zero. (In some other cases, zero might be a sensible
- // answer--e.g., for ratios like 'CorridorFactor', where an
- // average weighted by number of lives would be inaccurate,
- // and any aggregate value could be misleading.)
+ // For 'CorridorFactor', an average weighted by number of lives
+ // would be inaccurate, and indeed any aggregate value could be
+ // surprising because it would not necessarily be monotone (for
+ // two lives with a ten-year age difference, the last ten would
+ // depend on the younger life only, most likely producing a
+ // discontinuity at the older life's maturity age).
//
// ET !! This is of the form 'x[iota rho y] gets y'.
for(int j = 0; j < a_Addend.Length; ++j)
{
- AnnLoanDueRate[j] = a_Addend.AnnLoanDueRate[j];
+ IndvTaxBracket [j] = a_Addend.IndvTaxBracket [j];
+ CorpTaxBracket [j] = a_Addend.CorpTaxBracket [j];
+ AnnualFlatExtra [j] = a_Addend.AnnualFlatExtra [j];
+ HoneymoonValueSpread [j] = a_Addend.HoneymoonValueSpread [j];
+ PartMortTableMult [j] = a_Addend.PartMortTableMult [j];
+ AddonCompOnAssets [j] = a_Addend.AddonCompOnAssets [j];
+ AddonCompOnPremium [j] = a_Addend.AddonCompOnPremium [j];
+ CorridorFactor [j] = 0.0;
+ AnnLoanDueRate [j] = a_Addend.AnnLoanDueRate [j];
+ CurrMandE [j] = a_Addend.CurrMandE [j];
+ TotalIMF [j] = a_Addend.TotalIMF [j];
+ RefundableSalesLoad [j] = a_Addend.RefundableSalesLoad [j];
}
IsMec = a_Addend.IsMec || IsMec;
- [lmi-commits] [lmi] master updated (655648d -> dfb045a), Greg Chicares, 2020/04/09
- [lmi-commits] [lmi] master 859240e 1/8: Remove unneeded assertion and conditional, Greg Chicares, 2020/04/09
- [lmi-commits] [lmi] master 840fd2f 4/8: Treat LedgerInvariant::Salary as forborne, Greg Chicares, 2020/04/09
- [lmi-commits] [lmi] master 07c029f 2/8: Improve documentation, Greg Chicares, 2020/04/09
- [lmi-commits] [lmi] master ce789de 3/8: Treat 'AddonMonthlyFee' as a BOY vector, Greg Chicares, 2020/04/09
- [lmi-commits] [lmi] master 9cd8cf7 7/8: Refactor: composite 'OtherVectors' in LedgerBase::PlusEq(), Greg Chicares, 2020/04/09
- [lmi-commits] [lmi] master ab9d0d1 6/8: Truncate GPT corridor factors at maturity age [349], Greg Chicares, 2020/04/09
- [lmi-commits] [lmi] master 46b9de9 5/8: Regularize compositing of non-additive vectors,
Greg Chicares <=
- [lmi-commits] [lmi] master dfb045a 8/8: Move a block of code, Greg Chicares, 2020/04/09