Stan Math Library  2.20.0
reverse mode automatic differentiation
Classes | Functions | Variables
stan::math::internal Namespace Reference

Classes

class  acos_vari
 
class  acosh_vari
 
class  add_vd_vari
 
class  add_vv_vari
 
class  asin_vari
 
class  asinh_vari
 
class  atan2_dv_vari
 
class  atan2_vd_vari
 
class  atan2_vv_vari
 
class  atan_vari
 
class  atanh_vari
 
class  bessel_first_kind_dv_vari
 
class  bessel_second_kind_dv_vari
 
class  beta_dv_vari
 
class  beta_vd_vari
 
class  beta_vv_vari
 
class  binary_log_loss_0_vari
 
class  binary_log_loss_1_vari
 
struct  bounded
 
struct  bounded< T_y, T_low, T_high, true >
 
class  broadcast_array
 
class  cbrt_vari
 
class  ceil_vari
 
struct  compute_dims
 Compute the dimensionality of the given template argument. More...
 
struct  compute_dims< double >
 Compute the dimensionality of the given template argument. More...
 
struct  compute_dims< Eigen::Matrix< T, R, C > >
 compute the dimensionality of the given template argument. More...
 
struct  compute_dims< std::vector< T > >
 Compute the dimensionality of the given template argument. More...
 
class  cos_vari
 
class  cosh_vari
 
class  decrement_vari
 
class  determinant_vari
 
class  digamma_vari
 
class  divide_dv_vari
 
class  divide_vd_vari
 
class  divide_vv_vari
 
struct  dot_product_store_type
 
struct  dot_product_store_type< double >
 
struct  dot_product_store_type< var >
 
class  dot_product_vari
 
class  dot_self_vari
 
class  empty_broadcast_array
 
class  empty_broadcast_array< ViewElt, Eigen::Matrix< OpElt, R, C > >
 
class  erf_vari
 
class  erfc_vari
 
class  exp2_vari
 
class  exp_vari
 
class  expm1_vari
 
class  falling_factorial_vd_vari
 
class  fdim_dv_vari
 
class  fdim_vd_vari
 
class  fdim_vv_vari
 
struct  finite
 
struct  finite< Eigen::Matrix< T, R, C >, true >
 
struct  finite< T_y, true >
 
class  floor_vari
 
class  fma_ddv_vari
 
class  fma_vdd_vari
 
class  fma_vdv_vari
 
class  fma_vvd_vari
 
class  fma_vvv_vari
 
class  fmod_dv_vari
 
class  fmod_vd_vari
 
class  fmod_vv_vari
 
class  gamma_p_dv_vari
 
class  gamma_p_vd_vari
 
class  gamma_p_vv_vari
 
class  gamma_q_dv_vari
 
class  gamma_q_vd_vari
 
class  gamma_q_vv_vari
 
struct  greater
 
struct  greater< T_y, T_low, true >
 
struct  greater_or_equal
 
struct  greater_or_equal< T_y, T_low, true >
 
class  hypot_vd_vari
 
class  hypot_vv_vari
 
class  ibeta_ddv_vari
 
class  ibeta_dvd_vari
 
class  ibeta_dvv_vari
 
class  ibeta_vdd_vari
 
class  ibeta_vdv_vari
 
class  ibeta_vvd_vari
 
class  ibeta_vvv_vari
 
class  inc_beta_vvv_vari
 
class  increment_vari
 
class  index_comparator
 
class  inv_cloglog_vari
 
class  inv_logit_vari
 
class  inv_Phi_vari
 
class  inv_sqrt_vari
 
class  inv_square_vari
 
class  inv_vari
 
class  lbeta_dv_vari
 
class  lbeta_vd_vari
 
class  lbeta_vv_vari
 
struct  less
 
struct  less< T_y, T_high, true >
 
struct  less_or_equal
 
struct  less_or_equal< T_y, T_high, true >
 
class  lgamma_vari
 
class  lmgamma_dv_vari
 
class  log10_vari
 
class  log1m_exp_v_vari
 
class  log1m_vari
 
class  log1p_exp_v_vari
 
class  log1p_vari
 
class  log2_vari
 
class  log_det_ldlt_vari
 Returns the log det of the matrix whose LDLT factorization is given See The Matrix Cookbook's chapter on Derivatives of a Determinant In this case, it is just the inverse of the underlying matrix. More...
 
