File: cptvsdrow.cc

package info (click to toggle)
simrisc 16.06.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,889; fortran: 669; makefile: 112; ansic: 112; sh: 107
file content (30 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#define XERR
#include "survival.ih"

    // determine the row of d_vsdMatrix to use by locating the row in s3
    // containing 'diameter' in its ProbGrooup.end() value. Then compute
    // the lowest column index in that row exceeding a random proportion
    // value. That index becomes d_vsdRow.
RowCol Survival::cptVSDrow(double diameter)
{
    // if diameter > 100 the last line in S3 must be used. probIndexOf uses
    // 101 as end-value because that's an end-age and probGroups are normally
    // based on ages.
    // Therefore, if diameter > 100 100 is passed to probIndexOf
    // resulting in the last line of S3 being used.

                // S3's row (first) and S3's column (second)
    RowCol rowCol = ProbGroup::probIndexOf(
                                    d_s3,
                                    diameter > 100 ? 100 : diameter,
                                    Random::instance().uniformVSD()
                                );

    d_vsdRow = rowCol.second;

    g_log << "      Survival::cptVSDRow: S3 row = " << d_vsdRow <<
                                        " for diameter " << diameter << '\n';

    return rowCol;
}