17#include "../interface/interface.hpp"
31inline const Type exp(
const Type &x) {
42inline const Type log(
const Type &x) {
47inline const Type cos(
const Type &x) {
52inline const Type sqrt(
const Type &x) {
57inline const Type pow(
const Type &x,
const Type &y) {
58 return std::pow(x, y);
62inline const Type lgamma(
const Type &x) {
63 return std::lgamma(x);
85inline const Type exp(
const Type &x) {
104inline const Type log(
const Type &x) {
123inline const Type cos(
const Type &x) {
141inline const Type sqrt(
const Type &x) {
160inline const Type pow(
const Type &x,
const Type &y) {
182inline const Type lgamma(
const Type &x) {
208inline const Type
logistic(
const Type &inflection_point,
const Type &slope,
210 return static_cast<Type
>(1.0) /
211 (
static_cast<Type
>(1.0) +
212 exp(Type(-1.0) * slope * (x - inflection_point)));
226inline const Type
logit(
const Type &a,
const Type &b,
const Type &x) {
227 return -fims_math::log(b - x) + fims_math::log(x - a);
241inline const Type
inv_logit(
const Type &a,
const Type &b,
const Type &logit_x) {
242 return a + (b - a) / (
static_cast<Type
>(1.0) + fims_math::exp(-logit_x));
267 const Type &slope_asc,
268 const Type &inflection_point_desc,
269 const Type &slope_desc,
const Type &x) {
270 return (
static_cast<Type
>(1.0)) /
271 (
static_cast<Type
>(1.0) +
272 exp(Type(-1.0) * slope_asc * (x - inflection_point_asc))) *
273 (
static_cast<Type
>(1.0) -
274 (
static_cast<Type
>(1.0)) /
275 (
static_cast<Type
>(1.0) +
276 exp(Type(-1.0) * slope_desc * (x - inflection_point_desc))));
293const Type
ad_fabs(
const Type &x, Type C = 1e-5) {
294 return sqrt((x * x) + C);
312template <
typename Type>
313inline const Type
ad_min(
const Type &a,
const Type &b, Type C = 1e-5) {
329template <
typename Type>
330inline const Type
ad_max(
const Type &a,
const Type &b, Type C = 1e-5) {
343T
sum(
const std::vector<T> &v) {
345 for (
size_t i = 0; i < v.size(); i++) {
362 for (
size_t i = 0; i < v.
size(); i++) {
Definition fims_vector.hpp:27
size_type size() const
Returns the number of elements.
Definition fims_vector.hpp:273
const Type logit(const Type &a, const Type &b, const Type &x)
A logit function for bounding of parameters.
Definition fims_math.hpp:226
T sum(const std::vector< T > &v)
Definition fims_math.hpp:343
const Type ad_min(const Type &a, const Type &b, Type C=1e-5)
Definition fims_math.hpp:313
const Type double_logistic(const Type &inflection_point_asc, const Type &slope_asc, const Type &inflection_point_desc, const Type &slope_desc, const Type &x)
The general double logistic function.
Definition fims_math.hpp:266
const Type ad_max(const Type &a, const Type &b, Type C=1e-5)
Definition fims_math.hpp:330
const Type inv_logit(const Type &a, const Type &b, const Type &logit_x)
An inverse logit function for bounding of parameters.
Definition fims_math.hpp:241
const Type ad_fabs(const Type &x, Type C=1e-5)
Definition fims_math.hpp:293
const Type logistic(const Type &inflection_point, const Type &slope, const Type &x)
The general logistic function.
Definition fims_math.hpp:208
Establishes the FIMS Vector class.