class  log_diff_exp_dv_vari
 
class  log_diff_exp_vd_vari
 
class  log_diff_exp_vv_vari
 
class  log_falling_factorial_dv_vari
 
class  log_falling_factorial_vd_vari
 
class  log_falling_factorial_vv_vari
 
class  log_inv_logit_diff_dv_vari
 
class  log_inv_logit_diff_vd_vari
 
class  log_inv_logit_diff_vv_vari
 
class  log_rising_factorial_dv_vari
 
class  log_rising_factorial_vd_vari
 
class  log_rising_factorial_vv_vari
 
class  log_softmax_elt_vari
 
class  log_sum_exp_dv_vari
 
class  log_sum_exp_matrix_vari
 
class  log_sum_exp_vd_vari
 
class  log_sum_exp_vector_vari
 
class  log_sum_exp_vv_vari
 
class  log_vari
 
class  map_rect_combine
 
class  map_rect_reduce
 
class  map_rect_reduce< F, double, double >
 
struct  map_rect_reduce< F, double, var >
 
struct  map_rect_reduce< F, var, double >
 
struct  map_rect_reduce< F, var, var >
 
class  mdivide_left_dv_vari
 
class  mdivide_left_ldlt_alloc
 
class  mdivide_left_ldlt_dv_vari
 The vari for mdivide_left_ldlt(A, b) which handles the chain() call for all elements of the result. More...
 
class  mdivide_left_ldlt_vd_vari
 The vari for mdivide_left_ldlt(A, b) which handles the chain() call for all elements of the result. More...
 
class  mdivide_left_ldlt_vv_vari
 The vari for mdivide_left_ldlt(A, b) which handles the chain() call for all elements of the result. More...
 
class  mdivide_left_spd_alloc
 
class  mdivide_left_spd_dv_vari
 
class  mdivide_left_spd_vd_vari
 
class  mdivide_left_spd_vv_vari
 
class  mdivide_left_tri_dv_vari
 
class  mdivide_left_tri_vd_vari
 
class  mdivide_left_tri_vv_vari
 
class  mdivide_left_vd_vari
 
class  mdivide_left_vv_vari
 
class  modified_bessel_first_kind_dv_vari
 
class  modified_bessel_second_kind_dv_vari
 
class  multiply_log_dv_vari
 
class  multiply_log_vd_vari
 
class  multiply_log_vv_vari
 
class  multiply_vd_vari
 
class  multiply_vv_vari
 
class  neg_vari
 
struct  nonnegative
 
struct  nonnegative< T_y, true >
 
struct  not_nan
 
struct  not_nan< T_y, true >
 
class  ops_partials_edge
 An edge holds both the operands and its associated partial derivatives. More...
 
class  ops_partials_edge< double, Eigen::Matrix< var, R, C > >
 
class  ops_partials_edge< double, std::vector< Eigen::Matrix< var, R, C > > >
 
class  ops_partials_edge< double, std::vector< std::vector< var > > >
 
class  ops_partials_edge< double, std::vector< var > >
 
class  ops_partials_edge< double, var >
 
class  ops_partials_edge< Dx, Eigen::Matrix< fvar< Dx >, R, C > >
 
class  ops_partials_edge< Dx, fvar< Dx > >
 
class  ops_partials_edge< Dx, std::vector< Eigen::Matrix< fvar< Dx >, R, C > > >
 
class  ops_partials_edge< Dx, std::vector< fvar< Dx > > >
 
class  ops_partials_edge< Dx, std::vector< std::vector< fvar< Dx > > > >
 
class  ops_partials_edge< ViewElt, Eigen::Matrix< Op, R, C > >
 
class  ops_partials_edge< ViewElt, std::vector< Eigen::Matrix< Op, R, C > > >
 
class  ops_partials_edge< ViewElt, std::vector< std::vector< Op > > >
 
class  ordered_constrain_op
 
class  owens_t_dv_vari
 
class  owens_t_vd_vari
 
class  owens_t_vv_vari
 
class  Phi_vari
 
class  positive_ordered_constrain_op
 
class  pow_dv_vari
 
class  pow_vd_vari
 
class  pow_vv_vari
 
class  quad_form_vari
 
class  quad_form_vari_alloc
 
class  rising_factorial_vd_vari
 
class  round_vari
 
class  simplex_constrain_op
 
class  sin_vari
 
class  sinh_vari
 
class  softmax_op
 
