Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::RelativeRiskLookup Class Reference

Defines the relative risk factors lookup data type. More...

#include <relative_risk.h>

Public Member Functions

 RelativeRiskLookup ()=delete
 
 RelativeRiskLookup (const MonotonicVector< int > &rows, const MonotonicVector< float > &cols, core::FloatArray2D &&values)
 Initialises a new instance of the RelativeRiskLookup class. More...
 
std::size_t size () const noexcept
 Gets the number of elements in the lookup dataset. More...
 
std::size_t rows () const noexcept
 Gets the number of rows lookup breakpoints. More...
 
std::size_t columns () const noexcept
 Gets the number of columns lookup breakpoints. More...
 
bool empty () const noexcept
 Checks if the lookup has no data. More...
 
float at (const int age, const float value) const
 Lookup a value at specific breakpoints with bounds checking. More...
 
float operator() (const int age, const float value) const
 Lookup a value at specific breakpoints with bounds checking. More...
 
bool contains (const int age, const float value) const noexcept
 Checks if the lookup contains a value with specific breakpoints. More...
 

Detailed Description

Defines the relative risk factors lookup data type.

Note
When a lookup value does not exists at the exact breakpoint values provided, a data at bound value or a linear interpolated value is returned for the operation.

Constructor & Destructor Documentation

◆ RelativeRiskLookup() [1/2]

hgps::RelativeRiskLookup::RelativeRiskLookup ( )
delete

◆ RelativeRiskLookup() [2/2]

hgps::RelativeRiskLookup::RelativeRiskLookup ( const MonotonicVector< int > &  rows,
const MonotonicVector< float > &  cols,
core::FloatArray2D &&  values 
)

Initialises a new instance of the RelativeRiskLookup class.

Parameters
rowsThe rows lookup breakpoints
colsThe columns lookup breakpoints
valuesThe lookup data values
Exceptions
std::out_of_rangefor lookup breakpoints and values size mismatch.
Here is the call graph for this function:

Member Function Documentation

◆ at()

float hgps::RelativeRiskLookup::at ( const int  age,
const float  value 
) const

Lookup a value at specific breakpoints with bounds checking.

Parameters
ageThe row value
valueThe column value
Returns
The lookup value
Exceptions
std::out_of_rangefor row breakpoint value outside of the bounds.

◆ columns()

std::size_t hgps::RelativeRiskLookup::columns ( ) const
noexcept

Gets the number of columns lookup breakpoints.

Returns
Number of columns
Here is the call graph for this function:

◆ contains()

bool hgps::RelativeRiskLookup::contains ( const int  age,
const float  value 
) const
noexcept

Checks if the lookup contains a value with specific breakpoints.

Parameters
ageThe row value
valueThe column value
Returns
true if there is such a value; otherwise, false.

◆ empty()

bool hgps::RelativeRiskLookup::empty ( ) const
noexcept

Checks if the lookup has no data.

Returns
true if the lookup data is empty; otherwise, false.

◆ operator()()

float hgps::RelativeRiskLookup::operator() ( const int  age,
const float  value 
) const

Lookup a value at specific breakpoints with bounds checking.

Parameters
ageThe row value
valueThe column value
Returns
The lookup value
Exceptions
std::out_of_rangefor row breakpoint value outside of the bounds.

◆ rows()

std::size_t hgps::RelativeRiskLookup::rows ( ) const
noexcept

Gets the number of rows lookup breakpoints.

Returns
Number of rows
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

std::size_t hgps::RelativeRiskLookup::size ( ) const
noexcept

Gets the number of elements in the lookup dataset.

Returns
Number of lookup elements.
Here is the call graph for this function:

The documentation for this class was generated from the following files: