Skip to content

Commit

Permalink
fix return const double
Browse files Browse the repository at this point in the history
  • Loading branch information
armstrtw committed Jun 24, 2014
1 parent 517d5c1 commit bf015b1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions cppbugs/mcmc.arma.extensions.hpp
Expand Up @@ -205,17 +205,17 @@ namespace arma {
return eOp<T1, eop_scalar_times>(X.get_ref(),k); // NOTE: order is swapped
}

const double schur(const int x, const double y) { return x * y; }
const double schur(const double x, const int y) { return x * y; }
const double schur(const double& x, const double& y) { return x * y; }
const double schur(const int& x, const int& y) { return x * y; }
double schur(const int x, const double y) { return x * y; }
double schur(const double x, const int y) { return x * y; }
double schur(const double& x, const double& y) { return x * y; }
double schur(const int& x, const int& y) { return x * y; }

// insert an 'any' function for bools into the arma namespace
const bool any(const bool x) {
bool any(const bool x) {
return x;
}

const bool vectorise(bool x) {
bool vectorise(bool x) {
return x;
}
} // namespace arma
Expand Down
2 changes: 1 addition & 1 deletion cppbugs/mcmc.model.hpp
Expand Up @@ -71,7 +71,7 @@ namespace cppbugs {
return bad_logp(value) || log(rng_.uniform()) > (value - old_logp) ? true : false;
}

const double logp() const {
double logp() const {
double ans(0);
for(auto node : stochastic_nodes) {
ans += node->loglik();
Expand Down
4 changes: 2 additions & 2 deletions cppbugs/mcmc.stochastic.1p.family.hpp
Expand Up @@ -37,7 +37,7 @@ namespace cppbugs {
~Stochastic1p() {
if(destory_p1_) { delete &p1_; }
}
const double loglik() const { return LOGLIKFUN(DynamicStochastic<T>::value,p1_); }
double loglik() const { return LOGLIKFUN(DynamicStochastic<T>::value,p1_); }
};

template<typename T, typename U, double LOGLIKFUN(const T&, const U&)>
Expand All @@ -51,7 +51,7 @@ namespace cppbugs {
~ObservedStochastic1p() {
if(destory_p1_) { delete &p1_; }
}
const double loglik() const { return LOGLIKFUN(Observed<T>::value,p1_); }
double loglik() const { return LOGLIKFUN(Observed<T>::value,p1_); }
};

} // namespace cppbugs
Expand Down
4 changes: 2 additions & 2 deletions cppbugs/mcmc.stochastic.2p.family.hpp
Expand Up @@ -41,7 +41,7 @@ namespace cppbugs {
if(destory_p1_) { delete &p1_; }
if(destory_p2_) { delete &p2_; }
}
const double loglik() const { return LOGLIKFUN(DynamicStochastic<T>::value,p1_,p2_); }
double loglik() const { return LOGLIKFUN(DynamicStochastic<T>::value,p1_,p2_); }
};

template<typename T, typename U, typename V, double LOGLIKFUN(const T&, const U&, const V&)>
Expand All @@ -61,7 +61,7 @@ namespace cppbugs {
if(destory_p1_) { delete &p1_; }
if(destory_p2_) { delete &p2_; }
}
const double loglik() const { return LOGLIKFUN(Observed<T>::value,p1_,p2_); }
double loglik() const { return LOGLIKFUN(Observed<T>::value,p1_,p2_); }
};

} // namespace cppbugs
Expand Down
2 changes: 1 addition & 1 deletion cppbugs/mcmc.stochastic.hpp
Expand Up @@ -27,7 +27,7 @@ namespace cppbugs {
public:
Stochastic() {}
~Stochastic() {}
virtual const double loglik() const = 0;
virtual double loglik() const = 0;
};

} // namespace cppbugs
Expand Down

0 comments on commit bf015b1

Please sign in to comment.