class  sqrt_vari
 
class  square_vari
 
class  squared_distance_vd_vari
 
class  squared_distance_vv_vari
 
class  subtract_dv_vari
 
class  subtract_vd_vari
 
class  subtract_vv_vari
 
class  tan_vari
 
class  tanh_vari
 
class  tgamma_vari
 
class  trace_gen_quad_form_vari
 
class  trace_gen_quad_form_vari_alloc
 
class  trace_inv_quad_form_ldlt_impl
 
class  trace_inv_quad_form_ldlt_vari
 
class  trace_quad_form_vari
 
class  trace_quad_form_vari_alloc
 
class  trunc_vari
 
class  unit_vector_elt_vari
 

Functions

char * eight_byte_aligned_malloc (size_t size)
 
double notNan (double x)
 
size_t fft_next_good_size (size_t N)
 Find the optimal next size for the FFT so that a minimum number of zeros are padded. More...
 
template<typename T , int R, int C>
void resize (Eigen::Matrix< T, R, C > &x, const std::vector< int > &dims, int pos)
 
template<typename T >
void resize (T, const std::vector< int > &, int)
 
template<typename T >
void resize (std::vector< T > &x, const std::vector< int > &dims, int pos)
 
int get_num_threads (int num_jobs)
 Get number of threads to use for num_jobs jobs. More...
 
template<int call_id, typename F , typename T_shared_param , typename T_job_param >
Eigen::Matrix< typename stan::return_type< T_shared_param, T_job_param >::type, Eigen::Dynamic, 1 > map_rect_concurrent (const Eigen::Matrix< T_shared_param, Eigen::Dynamic, 1 > &shared_params, const std::vector< Eigen::Matrix< T_job_param, Eigen::Dynamic, 1 >> &job_params, const std::vector< std::vector< double >> &x_r, const std::vector< std::vector< int >> &x_i, std::ostream *msgs=nullptr)
 
template<class RNG >
Eigen::VectorXd multi_normal_semidefinite_rng (const Eigen::VectorXd &mu, const Eigen::LDLT< Eigen::MatrixXd > &S_ldlt, RNG &rng)
 Return a multivariate normal random variate with the given location and covariance using the specified random number generator. More...
 
template<class RNG >
Eigen::VectorXd multi_normal_definite_rng (const Eigen::VectorXd &mu, const Eigen::LLT< Eigen::MatrixXd > &S_llt, RNG &rng)
 Return a multivariate normal random variate with the given location and covariance using the specified random number generator. More...
 
double log_sum_exp_as_double (const std::vector< var > &x)
 
void set_lower_tri_coeff_ref (Eigen::Matrix< var, -1, -1 > &L, vari **vari_ref)
 Set the lower right triangular of a var matrix given a set of vari**. More...
 
template<int R, int C>
double log_sum_exp_as_double (const Eigen::Matrix< var, R, C > &x)
 
var calc_sd (size_t size, const var *dtrs)
 
var calc_variance (size_t size, const var *dtrs)
 
template<class F , class Tuple , std::size_t... I>
constexpr auto apply_impl (const F &f, const Tuple &t, std::index_sequence< I... > i)
 Invoke the functor f with arguments given in t and indexed in the index sequence I. More...
 
template<class F , class Tuple >
constexpr auto apply (const F &f, const Tuple &t)
 Call the functor f with the tuple of arguments t, like: More...
 
template<size_t size>
void build_y_adj (vari **y_vi, const std::array< int, size > &M, double &y_adj)
 Store the adjoint in y_vi[0] in y_adj. More...
 
template<size_t size>
void build_y_adj (vari **y_vi, const std::array< int, size > &M, std::vector< double > &y_adj)
 Store the adjoints from y_vi in y_adj. More...
 
template<size_t size, int R, int C>
void build_y_adj (vari **y_vi, const std::array< int, size > &M, Eigen::Matrix< double, R, C > &y_adj)
 Store the adjoints from y_vi in y_adj. More...
 
double ibeta_hypergeometric_helper (double a, double b, double z, double precision=1e-8, double max_steps=1000)
 Calculates the generalized hypergeometric 3F2(a, a, b; a + 1, a + 1; z). More...
 

Variables

const size_t DEFAULT_INITIAL_NBYTES = 1 << 16
 

Function Documentation

◆ apply()

template<class F , class Tuple >
constexpr auto stan::math::internal::apply ( const F &  f,
const Tuple &  t 
)

Call the functor f with the tuple of arguments t, like:

f(std::get<0>(t), std::get<1>(t), ...)

TODO: replace this with implementation in C++ std when C++17 is available

Template Parameters
FType of functor
TupleType of tuple containing arguments
Parameters
ffunctor callable
ttuple of arguments

Definition at line 47 of file adj_jac_apply.hpp.

◆ apply_impl()

template<class F , class Tuple , std::size_t... I>
constexpr auto stan::math::internal::apply_impl ( const F &  f,
const Tuple &  t,
std::index_sequence< I... >  i 
)

Invoke the functor f with arguments given in t and indexed in the index sequence I.

Template Parameters
FType of functor
TupleType of tuple containing arguments
IIndex sequence going from 0 to std::tuple_size<T>::value - 1 inclusive
Parameters
ffunctor callable
ttuple of arguments
iplaceholder variable for index sequence

Definition at line 29 of file adj_jac_apply.hpp.

◆ build_y_adj() [1/3]

template<size_t size>
void stan::math::internal::build_y_adj ( vari **  y_vi,
const std::array< int, size > &  M,
double &  y_adj 
)

Store the adjoint in y_vi[0] in y_adj.

Template Parameters
sizedimensionality of M
Parameters
[in]y_vipointer to pointer to vari
[in]M
[out]y_adjreference to variable where adjoint is to be stored

Definition at line 60 of file adj_jac_apply.hpp.

◆ build_y_adj() [2/3]

template<size_t size>
void stan::math::internal::build_y_adj ( vari **  y_vi,
const std::array< int, size > &  M,
std::vector< double > &  y_adj 
)

Store the adjoints from y_vi in y_adj.

Template Parameters
sizedimensionality of M
Parameters
[in]y_vipointer to pointers to varis
[in]Mshape of y_adj
[out]y_adjreference to std::vector where adjoints are to be stored

Definition at line 73 of file adj_jac_apply.hpp.

◆ build_y_adj() [3/3]

template<size_t size, int R, int C>
void stan::math::internal::build_y_adj ( vari **  y_vi,
const std::array< int, size > &  M,
Eigen::Matrix< double, R, C > &  y_adj 
)

Store the adjoints from y_vi in y_adj.

Template Parameters
sizedimensionality of M
Parameters
[in]y_vipointer to pointers to varis
[in]Mshape of y_adj
[out]y_adjreference to Eigen::Matrix where adjoints are to be stored

Definition at line 89 of file adj_jac_apply.hpp.

◆ calc_sd()

var stan::math::internal::calc_sd ( size_t  size,
const var dtrs 
)
inline

Definition at line 19 of file sd.hpp.

◆ calc_variance()

var stan::math::internal::calc_variance ( size_t  size,
const var dtrs 
)
inline

Definition at line 15 of file variance.hpp.

◆ eight_byte_aligned_malloc()

char* stan::math::internal::eight_byte_aligned_malloc ( size_t  size)
inline

Definition at line 38 of file stack_alloc.hpp.

◆ fft_next_good_size()

size_t stan::math::internal::fft_next_good_size ( size_t  N)
inline

Find the optimal next size for the FFT so that a minimum number of zeros are padded.

Definition at line 17 of file autocorrelation.hpp.

◆ get_num_threads()

int stan::math::internal::get_num_threads ( int  num_jobs)
inline

Get number of threads to use for num_jobs jobs.

The function uses the environment variable STAN_NUM_THREADS and follows these conventions:

  • STAN_NUM_THREADS is not defined => num_threads=1
  • STAN_NUM_THREADS is positive => num_threads is set to the specified number
  • STAN_NUM_THREADS is set to -1 => num_threads is the number of available cores on the machine
  • STAN_NUM_THREADS < -1, STAN_NUM_THREADS = 0 or STAN_NUM_THREADS is not numeric => throws an exception

Should num_threads exceed the number of jobs, then num_threads will be set equal to the number of jobs.

Parameters
num_jobsnumber of jobs
Returns
number of threads to use
Exceptions
std::runtime_errorif the value of STAN_NUM_THREADS env. variable is invalid

Definition at line 39 of file map_rect_concurrent.hpp.

◆ ibeta_hypergeometric_helper()

double stan::math::internal::ibeta_hypergeometric_helper ( double  a,
double  b,
double  z,
double  precision = 1e-8,
double  max_steps = 1000 
)
inline

