Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run-time model status flags #1

Open
AlePalu opened this issue Sep 7, 2023 · 0 comments
Open

Run-time model status flags #1

AlePalu opened this issue Sep 7, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@AlePalu
Copy link
Member

AlePalu commented Sep 7, 2023

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.

@AlePalu AlePalu added the enhancement New feature or request label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant