[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 80f3ab4 09/14: Don't touch a ledger object be
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 80f3ab4 09/14: Don't touch a ledger object before calling its Init() (bis) |
Date: |
Sat, 29 Aug 2020 19:34:49 -0400 (EDT) |
branch: master
commit 80f3ab43a86ae4af0ff17f40afdab767ebf78f57
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Don't touch a ledger object before calling its Init() (bis)
---
ihs_acctval.cpp | 77 +++++++++++++++++++++++++++++----------------------------
1 file changed, 39 insertions(+), 38 deletions(-)
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index 5042cd0..5c0924a 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -125,44 +125,6 @@ AccountValue::AccountValue(Input const& input)
// If BasicValues changes, then this init becomes invalid
// e.g. solves change BasicValues
- // Iff partial mortality is used, save yearly values in a vector
- // for use elsewhere in this class, and store yearly inforce lives
- // (assuming no one ever lapses) in the invariant ledger object.
- //
- // A contract may be in force at the end of its maturity year,
- // and it's necessary to treat it that way because other year-end
- // composite values are multiplied by the number of lives inforce.
- // Of course, a contract is not normally in force after maturity.
-
- LMI_ASSERT
- ( lmi::ssize(InvariantValues().InforceLives)
- == 1 + BasicValues::GetLength()
- );
- partial_mortality_q.resize(BasicValues::GetLength());
- // TODO ?? 'InvariantValues().InforceLives' may be thought of as
- // counting potential inforce lives: it does not reflect lapses.
- // It should either reflect lapses or be renamed. Meanwhile,
- // InforceLivesBoy() and InforceLivesEoy() may be used where
- // lapses should be taken into account.
- if(yare_input_.UsePartialMortality)
- {
- double inforce_lives = yare_input_.NumberOfIdenticalLives;
- InvariantValues().InforceLives[0] = inforce_lives;
- for(int j = 0; j < BasicValues::GetLength(); ++j)
- {
- partial_mortality_q[j] = GetPartMortQ(j);
- inforce_lives *= 1.0 - partial_mortality_q[j];
- InvariantValues().InforceLives[1 + j] = inforce_lives;
- }
- }
- else
- {
- InvariantValues().InforceLives.assign
- (InvariantValues().InforceLives.size()
- ,yare_input_.NumberOfIdenticalLives
- );
- }
-
set_list_bill_year_and_month();
OverridingEePmts .resize(12 * BasicValues::GetLength());
@@ -460,6 +422,45 @@ void AccountValue::InitializeLife(mcenum_run_basis a_Basis)
InvariantValues().SpecAmt [0]
+ (TermIsDbFor7702 ? InvariantValues().TermSpecAmt[0] : 0.0)
;
+
+ // Iff partial mortality is used, save yearly values in a vector
+ // for use elsewhere in this class, and store yearly inforce lives
+ // (assuming no one ever lapses) in the invariant ledger object.
+ //
+ // A contract may be in force at the end of its maturity year,
+ // and it's necessary to treat it that way because other year-end
+ // composite values are multiplied by the number of lives inforce.
+ // Of course, a contract is not normally in force after maturity.
+
+ LMI_ASSERT
+ ( lmi::ssize(InvariantValues().InforceLives)
+ == 1 + BasicValues::GetLength()
+ );
+ partial_mortality_q.resize(BasicValues::GetLength());
+ // TODO ?? 'InvariantValues().InforceLives' may be thought of as
+ // counting potential inforce lives: it does not reflect lapses.
+ // It should either reflect lapses or be renamed. Meanwhile,
+ // InforceLivesBoy() and InforceLivesEoy() may be used where
+ // lapses should be taken into account.
+ if(yare_input_.UsePartialMortality)
+ {
+ double inforce_lives = yare_input_.NumberOfIdenticalLives;
+ InvariantValues().InforceLives[0] = inforce_lives;
+ for(int j = 0; j < BasicValues::GetLength(); ++j)
+ {
+ partial_mortality_q[j] = GetPartMortQ(j);
+ inforce_lives *= 1.0 - partial_mortality_q[j];
+ InvariantValues().InforceLives[1 + j] = inforce_lives;
+ }
+ }
+ else
+ {
+ InvariantValues().InforceLives.assign
+ (InvariantValues().InforceLives.size()
+ ,yare_input_.NumberOfIdenticalLives
+ );
+ }
+
// It is at best superfluous to do this for every basis.
// TAXATION !! Don't do that then.
Irc7702_->Initialize7702
- [lmi-commits] [lmi] master 4c54e90 02/14: Self test: explicitly specify product, (continued)
- [lmi-commits] [lmi] master 4c54e90 02/14: Self test: explicitly specify product, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master c2f6854 03/14: Self test: print more timings, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master ccb70ce 04/14: Self test: measure speed for 'finra' as well as 'ill_reg', Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master f6dfcf1 05/14: Filter out self-test timings, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 19be5c7 07/14: Don't initialize what's already been initialized, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 5dec884 01/14: Include appropriate headers, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master fa15960 06/14: Don't touch a ledger object before calling its Init(), Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 520bb97 14/14: Call ledger Init() less repeatedly [340], Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 74927c6 13/14: Eradicate 'EePmt' and 'ErPmt', Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master c017212 08/14: Make 'daily_interest_accounting' harder to overlook, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 80f3ab4 09/14: Don't touch a ledger object before calling its Init() (bis),
Greg Chicares <=
- [lmi-commits] [lmi] master 4a28bc2 10/14: Replace 'EePmt' (antediluvian), Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 9ba754c 11/14: Replace 'EePmt' and 'ErPmt' (production), Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 5827c93 12/14: No longer assign to 'EePmt' and 'ErPmt', Greg Chicares, 2020/08/29