Calculates the generalized hypergeometric 3F2(a, a, b; a + 1, a + 1; z).

Handles negative values of b properly.

Definition at line 19 of file ibeta.hpp.

◆ log_sum_exp_as_double() [1/2]

double stan::math::internal::log_sum_exp_as_double ( const std::vector< var > &  x)
inline

Definition at line 14 of file log_sum_exp.hpp.

◆ log_sum_exp_as_double() [2/2]

template<int R, int C>
double stan::math::internal::log_sum_exp_as_double ( const Eigen::Matrix< var, R, C > &  x)
inline

Definition at line 20 of file log_sum_exp.hpp.

◆ map_rect_concurrent()

template<int call_id, typename F , typename T_shared_param , typename T_job_param >
Eigen::Matrix< typename stan::return_type< T_shared_param, T_job_param >::type, Eigen::Dynamic, 1 > stan::math::internal::map_rect_concurrent ( const Eigen::Matrix< T_shared_param, Eigen::Dynamic, 1 > &  shared_params,
const std::vector< Eigen::Matrix< T_job_param, Eigen::Dynamic, 1 >> &  job_params,
const std::vector< std::vector< double >> &  x_r,
const std::vector< std::vector< int >> &  x_i,
std::ostream *  msgs = nullptr 
)

Definition at line 23 of file map_rect_concurrent.hpp.

◆ multi_normal_definite_rng()

template<class RNG >
Eigen::VectorXd stan::math::internal::multi_normal_definite_rng ( const Eigen::VectorXd &  mu,
const Eigen::LLT< Eigen::MatrixXd > &  S_llt,
RNG &  rng 
)
inline

Return a multivariate normal random variate with the given location and covariance using the specified random number generator.

No error checking or templating, takes the LLT directly to avoid recomputation.

Template Parameters
RNGType of pseudo-random number generator
Parameters
mulocation parameter
S_lltEigen::LLT of positive definite covariance matrix.
rngrandom number generator

Definition at line 73 of file gaussian_dlm_obs_rng.hpp.

◆ multi_normal_semidefinite_rng()

template<class RNG >
Eigen::VectorXd stan::math::internal::multi_normal_semidefinite_rng ( const Eigen::VectorXd &  mu,
const Eigen::LDLT< Eigen::MatrixXd > &  S_ldlt,
RNG &  rng 
)
inline

Return a multivariate normal random variate with the given location and covariance using the specified random number generator.

No error checking or templating, takes the LDLT directly to avoid recomputation. Can sample from semidefinite covariance matrices.

Template Parameters
RNGType of pseudo-random number generator
Parameters
mulocation parameter
S_ldltEigen::LDLT of covariance matrix, semidefinite is okay
rngrandom number generator

Definition at line 35 of file gaussian_dlm_obs_rng.hpp.

◆ notNan()

double stan::math::internal::notNan ( double  x)
inline

Definition at line 11 of file is_lower_triangular.hpp.

◆ resize() [1/3]

template<typename T , int R, int C>
void stan::math::internal::resize ( Eigen::Matrix< T, R, C > &  x,
const std::vector< int > &  dims,
int  pos 
)

Definition at line 11 of file resize.hpp.

◆ resize() [2/3]

template<typename T >
void stan::math::internal::resize ( ,
const std::vector< int > &  ,
int   
)

Definition at line 16 of file resize.hpp.

◆ resize() [3/3]

template<typename T >
void stan::math::internal::resize ( std::vector< T > &  x,
const std::vector< int > &  dims,
int  pos 
)

Definition at line 21 of file resize.hpp.

◆ set_lower_tri_coeff_ref()

void stan::math::internal::set_lower_tri_coeff_ref ( Eigen::Matrix< var, -1, -1 > &  L,
vari **  vari_ref 
)
inline

Set the lower right triangular of a var matrix given a set of vari**.

Parameters
LMatrix of vars
vari_refValues to be set in lower right triangular of L.
Returns
None, L modified by reference.

Definition at line 34 of file cholesky_decompose.hpp.

Variable Documentation

◆ DEFAULT_INITIAL_NBYTES

const size_t stan::math::internal::DEFAULT_INITIAL_NBYTES = 1 << 16

Definition at line 34 of file stack_alloc.hpp.


     [ Stan Home Page ] © 2011–2018, Stan Development Team.