You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several optimizations can be turned on if we keep a run-time set of flags related to a model instance.
The idea would be to declare a public member struct runtime in ModelBase, and eventually enrich it as we move up in the model hierarchy. A model instance can then be queried at any point in the code for its run-time status.
A list of possible flags follow
flag
description
lambda_changed
tells whether a different value for the parameters' vector $\boldsymbol{\lambda}$ has been set. This can be easily detected in setters like set_lambda (and related more specific setters set_lambda_d and set_lambda_t), by checking if the given vector is equal to the currently stored one. If this is not the case, runtime.lambda_changed is set true.
R0_spec
can assume one between mass, identity, lumped to specify if the mass matrix $R_0$ should be returned as the full mass matrix, the identity matrix or the lumped mass matrix respectively. Supplied by the user.
weight_changed
tells, in WLS problems, or algorithms related to them, whether a different weight matrix $W$ has been supplied. Detectable from setter.
obs_changed
tells whether a different observation vector $\boldsymbol{y}$ has been set. Detectable from setter.
is_parallel
tells whether multithreading support is enabled. If so, algorithms for which a parallel implementation is available should be executed in their parallel version.
has_nan
tells wheter there are some missing entries in the observation vector. Currently this is provided by the has_nan() method, would be better to keep this information centralized. Detectable from set_data()
Checks could eventually rely on fast hash functions, which work on large chunks of data (avoiding possible expensive loops over large matrices/vectors).
Model implementations must then exploit the knowledge on the runtime configuration to eventually bypass computations, whenever this is possible.
The text was updated successfully, but these errors were encountered:
Several optimizations can be turned on if we keep a run-time set of flags related to a model instance.
The idea would be to declare a public member struct
runtime
inModelBase
, and eventually enrich it as we move up in the model hierarchy. A model instance can then be queried at any point in the code for its run-time status.A list of possible flags follow
lambda_changed
set_lambda
(and related more specific settersset_lambda_d
andset_lambda_t
), by checking if the given vector is equal to the currently stored one. If this is not the case,runtime.lambda_changed
is set true.R0_spec
mass
,identity
,lumped
to specify if the mass matrixweight_changed
obs_changed
is_parallel
has_nan
has_nan()
method, would be better to keep this information centralized. Detectable fromset_data()
Checks could eventually rely on fast hash functions, which work on large chunks of data (avoiding possible expensive loops over large matrices/vectors).
Model implementations must then exploit the knowledge on the runtime configuration to eventually bypass computations, whenever this is possible.
The text was updated successfully, but these errors were encountered: