17#include "../interface/interface.hpp"
32inline const Type exp(
const Type &x) {
43inline const Type log(
const Type &x) {
48inline const Type cos(
const Type &x) {
53inline const Type sqrt(
const Type &x) {
58inline const Type pow(
const Type &x,
const Type &y) {
59 return std::pow(x, y);
63inline const Type lgamma(
const Type &x) {
64 return std::lgamma(x);
67inline double Value(
const double &x) {
return x; }
72inline double Value(
const TMBAD_FIMS_TYPE &x) {
return x.Value(); }
74inline double Value(
const double &x) {
return x; }
92inline const Type exp(
const Type &x) {
111inline const Type log(
const Type &x) {
130inline const Type cos(
const Type &x) {
148inline const Type sqrt(
const Type &x) {
167inline const Type pow(
const Type &x,
const Type &y) {
189inline const Type lgamma(
const Type &x) {
215inline const Type
logistic(
const Type &inflection_point,
const Type &slope,
217 return static_cast<Type
>(1.0) /
218 (
static_cast<Type
>(1.0) +
219 exp(Type(-1.0) * slope * (x - inflection_point)));
233inline const Type
logit(
const Type &a,
const Type &b,
const Type &x) {
234 return -fims_math::log(b - x) + fims_math::log(x - a);
248inline const Type
inv_logit(
const Type &a,
const Type &b,
const Type &logit_x) {
249 return a + (b - a) / (
static_cast<Type
>(1.0) + fims_math::exp(-logit_x));
274 const Type &slope_asc,
275 const Type &inflection_point_desc,
276 const Type &slope_desc,
const Type &x) {
277 return (
static_cast<Type
>(1.0)) /
278 (
static_cast<Type
>(1.0) +
279 exp(Type(-1.0) * slope_asc * (x - inflection_point_asc))) *
280 (
static_cast<Type
>(1.0) -
281 (
static_cast<Type
>(1.0)) /
282 (
static_cast<Type
>(1.0) +
283 exp(Type(-1.0) * slope_desc * (x - inflection_point_desc))));
300const Type
ad_fabs(
const Type &x, Type C = 1e-5) {
301 return sqrt((x * x) + C);
319template <
typename Type>
320inline const Type
ad_min(
const Type &a,
const Type &b, Type C = 1e-5) {
336template <
typename Type>
337inline const Type
ad_max(
const Type &a,
const Type &b, Type C = 1e-5) {
350T
sum(
const std::vector<T> &v) {
352 for (
size_t i = 0; i < v.size(); i++) {
369 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:299
Platform macros and the core FIMS logging system.
const Type logit(const Type &a, const Type &b, const Type &x)
A logit function for bounding of parameters.
Definition fims_math.hpp:233
T sum(const std::vector< T > &v)
Definition fims_math.hpp:350
const Type ad_min(const Type &a, const Type &b, Type C=1e-5)
Definition fims_math.hpp:320
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:273
const Type ad_max(const Type &a, const Type &b, Type C=1e-5)
Definition fims_math.hpp:337
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:248
const Type ad_fabs(const Type &x, Type C=1e-5)
Definition fims_math.hpp:300
const Type logistic(const Type &inflection_point, const Type &slope, const Type &x)
The general logistic function.
Definition fims_math.hpp:215
Establishes the FIMS Vector class.