Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea-Havron-NOAA committed Jun 1, 2024
1 parent 083ca6e commit 64ecf39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "../../common/model_object.hpp"
#include "../../interface/interface.hpp"
#include "../../common/fims_vector.hpp"
#include "../../common/fims_math.hpp"

namespace fims_distributions {

Expand Down
9 changes: 6 additions & 3 deletions inst/include/distributions/functors/lognormal_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ namespace fims_distributions
fims::Vector<Type> mu;
fims::Vector<Type> sd;
std::vector<bool> is_na;
#ifdef TMB_MODEL
::objective_function<Type> *of;
#endif
Type nll = 0.0;
// data_indicator<tmbutils::vector<Type> , Type> keep;

Expand Down Expand Up @@ -44,11 +47,11 @@ namespace fims_distributions

if (log_sd.size() == 1)
{
sd[i] = exp(log_sd[0]);
sd[i] = fims_math::exp(log_sd[0]);
}
else
{
sd[i] = exp(log_sd[i]);
sd[i] = fims_math::exp(log_sd[i]);
}
}
this->nll_vec.resize(this->observed_values.size());
Expand All @@ -65,7 +68,7 @@ namespace fims_distributions
FIMS_SIMULATE_F(this->of)
{ // preprocessor definition in interface.hpp
// this simulates data that is mean biased
this->observed_values[i] = exp(rnorm(mu[i], sd[i]));
this->observed_values[i] = fims_math::exp(rnorm(mu[i], sd[i]));
}
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions inst/include/distributions/functors/normal_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ struct NormalLPDF : public DensityComponentBase<Type> {
this->mu[i] = this->expected_values[i];
}
if(log_sd.size() == 1){
sd[i] = exp(log_sd[0]);
sd[i] = fims_math::exp(log_sd[0]);
} else {
sd[i] = exp(log_sd[i]);
sd[i] = fims_math::exp(log_sd[i]);
}
}
this->nll_vec.resize(this->observed_values.size());
Expand Down

0 comments on commit 64ecf39

Please sign in to comment.