Currently when there is an out of bounds error on a fims::Vector, the following error is returned:
fims::Vector out of bounds
We can improve the information of this error message by adding the name of the vector and including index and size information in the error.
To Do Items:
Example setting fims::Vector name:
for (size_t i = 0; i < this->slope.size(); i++) {
selectivity->slope[i] = this->slope[i].initial_value_m;
if (this->slope[i].estimation_type_m.get() == "fixed_effects") {
ss.str("");
ss << "Selectivity." << this->id << ".slope." << this->slope[i].id_m;
info->RegisterParameterName(ss.str());
info->RegisterParameter(selectivity->slope[i]);
}
if (this->slope[i].estimation_type_m.get() == "random_effects") {
ss.str("");
ss << "Selectivity." << this->id << ".slope." << this->slope[i].id_m;
info->RegisterRandomEffectName(ss.str());
info->RegisterRandomEffect(selectivity->slope[i]);
}
}
The above original code can be modified to:
ss.str("");
ss << "Selectivity." << this->id << ".slope
selectivity->slope.set_variable_name(ss.str());
for (size_t i = 0; i < this->slope.size(); i++) {
selectivity->slope[i] = this->slope[i].initial_value_m;
ss << "." << this->slope[i].id_m;
if (this->slope[i].estimation_type_m.get() == "fixed_effects") {
info->RegisterParameterName(ss.str());
info->RegisterParameter(selectivity->slope[i]);
}
if (this->slope[i].estimation_type_m.get() == "random_effects") {
info->RegisterRandomEffectName(ss.str());
info->RegisterRandomEffect(selectivity->slope[i]);
}
}
Currently when there is an out of bounds error on a fims::Vector, the following error is returned:
We can improve the information of this error message by adding the name of the vector and including index and size information in the error.
To Do Items:
variable_name_mto fims::Vector class (file)set_variable_namemethod in fims::Vector class to set the nameinline Type &operator[](size_t pos)andinline const Type &operator[](size_t n)to include the name of the fims::Vector, the total size of the vector, and the index (subtract 1 to convert to R) throwing the error.Example setting fims::Vector name:
The above original code can be modified to: