Stan
2.5.0
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
stan
agrad
fwd
functions
logit.hpp
Go to the documentation of this file.
1
#ifndef STAN__AGRAD__FWD__FUNCTIONS__LOGIT_HPP
2
#define STAN__AGRAD__FWD__FUNCTIONS__LOGIT_HPP
3
4
#include <
stan/agrad/fwd/fvar.hpp
>
5
#include <
stan/meta/traits.hpp
>
6
#include <
stan/math/functions/logit.hpp
>
7
#include <
stan/math/functions/square.hpp
>
8
#include <
stan/math/constants.hpp
>
9
10
namespace
stan {
11
12
namespace
agrad {
13
14
template
<
typename
T>
15
inline
16
fvar<T>
17
logit
(
const
fvar<T>
& x) {
18
using
stan::math::logit
;
19
using
stan::math::square
;
20
using
stan::math::NOT_A_NUMBER
;
21
if
(x.
val_
> 1 || x.
val_
< 0)
22
return
fvar<T>
(
NOT_A_NUMBER
,
NOT_A_NUMBER
);
23
else
24
return
fvar<T>
(
logit
(x.
val_
), x.
d_
/ (x.
val_
-
square
(x.
val_
)));
25
}
26
}
27
}
28
#endif
stan::math::square
T square(const T x)
Return the square of the specified argument.
Definition:
square.hpp:22
stan::math::logit
boost::math::tools::promote_args< T >::type logit(const T a)
Returns the logit function applied to the argument.
Definition:
logit.hpp:44
stan::math::NOT_A_NUMBER
const double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition:
constants.hpp:53
logit.hpp
stan::agrad::fvar
Definition:
fvar.hpp:13
square.hpp
stan::agrad::square
fvar< T > square(const fvar< T > &x)
Definition:
square.hpp:15
traits.hpp
fvar.hpp
stan::agrad::logit
fvar< T > logit(const fvar< T > &x)
Definition:
logit.hpp:17
stan::agrad::fvar::d_
T d_
Definition:
fvar.hpp:16
constants.hpp
stan::agrad::fvar::val_
T val_
Definition:
fvar.hpp:15
[
Stan Home Page
]
© 2011–2014, Stan Development Team.