Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math Namespace Reference

Detailed Description

Matrices and templated mathematical functions.

Templated probability distributions. All paramaterizations are based on Bayesian Data Analysis. Function gradients via reverse-mode automatic differentiation.

Namespaces

namespace  internal
 A comparator that works for any container type that has the brackets operator.
 
namespace  opencl
 
namespace  opencl_kernels
 

Classes

struct  abs_fun
 Return elementwise absolute value of the specified real-valued container. More...
 
class  accumulator
 Class to accumulate values and eventually return their sum. More...
 
class  accumulator< T, require_var_t< T > >
 Class to accumulate values and eventually return their sum. More...
 
class  acos_
 
struct  acos_fun
 Structure to wrap acos() so it can be vectorized. More...
 
class  acosh_
 
struct  acosh_fun
 Structure to wrap acosh() so it can be vectorized. More...
 
struct  ad_promotable
 If the type From can be converted to To using implicit conversions, or both From and To are possibly cv-qualified void), provides the member constant value equal to true. More...
 
class  ad_tape_observer
 TBB observer object which is a callback hook called whenever the TBB scheduler adds a new thread to the TBB managed threadpool. More...
 
class  addition_
 
class  addition_operator_
 
class  adjoint_results_cl
 Represents results that are adjoints of vars in kernel generrator expressions. More...
 
class  append_col_
 Represents appending of cols in kernel generator expressions. More...
 
struct  append_return_type
 This template metaprogram is used to compute the return type for append_array. More...
 
struct  append_return_type< Eigen::Matrix< T1, R, C >, Eigen::Matrix< T2, R, C > >
 This template metaprogram is used to compute the return type for append_array. More...
 
struct  append_return_type< int, int >
 This template metaprogram is used to compute the return type for append_array. More...
 
struct  append_return_type< std::vector< T1 >, std::vector< T2 > >
 This template metaprogram is used to compute the return type for append_array. More...
 
class  append_row_
 Represents appending of rows in kernel generator expressions. More...
 
struct  apply_scalar_unary
 Base template class for vectorization of unary scalar functions defined by a template class F to a scalar, standard library vector, or Eigen dense matrix expression template. More...
 
struct  apply_scalar_unary< F, fvar< T > >
 Template specialization to fvar for vectorizing a unary scalar function. More...
 
struct  apply_scalar_unary< F, std::vector< T > >
 Template specialization for vectorized functions applying to standard vector containers. More...
 
struct  apply_scalar_unary< F, T, require_complex_t< T > >
 Template specialization for vectorized functions applying to complex arguments. More...
 
struct  apply_scalar_unary< F, T, require_eigen_t< T > >
 Template specialization for vectorized functions applying to Eigen matrix arguments. More...
 
struct  apply_scalar_unary< F, T, require_floating_point_t< T > >
 Template specialization for vectorized functions applying to double arguments. More...
 
struct  apply_scalar_unary< F, T, require_integral_t< T > >
 Template specialization for vectorized functions applying to integer arguments. More...
 
struct  apply_scalar_unary< F, T, require_var_matrix_t< T > >
 
struct  apply_scalar_unary< F, var >
 Template specialization to var for vectorizing a unary scalar function. More...
 
struct  apply_vector_unary
 
struct  apply_vector_unary< T, require_eigen_t< T > >
 Base template class for vectorization of unary vector functions defined by applying a functor to a standard library vector, Eigen dense matrix expression template, or container of these. More...
 
struct  apply_vector_unary< T, require_std_vector_vt< is_container_or_var_matrix, T > >
 Specialization for use with nested containers (std::vectors). More...
 
struct  apply_vector_unary< T, require_std_vector_vt< is_stan_scalar, T > >
 Specialization for use with (non-nested) std::vectors. More...
 
struct  apply_vector_unary< T, require_var_matrix_t< T > >
 Specialization for use with var_value<T> types where T inherits from EigenBase. More...
 
struct  arena_allocator
 std library compatible allocator that uses AD stack. More...
 
class  arena_matrix
 Equivalent to Eigen::Matrix, except that the data is stored on AD stack. More...
 
class  arena_matrix< MatrixType, require_eigen_dense_base_t< MatrixType > >
 
class  arena_matrix< MatrixType, require_eigen_sparse_base_t< MatrixType > >
 
class  arena_matrix_cl
 A variant of matrix_cl that schedules its destructor to be called, so it can be used on the AD stack. More...
 
class  array_builder
 Structure for building up arrays in an expression (rather than in statements) using an argument-chaining add() method and a getter method array() to return the result. More...
 
class  as_column_vector_or_scalar_
 Represents as_column_vector_or_scalar of a row or column vector in kernel generator expressions. More...
 
class  asin_
 
struct  asin_fun
 Structure to wrap asin() so it can be vectorized. More...
 
class  asinh_
 
struct  asinh_fun
 Structure to wrap asinh() so it can be vectorized. More...
 
class  atan_
 
struct  atan_fun
 Structure to wrap atan() so it can be vectorized. More...
 
class  atanh_
 
struct  atanh_fun
 Structure to wrap atanh() so it can be vectorized. More...
 
struct  AutodiffStackSingleton
 This struct always provides access to the autodiff stack using the singleton pattern. More...
 
class  beta_
 
class  binary_operation
 Represents a binary operation in kernel generator expressions. More...
 
class  binomial_coefficient_log_
 
class  block_
 Represents submatrix block in kernel generator expressions. More...
 
class  broadcast_
 Represents a broadcasting operation in kernel generator expressions. More...
 
class  calc_if_
 Represents a calc_if in kernel generator expressions. More...
 
class  cast_
 Represents a typecast os scalar in kernel generator expressions. More...
 
class  cbrt_
 
struct  cbrt_fun
 Structure to wrap cbrt() so it can be vectorized. More...
 
class  ceil_
 
struct  ceil_fun
 Structure to wrap ceil() so it can be vectorized. More...
 
class  chainable_alloc
 A chainable_alloc is an object which is constructed and destructed normally but the memory lifespan is managed along with the arena allocator for the gradient calculation. More...
 
class  chainable_object
 chainable_object hold another object is useful for connecting the lifetime of a specific object to the chainable stack More...
 
class  check_cl_
 Represents a check in kernel generator expressions. More...
 
class  col_index
 Represents operation that determines column index. More...
 
class  colwise_max_
 Represents column wise max - reduction in kernel generator expressions. More...
 
class  colwise_min_
 Represents column wise min - reduction in kernel generator expressions. More...
 
class  colwise_prod_
 Represents column wise product - reduction in kernel generator expressions. More...
 
class  colwise_reduction
 Represents a column wise reduction in kernel generator expressions. More...
 
class  colwise_sum_
 Represents column wise sum - reduction in kernel generator expressions. More...
 
class  complex_base
 Base class for complex numbers. More...
 
struct  conjunction
 Extends std::true_type when instantiated with zero or more template parameters, all of which extend the std::true_type. More...
 
struct  conjunction< T, Ts... >
 
class  constant_
 Represents a matrix of single repeated value in kernel generator expressions. More...
 
class  copysign_
 
class  cos_
 
struct  cos_fun
 Structure to wrap cos() so it can be vectorized. More...
 
class  cosh_
 
struct  cosh_fun
 Structure to wrap cosh() so it can be vectorized. More...
 
struct  coupled_ode_system
 
struct  coupled_ode_system_impl
 
struct  coupled_ode_system_impl< false, F, T_y0, Args... >
 The coupled_ode_system_impl template specialization when the state or parameters are autodiff types. More...
 
struct  coupled_ode_system_impl< true, F, T_y0, Args... >
 The coupled_ode_system_impl for arithmetic arguments reduces to the regular ode system (there are no sensitivities) More...
 
class  cov_exp_quad_vari
 
class  cov_exp_quad_vari< T_x, double, T_l >
 
class  cvodes_integrator
 Integrator interface for CVODES' ODE solvers (Adams & BDF methods). More...
 
class  cvodes_integrator_adjoint_vari
 Integrator interface for CVODES' adjoint ODE solvers (Adams & BDF methods). More...
 
class  dae_system
 IDAS DAE system that contains information on residual equation functor, sensitivity residual equation functor, as well as initial conditions. More...
 
struct  deserializer
 A class to store a sequence of values which can be deserialized back into structured objects such as scalars, vectors, and matrices. More...
 
class  diagonal_
 Represents diagonal of a matrix (as column vector) in kernel generator expressions. More...
 
class  digamma_
 
struct  digamma_fun
 Structure to wrap digamma() so it can be vectorized. More...
 
struct  disjunction
 Extends std::false_type when instantiated with zero or more template parameters, all of which extend the std::false_type. More...
 
struct  disjunction< Cond, Conds... >
 
class  elt_divide_
 
class  elt_function_cl
 Represents an element-wise function in kernel generator expressions. More...
 
class  elt_modulo_
 
class  elt_multiply_
 
class  equals_
 
class  erf_
 
struct  erf_fun
 Structure to wrap erf() so it can be vectorized. More...
 
class  erfc_
 
struct  erfc_fun
 Structure to wrap the erfc() so that it can be vectorized. More...
 
class  exp2_
 
struct  exp2_fun
 Structure to wrap exp2() so it can be vectorized. More...
 
class  exp_
 
struct  exp_fun
 Structure to wrap exp() so that it can be vectorized. More...
 
class  expm1_
 
struct  expm1_fun
 Structure to wrap expm1() so that it can be vectorized. More...
 
class  expressions_cl
 Represents multiple expressions that will be calculated in same kernel. More...
 
class  fabs_
 
struct  fabs_fun
 Structure to wrap fabs() so that it can be vectorized. More...
 
class  fdim_
 
struct  FixedPointADJac
 Calculate Jacobian Jxy(Jacobian of unknown x w.r.t. More...
 
struct  FixedPointSolver
 Fixed point solver for problem of form. More...
 
struct  FixedPointSolver< KinsolFixedPointEnv< F >, fp_jac_type >
 Specialization for fixed point solver when using KINSOL. More...
 
class  floor_
 
struct  floor_fun
 Structure to wrap floor() so that it can be vectorized. More...
 
class  fmax_
 
class  fmin_
 
class  fmod_
 
struct  fvar
 This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type. More...
 
class  gevv_vvv_vari
 
class  greater_than_
 
class  greater_than_or_equal_
 
class  Holder
 A no-op Eigen operation. More...
 
class  holder_cl_
 Represents a no-op in kernel generator expressions. More...
 
struct  hybrj_functor_solver
 A functor with the required operators to call Eigen's algebraic solver. More...
 
class  hypot_
 
class  idas_integrator
 IDAS DAE integrator. More...
 
struct  idas_service
 For each type of Ode(with different rhs functor F and senstivity parameters), we allocate mem and workspace for idas. More...
 
struct  include_summand
 Template metaprogram to calculate whether a summand needs to be included in a proportional (log) probability calculation. More...
 
struct  include_summand< propto, T >
 true if a term with the specified propto value and subterm types should be included in a proportionality calculation. More...
 
struct  index_type
 Primary template class for the metaprogram to compute the index type of a container. More...
 
struct  index_type< T, require_eigen_t< T > >
 Template metaprogram defining typedef for the type of index for an Eigen matrix, vector, or row vector. More...
 
struct  index_type< T, require_std_vector_t< T > >
 Template metaprogram class to compute the type of index for a standard vector. More...
 
struct  index_type< T, std::enable_if_t< std::is_pointer< T >::value > >
 Specialization of index_type for pointers. More...
 
class  indexing_
 Represents indexing of a matrix with two matrices of indices. More...
 
struct  inv_cloglog_fun
 Structure to wrap inv_cloglog() so that it can be vectorized. More...
 
struct  inv_erfc_fun
 Structure to wrap the inv_erfc() function so that it can be vectorized. More...
 
struct  inv_fun
 Structure to wrap 1.0 / x so that it can be vectorized. More...
 
class  inv_logit_
 
struct  inv_logit_fun
 Structure to wrap inv_logit() so that it can be vectorized. More...
 
class  inv_Phi_
 
struct  inv_Phi_fun
 Structure to wrap inv_Phi() so it can be vectorized. More...
 
struct  inv_sqrt_fun
 Structure to wrap 1 / sqrt(x) so that it can be vectorized. More...
 
class  inv_square_
 
struct  is_tuple
 
class  isfinite_
 
class  isinf_
 
class  isnan_
 
struct  kernel_parts
 Parts of an OpenCL kernel, generated by an expression. More...
 
class  kinsol_system_data
 KINSOL algebraic system data holder. More...
 
struct  KinsolFixedPointEnv
 KINSOL algebraic system data holder that handles construction & destruction of SUNDIALS data, as well as auxiliary data that will be used for functor evaluation. More...
 
class  lbeta_
 
class  ldexp_
 
class  LDLT_factor
 LDLT_factor is a structure that holds a matrix of type T and the LDLT of its values. More...
 
class  LDLT_factor< T, require_eigen_matrix_dynamic_vt< is_var, T > >
 An LDLT_factor of an Eigen::Matrix<var, Eigen::Dynamic, Eigen::Dynamic> with alloc_in_arena = True holds a copy of the input matrix and the LDLT of its values, with all member variable allocations are done in the arena. More...
 
class  LDLT_factor< T, require_var_matrix_t< T > >
 An LDLT_factor of a var_value<Eigen::MatrixXd> holds a copy of the input var_value and the LDLT of its values. More...
 
class  LDLT_factor< T, std::enable_if_t< bool_constant< is_eigen_matrix_dynamic< T >::value &&!is_var< scalar_type_t< T > >::value >::value > >
 An LDLT_factor is a structure that holds a matrix of type T and the LDLT of its values. More...
 
class  less_than_
 
class  less_than_or_equal_
 
class  lgamma_
 
struct  lgamma_fun
 Structure to wrap lgamma() so that it can be vectorized. More...
 
class  lmultiply_
 
class  load_
 Represents an access to a matrix_cl in kernel generator expressions. More...
 
class  log10_
 
struct  log10_fun
 Structure to wrap log10() so it can be vectorized. More...
 
class  log1m_
 
class  log1m_exp_
 
struct  log1m_exp_fun
 Structure to wrap log1m_exp() so it can be vectorized. More...
 
struct  log1m_fun
 Structure to wrap log1m() so it can be vectorized. More...
 
class  log1m_inv_logit_
 
struct  log1m_inv_logit_fun
 Structure to wrap log1m_inv_logit() so it can be vectorized. More...
 
class  log1p_
 
class  log1p_exp_
 
struct  log1p_exp_fun
 Structure to wrap log1p_exp() so that it can be vectorized. More...
 
struct  log1p_fun
 Structure to wrap log1p() so it can be vectorized. More...
 
class  log2_
 
struct  log2_fun
 Structure to wrap log2() so it can be vectorized. More...
 
class  log_
 
class  log_diff_exp_
 
struct  log_fun
 Structure to wrap log() so that it can be vectorized. More...
 
class  log_inv_logit_
 
class  log_inv_logit_diff_
 
struct  log_inv_logit_fun
 Structure to wrap log_inv_logit() so it can be vectorized. More...
 
class  logical_and_
 
class  logical_negation_
 Represents a logical negation in kernel generator expressions. More...
 
class  logical_or_
 
class  logit_
 
struct  logit_fun
 Structure to wrap logit() so it can be vectorized. More...
 
class  matrix_cl
 Represents an arithmetic matrix on the OpenCL device. More...
 
class  matrix_cl_base
 Non-templated base class for matrix_cl simplifies checking if something is matrix_cl. More...
 
class  matrix_exp_action_handler
 The implementation of the work by Awad H. More...
 
class  max_2d_
 Represents two dimensional max - reduction in kernel generator expressions. More...
 
struct  max_op
 Operation for max reduction. More...
 
class  min_2d_
 Represents two dimensional min - reduction in kernel generator expressions. More...
 
struct  min_op
 Operation for min reduction. More...
 
struct  mpi_cluster
 MPI cluster holds MPI resources and must be initialized only once in any MPI program. More...
 
struct  mpi_command
 A MPI command object is used to execute code on worker nodes. More...
 
struct  mpi_distributed_apply
 MPI command template which calls the static method distributed_apply of the given class F. More...
 
class  mpi_is_in_use
 Exception thrown whenever the MPI resource is busy. More...
 
class  mpi_parallel_call
 The MPI parallel call class manages the distributed evaluation of a collection of tasks following the map - reduce - combine pattern. More...
 
class  mpi_stop_listen
 Exception used to stop workers nodes from further listening to commands send from the root. More...
 
struct  mpi_stop_worker
 MPI command used to stop childs nodes from listening for further commands. More...
 
class  multiply_log_
 
class  name_generator
 Unique name generator for variables used in generated kernels. More...
 
class  nested_rev_autodiff
 A class following the RAII idiom to start and recover nested autodiff scopes. More...
 
struct  nlo_functor
 A structure which gets passed to Eigen's dogleg algebraic solver. More...
 
class  not_equals_
 
class  op_ddv_vari
 
class  op_dv_vari
 
class  op_dvd_vari
 
class  op_dvv_vari
 
class  op_matrix_vari
 
class  op_v_vari
 
class  op_vd_vari
 
class  op_vdd_vari
 
class  op_vdv_vari
 
class  op_vector_vari
 
class  op_vv_vari
 
class  op_vvd_vari
 
class  op_vvv_vari
 
class  opencl_code_
 Represents custom code in kernel generator expressions. More...
 
class  opencl_code_output
 Represents output variable of custom code in kernel generator expressions. More...
 
class  opencl_context
 The API to access the methods and values in opencl_context_base. More...
 
class  opencl_context_base
 The opencl_context_base class represents an OpenCL context in the standard Meyers singleton design pattern. More...
 
class  operands_and_partials
 This template builds partial derivatives with respect to a set of operands. More...
 
class  operands_and_partials< Op1, Op2, Op3, Op4, Op5, Op6, Op7, Op8, fvar< Dx > >
 This class builds partial derivatives with respect to a set of operands. More...
 
class  operands_and_partials< Op1, Op2, Op3, Op4, Op5, Op6, Op7, Op8, var >
 This class builds partial derivatives with respect to a set of operands. More...
 
class  operation_cl
 Base for all kernel generator operations. More...
 
class  operation_cl_lhs
 Base for all kernel generator operations that can be used on left hand side of an expression. More...
 
class  optional_broadcast_
 Represents an optional broadcasting operation in kernel generator expressions. More...
 
struct  pass_type
 
struct  pass_type< double >
 
struct  pass_type< int >
 
class  Phi_
 
class  Phi_approx_
 
struct  Phi_approx_fun
 Structure to wrap Phi_approx() so it can be vectorized. More...
 
struct  Phi_fun
 Structure to wrap Phi() so it can be vectorized. More...
 
class  pinned_matrix
 Equivalent to Eigen::Matrix, except that the data is stored in (hopefully pinned) memory, allocated by OpenCL driver. More...
 
class  pow_
 
class  precomp_vv_vari
 
class  precomp_vvv_vari
 
class  precomputed_gradients_vari_template
 A variable implementation taking a sequence of operands and partial derivatives with respect to the operands. More...
 
class  prod_2d_
 Represents two dimensional product - reduction in kernel generator expressions. More...
 
struct  prod_op
 Operation for product reduction. More...
 
class  profile
 Profiles C++ lines where the object is in scope. More...
 
class  profile_info
 Class used for storing profiling information. More...
 
struct  promote_elements
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< Eigen::Matrix< T, R, C >, Eigen::Matrix< S, R, C > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< Eigen::Matrix< T, R, C >, Eigen::Matrix< T, R, C > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< std::vector< T >, std::vector< S > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< std::vector< T >, std::vector< T > >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_elements< T, T >
 Struct with static function for elementwise type promotion. More...
 
struct  promote_scalar_type
 Template metaprogram to calculate a type for converting a convertible type. More...
 
struct  promote_scalar_type< std::tuple< PromotionScalars... >, std::tuple< UnPromotedTypes... > >
 
struct  promote_scalar_type< T, S, require_all_t< is_var< T >, is_var< S >, is_eigen< value_type_t< S > > > >
 Specialization for var_value when the type to convert to is a var_value. More...
 
struct  promote_scalar_type< T, S, require_all_t< std::is_arithmetic< T >, is_var< S >, is_eigen< value_type_t< S > > > >
 Specialization for var_value when the type to convert to is arithmetic. More...
 
struct  promote_scalar_type< T, S, require_eigen_dense_base_t< S > >
 Template metaprogram to calculate a type for a matrix, vector, row vector or Eigen::Array whose underlying scalar is converted from the second template parameter type to the first. More...
 
struct  promote_scalar_type< T, S, require_eigen_sparse_base_t< S > >
 
struct  promote_scalar_type< T, std::vector< S > >
 Template metaprogram to calculate a type for a container whose underlying scalar is converted from the second template parameter type to the first. More...
 
class  read_fvar_functor
 Functor for extracting the values and tangents from a matrix of fvar. More...
 
class  reduction_2d
 Represents a two dimensional reduction in kernel generator expressions. More...
 
struct  ref_type_for_opencl
 Determines appropriate type for assigning expression of given type to, so that the resulting type has directly accessible contiguous colum-major data, which is needed to copy to OpenCL device for construction of matrix_cl. More...
 
struct  ref_type_for_opencl< T, require_arena_matrix_t< T > >
 
struct  ref_type_for_opencl< T, require_not_eigen_t< T > >
 
class  results_cl
 Represents results that will be calculated in same kernel. More...
 
class  round_
 
struct  round_fun
 Structure to wrap round() so it can be vectorized. More...
 
class  row_index
 Represents operation that determines row index. More...
 
class  rowwise_max_
 Represents rowwise max reduction in kernel generator expressions. More...
 
class  rowwise_min_
 Represents rowwise min reduction in kernel generator expressions. More...
 
class  rowwise_prod_
 Represents rowwise product reduction in kernel generator expressions. More...
 
class  rowwise_reduction
 Represents a rowwise reduction in kernel generator expressions. More...
 
class  rowwise_sum_
 Represents rowwise sum reduction in kernel generator expressions. More...
 
class  rsqrt_
 
class  scalar_
 Represents a scalar in kernel generator expressions. More...
 
class  ScopedChainableStack
 The AD tape of reverse mode AD is by default stored globally within the process (or thread). More...
 
class  select_
 Represents a selection operation in kernel generator expressions. More...
 
class  seq_view
 
class  seq_view< double, std::vector< int > >
 
class  seq_view< T, Eigen::Matrix< S, 1, Eigen::Dynamic > >
 
class  seq_view< T, Eigen::Matrix< S, Eigen::Dynamic, 1 > >
 
class  seq_view< T, Eigen::Matrix< S, Eigen::Dynamic, Eigen::Dynamic > >
 
class  seq_view< T, std::vector< S > >
 
class  seq_view< T, std::vector< std::vector< T > > >
 
class  seq_view< T, std::vector< T > >
 
struct  serializer
 A structure to serialize structures to an internal stored sequence of scalars. More...
 
struct  sign_fun
 Structure to wrap sign() so it can be vectorized. More...
 
class  sin_
 
struct  sin_fun
 Structure to wrap sin() so it can be vectorized. More...
 
class  sinh_
 
struct  sinh_fun
 Structure to wrap sinh() so that it can be vectorized. More...
 
class  sqrt_
 
struct  sqrt_fun
 Structure to wrap sqrt() so that it can be vectorized. More...
 
class  square_
 
struct  square_fun
 Structure to wrap square() so that it can be vectorized. More...
 
class  stack_alloc
 An instance of this class provides a memory pool through which blocks of raw memory may be allocated and then collected simultaneously. More...
 
struct  std_normal_log_qf_fun
 Structure to wrap std_normal_log_qf() so it can be vectorized. More...
 
struct  step_fun
 Structure to wrap step() so it can be vectorized. More...
 
struct  store_type
 
struct  store_type< double >
 
struct  store_type< int >
 
class  stored_gradient_vari
 A var implementation that stores the daughter variable implementation pointers and the partial derivative with respect to the result explicitly in arrays constructed on the autodiff memory stack. More...
 
class  subtraction_
 
class  subtraction_operator_
 
class  sum_2d_
 Represents two dimensional sum - reduction in kernel generator expressions. More...
 
struct  sum_op
 Operation for sum reduction. More...
 
class  tan_
 
struct  tan_fun
 Structure to wrap tan() so that it can be vectorized. More...
 
class  tanh_
 
struct  tanh_fun
 Structure to wrap tanh() so that it can be vectorized. More...
 
class  tgamma_
 
struct  tgamma_fun
 Structure to wrap tgamma() so that it can be vectorized. More...
 
struct  to_int_fun
 Return elementwise integer value of the specified real-valued container. More...
 
class  transpose_
 Represents a transpose in kernel generator expressions. More...
 
class  trigamma_
 
struct  trigamma_fun
 Structure to wrap trigamma() so it can be vectorized. More...
 
class  trunc_
 
struct  trunc_fun
 Structure to wrap trunc() so it can be vectorized. More...
 
class  unary_minus_
 Represents an unary minus operation in kernel generator expressions. More...
 
class  unary_operation_cl
 Represents a unary operation in kernel generator expressions. More...
 
class  unsafe_chainable_object
 unsafe_chainable_object hold another object and is useful for connecting the lifetime of a specific object to the chainable stack. More...
 
class  val_adj_functor
 Functor for extracting the values and adjoints from a matrix of var or vari. More...
 
class  var_value
 
class  var_value< T, internal::require_matrix_var_value< T > >
 Independent (input) and dependent (output) variables for gradients. More...
 
class  var_value< T, require_floating_point_t< T > >
 Independent (input) and dependent (output) variables for gradients. More...
 
class  vari_base
 Abstract base class that all vari_value and it's derived classes inherit. More...
 
class  vari_cl_base
 
class  vari_value
 
class  vari_value< T, require_all_t< is_plain_type< T >, is_eigen_dense_base< T > > >
 The variable implementation for Eigen dense matrix types. More...
 
class  vari_value< T, require_eigen_sparse_base_t< T > >
 The variable implementation for Eigen sparse matrix types. More...
 
class  vari_value< T, require_matrix_cl_t< T > >
 The variable implementation for matrix_cl. More...
 
class  vari_value< T, require_t< std::is_floating_point< T > > >
 The variable implementation for floating point types. More...
 
class  vari_view
 A vari_view is used to read from a slice of a vari_value with an inner eigen type. More...
 
class  vari_view< T, require_all_t< is_eigen< T >, bool_constant<!is_plain_type< T >::value > > >
 
class  vari_view< T, require_kernel_expression_lhs_t< T > >
 
class  vari_view_eigen
 This struct is follows the CRTP for methods common to vari_view<> and vari_value<Matrix>. More...
 
class  vi_adj_functor
 Functor for extracting the varis and adjoints from a matrix of var. More...
 
class  vi_val_adj_functor
 Functor for extracting the vari*, values, and adjoints from a matrix of var. More...
 
class  vi_val_functor
 Functor for extracting the varis and values from a matrix of var. More...
 
class  welford_covar_estimator
 
class  welford_var_estimator
 

Typedefs

using size_type = Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index
 Type for sizes and indexes in an Eigen matrix with double elements.
 
using matrix_fd = Eigen::Matrix< fvar< double >, Eigen::Dynamic, Eigen::Dynamic >
 
using matrix_ffd = Eigen::Matrix< fvar< fvar< double > >, Eigen::Dynamic, Eigen::Dynamic >
 
using vector_fd = Eigen::Matrix< fvar< double >, Eigen::Dynamic, 1 >
 
using vector_ffd = Eigen::Matrix< fvar< fvar< double > >, Eigen::Dynamic, 1 >
 
using row_vector_fd = Eigen::Matrix< fvar< double >, 1, Eigen::Dynamic >
 
using row_vector_ffd = Eigen::Matrix< fvar< fvar< double > >, 1, Eigen::Dynamic >
 
using matrix_fv = Eigen::Matrix< fvar< var >, Eigen::Dynamic, Eigen::Dynamic >
 
using matrix_ffv = Eigen::Matrix< fvar< fvar< var > >, Eigen::Dynamic, Eigen::Dynamic >
 
using vector_fv = Eigen::Matrix< fvar< var >, Eigen::Dynamic, 1 >
 
using vector_ffv = Eigen::Matrix< fvar< fvar< var > >, Eigen::Dynamic, 1 >
 
using row_vector_fv = Eigen::Matrix< fvar< var >, 1, Eigen::Dynamic >
 
using row_vector_ffv = Eigen::Matrix< fvar< fvar< var > >, 1, Eigen::Dynamic >
 
template<typename T , assign_op_cl AssignOp = assign_op_cl::equals>
using as_operation_cl_t = std::conditional_t< std::is_lvalue_reference< T >::value, decltype(as_operation_cl< AssignOp >(std::declval< T >())), std::remove_reference_t< decltype(as_operation_cl< AssignOp >(std::declval< T >()))> >
 Type that results when converting any valid kernel generator expression into operation.
 
template<typename T >
using is_without_output = internal::is_without_output_impl< std::decay_t< T > >
 
template<typename T >
using is_colwise_reduction = internal::is_colwise_reduction_impl< std::decay_t< T > >
 Check whether a kernel generator expression is a colwise reduction.
 
template<typename... Types>
using common_scalar_t = typename std::common_type_t< typename std::remove_reference_t< Types >::Scalar... >
 Wrapper for std::common_type_t
 
template<typename T >
using is_reduction_2d = internal::is_reduction_2d_impl< std::decay_t< T > >
 Check whether a kernel generator expression is a colwise reduction.
 
template<typename T >
using ref_type_for_opencl_t = typename ref_type_for_opencl< T >::type
 
template<int B = 0>
using boost_policy_t = boost::math::policies::policy< boost::math::policies::overflow_error< boost::math::policies::errno_on_error >, boost::math::policies::pole_error< boost::math::policies::errno_on_error >, boost::math::policies::promote_double< false >, boost::math::policies::digits2< B > >
 Boost policy that overrides the defaults to match the built-in C++ standard library functions.
 
using matrix_d = Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >
 Type for matrix of double values.
 
using vector_d = Eigen::Matrix< double, Eigen::Dynamic, 1 >
 Type for (column) vector of double values.
 
using row_vector_d = Eigen::Matrix< double, 1, Eigen::Dynamic >
 Type for (row) vector of double values.
 
template<typename T >
using index_type_t = typename index_type< T >::type
 
template<typename T >
using require_tuple_t = require_t< is_tuple< std::decay_t< T > > >
 Require type satisfies is_tuple.
 
template<typename T >
using require_not_tuple_t = require_not_t< is_tuple< std::decay_t< T > > >
 Require type does not satisfy is_tuple.
 
template<typename... Types>
using require_all_tuple_t = require_all_t< is_tuple< std::decay_t< Types > >... >
 Require all of the types satisfy is_tuple.
 
template<typename... Types>
using require_all_not_tuple_t = require_all_not_t< is_tuple< std::decay_t< Types > >... >
 Require none of the types satisfy is_tuple.
 
template<typename Mat , int NewOptions>
using change_eigen_options_t = typename internal::change_eigen_options_impl< plain_type_t< std::decay_t< Mat > >, NewOptions >::type
 Change the options of an Eigen matrix or array.
 
template<typename T , typename S >
using promote_scalar_t = typename promote_scalar_type< std::decay_t< T >, std::decay_t< S > >::type
 
using ChainableStack = AutodiffStackSingleton< vari_base, chainable_alloc >
 
using precomputed_gradients_vari = precomputed_gradients_vari_template< std::tuple<>, std::tuple<> >
 
using profile_key = std::pair< std::string, std::thread::id >
 
using profile_map = std::map< profile_key, profile_info >
 
using matrix_v = Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic >
 The type of a matrix holding var values.
 
using vector_v = Eigen::Matrix< var, Eigen::Dynamic, 1 >
 The type of a (column) vector holding var values.
 
using row_vector_v = Eigen::Matrix< var, 1, Eigen::Dynamic >
 The type of a row vector holding var values.
 
using matrix_vi = Eigen::Matrix< vari *, Eigen::Dynamic, Eigen::Dynamic >
 The type of a matrix holding vari* values.
 
using vector_vi = Eigen::Matrix< vari *, Eigen::Dynamic, 1 >
 The type of a (column) vector holding vari* values.
 
using row_vector_vi = Eigen::Matrix< vari *, 1, Eigen::Dynamic >
 The type of a row vector holding vari* values.
 
using var = var_value< double >
 
using vari = vari_value< double >
 

Enumerations

enum class  assign_op_cl {
  equals ,
  plus_equals ,
  minus_equals ,
  divide_equals ,
  multiply_equals
}
 Ops that decide the type of assignment for LHS operations. More...
 
enum class  matrix_cl_view {
  Diagonal = 0 ,
  Lower = 1 ,
  Upper = 2 ,
  Entire = 3
}
 

Functions

template<typename T >
fvar< T > operator+ (const fvar< T > &x1, const fvar< T > &x2)
 Return the sum of the specified forward mode addends.
 
template<typename T >
fvar< T > operator+ (double x1, const fvar< T > &x2)
 Return the sum of the specified double and forward mode addends.
 
template<typename T >
fvar< T > operator+ (const fvar< T > &x1, double x2)
 Return the sum of the specified forward mode and double addends.
 
template<typename T >
fvar< T > operator/ (const fvar< T > &x1, const fvar< T > &x2)
 Return the result of dividing the first argument by the second.
 
template<typename T , typename U , require_arithmetic_t< U > * = nullptr>
fvar< T > operator/ (const fvar< T > &x1, U x2)
 Return the result of dividing the first argument by the second.
 
template<typename T , typename U , require_arithmetic_t< U > * = nullptr>
fvar< T > operator/ (U x1, const fvar< T > &x2)
 Return the result of dividing the first argument by the second.
 
template<typename T >
std::complex< fvar< T > > operator/ (const std::complex< fvar< T > > &x1, const std::complex< fvar< T > > &x2)
 
template<typename T , typename U , require_arithmetic_t< U > * = nullptr>
std::complex< fvar< T > > operator/ (const std::complex< fvar< T > > &x1, const std::complex< U > &x2)
 
template<typename T >
std::complex< fvar< T > > operator/ (const std::complex< fvar< T > > &x1, const fvar< T > &x2)
 
template<typename T , typename U , require_arithmetic_t< U > * = nullptr>
std::complex< fvar< T > > operator/ (const std::complex< fvar< T > > &x1, U x2)
 
template<typename T , typename U , require_arithmetic_t< U > * = nullptr>
std::complex< fvar< T > > operator/ (const std::complex< U > &x1, const std::complex< fvar< T > > &x2)
 
template<typename T , typename U , require_arithmetic_t< U > * = nullptr>
std::complex< fvar< T > > operator/ (const std::complex< U > &x1, const fvar< T > &x2)
 
template<typename T >
std::complex< fvar< T > > operator/ (const fvar< T > &x1, const std::complex< fvar< T > > &x2)
 
template<typename T , typename U , typename = std::enable_if_t<std::is_arithmetic<U>::value>>
std::complex< fvar< T > > operator/ (const fvar< T > &x1, const std::complex< U > &x2)
 
template<typename T , typename U , require_arithmetic_t< U > * = nullptr>
std::complex< fvar< T > > operator/ (U x1, const std::complex< fvar< T > > &x2)
 
template<typename T >
bool operator== (const fvar< T > &x, const fvar< T > &y)
 Return true if the specified variables have equal values as defined by ==.
 
template<typename T >
bool operator== (const fvar< T > &x, double y)
 Return true if the the first variable has a value equal to the second argument as defined by by ==.
 
template<typename T >
bool operator== (double x, const fvar< T > &y)
 Return true if the the first argument is equal to the value of the second argument as defined by by ==.
 
template<typename T >
bool operator> (const fvar< T > &x, const fvar< T > &y)
 Return true if the first argument has a greater value than the second as defined by >.
 
template<typename T >
bool operator> (const fvar< T > &x, double y)
 Return true if the first argument has a greater value than the second as defined by >.
 
template<typename T >
bool operator> (double x, const fvar< T > &y)
 Return true if the first argument has a greater value than the second as defined by >.
 
template<typename T >
bool operator>= (const fvar< T > &x, const fvar< T > &y)
 Return true if the value of the first argument is greater than or equal to that of the second as defined by >=.
 
template<typename T >
bool operator>= (const fvar< T > &x, double y)
 Return true if the value of the first argument has a value greater than or equal to the second argument as defined by >=.
 
template<typename T >
bool operator>= (double x, const fvar< T > &y)
 Return true if the first argument is greater than or equal to the value of the second argument as defined by >=.
 
template<typename T >
bool operator< (const fvar< T > &x, const fvar< T > &y)
 Return true if the first argument has a value less than the value of the second argument as defined by <.
 
template<typename T >
bool operator< (double x, const fvar< T > &y)
 Return true if the first argument is less than the value of the second argument as defined by <.
 
template<typename T >
bool operator< (const fvar< T > &x, double y)
 Return true if the first argument has a value less than the second argument as defined by <.
 
template<typename T >
bool operator<= (const fvar< T > &x, const fvar< T > &y)
 Return true if the first argument has a value less than or equal to the value of the second argument as defined by <=.
 
template<typename T >
bool operator<= (const fvar< T > &x, double y)
 Return true if the first argument has a value less than or equal to the second argument as defined by <=.
 
template<typename T >
bool operator<= (double x, const fvar< T > &y)
 Return true if the first argument is less than or equal to the second argument's value as defined by <=.
 
template<typename T >
bool operator&& (const fvar< T > &x, const fvar< T > &y)
 Return the logical conjunction of the values of the two arguments as defined by &&.
 
template<typename T >
bool operator&& (const fvar< T > &x, double y)
 Return the logical conjunction of the values of the two arguments as defined by &&.
 
template<typename T >
bool operator&& (double x, const fvar< T > &y)
 Return the logical conjunction of the values of the two arguments as defined by &&.
 
template<typename T >
bool operator|| (const fvar< T > &x, const fvar< T > &y)
 Return the logical disjunction of the values of the two arguments as defined by ||.
 
template<typename T >
bool operator|| (const fvar< T > &x, double y)
 Return the logical disjunction of the values of the two arguments as defined by ||.
 
template<typename T >
bool operator|| (double x, const fvar< T > &y)
 Return the logical disjunction of the values of the two arguments as defined by ||.
 
template<typename T >
fvar< T > operator* (const fvar< T > &x, const fvar< T > &y)
 Return the product of the two arguments.
 
template<typename T >
fvar< T > operator* (double x, const fvar< T > &y)
 Return the product of the two arguments.
 
template<typename T >
fvar< T > operator* (const fvar< T > &x, double y)
 Return the product of the two arguments.
 
template<typename T >
std::complex< stan::math::fvar< T > > operator* (const std::complex< stan::math::fvar< T > > &x, const std::complex< stan::math::fvar< T > > &y)
 Return the product of the two complex fvar<T> arguments.
 
template<typename T >
std::complex< stan::math::fvar< T > > operator* (const std::complex< double > &x, const std::complex< stan::math::fvar< T > > &y)
 Return the product of std::complex<double> and std::complex<fvar<T>> arguments.
 
template<typename T >
std::complex< stan::math::fvar< T > > operator* (const std::complex< stan::math::fvar< T > > &x, const std::complex< double > &y)
 Return the product of std::complex<double> and std::complex<fvar<T>> arguments.
 
template<typename T >
bool operator!= (const fvar< T > &x, const fvar< T > &y)
 Return true if the value of the two arguments are not equal as defined by !=.
 
template<typename T >
bool operator!= (const fvar< T > &x, double y)
 Return true if the value of the first argument is not equal to the second argument as defined by !=.
 
template<typename T >
bool operator!= (double x, const fvar< T > &y)
 Return true if the first argument is not equal to the value of the second argument as defined by !=.
 
template<typename T >
fvar< T > operator- (const fvar< T > &x1, const fvar< T > &x2)
 Return the difference of the specified arguments.
 
template<typename T >
fvar< T > operator- (double x1, const fvar< T > &x2)
 Return the difference of the specified arguments.
 
template<typename T >
fvar< T > operator- (const fvar< T > &x1, double x2)
 Return the difference of the specified arguments.
 
template<typename T >
fvar< T > operator- (const fvar< T > &x)
 Return the negation of the specified argument.
 
template<typename T >
bool operator! (const fvar< T > &x)
 Return the negation of the value of the argument as defined by !.
 
template<typename T >
fvar< T > operator+ (const fvar< T > &x)
 Returns the argument.
 
template<typename T >
fvar< T > abs (const fvar< T > &x)
 
template<typename T >
fvar< T > abs (const std::complex< fvar< T > > &z)
 Return the absolute value of the complex argument.
 
template<typename T >
fvar< T > acos (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > acos (const std::complex< fvar< T > > &x)
 Return the arc cosine of the complex argument.
 
template<typename T >
fvar< T > acosh (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > acosh (const std::complex< fvar< T > > &z)
 Return the hyperbolic arc cosine of the complex argument.
 
template<typename T >
fvar< T > arg (const std::complex< fvar< T > > &z)
 Return the phase angle of the complex argument.
 
template<typename T >
fvar< T > asin (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > asin (const std::complex< fvar< T > > &z)
 Return the arc sine of the complex argument.
 
template<typename T >
fvar< T > asinh (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > asinh (const std::complex< fvar< T > > &z)
 Return the hyperbolic arcsine of the complex argument.
 
template<typename T >
fvar< T > atan (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > atan (const std::complex< fvar< T > > &z)
 Return the arc tangent of the complex argument.
 
template<typename T >
fvar< T > atan2 (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > atan2 (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > atan2 (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > atanh (const fvar< T > &x)
 Return inverse hyperbolic tangent of specified value.
 
template<typename T >
std::complex< fvar< T > > atanh (const std::complex< fvar< T > > &z)
 Return the hyperbolic arc tangent of the complex argument.
 
template<typename T >
fvar< T > bessel_first_kind (int v, const fvar< T > &z)
 
template<typename T >
fvar< T > bessel_second_kind (int v, const fvar< T > &z)
 
template<typename T >
fvar< T > beta (const fvar< T > &x1, const fvar< T > &x2)
 Return fvar with the beta function applied to the specified arguments and its gradient.
 
template<typename T >
fvar< T > beta (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > beta (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > binary_log_loss (int y, const fvar< T > &y_hat)
 
template<typename T >
fvar< T > cbrt (const fvar< T > &x)
 Return cube root of specified argument.
 
template<typename T >
fvar< T > ceil (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > conj (const std::complex< fvar< T > > &z)
 Return the phase angle of the complex argument.
 
template<typename T >
fvar< T > cos (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > cos (const std::complex< fvar< T > > &z)
 Return the cosine of the complex argument.
 
template<typename T >
fvar< T > cosh (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > cosh (const std::complex< fvar< T > > &z)
 Return the hyperbolic cosine of the complex argument.
 
template<typename EigMat , require_eigen_vt< is_fvar, EigMat > * = nullptr>
value_type_t< EigMat > determinant (const EigMat &m)
 
template<typename T >
fvar< T > digamma (const fvar< T > &x)
 Return the derivative of the log gamma function at the specified argument.
 
template<typename T >
fvar< T > erf (const fvar< T > &x)
 
template<typename T >
fvar< T > erfc (const fvar< T > &x)
 
template<typename T >
fvar< T > exp (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > exp (const std::complex< fvar< T > > &z)
 Return the natural exponentiation (base e) of the specified complex number.
 
template<typename T >
fvar< T > exp2 (const fvar< T > &x)
 
template<typename T >
fvar< T > expm1 (const fvar< T > &x)
 
template<typename T >
fvar< T > fabs (const fvar< T > &x)
 
template<typename T >
fvar< T > falling_factorial (const fvar< T > &x, int n)
 Return autodiff variable with the gradient and result of the falling factorial function applied to the inputs.
 
template<typename T >
fvar< T > fdim (const fvar< T > &x, const fvar< T > &y)
 Return the positive difference of the specified values (C++11).
 
template<typename T >
fvar< T > fdim (const fvar< T > &x, double y)
 Return the positive difference of the specified values (C++11).
 
template<typename T >
fvar< T > fdim (double x, const fvar< T > &y)
 Return the positive difference of the specified values (C++11).
 
template<typename T >
fvar< T > floor (const fvar< T > &x)
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > fma (const fvar< T1 > &x1, const fvar< T2 > &x2, const fvar< T3 > &x3)
 The fused multiply-add operation (C99).
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > fma (const T1 &x1, const fvar< T2 > &x2, const fvar< T3 > &x3)
 See all-var input signature for details on the function and derivatives.
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > fma (const fvar< T1 > &x1, const T2 &x2, const fvar< T3 > &x3)
 See all-var input signature for details on the function and derivatives.
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > fma (const fvar< T1 > &x1, const fvar< T2 > &x2, const T3 &x3)
 See all-var input signature for details on the function and derivatives.
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > fma (const T1 &x1, const T2 &x2, const fvar< T3 > &x3)
 See all-var input signature for details on the function and derivatives.
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > fma (const fvar< T1 > &x1, const T2 &x2, const T3 &x3)
 See all-var input signature for details on the function and derivatives.
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > fma (const T1 &x1, const fvar< T2 > &x2, const T3 &x3)
 See all-var input signature for details on the function and derivatives.
 
template<typename T >
fvar< T > fmax (const fvar< T > &x1, const fvar< T > &x2)
 Return the greater of the two specified arguments.
 
template<typename T >
fvar< T > fmax (double x1, const fvar< T > &x2)
 Return the greater of the two specified arguments.
 
template<typename T >
fvar< T > fmax (const fvar< T > &x1, double x2)
 Return the greater of the two specified arguments.
 
template<typename T >
fvar< T > fmin (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > fmin (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > fmin (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > fmod (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > fmod (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > fmod (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_p (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_p (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > gamma_p (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_q (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > gamma_q (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > gamma_q (double x1, const fvar< T > &x2)
 
template<typename T >
void grad_inc_beta (fvar< T > &g1, fvar< T > &g2, fvar< T > a, fvar< T > b, fvar< T > z)
 Gradient of the incomplete beta function beta(a, b, z) with respect to the first two arguments.
 
template<typename Ta , typename Tz , typename FvarT = return_type_t<Ta, Tz>, require_all_stan_scalar_t< Ta, Tz > * = nullptr, require_any_fvar_t< Ta, Tz > * = nullptr>
FvarT hypergeometric_1f0 (const Ta &a, const Tz &z)
 Returns the Hypergeometric 1F0 function applied to the input arguments: \( _1F_0(a;;z) = \sum_{k=1}^{\infty}\frac{\left(a\right)_kz^k}{k!}\).
 
template<typename Ta1 , typename Ta2 , typename Tb , typename Tz , require_all_stan_scalar_t< Ta1, Ta2, Tb, Tz > * = nullptr, require_any_fvar_t< Ta1, Ta2, Tb, Tz > * = nullptr>
return_type_t< Ta1, Ta1, Tb, Tz > hypergeometric_2F1 (const Ta1 &a1, const Ta2 &a2, const Tb &b, const Tz &z)
 Returns the Gauss hypergeometric function applied to the input arguments: \(_2F_1(a_1,a_2;b;z)\).
 
template<typename Ta , typename Tb , typename Tz , typename FvarT = return_type_t<Ta, Tb, Tz>, bool grad_a = !is_constant<Ta>::value, bool grad_b = !is_constant<Tb>::value, bool grad_z = !is_constant<Tz>::value, require_all_vector_t< Ta, Tb > * = nullptr, require_fvar_t< FvarT > * = nullptr>
FvarT hypergeometric_pFq (const Ta &a, const Tb &b, const Tz &z)
 Returns the generalized hypergeometric (pFq) function applied to the input arguments.
 
template<typename T >
fvar< T > hypot (const fvar< T > &x1, const fvar< T > &x2)
 Return the length of the hypotenuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).
 
template<typename T >
fvar< T > hypot (const fvar< T > &x1, double x2)
 Return the length of the hypotenuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).
 
template<typename T >
fvar< T > hypot (double x1, const fvar< T > &x2)
 Return the length of the hypotenuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).
 
template<typename T >
fvar< T > inc_beta (const fvar< T > &a, const fvar< T > &b, const fvar< T > &x)
 
template<typename T >
fvar< T > inc_beta (double a, const fvar< T > &b, const fvar< T > &x)
 
template<typename T >
fvar< T > inc_beta (const fvar< T > &a, double b, const fvar< T > &x)
 
template<typename T >
fvar< T > inc_beta (const fvar< T > &a, const fvar< T > &b, double x)
 
template<typename T >
fvar< T > inc_beta (double a, double b, const fvar< T > &x)
 
template<typename T >
fvar< T > inc_beta (const fvar< T > &a, double b, double x)
 
template<typename T >
fvar< T > inc_beta (double a, const fvar< T > &b, double x)
 
template<typename T >
fvar< T > inv (const fvar< T > &x)
 
template<typename T >
fvar< T > inv_cloglog (const fvar< T > &x)
 
template<typename T >
fvar< T > inv_erfc (const fvar< T > &x)
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr, require_any_fvar_t< T1, T2, T3 > * = nullptr>
fvar< partials_return_t< T1, T2, T3 > > inv_inc_beta (const T1 &a, const T2 &b, const T3 &p)
 The inverse of the normalized incomplete beta function of a, b, with probability p.
 
template<typename T >
fvar< T > inv_logit (const fvar< T > &x)
 Returns the inverse logit function applied to the argument.
 
template<typename T >
fvar< T > inv_Phi (const fvar< T > &p)
 
template<typename T >
fvar< T > inv_sqrt (const fvar< T > &x)
 
template<typename T >
fvar< T > inv_square (const fvar< T > &x)
 
template<typename EigMat , require_eigen_vt< is_fvar, EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::ColsAtCompileTime > inverse (const EigMat &m)
 Forward mode specialization of calculating the inverse of the matrix.
 
template<typename T >
int is_inf (const fvar< T > &x)
 Returns 1 if the input's value is infinite and 0 otherwise.
 
template<typename T , require_fvar_t< T > * = nullptr>
bool is_nan (T &&x)
 Returns 1 if the input's value is NaN and 0 otherwise.
 
template<typename T >
fvar< T > lambert_w0 (const fvar< T > &x)
 
template<typename T >
fvar< T > lambert_wm1 (const fvar< T > &x)
 
template<typename T >
fvar< T > lbeta (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > lbeta (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > lbeta (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > ldexp (const fvar< T > &a, int b)
 Returns the product of a (the significand) times 2 to power b (the exponent).
 
template<typename T >
fvar< T > lgamma (const fvar< T > &x)
 Return the natural logarithm of the gamma function applied to the specified argument.
 
template<typename T >
fvar< return_type_t< T, int > > lmgamma (int x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > lmultiply (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > lmultiply (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > lmultiply (const fvar< T > &x1, double x2)
 
template<typename T >
fvar< T > log (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > log (const std::complex< fvar< T > > &z)
 Return the natural logarithm (base e) of the specified complex argument.
 
template<typename T >
fvar< T > log10 (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > log10 (const std::complex< fvar< T > > &z)
 Return the base 10 logarithm of the specified complex number.
 
template<typename T >
fvar< T > log1m (const fvar< T > &x)
 
template<typename T >
fvar< T > log1m_exp (const fvar< T > &x)
 Return the natural logarithm of one minus the exponentiation of the specified argument.
 
template<typename T >
fvar< T > log1m_inv_logit (const fvar< T > &x)
 Return the natural logarithm of one minus the inverse logit of the specified argument.
 
template<typename T >
fvar< T > log1p (const fvar< T > &x)
 
template<typename T >
fvar< T > log1p_exp (const fvar< T > &x)
 
template<typename T >
fvar< T > log2 (const fvar< T > &x)
 Return the base two logarithm of the specified argument.
 
template<typename EigMat , require_eigen_vt< is_fvar, EigMat > * = nullptr>
value_type_t< EigMat > log_determinant (const EigMat &m)
 Returns the log absolute determinant of the specified square matrix.
 
template<typename T >
fvar< T > log_diff_exp (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T1 , typename T2 , require_arithmetic_t< T1 > * = nullptr>
fvar< T2 > log_diff_exp (const T1 &x1, const fvar< T2 > &x2)
 
template<typename T1 , typename T2 , require_arithmetic_t< T2 > * = nullptr>
fvar< T1 > log_diff_exp (const fvar< T1 > &x1, const T2 &x2)
 
template<typename T >
fvar< T > log_falling_factorial (const fvar< T > &x, const fvar< T > &n)
 
template<typename T >
fvar< T > log_falling_factorial (double x, const fvar< T > &n)
 
template<typename T >
fvar< T > log_falling_factorial (const fvar< T > &x, double n)
 
template<typename T >
fvar< T > log_inv_logit (const fvar< T > &x)
 
template<typename T >
fvar< T > log_inv_logit_diff (const fvar< T > &x, const fvar< T > &y)
 Returns fvar with the natural logarithm of the difference of the inverse logits of the specified arguments and its gradients.
 
template<typename T >
fvar< T > log_inv_logit_diff (const fvar< T > &x, double y)
 
template<typename T >
fvar< T > log_inv_logit_diff (double x, const fvar< T > &y)
 
template<typename T_theta , typename T_lambda1 , typename T_lambda2 , int N>
void log_mix_partial_helper (const T_theta &theta, const T_lambda1 &lambda1, const T_lambda2 &lambda2, promote_args_t< T_theta, T_lambda1, T_lambda2 >(&partials_array)[N])
 
template<typename T >
fvar< T > log_mix (const fvar< T > &theta, const fvar< T > &lambda1, const fvar< T > &lambda2)
 Return the log mixture density with specified mixing proportion and log densities and its derivative at each.
 
template<typename T , typename P , require_all_arithmetic_t< P > * = nullptr>
fvar< T > log_mix (const fvar< T > &theta, const fvar< T > &lambda1, P lambda2)
 
template<typename T , typename P , require_all_arithmetic_t< P > * = nullptr>
fvar< T > log_mix (const fvar< T > &theta, P lambda1, const fvar< T > &lambda2)
 
template<typename T , typename P , require_all_arithmetic_t< P > * = nullptr>
fvar< T > log_mix (P theta, const fvar< T > &lambda1, const fvar< T > &lambda2)
 
template<typename T , typename P1 , typename P2 , require_all_arithmetic_t< P1, P2 > * = nullptr>
fvar< T > log_mix (const fvar< T > &theta, P1 lambda1, P2 lambda2)
 
template<typename T , typename P1 , typename P2 , require_all_arithmetic_t< P1, P2 > * = nullptr>
fvar< T > log_mix (P1 theta, const fvar< T > &lambda1, P2 lambda2)
 
template<typename T , typename P1 , typename P2 , require_all_arithmetic_t< P1, P2 > * = nullptr>
fvar< T > log_mix (P1 theta, P2 lambda1, const fvar< T > &lambda2)
 
template<typename T >
fvar< T > log_rising_factorial (const fvar< T > &x, const fvar< T > &n)
 
template<typename T >
fvar< T > log_rising_factorial (const fvar< T > &x, double n)
 
template<typename T >
fvar< T > log_rising_factorial (double x, const fvar< T > &n)
 
template<typename T , require_vector_st< is_fvar, T > * = nullptr>
auto log_softmax (const T &x)
 Return the log softmax of the specified vector or container of vectors.
 
template<typename T >
fvar< T > log_sum_exp (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > log_sum_exp (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > log_sum_exp (const fvar< T > &x1, double x2)
 
template<typename T , require_container_st< is_fvar, T > * = nullptr>
auto log_sum_exp (const T &x)
 Return the log of the sum of the exponentiated values of the specified matrix of values.
 
template<typename T >
fvar< T > logit (const fvar< T > &x)
 
template<typename T1 , typename T2 , require_all_eigen_vt< is_fvar, T1, T2 > * = nullptr, require_vt_same< T1, T2 > * = nullptr>
Eigen::Matrix< value_type_t< T1 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left (const T1 &A, const T2 &b)
 
template<typename T1 , typename T2 , require_eigen_vt< std::is_arithmetic, T1 > * = nullptr, require_eigen_vt< is_fvar, T2 > * = nullptr>
Eigen::Matrix< value_type_t< T2 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left (const T1 &A, const T2 &b)
 
template<typename T , typename EigMat , require_eigen_vt< std::is_arithmetic, T > * = nullptr, require_eigen_vt< is_fvar, EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, EigMat::ColsAtCompileTime > mdivide_left_ldlt (LDLT_factor< T > &A, const EigMat &b)
 Returns the solution of the system Ax=b given an LDLT_factor of A.
 
template<typename T1 , typename T2 , require_all_eigen_vt< is_fvar, T1, T2 > * = nullptr, require_vt_same< T1, T2 > * = nullptr>
Eigen::Matrix< value_type_t< T1 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left_tri_low (const T1 &A, const T2 &b)
 
template<typename T1 , typename T2 , require_eigen_t< T1 > * = nullptr, require_vt_same< double, T1 > * = nullptr, require_eigen_vt< is_fvar, T2 > * = nullptr>
Eigen::Matrix< value_type_t< T2 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left_tri_low (const T1 &A, const T2 &b)
 
template<typename T1 , typename T2 , require_eigen_vt< is_fvar, T1 > * = nullptr, require_eigen_t< T2 > * = nullptr, require_vt_same< double, T2 > * = nullptr>
Eigen::Matrix< value_type_t< T1 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left_tri_low (const T1 &A, const T2 &b)
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_vt< is_fvar, EigMat1, EigMat2 > * = nullptr, require_vt_same< EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< value_type_t< EigMat1 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_right (const EigMat1 &A, const EigMat2 &b)
 
template<typename EigMat1 , typename EigMat2 , require_eigen_vt< std::is_arithmetic, EigMat1 > * = nullptr, require_eigen_vt< is_fvar, EigMat2 > * = nullptr>
Eigen::Matrix< value_type_t< EigMat2 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_right (const EigMat1 &A, const EigMat2 &b)
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_vt< is_fvar, EigMat1, EigMat2 > * = nullptr, require_vt_same< EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< value_type_t< EigMat1 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_right_tri_low (const EigMat1 &A, const EigMat2 &b)
 
template<typename EigMat1 , typename EigMat2 , require_eigen_vt< std::is_arithmetic, EigMat1 > * = nullptr, require_eigen_vt< is_fvar, EigMat2 > * = nullptr>
Eigen::Matrix< value_type_t< EigMat2 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_right_tri_low (const EigMat1 &A, const EigMat2 &b)
 
template<typename T >
fvar< T > modified_bessel_first_kind (int v, const fvar< T > &z)
 
template<typename T >
fvar< T > modified_bessel_second_kind (int v, const fvar< T > &z)
 
template<typename Mat1 , typename Mat2 , require_all_eigen_vt< is_fvar, Mat1, Mat2 > * = nullptr, require_vt_same< Mat1, Mat2 > * = nullptr, require_not_eigen_row_and_col_t< Mat1, Mat2 > * = nullptr>
auto multiply (const Mat1 &m1, const Mat2 &m2)
 Return the product of the specified matrices.
 
template<typename T >
fvar< T > multiply_log (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > multiply_log (double x1, const fvar< T > &x2)
 
template<typename T >
fvar< T > multiply_log (const fvar< T > &x1, double x2)
 
template<typename EigMat , require_eigen_vt< is_fvar, EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::RowsAtCompileTime > multiply_lower_tri_self_transpose (const EigMat &m)
 
template<typename T >
fvar< T > norm (const std::complex< fvar< T > > &z)
 Return the squared magnitude of the complex argument.
 
template<typename Container , require_eigen_vt< is_fvar, Container > * = nullptr>
auto norm1 (const Container &x)
 Compute the L1 norm of the specified vector of values.
 
template<typename Container , require_eigen_vt< is_fvar, Container > * = nullptr>
auto norm2 (const Container &x)
 Compute the L2 norm of the specified vector of values.
 
template<typename T >
fvar< T > owens_t (const fvar< T > &x1, const fvar< T > &x2)
 Return Owen's T function applied to the specified arguments.
 
template<typename T >
fvar< T > owens_t (double x1, const fvar< T > &x2)
 Return Owen's T function applied to the specified arguments.
 
template<typename T >
fvar< T > owens_t (const fvar< T > &x1, double x2)
 Return Owen's T function applied to the specified arguments.
 
template<typename T >
fvar< T > Phi (const fvar< T > &x)
 
template<typename T >
fvar< T > Phi_approx (const fvar< T > &x)
 Return an approximation of the unit normal cumulative distribution function (CDF).
 
template<typename T >
std::complex< fvar< T > > polar (const fvar< T > &r, const fvar< T > &theta)
 Returns complex number with specified magnitude and phase angle.
 
template<typename T , typename U >
std::complex< fvar< T > > polar (const fvar< T > &r, U theta)
 Returns complex number with specified magnitude and phase angle.
 
template<typename T , typename U >
std::complex< fvar< T > > polar (U r, const fvar< T > &theta)
 Returns complex number with specified magnitude and phase angle.
 
template<typename T >
fvar< T > pow (const fvar< T > &x1, const fvar< T > &x2)
 
template<typename T , typename U , typename = require_arithmetic_t<U>>
fvar< T > pow (U x1, const fvar< T > &x2)
 
template<typename T , typename U , typename = require_arithmetic_t<U>>
fvar< T > pow (const fvar< T > &x1, U x2)
 
template<typename V >
std::complex< fvar< V > > pow (const std::complex< fvar< V > > &x, const std::complex< fvar< V > > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename V , typename T , typename = require_arithmetic_t<T>>
std::complex< fvar< V > > pow (const std::complex< fvar< V > > &x, const std::complex< T > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename V >
std::complex< fvar< V > > pow (const std::complex< fvar< V > > &x, const fvar< V > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename V , typename T , typename = require_arithmetic_t<T>>
std::complex< fvar< V > > pow (const std::complex< fvar< V > > &x, const T &y)
 Return the first argument raised to the power of the second argument.
 
template<typename V , typename T , typename = require_arithmetic_t<T>>
std::complex< fvar< V > > pow (const std::complex< T > &x, const std::complex< fvar< V > > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename V , typename T , typename = require_arithmetic_t<T>>
std::complex< fvar< V > > pow (const std::complex< T > &x, const fvar< V > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename V >
std::complex< fvar< V > > pow (const fvar< V > &x, const std::complex< fvar< V > > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename V , typename T , typename = require_arithmetic_t<T>>
std::complex< fvar< V > > pow (const fvar< V > &x, const std::complex< T > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename T , typename V , typename = require_arithmetic_t<T>>
std::complex< fvar< V > > pow (T x, const std::complex< fvar< V > > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename T >
std::complex< fvar< T > > pow (const std::complex< fvar< T > > &x, int y)
 Return the first argument raised to the power of the second argument.
 
template<typename T >
double primitive_value (const fvar< T > &v)
 Return the primitive value of the specified forward-mode autodiff variable.
 
template<typename T >
std::complex< fvar< T > > proj (const std::complex< fvar< T > > &z)
 Return the projection of the complex argument onto the Riemann sphere.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_not_eigen_col_vector_t< EigMat2 > * = nullptr, require_any_vt_fvar< EigMat1, EigMat2 > * = nullptr>
promote_scalar_t< return_type_t< EigMat1, EigMat2 >, EigMat2 > quad_form (const EigMat1 &A, const EigMat2 &B)
 Return the quadratic form \( B^T A B \).
 
template<typename EigMat , typename ColVec , require_eigen_t< EigMat > * = nullptr, require_eigen_col_vector_t< ColVec > * = nullptr, require_any_vt_fvar< EigMat, ColVec > * = nullptr>
return_type_t< EigMat, ColVec > quad_form (const EigMat &A, const ColVec &B)
 Return the quadratic form \( B^T A B \).
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_not_eigen_col_vector_t< EigMat2 > * = nullptr, require_any_vt_fvar< EigMat1, EigMat2 > * = nullptr>
promote_scalar_t< return_type_t< EigMat1, EigMat2 >, EigMat2 > quad_form_sym (const EigMat1 &A, const EigMat2 &B)
 Return the quadratic form \( B^T A B \) of a symmetric matrix.
 
template<typename EigMat , typename ColVec , require_eigen_t< EigMat > * = nullptr, require_eigen_col_vector_t< ColVec > * = nullptr, require_any_vt_fvar< EigMat, ColVec > * = nullptr>
return_type_t< EigMat, ColVec > quad_form_sym (const EigMat &A, const ColVec &B)
 Return the quadratic form \( B^T A B \) of a symmetric matrix.
 
template<typename EigFvar , typename EigOut >
void read_fvar (const EigFvar &FvarMat, EigOut &ValMat, EigOut &DMat)
 Function applying the read_fvar_functor to extract the values and tangets of a given fvar matrix into separate matrices.
 
template<typename T >
fvar< T > rising_factorial (const fvar< T > &x, int n)
 Return autodiff variable with the gradient and result of the rising factorial function applied to the inputs.
 
template<typename T >
fvar< T > round (const fvar< T > &x)
 Return the closest integer to the specified argument, with halfway cases rounded away from zero.
 
template<typename T >
fvar< T > sin (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > sin (const std::complex< fvar< T > > &z)
 Return the sine of the complex argument.
 
template<typename T >
fvar< T > sinh (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > sinh (const std::complex< fvar< T > > &z)
 Return the hyperbolic sine of the complex argument.
 
template<typename ColVec , require_eigen_col_vector_vt< is_fvar, ColVec > * = nullptr>
auto softmax (const ColVec &alpha)
 
template<typename T >
fvar< T > sqrt (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > sqrt (const std::complex< fvar< T > > &z)
 Return the square root of the complex argument.
 
template<typename T >
fvar< T > square (const fvar< T > &x)
 
template<typename T >
fvar< T > sum (const std::vector< fvar< T > > &m)
 Return the sum of the entries of the specified standard vector.
 
template<typename T , require_eigen_vt< is_fvar, T > * = nullptr>
value_type_t< T > sum (const T &m)
 Return the sum of the entries of the specified matrix.
 
template<typename T >
fvar< T > tan (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > tan (const std::complex< fvar< T > > &z)
 Return the tangent of the complex argument.
 
template<typename T >
fvar< T > tanh (const fvar< T > &x)
 
template<typename T >
std::complex< fvar< T > > tanh (const std::complex< fvar< T > > &z)
 Return the hyperbolic tangent of the complex argument.
 
template<typename EigMat , require_eigen_vt< is_fvar, EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::RowsAtCompileTime > tcrossprod (const EigMat &m)
 
template<typename T >
fvar< T > tgamma (const fvar< T > &x)
 Return the result of applying the gamma function to the specified argument.
 
template<typename T , require_stan_scalar_t< T > * = nullptr, require_not_fvar_t< T > * = nullptr>
fvar< T > to_fvar (const T &x)
 
template<typename T , require_fvar_t< scalar_type_t< T > > * = nullptr>
T && to_fvar (T &&x)
 Specialization of to_fvar for [containers of] fvars.
 
template<typename T >
std::vector< fvar< T > > to_fvar (const std::vector< T > &v)
 
template<typename T >
std::vector< fvar< T > > to_fvar (const std::vector< T > &v, const std::vector< T > &d)
 
template<typename T , require_eigen_t< T > * = nullptr, require_not_eigen_vt< is_fvar, T > * = nullptr>
promote_scalar_t< fvar< value_type_t< T > >, T > to_fvar (const T &m)
 
template<typename T1 , typename T2 , require_all_eigen_t< T1, T2 > * = nullptr, require_vt_same< T1, T2 > * = nullptr>
promote_scalar_t< fvar< value_type_t< T1 > >, T1 > to_fvar (const T1 &val, const T2 &deriv)
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_any_vt_fvar< EigMat1, EigMat2 > * = nullptr>
return_type_t< EigMat1, EigMat2 > trace_quad_form (const EigMat1 &A, const EigMat2 &B)
 
template<typename T >
fvar< T > trigamma (const fvar< T > &u)
 Return the value of the trigamma function at the specified argument (i.e., the second derivative of the log Gamma function at the specified argument).
 
template<typename T >
fvar< T > trunc (const fvar< T > &x)
 Return the nearest integral value that is not larger in magnitude than the specified argument.
 
template<typename EigMat , require_eigen_col_vector_vt< is_fvar, EigMat > * = nullptr>
auto unit_vector_constrain (const EigMat &y)
 
template<typename EigMat , typename T , require_eigen_vt< is_fvar, EigMat > * = nullptr, require_stan_scalar_t< T > * = nullptr>
auto unit_vector_constrain (const EigMat &y, T &lp)
 
template<typename T >
value_of (const fvar< T > &v)
 Return the value of the specified variable.
 
template<typename T >
double value_of_rec (const fvar< T > &v)
 Return the value of the specified variable.
 
template<typename F , typename... TArgs, require_any_st_fvar< TArgs... > * = nullptr>
auto finite_diff (const F &func, const TArgs &... args)
 Construct an fvar<T> where the tangent is calculated by finite-differencing.
 
template<typename T , typename F >
void gradient (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, T &fx, Eigen::Matrix< T, Eigen::Dynamic, 1 > &grad_fx)
 Calculate the value and the gradient of the specified function at the specified argument.
 
template<typename T , typename F >
void hessian (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, T &fx, Eigen::Matrix< T, Eigen::Dynamic, 1 > &grad, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &H)
 Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in time O(N^3) time and O(N^2) space.
 
template<typename F , typename T_a , typename T_b , typename... Args, require_any_st_fvar< T_a, T_b, Args... > * = nullptr>
return_type_t< T_a, T_b, Args... > integrate_1d_impl (const F &f, const T_a &a, const T_b &b, double relative_tolerance, std::ostream *msgs, const Args &... args)
 Return the integral of f from a to b to the given relative tolerance.
 
template<typename F , typename T_a , typename T_b , typename T_theta , require_any_fvar_t< T_a, T_b, T_theta > * = nullptr>
return_type_t< T_a, T_b, T_theta > integrate_1d (const F &f, const T_a &a, const T_b &b, const std::vector< T_theta > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs, const double relative_tolerance)
 Compute the integral of the single variable function f from a to b to within a specified relative tolerance.
 
template<typename T , typename F >
void jacobian (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &fx, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &J)
 
template<typename T >
fvar< T > std_normal_log_qf (const fvar< T > &p)
 
template<typename T >
bool is_aligned (T *ptr, unsigned int bytes_aligned)
 Return true if the specified pointer is aligned on the number of bytes.
 
template<typename T , typename F >
void derivative (const F &f, const T &x, T &fx, T &dfx_dx)
 Return the derivative of the specified univariate function at the specified argument.
 
template<typename F >
void finite_diff_grad_hessian (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::MatrixXd &hess, std::vector< Eigen::MatrixXd > &grad_hess_fx, double epsilon=1e-04)
 Calculate the value and the gradient of the hessian of the specified function at the specified argument using second-order autodiff and first-order finite difference.
 
template<typename F >
void finite_diff_grad_hessian_auto (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::MatrixXd &hess, std::vector< Eigen::MatrixXd > &grad_hess_fx)
 Calculate the value, Hessian, and the gradient of the Hessian of the specified function at the specified argument using second-order autodiff and first-order finite difference.
 
template<typename F >
void grad_hessian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, double &fx, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &H, std::vector< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > > &grad_H)
 Calculate the value, the Hessian, and the gradient of the Hessian of the specified function at the specified argument.
 
template<typename F >
void grad_tr_mat_times_hessian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &M, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad_tr_MH)
 
template<typename T1 , typename T2 , typename F >
void gradient_dot_vector (const F &f, const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &v, T1 &fx, T1 &grad_fx_dot_v)
 
template<typename F >
void hessian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, double &fx, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &H)
 Calculate the value, the gradient, and the Hessian, of the specified function at the specified argument in O(N^2) time and O(N^2) space.
 
template<typename F >
void hessian_times_vector (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &v, double &fx, Eigen::Matrix< double, Eigen::Dynamic, 1 > &Hv)
 
template<typename T , typename F >
void hessian_times_vector (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, T &fx, Eigen::Matrix< T, Eigen::Dynamic, 1 > &Hv)
 
template<typename T , typename F >
void partial_derivative (const F &f, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, int n, T &fx, T &dfx_dxn)
 Return the partial derivative of the specified multivariate function at the specified argument.
 
template<typename T , require_st_arithmetic< T > * = nullptr>
matrix_cl< scalar_type_t< T > > to_matrix_cl (T &&src)
 Copies the source Eigen matrix, std::vector or scalar to the destination matrix that is stored on the OpenCL device.
 
template<typename T_ret , typename T , require_eigen_t< T_ret > * = nullptr, require_matrix_cl_t< T > * = nullptr, require_st_same< T_ret, T > * = nullptr>
auto from_matrix_cl (const T &src)
 Copies the source matrix that is stored on the OpenCL device to the destination Eigen matrix.
 
template<typename T_ret , typename T , require_all_kernel_expressions_t< T > * = nullptr, require_not_matrix_cl_t< T > * = nullptr>
auto from_matrix_cl (const T &src)
 Copies result of a kernel generator expression to the specified destination type.
 
template<typename T_dst , typename T , require_arithmetic_t< T > * = nullptr, require_same_t< T_dst, T > * = nullptr>
T_dst from_matrix_cl (const matrix_cl< T > &src)
 Copy A 1 by 1 source matrix from the Device to the host.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto from_matrix_cl (const T &src)
 Copies the source kernel generator expression or matrix that is stored on the OpenCL device to the destination Eigen matrix.
 
template<typename T , require_matrix_cl_t< T > * = nullptr>
auto packed_copy (const T &src)
 Packs the square flat triangular matrix on the OpenCL device and copies it to the std::vector.
 
template<matrix_cl_view matrix_view, typename Vec , typename Vec_scalar = scalar_type_t<Vec>, require_vector_vt< std::is_arithmetic, Vec > * = nullptr>
matrix_cl< Vec_scalar > packed_copy (Vec &&src, int rows)
 Copies the packed triangular matrix from the source std::vector to an OpenCL buffer and unpacks it to a flat matrix on the OpenCL device.
 
template<typename T , require_matrix_cl_t< T > * = nullptr>
plain_type_t< T > copy_cl (const T &src)
 Copies the source matrix to the destination matrix.
 
template<typename T >
void check_mat_not_size_one (const char *function, const char *name, const matrix_cl< T > &A)
 Check if the matrix_cl has a single element.
 
void check_opencl_error (const char *function, const cl::Error &e)
 Throws the domain error with specifying the OpenCL error that occurred.
 
template<typename T , typename = require_arithmetic_t<T>>
void check_symmetric (const char *function, const char *name, const matrix_cl< T > &y)
 Check if the matrix_cl is symmetric.
 
template<typename T , require_matrix_cl_t< T > * = nullptr>
void check_triangular (const char *function, const char *name, const T &A)
 Check if the matrix_cl is either upper triangular or lower triangular.
 
void indexing_rev (matrix_cl< double > &adj, const matrix_cl< int > &idx, const matrix_cl< double > &res)
 Performs reverse pass for indexing operation on the OpenCL device.
 
template<typename Ta , typename Tb , typename = require_all_kernel_expressions_and_none_scalar_t<Ta, Tb>>
auto append_row (Ta &&a, Tb &&b)
 Stack the rows of the first argument on top of the second argument.
 
template<typename Ta , typename Tb , typename = require_all_kernel_expressions_and_none_scalar_t<Ta, Tb>>
auto append_col (Ta &&a, Tb &&b)
 Stack the cols of the arguments.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
auto as_column_vector_or_scalar (T &&a)
 as_column_vector_or_scalar of a kernel generator expression.
 
template<assign_op_cl AssignOp = assign_op_cl::equals, typename T_operation , typename = std::enable_if_t<std::is_base_of< operation_cl_base, std::remove_reference_t<T_operation>>::value>>
T_operation && as_operation_cl (T_operation &&a)
 Converts any valid kernel generator expression into an operation.
 
template<assign_op_cl AssignOp = assign_op_cl::equals, typename T_scalar , typename = require_arithmetic_t<T_scalar>, require_not_same_t< T_scalar, bool > * = nullptr>
scalar_< T_scalar > as_operation_cl (const T_scalar a)
 Converts any valid kernel generator expression into an operation.
 
template<assign_op_cl AssignOp = assign_op_cl::equals>
scalar_< char > as_operation_cl (const bool a)
 Converts any valid kernel generator expression into an operation.
 
template<assign_op_cl AssignOp = assign_op_cl::equals, typename T_matrix_cl , typename = require_any_t<is_matrix_cl<T_matrix_cl>, is_arena_matrix_cl<T_matrix_cl>>>
load_< T_matrix_cl, AssignOp > as_operation_cl (T_matrix_cl &&a)
 Converts any valid kernel generator expression into an operation.
 
template<typename T >
constexpr const char * assignment_op () noexcept
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
addition_operator_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator+ (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
addition_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > add (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
subtraction_operator_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator- (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
subtraction_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > subtract (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
elt_multiply_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > elt_multiply (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
elt_divide_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > elt_divide (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
elt_modulo_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator% (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
less_than_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator< (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
less_than_or_equal_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator<= (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
greater_than_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator> (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
greater_than_or_equal_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator>= (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
equals_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator== (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
not_equals_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator!= (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
logical_or_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator|| (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr>
logical_and_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator&& (T_a &&a, T_b &&b)
 
template<typename T_a , typename T_b , typename = require_arithmetic_t<T_a>, typename = require_all_kernel_expressions_t<T_b>>
elt_multiply_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator* (T_a a, T_b &&b)
 Multiplication of a scalar and a kernel generator expression.
 
template<typename T_a , typename T_b , typename = require_all_kernel_expressions_t<T_a>, typename = require_arithmetic_t<T_b>>
elt_multiply_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > operator* (T_a &&a, const T_b b)
 Multiplication of a kernel generator expression and a scalar.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto block_zero_based (T &&a, int start_row, int start_col, int rows, int cols)
 Block of a kernel generator expression.
 
template<bool Colwise, bool Rowwise, typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto broadcast (T &&a)
 Broadcast an expression in specified dimension(s).
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto rowwise_broadcast (T &&a)
 Broadcast an expression in rowwise dimmension.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto colwise_broadcast (T &&a)
 Broadcast an expression in colwise dimmension.
 
template<bool Do_Calculate, typename T , require_all_kernel_expressions_t< T > * = nullptr, std::enable_if_t< Do_Calculate > * = nullptr>
calc_if_< true, as_operation_cl_t< T > > calc_if (T &&a)
 
template<bool Do_Calculate, typename T , std::enable_if_t<!Do_Calculate > * = nullptr>
calc_if_< false, scalar_< double > > calc_if (T &&a)
 
template<typename Scalar , typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
auto cast (T &&a)
 Typecast a kernel generator expression scalar.
 
template<typename Scalar , typename T , require_stan_scalar_t< T > * = nullptr>
Scalar cast (T a)
 Typecast a scalar.
 
template<typename T , typename = require_all_kernel_expressions_t<T>>
auto check_cl (const char *function, const char *var_name, T &&y, const char *must_be)
 Constructs a check on opencl matrix or expression.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto colwise_sum (T &&a)
 Column wise sum - reduction of a kernel generator expression.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto colwise_prod (T &&a)
 Column wise product - reduction of a kernel generator expression.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto colwise_max (T &&a)
 Column wise max - reduction of a kernel generator expression.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto colwise_min (T &&a)
 Column wise min - reduction of a kernel generator expression.
 
template<typename T1 , typename T2 , require_kernel_expression_lhs_t< T1 > * = nullptr, require_all_kernel_expressions_t< T2 > * = nullptr>
T1 operator+= (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_kernel_expression_lhs_t< T1 > * = nullptr, require_all_kernel_expressions_t< T2 > * = nullptr>
T1 operator-= (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_kernel_expression_lhs_t< T1 > * = nullptr, require_all_kernel_expressions_t< T2 > * = nullptr>
T1 operator*= (T1 &&a, T2 &&b)
 
template<typename T , typename = require_arithmetic_t<T>>
auto constant (const T a, int rows, int cols)
 Matrix of repeated values in kernel generator expressions.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto diagonal (T &&a)
 Diagonal of a kernel generator expression.
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
rsqrt_< as_operation_cl_t< T > > rsqrt (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
sqrt_< as_operation_cl_t< T > > sqrt (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
cbrt_< as_operation_cl_t< T > > cbrt (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
exp_< as_operation_cl_t< T > > exp (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
exp2_< as_operation_cl_t< T > > exp2 (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
expm1_< as_operation_cl_t< T > > expm1 (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log_< as_operation_cl_t< T > > log (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log2_< as_operation_cl_t< T > > log2 (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log10_< as_operation_cl_t< T > > log10 (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log1p_< as_operation_cl_t< T > > log1p (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
sin_< as_operation_cl_t< T > > sin (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
sinh_< as_operation_cl_t< T > > sinh (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
cos_< as_operation_cl_t< T > > cos (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
cosh_< as_operation_cl_t< T > > cosh (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
tan_< as_operation_cl_t< T > > tan (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
tanh_< as_operation_cl_t< T > > tanh (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
asin_< as_operation_cl_t< T > > asin (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
asinh_< as_operation_cl_t< T > > asinh (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
acos_< as_operation_cl_t< T > > acos (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
acosh_< as_operation_cl_t< T > > acosh (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
atan_< as_operation_cl_t< T > > atan (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
atanh_< as_operation_cl_t< T > > atanh (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
tgamma_< as_operation_cl_t< T > > tgamma (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
lgamma_< as_operation_cl_t< T > > lgamma (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
erf_< as_operation_cl_t< T > > erf (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
erfc_< as_operation_cl_t< T > > erfc (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
floor_< as_operation_cl_t< T > > floor (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
round_< as_operation_cl_t< T > > round (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
ceil_< as_operation_cl_t< T > > ceil (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
fabs_< as_operation_cl_t< T > > fabs (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
trunc_< as_operation_cl_t< T > > trunc (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
digamma_< as_operation_cl_t< T > > digamma (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log1m_< as_operation_cl_t< T > > log1m (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log_inv_logit_< as_operation_cl_t< T > > log_inv_logit (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log1m_exp_< as_operation_cl_t< T > > log1m_exp (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log1p_exp_< as_operation_cl_t< T > > log1p_exp (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
inv_square_< as_operation_cl_t< T > > inv_square (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
inv_logit_< as_operation_cl_t< T > > inv_logit (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
logit_< as_operation_cl_t< T > > logit (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
Phi_< as_operation_cl_t< T > > Phi (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
Phi_approx_< as_operation_cl_t< T > > Phi_approx (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
inv_Phi_< as_operation_cl_t< T > > inv_Phi (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
log1m_inv_logit_< as_operation_cl_t< T > > log1m_inv_logit (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
trigamma_< as_operation_cl_t< T > > trigamma (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
square_< as_operation_cl_t< T > > square (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
isfinite_< as_operation_cl_t< T > > isfinite (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
isinf_< as_operation_cl_t< T > > isinf (T &&a)
 
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>>
isnan_< as_operation_cl_t< T > > isnan (T &&a)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
fdim_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > fdim (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
fmax_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > fmax (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
fmin_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > fmin (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
fmod_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > fmod (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
hypot_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > hypot (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
ldexp_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > ldexp (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
pow_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > pow (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
copysign_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > copysign (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
beta_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > beta (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
binomial_coefficient_log_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > binomial_coefficient_log (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
lbeta_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > lbeta (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
log_inv_logit_diff_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > log_inv_logit_diff (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
log_diff_exp_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > log_diff_exp (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
multiply_log_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > multiply_log (T1 &&a, T2 &&b)
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr>
lmultiply_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > lmultiply (T1 &&a, T2 &&b)
 
template<typename T , typename... Ptrs, require_all_kernel_expressions_t< T, Ptrs... > * = nullptr>
auto holder_cl (T &&a, Ptrs *... ptrs)
 Constructs a no-op operation that also holds pointer to some other expressions, allocated on heap.
 
template<typename T , typename... Args, require_all_kernel_expressions_t< decltype(std::declval< T >()(std::declval< Args & >()...)), Args... > * = nullptr>
auto make_holder_cl (const T &func, Args &&... args)
 Constructs an expression from given arguments using given functor.
 
template<typename T_mat , typename T_row_index , typename T_col_index , require_all_kernel_expressions_t< T_mat, T_row_index, T_col_index > * = nullptr>
auto indexing (T_mat &&mat, T_row_index &&row_index, T_col_index &&col_index)
 Index a kernel generator expression using two expressions for indices.
 
template<typename T_matrix , typename T_vector , typename = require_all_kernel_expressions_t<T_matrix, T_vector>>
auto matrix_vector_multiply (T_matrix &&matrix, T_vector &&vector)
 Multiplies a matrix and a vector on an OpenCL device.
 
template<typename... T_expressions>
expressions_cl< T_expressions... > expressions (T_expressions &&... expressions)
 Deduces types for constructing expressions_cl object.
 
template<typename... T_results>
results_cl< T_results... > results (T_results &&... results)
 Deduces types for constructing results_cl object.
 
template<const char * Code, typename... T_arguments, require_all_kernel_expressions_t< T_arguments... > * = nullptr>
auto opencl_code (std::tuple< typename std::pair< const char *, T_arguments >::first_type... > names, T_arguments &&... arguments)
 Custom code in kernel generator expressions.
 
std::ostream & operator<< (std::ostream &os, kernel_parts &parts)
 
template<bool Colwise, bool Rowwise, typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
optional_broadcast_< as_operation_cl_t< T >, Colwise, Rowwise > optional_broadcast (T &&a)
 Broadcast an expression in specified dimension(s) if the size along that dimension equals 1.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto rowwise_optional_broadcast (T &&a)
 Broadcast an expression in rowwise dimmension if the number of columns equals to 1.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto colwise_optional_broadcast (T &&a)
 Broadcast an expression in colwise dimmension if the number of rows equals to 1.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto sum_2d (T &&a)
 Two dimensional sum - reduction of a kernel generator expression.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto prod_2d (T &&a)
 Two dimensional product - reduction of a kernel generator expression.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto max_2d (T &&a)
 Two dimensional max - reduction of a kernel generator expression.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto min_2d (T &&a)
 Two dimensional min - reduction of a kernel generator expression.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto rowwise_sum (T &&a)
 Rowwise sum reduction of a kernel generator expression.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto rowwise_prod (T &&a)
 Rowwise product reduction of a kernel generator expression.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto rowwise_max (T &&a)
 Rowwise max reduction of a kernel generator expression.
 
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>>
auto rowwise_min (T &&a)
 Min reduction of a kernel generator expression.
 
template<typename T_condition , typename T_then , typename T_else , require_all_kernel_expressions_t< T_condition, T_then, T_else > * = nullptr, require_any_not_arithmetic_t< T_condition, T_then, T_else > * = nullptr>
select_< as_operation_cl_t< T_condition >, as_operation_cl_t< T_then >, as_operation_cl_t< T_else > > select (T_condition &&condition, T_then &&then, T_else &&els)
 Selection operation on kernel generator expressions.
 
template<typename Arg , typename = require_all_kernel_expressions_and_none_scalar_t<Arg>>
auto transpose (Arg &&a)
 Transposes a kernel generator expression.
 
template<typename T >
std::string type_str ()
 Determines a string name of a type.
 
template<>
std::string type_str< double > ()
 
template<>
std::string type_str< int > ()
 
template<>
std::string type_str< char > ()
 
template<>
std::string type_str< bool > ()
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
logical_negation_< as_operation_cl_t< T > > operator! (T &&a)
 Logical negation of a kernel generator expression.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
unary_minus_< as_operation_cl_t< T > > operator- (T &&a)
 Unary minus of a kernel generator expression.
 
const matrix_cl_view either (const matrix_cl_view left_view, const matrix_cl_view right_view)
 Determines which parts are nonzero in any of the input views.
 
const matrix_cl_view both (const matrix_cl_view left_view, const matrix_cl_view right_view)
 Determines which parts are nonzero in both input views.
 
bool contains_nonzero (const matrix_cl_view view, const matrix_cl_view part)
 Check whether a view contains certain nonzero part.
 
const matrix_cl_view transpose (const matrix_cl_view view)
 Transposes a view - swaps lower and upper parts.
 
const matrix_cl_view invert (const matrix_cl_view view)
 Inverts a view.
 
matrix_cl_view from_eigen_uplo_type (Eigen::UpLoType eigen_type)
 Creates a view from Eigen::UpLoType.
 
int either (int left_view, int right_view)
 Determines which parts are nonzero in any of the input views.
 
int both (int left_view, int right_view)
 Determines which parts are nonzero in both input views.
 
bool contains_nonzero (int view, int part)
 Check whether a view contains certain nonzero part.
 
template<typename T , typename = require_arithmetic_t<T>>
matrix_cl< T > multiply_transpose (const matrix_cl< T > &A)
 Computes the product of a square OpenCL matrix with its transpose.
 
template<typename T_m , typename T_a , require_all_kernel_expressions_and_none_scalar_t< T_m > * = nullptr, require_all_kernel_expressions_t< T_a > * = nullptr>
auto add_diag (T_m &&mat, T_a &&to_add)
 Returns a Matrix with values added along the main diagonal.
 
template<typename T_x , typename T_y , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_x, T_y > * = nullptr>
auto append_array (T_x &&x, T_y &&y)
 Return the concatenation of two specified vectors in the order of the arguments.
 
template<typename T_n_cl , typename T_prob_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_prob_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_prob_cl > * = nullptr>
return_type_t< T_prob_cl > bernoulli_cdf (const T_n_cl &n, const T_prob_cl &theta)
 Returns the CDF of the Bernoulli distribution.
 
template<typename T_n_cl , typename T_prob_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_prob_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_prob_cl > * = nullptr>
return_type_t< T_prob_cl > bernoulli_lccdf (const T_n_cl &n, const T_prob_cl &theta)
 Returns the log CCDF of the Bernoulli distribution.
 
template<typename T_n_cl , typename T_prob_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_prob_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_prob_cl > * = nullptr>
return_type_t< T_prob_cl > bernoulli_lcdf (const T_n_cl &n, const T_prob_cl &theta)
 Returns the log CDF of the Bernoulli distribution.
 
template<bool propto, typename T_x_cl , typename T_y_cl , typename T_alpha_cl , typename T_beta_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_x_cl, T_alpha_cl, T_beta_cl > * = nullptr>
return_type_t< T_x_cl, T_alpha_cl, T_beta_cl > bernoulli_logit_glm_lpmf (const T_y_cl &y, const T_x_cl &x, const T_alpha_cl &alpha, const T_beta_cl &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with Bernoulli distribution and logit link function.
 
template<bool propto, typename T_n_cl , typename T_prob_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_prob_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_prob_cl > * = nullptr>
return_type_t< T_prob_cl > bernoulli_logit_lpmf (const T_n_cl &n, const T_prob_cl &theta)
 Returns the log PMF of the logit-parametrized Bernoulli distribution.
 
template<bool propto, typename T_n_cl , typename T_prob_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_prob_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_prob_cl > * = nullptr>
return_type_t< T_prob_cl > bernoulli_lpmf (const T_n_cl &n, const T_prob_cl &theta)
 Returns the log PMF of the Bernoulli distribution.
 
template<bool propto, typename T_n_cl , typename T_N_cl , typename T_size1_cl , typename T_size2_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_size1_cl, T_size2_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_size1_cl, T_size2_cl > * = nullptr>
return_type_t< T_n_cl, T_size1_cl, T_size2_cl > beta_binomial_lpmf (const T_n_cl &n, const T_N_cl N, const T_size1_cl &alpha, const T_size2_cl &beta)
 Returns the log PMF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.
 
template<bool propto, typename T_y_cl , typename T_scale_succ_cl , typename T_scale_fail_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_succ_cl, T_scale_fail_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_succ_cl, T_scale_fail_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_succ_cl, T_scale_fail_cl > beta_lpdf (const T_y_cl &y, const T_scale_succ_cl &alpha, const T_scale_fail_cl &beta)
 The log of the beta density for the specified scalar(s) given the specified sample stan::math::size(s).
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_prec_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_prec_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_prec_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_prec_cl > beta_proportion_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_prec_cl &kappa)
 The log of the beta density for specified y, location, and precision: beta_proportion_lpdf(y | mu, kappa) = beta_lpdf(y | mu * kappa, (1 - mu) * kappa).
 
template<bool propto, typename T_n_cl , typename T_N_cl , typename T_x_cl , typename T_alpha_cl , typename T_beta_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_x_cl, T_alpha_cl, T_beta_cl > * = nullptr>
return_type_t< T_x_cl, T_alpha_cl, T_beta_cl > binomial_logit_glm_lpmf (const T_n_cl &n, const T_N_cl &N, const T_x_cl &x, const T_alpha_cl &alpha, const T_beta_cl &beta)
 
template<bool propto, typename T_n_cl , typename T_N_cl , typename T_prob_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_prob_cl > * = nullptr, require_any_nonscalar_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_prob_cl > * = nullptr>
return_type_t< T_prob_cl > binomial_logit_lpmf (const T_n_cl &n, const T_N_cl N, const T_prob_cl &alpha)
 Binomial log PMF in logit parametrization.
 
template<bool propto, typename T_n_cl , typename T_N_cl , typename T_prob_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_prob_cl > * = nullptr, require_any_nonscalar_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_prob_cl > * = nullptr>
return_type_t< T_prob_cl > binomial_lpmf (const T_n_cl &n, const T_N_cl N, const T_prob_cl &theta)
 Returns the log PMF for the binomial distribution evaluated at the specified success, population size, and chance of success.
 
template<typename T_x , typename = require_all_kernel_expressions_and_none_scalar_t<T_x>>
auto block (T_x &&x, size_t i, size_t j, size_t nrows, size_t ncols)
 Return a nrows x ncols submatrix starting at (i-1, j-1).
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , require_all_prim_or_rev_kernel_expression_t< T_y, T_x, T_alpha, T_beta > * = nullptr>
return_type_t< T_x, T_alpha, T_beta > categorical_logit_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with categorical distribution and logit (softmax) link function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > cauchy_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the cauchy cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > cauchy_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the cauchy log complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > cauchy_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the cauchy cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > cauchy_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s).
 
template<bool propto, typename T_y_cl , typename T_dof_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_dof_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_dof_cl > * = nullptr>
return_type_t< T_y_cl, T_dof_cl > chi_square_lpdf (const T_y_cl &y, const T_dof_cl &nu)
 The log of a chi-squared density for y with the specified degrees of freedom parameter.
 
matrix_cl< double > cholesky_decompose (const matrix_cl< double > &A)
 Returns the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix on the OpenCL device.
 
template<typename T_x , typename = require_nonscalar_prim_or_rev_kernel_expression_t<T_x>>
auto col (T_x &&x, size_t j)
 Return the specified column of the specified kernel generator expression using start-at-1 indexing.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
int cols (const T_x &x)
 Returns the number of columns in the specified kernel generator expression.
 
template<typename T_a , typename T_b , require_all_kernel_expressions_and_none_scalar_t< T_a, T_b > * = nullptr>
auto columns_dot_product (const T_a &a, const T_b &b)
 Returns the dot product of columns of the specified matrices.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
auto columns_dot_self (const T &a)
 Returns the dot product of each column of a matrix with itself.
 
template<typename T_A , typename = require_all_kernel_expressions_and_none_scalar_t<T_A>>
matrix_cl< typename std::decay_t< T_A >::Scalar > crossprod (T_A &&A)
 Returns the result of pre-multiplying a matrix by its own transpose.
 
template<typename T_vec , require_all_kernel_expressions_and_none_scalar_t< T_vec > * = nullptr>
auto cumulative_sum (T_vec &&v)
 Return the cumulative sum of the specified vector.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
auto diag_matrix (T_x &&x)
 Return a square diagonal matrix with the specified vector of coefficients as the diagonal values.
 
template<typename T1 , typename T2 , require_all_kernel_expressions_and_none_scalar_t< T1, T2 > * = nullptr>
auto diag_post_multiply (const T1 &m1, const T2 &m2)
 Return the product of a matrix and the diagonal matrix formed from the vector or row_vector.
 
template<typename T1 , typename T2 , require_all_kernel_expressions_and_none_scalar_t< T1, T2 > * = nullptr>
auto diag_pre_multiply (const T1 &m1, const T2 &m2)
 Return the product of the diagonal matrix formed from the vector or row_vector and a matrix.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
void dims (const T_x &x, std::vector< int > &result)
 matrix_cl overload of the dims helper function in prim/fun/dims.hpp.
 
template<bool propto, typename T_prob_cl , typename T_prior_size_cl , require_all_prim_or_rev_kernel_expression_t< T_prob_cl, T_prior_size_cl > * = nullptr, require_any_not_stan_scalar_t< T_prob_cl, T_prior_size_cl > * = nullptr>
return_type_t< T_prob_cl, T_prior_size_cl > dirichlet_lpdf (const T_prob_cl &theta, const T_prior_size_cl &alpha)
 The log of the Dirichlet density for the given theta and a vector of prior sample sizes, alpha.
 
template<typename T_a , typename T_b , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr>
auto distance (const T_a &a, const T_b &b)
 Returns the distance between the specified vectors.
 
template<typename T_a , typename = require_all_kernel_expressions_and_none_scalar_t<T_a>>
auto divide (T_a &&a, double d)
 Returns the elementwise division of the kernel generator expression.
 
template<typename T1 , typename T2 , typename = require_all_arithmetic_t<T1, T2>>
void divide_columns (matrix_cl< T1 > &A, const matrix_cl< T2 > &B)
 Divides each column of a matrix by a vector.
 
template<typename T1 , typename T2 , typename = require_all_arithmetic_t<T1, T2>>
void divide_columns (matrix_cl< T1 > &A, const T2 &divisor)
 Divides each column of a matrix by a scalar.
 
template<typename T_a , typename T_b , require_all_kernel_expressions_and_none_scalar_t< T_a, T_b > * = nullptr>
auto dot_product (const T_a &a, const T_b &b)
 Returns the dot product of the specified vectors.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
auto dot_self (const T &a)
 Returns squared norm of a vector or matrix.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > double_exponential_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the double exponential cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > double_exponential_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the double exponential log complementary cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > double_exponential_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the double exponential log cumulative density function.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > double_exponential_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the double exponential log probability density function.
 
matrix_cl< double > eigenvalues_sym (const matrix_cl< double > &m)
 
matrix_cl< double > eigenvectors_sym (const matrix_cl< double > &m)
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > exp_mod_normal_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_inv_scale_cl &lambda)
 Returns the double exponential cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > exp_mod_normal_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_inv_scale_cl &lambda)
 Returns the exp mod normal log complementary cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > exp_mod_normal_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_inv_scale_cl &lambda)
 Returns the exp mod normal log cumulative density function.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_inv_scale_cl > exp_mod_normal_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_inv_scale_cl &lambda)
 Returns the log PMF of the exp mod normal distribution.
 
template<typename T_y_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_inv_scale_cl > exponential_cdf (const T_y_cl &y, const T_inv_scale_cl &beta)
 Calculates the exponential cumulative distribution function for the given y and beta.
 
template<typename T_y_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_inv_scale_cl > exponential_lccdf (const T_y_cl &y, const T_inv_scale_cl &beta)
 Calculates the log exponential cumulative distribution function for the given y and beta.
 
template<typename T_y_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_inv_scale_cl > exponential_lcdf (const T_y_cl &y, const T_inv_scale_cl &beta)
 Calculates the log exponential cumulative distribution function for the given y and beta.
 
template<bool propto, typename T_y_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_inv_scale_cl > exponential_lpdf (const T_y_cl &y, const T_inv_scale_cl &beta)
 The log of an exponential density for y with the specified inverse scale parameter.
 
template<typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > frechet_cdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 Returns the frechet cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > frechet_lccdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 Returns the frechet log complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > frechet_lcdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 Returns the frechet log cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > frechet_lpdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 The log of the frechet density for the specified scalar(s) given the specified sample stan::math::size(s).
 
template<bool propto, typename T_y_cl , typename T_shape_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_inv_scale_cl > gamma_lpdf (const T_y_cl &y, const T_shape_cl &alpha, const T_inv_scale_cl &beta)
 The log of a gamma density for y with the specified shape and inverse scale parameters.
 
template<typename T_x , typename T_sigma , require_all_prim_or_rev_kernel_expression_t< T_x > * = nullptr, require_stan_scalar_t< T_sigma > * = nullptr>
auto gp_dot_prod_cov (const T_x &x, const T_sigma sigma)
 Dot product kernel on the GPU.
 
template<typename T_x , typename T_y , typename T_sigma , require_all_prim_or_rev_kernel_expression_t< T_x, T_y > * = nullptr, require_stan_scalar_t< T_sigma > * = nullptr>
auto gp_dot_prod_cov (const T_x &x, const T_y &y, const T_sigma sigma)
 Dot product kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , typename = require_all_arithmetic_t<T1, T2, T3>>
matrix_cl< return_type_t< T1, T2, T3 > > gp_exp_quad_cov (const matrix_cl< T1 > &x, const T2 sigma, const T3 length_scale)
 Squared exponential kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename = require_all_arithmetic_t<T1, T2, T3, T4>>
matrix_cl< return_type_t< T1, T2, T3, T4 > > gp_exp_quad_cov (const matrix_cl< T1 > &x, const matrix_cl< T2 > &y, const T3 sigma, const T4 length_scale)
 Squared exponential kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , require_all_kernel_expressions_and_none_scalar_t< T1 > * = nullptr, require_all_arithmetic_t< T2, T3 > * = nullptr>
matrix_cl< return_type_t< T1, T2, T3 > > gp_exponential_cov (const T1 &x, const T2 sigma, const T3 length_scale)
 Matern exponential kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , typename T4 , require_all_kernel_expressions_and_none_scalar_t< T1, T2 > * = nullptr, require_all_arithmetic_t< T3, T4 > * = nullptr>
matrix_cl< return_type_t< T1, T2, T3, T4 > > gp_exponential_cov (const T1 &x, const T2 &y, const T3 sigma, const T4 length_scale)
 Matern exponential kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , require_all_kernel_expressions_and_none_scalar_t< T1 > * = nullptr, require_all_arithmetic_t< T2, T3 > * = nullptr>
matrix_cl< return_type_t< T1, T2, T3 > > gp_matern32_cov (const T1 &x, const T2 sigma, const T3 length_scale)
 Matern 3/2 kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , typename T4 , require_all_kernel_expressions_and_none_scalar_t< T1, T2 > * = nullptr, require_all_arithmetic_t< T3, T4 > * = nullptr>
matrix_cl< return_type_t< T1, T2, T3, T4 > > gp_matern32_cov (const T1 &x, const T2 &y, const T3 sigma, const T4 length_scale)
 Matern 3/2 kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , require_all_kernel_expressions_and_none_scalar_t< T1 > * = nullptr, require_all_arithmetic_t< T2, T3 > * = nullptr>
matrix_cl< return_type_t< T1, T2, T3 > > gp_matern52_cov (const T1 &x, const T2 sigma, const T3 length_scale)
 Matern 5/2 kernel on the GPU.
 
template<typename T1 , typename T2 , typename T3 , typename T4 , require_all_kernel_expressions_and_none_scalar_t< T1, T2 > * = nullptr, require_all_arithmetic_t< T3, T4 > * = nullptr>
matrix_cl< return_type_t< T1, T2, T3, T4 > > gp_matern52_cov (const T1 &x, const T2 &y, const T3 sigma, const T4 length_scale)
 Matern 5/2 kernel on the GPU.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > gumbel_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &beta)
 Returns the gumbel cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > gumbel_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &beta)
 Returns the Gumbel log complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > gumbel_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &beta)
 Returns the Gumbel log complementary cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > gumbel_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &beta)
 Returns the Gumbel log probability density for the given location and scale.
 
template<typename T_x , typename = require_nonscalar_prim_or_rev_kernel_expression_t<T_x>>
auto head (T_x &&x, size_t n)
 Return the specified number of elements as a vector or row vector (same as input) from the front of the specified vector or row vector.
 
template<typename T_x , require_matrix_cl_t< T_x > * = nullptr>
auto identity_matrix (int K)
 Return a square identity matrix.
 
template<typename T_x , typename = require_all_kernel_expressions_and_none_scalar_t<T_x>>
auto inv (T_x &&x)
 Return the elementwise 1.0 / x of the specified argument, which may be a scalar or any Stan container of numeric scalars.
 
template<bool propto, typename T_y_cl , typename T_dof_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_dof_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_dof_cl > * = nullptr>
return_type_t< T_y_cl, T_dof_cl > inv_chi_square_lpdf (const T_y_cl &y, const T_dof_cl &nu)
 The log of an inverse chi-squared density for y with the specified degrees of freedom parameter.
 
template<typename T_x , typename = require_all_kernel_expressions_and_none_scalar_t<T_x>>
auto inv_cloglog (T_x &&x)
 The inverse complementary log-log function.
 
template<bool propto, typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > inv_gamma_lpdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &beta)
 The log of an inverse gamma density for y with the specified shape and scale parameters.
 
template<typename T_x , typename = require_all_kernel_expressions_and_none_scalar_t<T_x>>
auto inv_sqrt (T_x &&x)
 Return the elementwise 1 / sqrt(x) of the specified kernel generator expression.
 
template<typename T , typename L , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr, require_all_kernel_expressions_t< L > * = nullptr>
auto lb_constrain (T &&x, L &&lb)
 Return the lower-bounded value for the specified unconstrained input and specified lower bound.
 
template<typename T , typename L , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr, require_all_kernel_expressions_t< L > * = nullptr>
auto lb_constrain (const T &x, const L &lb, return_type_t< T, L > &lp)
 Return the lower-bounded value for the specified unconstrained input and specified lower bound.
 
template<typename T_theta_cl , typename T_lambda_cl , require_all_prim_or_rev_kernel_expression_t< T_theta_cl, T_lambda_cl > * = nullptr>
auto log_mix (const T_theta_cl &theta, const T_lambda_cl &lambda)
 Return the log mixture density with specified mixing proportions and log densities.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
matrix_cl< double > log_softmax (const T &a)
 Return log of the softmax of the specified vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
double log_sum_exp (const T &a)
 Return the log of the sum of the exponentiated values of the specified matrix of values.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > logistic_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the logistic cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > logistic_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the logistic cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > logistic_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the logistic cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > logistic_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 The log of a logistic density for y with the specified location and scale parameters.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > lognormal_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the loghormal cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > lognormal_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the lognormal log complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > lognormal_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the lognormal log cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > lognormal_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 The log of the lognormal density for the specified scalar(s) given the specified sample stan::math::size(s).
 
template<typename T , typename L , typename U , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr, require_all_kernel_expressions_t< L, U > * = nullptr>
matrix_cl< double > lub_constrain (const T &x, const L &lb, const U &ub)
 Return the lower and upper-bounded matrix derived by transforming the specified free matrix given the specified lower and upper bounds.
 
template<typename T , typename L , typename U , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr, require_all_kernel_expressions_t< L, U > * = nullptr>
auto lub_constrain (const T &x, const L &lb, const U &ub, return_type_t< T, L, U > &lp)
 Return the lower and upper-bounded matrix derived by transforming the specified free matrix given the specified lower and upper bounds.
 
template<typename T_m , require_all_kernel_expressions_and_none_scalar_t< T_m > * = nullptr>
plain_type_t< T_m > matrix_power (T_m &&M, const int n)
 Returns the nth power of the specific matrix.
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr>
matrix_cl< double > mdivide_left_tri_low (const T1 &A, const T2 &b)
 Returns the solution of the system Ax=b when A is lower triangular.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
matrix_cl< double > mdivide_left_tri_low (const T &A)
 Returns the solution of the system Ax=b when A is triangular and b=I.
 
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr>
matrix_cl< double > mdivide_right_tri_low (const T2 &b, const T1 &A)
 Returns the solution of the system Ax=b where A is a lower triangular matrix.
 
template<typename T , require_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
scalar_type_t< T > mean (const T &m)
 Returns the sample mean (i.e., average) of the coefficients in the specified std vector, vector, row vector, or matrix.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_covar_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_covar_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_covar_cl > multi_normal_cholesky_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_covar_cl &L)
 The log of the multivariate normal density for the given y, mu, and a Cholesky factor L of the variance matrix.
 
template<typename T1 , typename T2 , typename = require_all_kernel_expressions_and_none_scalar_t<T1, T2>>
matrix_cl< return_type_t< T1, T2 > > multiply (const T1 &A, const T2 &B)
 Computes the product of the specified matrices with the option of specifying the triangularity of either input matrices.
 
template<typename T_a , typename T_b , typename = require_all_kernel_expressions_and_none_scalar_t<T_a, T_b>>
matrix_cl< return_type_t< T_a, T_b > > operator* (const T_a &a, const T_b &b)
 Matrix multiplication of two kernel generator expressions.
 
template<typename T_a , typename T_b , require_stan_scalar_t< T_a > * = nullptr, require_all_kernel_expressions_and_none_scalar_t< T_b > * = nullptr, require_all_not_var_t< T_a, T_b > * = nullptr>
matrix_cl< return_type_t< T_a, T_b > > multiply (const T_a &a, const T_b &b)
 Matrix multiplication of a scalar and a kernel generator expressions.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
auto multiply_lower_tri_self_transpose (T_x &&x)
 Returns the result of multiplying the lower triangular portion of the input matrix by its own transpose.
 
template<bool propto, typename T_y_cl , typename T_x_cl , typename T_alpha_cl , typename T_beta_cl , typename T_phi_cl , require_all_prim_or_rev_kernel_expression_t< T_x_cl, T_y_cl, T_alpha_cl, T_beta_cl, T_phi_cl > * = nullptr>
return_type_t< T_x_cl, T_alpha_cl, T_beta_cl, T_phi_cl > neg_binomial_2_log_glm_lpmf (const T_y_cl &y, const T_x_cl &x, const T_alpha_cl &alpha, const T_beta_cl &beta, const T_phi_cl &phi)
 Returns the log PMF of the Generalized Linear Model (GLM) with Negative-Binomial-2 distribution and log link function.
 
template<bool propto, typename T_n_cl , typename T_log_location_cl , typename T_precision_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_log_location_cl, T_precision_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_log_location_cl, T_precision_cl > * = nullptr>
return_type_t< T_n_cl, T_log_location_cl, T_precision_cl > neg_binomial_2_log_lpmf (const T_n_cl &n, const T_log_location_cl &eta, const T_precision_cl &phi)
 The log of the log transformed negative binomial density for the specified scalars given the specified mean(s) and deviation(s).
 
template<bool propto, typename T_n_cl , typename T_location_cl , typename T_precision_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_location_cl, T_precision_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_location_cl, T_precision_cl > * = nullptr>
return_type_t< T_n_cl, T_location_cl, T_precision_cl > neg_binomial_2_lpmf (const T_n_cl &n, const T_location_cl &mu, const T_precision_cl &phi)
 The log of the negative binomial density for the specified scalars given the specified mean(s) and deviation(s).
 
template<bool propto, typename T_n_cl , typename T_shape_cl , typename T_inv_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_shape_cl, T_inv_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_shape_cl, T_inv_scale_cl > * = nullptr>
return_type_t< T_n_cl, T_shape_cl, T_inv_scale_cl > neg_binomial_lpmf (const T_n_cl &n, const T_shape_cl &alpha, const T_inv_scale_cl &beta)
 The log of the negative binomial density for the specified scalars given the specified mean(s) and deviation(s).
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > normal_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the normal cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_x_cl , typename T_alpha_cl , typename T_beta_cl , typename T_sigma_cl , require_all_prim_or_rev_kernel_expression_t< T_x_cl, T_y_cl, T_alpha_cl, T_beta_cl, T_sigma_cl > * = nullptr>
return_type_t< T_y_cl, T_x_cl, T_alpha_cl, T_beta_cl, T_sigma_cl > normal_id_glm_lpdf (const T_y_cl &y, const T_x_cl &x, const T_alpha_cl &alpha, const T_beta_cl &beta, const T_sigma_cl &sigma)
 Returns the log PDF of the Generalized Linear Model (GLM) with Normal distribution and id link function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > normal_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the normal log complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > normal_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 Returns the normal log complementary cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl > normal_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma)
 The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s).
 
template<typename T , require_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
size_t num_elements (const T &m)
 Returns the number of the elements of a matrix_cl or var_value<matrix_cl<T>>.
 
template<typename T , typename M , typename S , require_all_kernel_expressions_t< T, M, S > * = nullptr, require_any_not_stan_scalar_t< T, M, S > * = nullptr>
auto offset_multiplier_constrain (const T &x, const M &mu, const S &sigma)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier.
 
template<typename T , typename M , typename S , require_all_kernel_expressions_t< T, M, S > * = nullptr, require_any_not_stan_scalar_t< T, M, S > * = nullptr>
auto offset_multiplier_constrain (const T &x, const M &mu, const S &sigma, double &lp)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier.
 
template<bool propto, typename T_y , typename T_x , typename T_beta , typename T_cuts , require_all_prim_or_rev_kernel_expression_t< T_y, T_x, T_beta, T_cuts > * = nullptr>
return_type_t< T_x, T_beta, T_cuts > ordered_logistic_glm_lpmf (const T_y &y, const T_x &x, const T_beta &beta, const T_cuts &cuts)
 Returns the log PMF of the ordinal regression Generalized Linear Model (GLM).
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_cuts_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_cuts_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_cuts_cl > ordered_logistic_lpmf (const T_y_cl &y, const T_loc_cl &lambda, const T_cuts_cl &cuts)
 Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and specified cutpoints in an ordered logistic model.
 
template<typename T_y_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl, T_shape_cl > pareto_cdf (const T_y_cl &y, const T_scale_cl &y_min, const T_shape_cl &alpha)
 Returns the Pareto cumulative density function.
 
template<typename T_y_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl, T_shape_cl > pareto_lccdf (const T_y_cl &y, const T_scale_cl &y_min, const T_shape_cl &alpha)
 Returns the Pareto cumulative density function.
 
template<typename T_y_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl, T_shape_cl > pareto_lcdf (const T_y_cl &y, const T_scale_cl &y_min, const T_shape_cl &alpha)
 Returns the Pareto cumulative density function.
 
template<bool propto, typename T_y_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl, T_shape_cl > pareto_lpdf (const T_y_cl &y, const T_scale_cl &y_min, const T_shape_cl &alpha)
 The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s).
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > pareto_type_2_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &lambda, const T_shape_cl &alpha)
 Returns the pareto type 2 cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > pareto_type_2_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &lambda, const T_shape_cl &alpha)
 Returns the pareto type 2 log complementaty cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > pareto_type_2_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &lambda, const T_shape_cl &alpha)
 Returns the pareto type 2 log cumulative density function.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > pareto_type_2_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &lambda, const T_shape_cl &alpha)
 Returns the log PMF of the Pareto type 2 distribution.
 
template<bool propto, typename T_y_cl , typename T_x_cl , typename T_alpha_cl , typename T_beta_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_x_cl, T_alpha_cl, T_beta_cl > * = nullptr>
return_type_t< T_x_cl, T_alpha_cl, T_beta_cl > poisson_log_glm_lpmf (const T_y_cl &y, const T_x_cl &x, const T_alpha_cl &alpha, const T_beta_cl &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with Poisson distribution and log link function.
 
template<bool propto, typename T_n_cl , typename T_log_rate_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_log_rate_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_log_rate_cl > * = nullptr>
return_type_t< T_log_rate_cl > poisson_log_lpmf (const T_n_cl &n, const T_log_rate_cl &alpha)
 Returns the log PMF of the Poisson log distribution.
 
template<bool propto, typename T_n_cl , typename T_rate_cl , require_all_prim_or_rev_kernel_expression_t< T_n_cl, T_rate_cl > * = nullptr, require_any_not_stan_scalar_t< T_n_cl, T_rate_cl > * = nullptr>
return_type_t< T_rate_cl > poisson_lpmf (const T_n_cl &n, const T_rate_cl &lambda)
 Returns the log PMF of the Poisson distribution.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
value_type_t< T > prod (const T &m)
 Calculates product of given kernel generator expression elements.
 
template<typename T_m , require_all_kernel_expressions_and_none_scalar_t< T_m > * = nullptr>
matrix_cl< double > qr_Q (T_m &&m)
 Returns the orthogonal factor of the fat QR decomposition.
 
template<typename T_m , require_all_kernel_expressions_and_none_scalar_t< T_m > * = nullptr>
matrix_cl< double > qr_R (T_m &&m)
 Returns the orthogonal factor of the fat QR decomposition.
 
template<typename T_m , require_all_kernel_expressions_and_none_scalar_t< T_m > * = nullptr>
matrix_cl< double > qr_thin_Q (T_m &&m)
 Returns the orthogonal factor of the fat QR decomposition.
 
template<typename T_m , require_all_kernel_expressions_and_none_scalar_t< T_m > * = nullptr>
matrix_cl< double > qr_thin_R (T_m &&m)
 Returns the orthogonal factor of the thin QR decomposition.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
int rank (const T &v, int s)
 Return the number of components of v less than v[s].
 
template<typename T_y_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl > rayleigh_cdf (const T_y_cl &y, const T_scale_cl &sigma)
 Returns the Rayleigh cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl > rayleigh_lccdf (const T_y_cl &y, const T_scale_cl &sigma)
 Returns the Rayleigh log complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl > rayleigh_lcdf (const T_y_cl &y, const T_scale_cl &sigma)
 Returns the Rayleigh log cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_scale_cl > rayleigh_lpdf (const T_y_cl &y, const T_scale_cl &sigma)
 The log of an Rayleigh density for y with the specified scale parameter.
 
template<typename T , require_any_t< is_matrix_cl< T >, math::conjunction< is_var< T >, is_matrix_cl< value_type_t< T > > > > * = nullptr>
auto rep_array (const scalar_type_t< T > &x, int n)
 Creates a matrix_cl representing an array by replicating the input value.
 
template<typename T , require_matrix_cl_t< T > * = nullptr>
auto rep_matrix (const value_type_t< T > &x, int n, int m)
 Creates a matrix_cl by replicating the given value of arithmetic type.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
auto rep_matrix (const matrix_cl< T > &x, int m)
 Creates a matrix_cl by replicating the input vector or row_vector.
 
template<typename T , require_any_t< is_matrix_cl< T >, math::conjunction< is_var< T >, is_matrix_cl< value_type_t< T > > > > * = nullptr>
auto rep_row_vector (const scalar_type_t< T > &x, int n)
 Creates a matrix_cl representing a row vector by replicating the input value.
 
template<typename T , require_any_t< is_matrix_cl< T >, math::conjunction< is_var< T >, is_matrix_cl< value_type_t< T > > > > * = nullptr>
auto rep_vector (const scalar_type_t< T > &x, int n)
 Creates a matrix_cl representing a vector by replicating the input value.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
auto reverse (T_x &&x)
 Return reversed view into the specified vector or row vector.
 
template<typename T_x , typename = require_nonscalar_prim_or_rev_kernel_expression_t<T_x>>
auto row (T_x &&x, size_t j)
 Return the specified row of the specified kernel generator expression using start-at-1 indexing.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
int rows (const T_x &x)
 Returns the number of rows in the specified kernel generator expression.
 
template<typename T_a , typename T_b , require_all_kernel_expressions_and_none_scalar_t< T_a, T_b > * = nullptr>
auto rows_dot_product (T_a &&a, T_b &&b)
 Returns the dot product of rows of the specified matrices.
 
template<typename T_a , require_all_kernel_expressions_and_none_scalar_t< T_a > * = nullptr>
auto rows_dot_self (T_a &&a)
 Returns the dot product of each row of a matrix with itself.
 
template<bool propto, typename T_y_cl , typename T_dof_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_dof_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_dof_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_dof_cl, T_scale_cl > scaled_inv_chi_square_lpdf (const T_y_cl &y, const T_dof_cl &nu, const T_scale_cl &s)
 The log of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
double sd (const T &a)
 Returns the unbiased sample standard deviation of the coefficients in the specified std vector, column vector, row vector, or matrix.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
auto segment (T_x &&x, size_t i, size_t n)
 Return the specified number of elements as a row/column vector starting from the specified element - 1 of the specified row/column vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
auto sign (const T &x)
 Returns signs of the arguments.
 
template<typename T , require_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
size_t size (const T &m)
 Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_skewness_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > skew_double_exponential_cdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_skewness_cl &tau)
 Returns the skew double exponential cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_skewness_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > skew_double_exponential_lccdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_skewness_cl &tau)
 Returns the skew double exponential cumulative density function.
 
template<typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_skewness_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > skew_double_exponential_lcdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_skewness_cl &tau)
 Returns the skew double exponential cumulative density function.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_skewness_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_skewness_cl > skew_double_exponential_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_skewness_cl &tau)
 Returns the log PMF of the skew double exponential distribution.
 
template<bool propto, typename T_y_cl , typename T_loc_cl , typename T_scale_cl , typename T_shape_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > * = nullptr>
return_type_t< T_y_cl, T_loc_cl, T_scale_cl, T_shape_cl > skew_normal_lpdf (const T_y_cl &y, const T_loc_cl &mu, const T_scale_cl &sigma, const T_shape_cl &alpha)
 The log of the skew normal density for the specified scalar(s) given the specified mean(s), deviation(s) and shape(s).
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
matrix_cl< double > softmax (const T &a)
 Return the softmax of the specified vector.
 
template<typename T , require_all_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto sort_asc (T &&input)
 Sort the (row)vector in ascending order.
 
template<typename T , require_all_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto sort_desc (T &&input)
 Sort the (row)vector in ascending order.
 
template<typename T_a , typename T_b , require_all_kernel_expressions_and_none_scalar_t< T_a, T_b > * = nullptr>
auto squared_distance (const T_a &a, const T_b &b)
 Returns the squared distance.
 
template<typename T_y_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl > * = nullptr>
return_type_t< T_y_cl > std_normal_cdf (const T_y_cl &y)
 Returns the standard normal cumulative distribution function.
 
template<typename T_y_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl > * = nullptr>
return_type_t< T_y_cl > std_normal_lccdf (const T_y_cl &y)
 Returns the log standard normal complementary cumulative distribution function.
 
template<typename T_y_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl > * = nullptr>
return_type_t< T_y_cl > std_normal_lcdf (const T_y_cl &y)
 Returns the log standard normal complementary cumulative distribution function.
 
template<bool propto, typename T_y_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl > * = nullptr>
return_type_t< T_y_cl > std_normal_lpdf (const T_y_cl &y)
 The log of the normal density for the specified scalar(s) given a location of 0 and a scale of 1.
 
template<bool propto, typename T_y_cl , typename T_dof_cl , typename T_loc_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_dof_cl, T_loc_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_dof_cl, T_loc_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_dof_cl, T_loc_cl, T_scale_cl > student_t_lpdf (const T_y_cl &y, const T_dof_cl &nu, const T_loc_cl &mu, const T_scale_cl &sigma)
 The log of the Student-t density for the given y, nu, mean, and scale parameter.
 
template<typename T_x , typename = require_nonscalar_prim_or_rev_kernel_expression_t<T_x>>
auto sub_col (T_x &&x, size_t i, size_t j, size_t nrows)
 Return a 1 x ncols subrow starting at (i-1, j-1).
 
template<typename T_x , typename = require_nonscalar_prim_or_rev_kernel_expression_t<T_x>>
auto sub_row (T_x &&x, size_t i, size_t j, size_t ncols)
 Return a 1 x ncols subrow starting at (i-1, j-1).
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
auto symmetrize_from_lower_tri (T_x &&x)
 Return a symmetric matrix using elements from the upper triangular part of the input matrix.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
auto symmetrize_from_upper_tri (T_x &&x)
 Return a symmetric matrix using elements from the lower triangular part of the input matrix.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
auto tail (T_x &&x, size_t n)
 Return the specified number of elements as a vector or row vector (same as input) from the back of the specified vector or row vector.
 
template<typename T_A , typename = require_all_kernel_expressions_and_none_scalar_t<T_A>>
matrix_cl< typename std::decay_t< T_A >::Scalar > tcrossprod (T_A &&A)
 Returns the result of post-multiplying a matrix by its own transpose.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
auto to_array_1d (T_x &&x)
 Returns input matrix reshaped into a vector.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
T_x to_array_2d (T_x &&x)
 Returns input matrix converted into a nested std vector.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
T_x to_matrix (T_x &&x)
 Returns input matrix.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
matrix_cl< return_type_t< T_x > > to_matrix (const T_x &x, int m, int n)
 Returns a matrix representation of a vector or matrix in column-major order with the specified number of rows and columns.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
auto to_matrix (const T_x &x, int m, int n, bool col_major) -> decltype(to_matrix(x, m, n))
 Returns a matrix representation of the vector or matrix in column-major or row major order with the specified number of rows and columns.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
auto to_row_vector (T_x &&x)
 Returns input matrix reshaped into a row vector.
 
template<typename T_x , require_nonscalar_prim_or_rev_kernel_expression_t< T_x > * = nullptr>
auto to_vector (T_x &&x)
 Returns input matrix reshaped into a vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
value_type_t< T > trace (const T &m)
 Calculates trace (sum of diagonal) of given kernel generator expression.
 
template<typename T , typename U , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr, require_all_kernel_expressions_t< U > * = nullptr>
auto ub_constrain (T &&x, U &&ub)
 Return the upper-bounded value for the specified unconstrained matrix and upper bound.
 
template<typename T , typename U , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr, require_all_kernel_expressions_t< U > * = nullptr>
auto ub_constrain (const T &x, const U &ub, return_type_t< T, U > &lp)
 Return the upper-bounded value for the specified unconstrained matrix and upper bound.
 
template<typename T_y_cl , typename T_low_cl , typename T_high_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr>
return_type_t< T_y_cl, T_low_cl, T_high_cl > uniform_cdf (const T_y_cl &y, const T_low_cl &alpha, const T_high_cl &beta)
 Returns the uniform cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_low_cl , typename T_high_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr>
return_type_t< T_y_cl, T_low_cl, T_high_cl > uniform_lccdf (const T_y_cl &y, const T_low_cl &alpha, const T_high_cl &beta)
 Returns the log uniform complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_low_cl , typename T_high_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr>
return_type_t< T_y_cl, T_low_cl, T_high_cl > uniform_lcdf (const T_y_cl &y, const T_low_cl &alpha, const T_high_cl &beta)
 Returns the log uniform cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_low_cl , typename T_high_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_low_cl, T_high_cl > * = nullptr>
return_type_t< T_y_cl, T_low_cl, T_high_cl > uniform_lpdf (const T_y_cl &y, const T_low_cl &alpha, const T_high_cl &beta)
 The log of a uniform density for the given y, lower, and upper bound.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
auto unit_vector_constrain (T_x &&x)
 Return the unit length vector corresponding to the given free vector.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
auto unit_vector_constrain (T_x &&x, double &lp)
 Return the unit length vector corresponding to the given free vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
double variance (const T &a)
 Return the sample variance of the var_value matrix Raise domain error if size is not greater than zero.
 
template<typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > weibull_cdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 Returns the weibull cumulative distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > weibull_lccdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 Returns the weibull log cumulative complementary distribution function for the given location, and scale.
 
template<typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > weibull_lcdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 Returns the weibull log cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y_cl , typename T_shape_cl , typename T_scale_cl , require_all_prim_or_rev_kernel_expression_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr, require_any_not_stan_scalar_t< T_y_cl, T_shape_cl, T_scale_cl > * = nullptr>
return_type_t< T_y_cl, T_shape_cl, T_scale_cl > weibull_lpdf (const T_y_cl &y, const T_shape_cl &alpha, const T_scale_cl &sigma)
 Returns the Weibull log probability density for the given location and scale.
 
template<bool need_Q = true>
void qr_decomposition_cl (const matrix_cl< double > &A, matrix_cl< double > &Q, matrix_cl< double > &R, int r=100)
 Calculates QR decomposition of A using the block Householder algorithm.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > acos (const var_value< T > &A)
 Returns the elementwise acos() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > acosh (const var_value< T > &A)
 Returns the elementwise acosh() of a var_value<matrix_cl<double>> in radians.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
auto add (T_a &&a, T_b &&b)
 Addition of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T_a , typename T_b , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr>
auto operator+ (const T_a &a, const T_b &b)
 Addition of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T_m , typename T_a , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_m > * = nullptr, require_all_prim_or_rev_kernel_expression_t< T_a > * = nullptr, require_any_var_t< T_m, T_a > * = nullptr>
auto add_diag (const T_m &mat, const T_a &to_add)
 Returns a Matrix with values added along the main diagonal.
 
template<typename... T_results>
adjoint_results_cl< T_results... > adjoint_results (T_results &&... results)
 Deduces types for constructing adjoint_results_cl object.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > append_col (T_a &&a, T_b &&b)
 Return the result of appending the second argument matrix after the first argument matrix, that is, putting them side by side, with the first matrix followed by the second matrix.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > append_row (T_a &&a, T_b &&b)
 Return the result of stacking the rows of the first argument matrix on top of the second argument matrix.
 
template<typename T , require_all_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_any_var_t< T > * = nullptr>
auto as_column_vector_or_scalar (const T &m)
 Converts kernel generator expression row or column vector to a column vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > asin (const var_value< T > &A)
 Returns the elementwise asin() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > asinh (const var_value< T > &A)
 Returns the elementwise asinh() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > atan (const var_value< T > &A)
 Returns the elementwise atan() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > atanh (const var_value< T > &A)
 Returns the elementwise atanh() of a var_value<matrix_cl<double>> in radians.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
auto beta (T_a &&a, T_b &&b)
 Return the elementwise beta() on two input kernel generator expression.
 
template<typename T , require_all_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_any_var_t< T > * = nullptr>
auto block (const T &m, size_t i, size_t j, size_t nrows, size_t ncols)
 Return a nrows x ncols submatrix starting at (i-1, j-1).
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > cbrt (const var_value< T > &A)
 Returns the elementwise cbrt() of the input var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > ceil (const var_value< T > &A)
 Returns the elementwise ceil() of the specified variable.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > cholesky_decompose (const var_value< T > &A)
 Returns the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric reverse mode matrix on the OpenCL device.
 
template<typename T1 , typename T2 , require_any_var_t< T1, T2 > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
var_value< matrix_cl< double > > columns_dot_product (T1 &&v1, T2 &&v2)
 Returns the dot product of columns of the specified matrices.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > columns_dot_self (const var_value< T > &v)
 Returns the dot product of each column of a matrix with itself.
 
template<typename T >
var_value< matrix_cl< value_type_t< T > > > to_matrix_cl (const var_value< T > &a)
 Copies the source var containing Eigen matrices to destination var that has data stored on the OpenCL device.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
var_value< matrix_cl< value_type_t< T > > > to_matrix_cl (const std::vector< var_value< T > > &a)
 Copies the source std::vector of vars to a destination var that has data stored on the OpenCL device.
 
template<typename T , require_eigen_vt< is_var, T > * = nullptr>
var_value< matrix_cl< value_type_t< value_type_t< T > > > > to_matrix_cl (const T &src)
 Copies the source Eigen matrix of vars to the destination matrix that is stored on the OpenCL device.
 
template<typename T , require_eigen_vt< is_var, T > * = nullptr>
var_value< matrix_cl< value_type_t< value_type_t< T > > > > to_matrix_cl (const std::vector< T > &src)
 Copies the source vector of Eigen matrices of vars to the destination matrix that is stored on the OpenCL device.
 
template<typename T_dst , typename T , require_var_vt< is_eigen, T_dst > * = nullptr, require_all_kernel_expressions_t< T > * = nullptr>
T_dst from_matrix_cl (const var_value< T > &a)
 Copies the source var that has data stored on the OpenCL device to destination var containing Eigen matrix.
 
template<typename T_dst , typename T , require_std_vector_vt< is_var, T_dst > * = nullptr, require_all_stan_scalar_t< value_type_t< T_dst > > * = nullptr, require_all_kernel_expressions_t< T > * = nullptr>
T_dst from_matrix_cl (const var_value< T > &a)
 Copies the source var that has data stored on the OpenCL device to destination std::vector containing vars.
 
template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto from_matrix_cl (const var_value< T > &src)
 Copies the source var that has data stored on the OpenCL device to destination Eigen matrix containing vars.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > cos (const var_value< T > &A)
 Returns the elementwise cos() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > cosh (const var_value< T > &A)
 Returns the elementwise cosh() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > crossprod (const var_value< T > &M)
 Returns the result of pre-multiplying a matrix by its own transpose.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > cumulative_sum (const var_value< T > &A)
 Return the cumulative sum of the specified vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > diag_matrix (const var_value< T > &v)
 Return a square diagonal matrix with the specified vector of coefficients as the diagonal values.
 
template<typename T1 , typename T2 , require_any_var_t< T1, T2 > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
var_value< matrix_cl< double > > diag_post_multiply (T1 &&v1, T2 &&v2)
 Return the product of a matrix and the diagonal matrix formed from the vector or row_vector.
 
template<typename T1 , typename T2 , require_any_var_t< T1, T2 > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
var_value< matrix_cl< double > > diag_pre_multiply (T1 &&v1, T2 &&v2)
 Return the product of the diagonal matrix formed from the vector or row_vector and a matrix.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > diagonal (const var_value< T > &M)
 Return a column vector of the diagonal elements of the specified matrix.
 
var_value< matrix_cl< double > > digamma (const var_value< matrix_cl< double > > &A)
 Returns the elementwise digamma() of a var_value<matrix_cl<double>>.
 
template<typename T_a , typename T_b , require_stan_scalar_t< T_b > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > divide (T_a &&a, T_b &&b)
 Elementwise division of a kernel generator expression and a scalar.
 
template<typename T1 , typename T2 , require_any_var_t< T1, T2 > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
var dot_product (T1 &&v1, T2 &&v2)
 Returns the dot product.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var dot_self (const var_value< T > &v)
 Returns the dot product of a vector of var with itself.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > elt_divide (T_a &&a, T_b &&b)
 Elementwise division of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T_a , typename T_b , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > elt_multiply (T_a &&a, T_b &&b)
 Elementwise multiplication of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > erf (const var_value< T > &A)
 Returns the elementwise erf() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > erfc (const var_value< T > &A)
 Returns the elementwise erfc() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > exp (const var_value< T > &A)
 Returns the elementwise exp() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > exp2 (const var_value< T > &A)
 Returns the elementwise exp2() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > expm1 (const var_value< T > &A)
 Returns the elementwise expm1() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > fabs (const var_value< T > &A)
 Returns the elementwise fabs() of the input var_value<matrix_cl<double>>.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > fdim (T_a &&a, T_b &&b)
 Return the positive difference between the first variable's the value and the second's (C99, C++11).
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > floor (const var_value< T > &A)
 Returns the elementwise floor() of the input var_value<matrix_cl<double>>.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > fmax (T_a &&a, T_b &&b)
 Return the greater of the two specified arguments.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > fmin (T_a &&a, T_b &&b)
 Return the lesser of the two specified arguments.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > fmod (T_a &&a, T_b &&b)
 Return the floating point remainder after dividing the first variable by the second (cmath).
 
void grad (var &v, var_value< matrix_cl< double > > &x, Eigen::VectorXd &g)
 Propagate chain rule to calculate gradients starting from the specified variable.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > hypot (T_a &&a, T_b &&b)
 Returns the elementwise hypot() of the input.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > inv (const var_value< T > &A)
 Returns the elementwise inv() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > inv_cloglog (const var_value< T > &A)
 Returns the elementwise inv_cloglog() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > inv_logit (const var_value< T > &A)
 Returns the elementwise inv_logit() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > inv_Phi (const var_value< T > &A)
 Returns the elementwise inv_Phi() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > inv_sqrt (const var_value< T > &A)
 Returns the elementwise inv_sqrt() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > inv_square (const var_value< T > &A)
 Returns the elementwise inv_square() of a var_value<matrix_cl<double>>.
 
template<typename T_x , typename T_lb , require_all_prim_or_rev_kernel_expression_t< T_x, T_lb > * = nullptr, require_any_var_t< T_x, T_lb > * = nullptr, require_any_not_stan_scalar_t< T_x, T_lb > * = nullptr>
var_value< matrix_cl< double > > lb_constrain (T_x &&x, T_lb &&lb)
 Return the lower-bounded value for the specified unconstrained input and specified lower bound.
 
template<typename T_x , typename T_lb , require_all_prim_or_rev_kernel_expression_t< T_x, T_lb > * = nullptr, require_any_var_t< T_x, T_lb > * = nullptr, require_any_not_stan_scalar_t< T_x, T_lb > * = nullptr>
var_value< matrix_cl< double > > lb_constrain (T_x &&x, T_lb &&lb, var &lp)
 Return the lower-bounded value for the specified unconstrained input and specified lower bound.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
auto lbeta (T_a &&a, T_b &&b)
 Return the elementwise lbeta() on two input kernel generator expression.
 
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_st_integral< T_b > * = nullptr>
var_value< matrix_cl< double > > ldexp (const var_value< T_a > &a, T_b &&b)
 Returns the elementwise ldexp() of the input var_value<matrix_cl<double>> and kernel generator expression.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > lgamma (const var_value< T > &A)
 Returns the elementwise lgamma() of a var_value<matrix_cl<double>>.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > lmultiply (T_a &&a, T_b &&b)
 Returns the elementwise lmultiply() of the input.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log (const var_value< T > &A)
 Returns the elementwise log() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log10 (const var_value< T > &A)
 Returns the elementwise log10() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log1m (const var_value< T > &A)
 Returns the elementwise log1m() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log1m_exp (const var_value< T > &A)
 Returns the elementwise log1m_exp() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log1m_inv_logit (const var_value< T > &A)
 Returns the elementwise log1m_inv_logit() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log1p (const var_value< T > &A)
 Returns the elementwise log1p() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log1p_exp (const var_value< T > &A)
 Returns the elementwise log1p_exp() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log2 (const var_value< T > &A)
 Returns the elementwise log2() of a var_value<matrix_cl<double>>.
 
template<typename T_x , typename T_y , require_all_prim_or_rev_kernel_expression_t< T_x, T_y > * = nullptr, require_any_var_t< T_x, T_y > * = nullptr, require_any_not_stan_scalar_t< T_x, T_y > * = nullptr>
var_value< matrix_cl< double > > log_diff_exp (T_x &&x, T_y &&y)
 Returns the natural logarithm of the difference of the natural exponentiation of x and the natural exponentiation of y.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log_inv_logit (const var_value< T > &A)
 Returns the elementwise log_inv_logit() of a var_value<matrix_cl<double>>.
 
template<typename T_x , typename T_y , require_all_prim_or_rev_kernel_expression_t< T_x, T_y > * = nullptr, require_any_var_t< T_x, T_y > * = nullptr, require_any_not_stan_scalar_t< T_x, T_y > * = nullptr>
var_value< matrix_cl< double > > log_inv_logit_diff (T_x &&x, T_y &&y)
 Returns the natural logarithm of the difference of the inverse logits of the specified arguments.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > log_softmax (const var_value< T > &A)
 Return log of the softmax of the specified vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var log_sum_exp (const var_value< T > &A)
 Return the log of the sum of the exponentiated values of the specified matrix of values.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > logit (const var_value< T > &A)
 Returns the elementwise logit() of a var_value<matrix_cl<double>>.
 
template<typename T_x , typename T_lb , typename T_ub , require_all_prim_or_rev_kernel_expression_t< T_x, T_lb, T_ub > * = nullptr, require_any_var_t< T_x, T_lb, T_ub > * = nullptr, require_any_not_stan_scalar_t< T_x, T_lb, T_ub > * = nullptr>
var_value< matrix_cl< double > > lub_constrain (T_x &&x, T_lb &&lb, T_ub &&ub)
 Return the bounded value for the specified unconstrained input and specified bounds.
 
template<typename T_x , typename T_lb , typename T_ub , require_all_prim_or_rev_kernel_expression_t< T_x, T_lb, T_ub > * = nullptr, require_any_var_t< T_x, T_lb, T_ub > * = nullptr, require_any_not_stan_scalar_t< T_x, T_lb, T_ub > * = nullptr>
var_value< matrix_cl< double > > lub_constrain (T_x &&x, T_lb &&lb, T_ub &&ub, var &lp)
 Return the bounded value for the specified unconstrained input and specified bounds.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > matrix_power (const var_value< T > &M, const int n)
 Returns the nth power of the specific matrix.
 
template<typename T1 , typename T2 , require_all_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr, require_any_var_t< T1, T2 > * = nullptr>
var_value< matrix_cl< double > > mdivide_left_tri_low (T1 &&A, T2 &&b)
 Returns the solution of the system Ax=b when A is lower triangular.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > mdivide_left_tri_low (const var_value< T > &A)
 Returns the solution of the system Ax=b when A is triangular and b=I.
 
template<typename T1 , typename T2 , require_all_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr, require_any_var_t< T1, T2 > * = nullptr>
var_value< matrix_cl< double > > mdivide_right_tri_low (T2 &&b, T1 &&A)
 Returns the solution of the system Ax=b when A is lower triangular.
 
template<typename T_a , typename T_b , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr>
auto multiply (T_a &&A, T_b &&B)
 Matrix multiplication of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T_a , typename T_b , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr>
auto operator* (const T_a &A, const T_b &B)
 Matrix multiplication of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T1 , typename T2 , require_stan_scalar_t< T1 > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T2 > * = nullptr, require_any_var_t< T1, T2 > * = nullptr>
auto multiply (const T1 &A, T2 &&B)
 Return matrix multiplied by a scalar.
 
template<typename T1 , typename T2 , require_stan_scalar_t< T2 > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T1 > * = nullptr, require_any_var_t< T1, T2 > * = nullptr>
auto multiply (const T1 &A, const T2 &B)
 Return matrix multiplied by a scalar.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > multiply_log (T_a &&a, T_b &&b)
 Returns the elementwise multiply_log() of the input.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > multiply_lower_tri_self_transpose (const var_value< T > &A)
 Returns the result of multiplying the lower triangular portion of the input matrix by its own transpose.
 
template<typename T , typename M , typename S , require_all_prim_or_rev_kernel_expression_t< T, M, S > * = nullptr, require_any_not_stan_scalar_t< T, M, S > * = nullptr, require_any_var_t< T, M, S > * = nullptr>
var_value< matrix_cl< double > > offset_multiplier_constrain (T &&A, M &&mu, S &&sigma)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier.
 
template<typename T , typename M , typename S , require_all_prim_or_rev_kernel_expression_t< T, M, S > * = nullptr, require_any_not_stan_scalar_t< T, M, S > * = nullptr, require_any_var_t< T, M, S > * = nullptr>
var_value< matrix_cl< double > > offset_multiplier_constrain (T &&A, M &&mu, S &&sigma, var &lp)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > operator- (const var_value< T > &M)
 Returns the unary minus of the input.
 
template<typename T , require_var_vt< is_kernel_expression_and_not_scalar, T > * = nullptr>
operator+ (T &&M)
 Returns the unary plus of the input.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > Phi (const var_value< T > &A)
 Returns the elementwise Phi() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > Phi_approx (const var_value< T > &A)
 Returns the elementwise Phi_approx() of a var_value<matrix_cl<double>>.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
var_value< matrix_cl< double > > pow (T_a &&a, T_b &&b)
 Return the first argument raised to the power of the second argument.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var prod (const var_value< T > &x)
 Returns the prod of the coefficients of the specified matrix on the OpenCL device.
 
template<typename T_ret , require_var_vt< is_matrix_cl, T_ret > * = nullptr>
var_value< matrix_cl< double > > rep_matrix (const var &A, int n, int m)
 Creates a matrix_cl by replicating the given value of arithmetic type.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > rep_matrix (const var_value< T > &A, int m)
 Creates a matrix_cl by replicating the input vector or row_vector.
 
template<typename T , require_all_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_any_var_t< T > * = nullptr>
auto reverse (const T &m)
 Return reversed view into the specified vector or row vector.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > round (const var_value< T > &A)
 Returns the elementwise round() of the input var_value<matrix_cl<double>>.
 
template<typename T1 , typename T2 , require_any_var_t< T1, T2 > * = nullptr, require_all_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
var_value< matrix_cl< double > > rows_dot_product (T1 &&v1, T2 &&v2)
 Returns the dot product of rows of the specified matrices.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > rows_dot_self (const var_value< T > &v)
 Returns the dot product of each row of a matrix with itself.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var sd (const var_value< T > &A)
 Return the sample standard deviation of the var_value matrix.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > sin (const var_value< T > &A)
 Returns the elementwise cos() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > sinh (const var_value< T > &A)
 Returns the elementwise cos() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > softmax (const var_value< T > &A)
 Returns softmax of given argument.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > sqrt (const var_value< T > &A)
 Returns the elementwise sqrt() of a var_value<matrix_cl<double>>.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > square (const var_value< T > &A)
 Returns the elementwise square() of a var_value<matrix_cl<double>>.
 
template<typename T_a , typename T_b , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr>
var_value< double > squared_distance (T_a &&a, T_b &&b)
 Returns the squared distance.
 
template<typename T_a , typename T_b , require_all_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr, require_any_not_stan_scalar_t< T_a, T_b > * = nullptr>
auto subtract (T_a &&a, T_b &&b)
 Subtraction of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T_a , typename T_b , require_all_nonscalar_prim_or_rev_kernel_expression_t< T_a, T_b > * = nullptr, require_any_var_t< T_a, T_b > * = nullptr>
auto operator- (const T_a &a, const T_b &b)
 Subtraction of two reverse mode matrices and/or kernel generator expressions.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var sum (const var_value< T > &x)
 Returns the sum of the coefficients of the specified matrix on the OpenCL device.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > symmetrize_from_lower_tri (const var_value< T > &A)
 Return a symmetric matrix using elements from the upper triangular part of the input matrix.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > symmetrize_from_upper_tri (const var_value< T > &A)
 Return a symmetric matrix using elements from the upper triangular part of the input matrix.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > tan (const var_value< T > &A)
 Returns the elementwise tan() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > tanh (const var_value< T > &A)
 Returns the elementwise tanh() of a var_value<matrix_cl<double>> in radians.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > tcrossprod (const var_value< T > &M)
 Returns the result of post-multiplying a matrix by its own transpose.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > tgamma (const var_value< T > &A)
 Returns the elementwise tgamma() of a var_value<matrix_cl<double>>.
 
template<typename T , require_matrix_cl_t< T > * = nullptr>
arena_t< T > to_arena (const T &a)
 Converts given argument into a type that either has any dynamic allocation on AD stack or schedules its destructor to be called when AD stack memory is recovered.
 
template<typename T_x , require_all_kernel_expressions_and_none_scalar_t< T_x > * = nullptr>
var_value< matrix_cl< double > > to_matrix (const var_value< T_x > &x, int m, int n)
 Returns a matrix representation of a vector or matrix in column-major order with the specified number of rows and columns.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var trace (const var_value< T > &x)
 Returns the trace (sum of diagonal) of the specified matrix on the OpenCL device.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
auto transpose (const var_value< T > &M)
 Transposes a matrix.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > trunc (const var_value< T > &A)
 Returns the elementwise trunc() of the input var_value<matrix_cl<double>>.
 
template<typename T_x , typename T_ub , require_all_prim_or_rev_kernel_expression_t< T_x, T_ub > * = nullptr, require_any_var_t< T_x, T_ub > * = nullptr, require_any_not_stan_scalar_t< T_x, T_ub > * = nullptr>
var_value< matrix_cl< double > > ub_constrain (T_x &&x, T_ub &&ub)
 Return the upper-bounded value for the specified unconstrained input and specified upper bound.
 
template<typename T_x , typename T_ub , require_all_prim_or_rev_kernel_expression_t< T_x, T_ub > * = nullptr, require_any_var_t< T_x, T_ub > * = nullptr, require_any_not_stan_scalar_t< T_x, T_ub > * = nullptr>
var_value< matrix_cl< double > > ub_constrain (T_x &&x, T_ub &&ub, var &lp)
 Return the upper-bounded value for the specified unconstrained input and specified upper bound.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > unit_vector_constrain (const var_value< T > &A)
 Return the unit length vector corresponding to the free vector y.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var_value< matrix_cl< double > > unit_vector_constrain (const var_value< T > &A, var &lp)
 Return the unit length vector corresponding to the free vector y.
 
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr>
var variance (const var_value< T > &A)
 Return the sample variance of the var_value matrix Raise domain error if size is not greater than zero.
 
template<bool need_eigenvectors = true>
void symmetric_eigensolver (const matrix_cl< double > &A, matrix_cl< double > &eigenvalues, matrix_cl< double > &eigenvectors)
 
template<typename T >
ref_type_for_opencl_t< T && > to_ref_for_opencl (T &&a)
 Converts given Eigen expression into one that can be directly copied to an OpenCL device to create matrix_cl.
 
template<matrix_cl_view matrix_view = matrix_cl_view::Entire, typename T , require_matrix_cl_st< std::is_floating_point, T > * = nullptr>
plain_type_t< T > tri_inverse (const T &A)
 Computes the inverse of a triangular matrix.
 
tbb::task_arena & init_threadpool_tbb (int n_threads=0)
 Initialize the Intel TBB threadpool and global scheduler through the tbb::task_arena object.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator+ (const std::complex< U > &x, const std::complex< V > &y)
 Return the sum of the arguments.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator+ (const std::complex< U > &x, const V &y)
 Return the sum of the arguments.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator+ (const U &x, const std::complex< V > &y)
 Return the sum of the arguments.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator/ (const std::complex< U > &x, const std::complex< V > &y)
 Return the quotient of the arguments.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator/ (const std::complex< U > &x, const V &y)
 Return the quotient of the arguments.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator/ (const U &x, const std::complex< V > &y)
 Return the quotient of the arguments.
 
template<typename U , typename V , typename = require_any_autodiff_t<U, V>>
bool operator== (const std::complex< U > &x, const std::complex< V > &y)
 Return true if the complex numbers have equal imaginary and complex parts.
 
template<typename U , typename V , typename = require_any_autodiff_t<U, V>>
bool operator== (const std::complex< U > &x, const V &y)
 Return true if the first argument's real part is equal to the second argument and the first argument's imaginary part is zero.
 
template<typename U , typename V , typename = require_any_autodiff_t<U, V>>
bool operator== (const U &x, const std::complex< V > &y)
 Return true if the first argument is equal to the real part of the second argument and the imaginary part of the second argument is zero.
 
template<typename U , require_autodiff_t< U > >
std::complex< U > operator- (const std::complex< U > &x)
 Return the negation of the argument.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator* (const std::complex< U > &x, const std::complex< V > &y)
 Return the product of the arguments.
 
template<typename U , typename V , require_stan_scalar_t< V > * = nullptr>
complex_return_t< U, V > operator* (const std::complex< U > &x, const V &y)
 Return the product of the arguments.
 
template<typename U , typename V , require_stan_scalar_t< U > * = nullptr>
complex_return_t< U, V > operator* (const U &x, const std::complex< V > &y)
 Return the product of the arguments.
 
template<typename U , typename V , typename = require_any_autodiff_t<U, V>>
bool operator!= (const std::complex< U > &x, const std::complex< V > &y)
 Return true if the complex numbers have unequal imaginary or complex parts.
 
template<typename U , typename V , typename = require_any_autodiff_t<U, V>>
bool operator!= (const std::complex< U > &x, const V &y)
 Return true if the first argument's real part is unequal to the second argument or the first argument's imaginary part is unequal to zero.
 
template<typename U , typename V , typename = require_any_autodiff_t<U, V>>
bool operator!= (const U &x, const std::complex< V > &y)
 Return true if the first argument is unequal to the real part of the second argument or the imaginary part of the second argument is nonzero.
 
template<typename U , require_autodiff_t< U > >
std::complex< U > operator+ (const std::complex< U > &x)
 Return the argument.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator- (const std::complex< U > &x, const std::complex< V > &y)
 Return the difference of the arguments.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator- (const std::complex< U > &x, const V &y)
 Return the difference of the arguments.
 
template<typename U , typename V , require_all_stan_scalar_t< U, V > * = nullptr>
complex_return_t< U, V > operator- (const U &x, const std::complex< V > &y)
 Return the difference of the arguments.
 
template<typename T_a1 , typename T_a2 , typename T_b1 , typename T_z >
void check_2F1_converges (const char *function, const T_a1 &a1, const T_a2 &a2, const T_b1 &b1, const T_z &z)
 Check if the hypergeometric function (2F1) called with supplied arguments will converge, assuming arguments are finite values.
 
template<typename T_a1 , typename T_a2 , typename T_a3 , typename T_b1 , typename T_b2 , typename T_z >
void check_3F2_converges (const char *function, const T_a1 &a1, const T_a2 &a2, const T_a3 &a3, const T_b1 &b1, const T_b2 &b2, const T_z &z)
 Check if the hypergeometric function (3F2) called with supplied arguments will converge, assuming arguments are finite values.
 
template<typename T_y , typename T_low , typename T_high >
void check_bounded (const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
 Check if the value is between the low and high values, inclusively.
 
template<typename Mat , require_matrix_t< Mat > * = nullptr>
void check_cholesky_factor (const char *function, const char *name, const Mat &y)
 Throw an exception if the specified matrix is not a valid Cholesky factor.
 
template<typename StdVec , require_std_vector_t< StdVec > * = nullptr>
void check_cholesky_factor (const char *function, const char *name, const StdVec &y)
 Throw an exception if the specified matrix is not a valid Cholesky factor.
 
template<typename Mat , require_matrix_t< Mat > * = nullptr>
void check_cholesky_factor_corr (const char *function, const char *name, const Mat &y)
 Throw an exception if the specified matrix is not a valid Cholesky factor of a correlation matrix.
 
template<typename StdVec , require_std_vector_t< StdVec > * = nullptr>
void check_cholesky_factor_corr (const char *function, const char *name, const StdVec &y)
 Throw an exception if the specified matrix is not a valid Cholesky factor of a correlation matrix.
 
template<typename T_y , require_any_t< is_matrix< T_y >, is_prim_or_rev_kernel_expression< T_y > > * = nullptr>
void check_column_index (const char *function, const char *name, const T_y &y, size_t i)
 Check if the specified index is a valid column of the matrix.
 
template<typename T >
void check_consistent_size (const char *function, const char *name, const T &x, size_t expected_size)
 Check if x is consistent with size expected_size.
 
void check_consistent_sizes (const char *)
 Trivial no input case, this function is a no-op.
 
template<typename T1 >
void check_consistent_sizes (const char *, const char *, const T1 &)
 Base case of recursion, this function is a no-op.
 
template<typename T1 , typename T2 , typename... Ts>
void check_consistent_sizes (const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2, const Ts &... names_and_xs)
 Check that the inputs are of consistent size.
 
void check_consistent_sizes_mvt (const char *)
 Trivial no input case, this function is a no-op.
 
template<typename T1 >
void check_consistent_sizes_mvt (const char *, const char *, const T1 &)
 Base case of recursion, this function is a no-op.
 
template<typename T1 , typename T2 , typename... Ts>
void check_consistent_sizes_mvt (const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2, const Ts &... names_and_xs)
 Check that the provided multivariate inputs are of consistent size with each other.
 
template<typename Mat , require_matrix_t< Mat > * = nullptr>
void check_corr_matrix (const char *function, const char *name, const Mat &y)
 Throw an exception if the specified matrix is not a valid correlation matrix.
 
template<typename StdVec , require_std_vector_t< StdVec > * = nullptr>
void check_corr_matrix (const char *function, const char *name, const StdVec &y)
 Throw an exception if the specified matrix is not a valid correlation matrix.
 
template<typename Mat , require_matrix_t< Mat > * = nullptr>
void check_cov_matrix (const char *function, const char *name, const Mat &y)
 Throw an exception if the specified matrix is not a valid covariance matrix.
 
template<typename StdVec , require_std_vector_t< StdVec > * = nullptr>
void check_cov_matrix (const char *function, const char *name, const StdVec &y)
 Throw an exception if the specified matrix is not a valid covariance matrix.
 
template<typename T_y >
void check_finite (const char *function, const char *name, const T_y &y)
 Return true if all values in y are finite.
 
std::array< std::string, 2 > cvodes_flag_msg (int flag)
 Map cvodes error flag to acutally error msg.
 
void cvodes_check (int flag, const char *func_name)
 Throws a std::domain_error exception when a Sundial function fails (i.e.
 
std::array< std::string, 2 > idas_flag_msg (int flag)
 
void idas_check (int flag, const char *func_name)
 
void kinsol_check (int flag, const char *func_name)
 Throws an exception message when the functions in KINSOL fails.
 
void kinsol_check (int flag, const char *func_name, long int max_num_steps)
 Throws an exception message when the KINSol() call fails.
 
template<typename T_y , typename T_low , require_all_stan_scalar_t< T_y, T_low > * = nullptr, typename... Idxs>
void check_greater (const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
 Throw an exception if y is not strictly greater than low.
 
template<typename T_y , typename T_low , require_stan_scalar_t< T_y > * = nullptr, require_vector_t< T_low > * = nullptr, require_not_std_vector_vt< is_container_or_var_matrix, T_low > * = nullptr, typename... Idxs>
void check_greater (const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
 Throw an exception if y is not strictly greater than each element of low.
 
template<typename T_y , typename T_low , require_stan_scalar_t< T_y > * = nullptr, require_dense_dynamic_t< T_low > * = nullptr, typename... Idxs>
void check_greater (const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
 Throw an exception if y is not strictly greater than each element of low.
 
template<typename T_y , typename T_low , require_all_stan_scalar_t< T_y, T_low > * = nullptr, typename... Idxs>
void check_greater_or_equal (const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
 Throw an exception if y is not greater or equal than low.
 
template<typename T_y , typename T_low , require_stan_scalar_t< T_y > * = nullptr, require_vector_t< T_low > * = nullptr, require_not_std_vector_vt< is_container_or_var_matrix, T_low > * = nullptr, typename... Idxs>
void check_greater_or_equal (const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
 Throw an exception if y is not greater or equal than each element of low.
 
template<typename T_y , typename T_low , require_stan_scalar_t< T_y > * = nullptr, require_dense_dynamic_t< T_low > * = nullptr, typename... Idxs>
void check_greater_or_equal (const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
 Throw an exception if y is not greater or equal than each element of low.
 
template<typename T >
void check_ldlt_factor (const char *function, const char *name, LDLT_factor< T > &A)
 Raise domain error if the specified LDLT factor is invalid.
 
template<typename T_y , typename T_high , require_all_stan_scalar_t< T_y, T_high > * = nullptr, typename... Idxs>
void check_less (const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
 Throw an exception if y is not strictly less than high.
 
template<typename T_y , typename T_high , require_stan_scalar_t< T_y > * = nullptr, require_vector_t< T_high > * = nullptr, require_not_std_vector_vt< is_container_or_var_matrix, T_high > * = nullptr, typename... Idxs>
void check_less (const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
 Throw an exception if y is not strictly less than each element of high.
 
template<typename T_y , typename T_high , require_stan_scalar_t< T_y > * = nullptr, require_dense_dynamic_t< T_high > * = nullptr, typename... Idxs>
void check_less (const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
 Throw an exception if y is not strictly less than each element of high.
 
template<typename T_y , typename T_high , require_all_stan_scalar_t< T_y, T_high > * = nullptr, typename... Idxs>
void check_less_or_equal (const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
 Throw an exception if y is not less than high.
 
template<typename T_y , typename T_high , require_stan_scalar_t< T_y > * = nullptr, require_vector_t< T_high > * = nullptr, require_not_std_vector_vt< is_container_or_var_matrix, T_high > * = nullptr, typename... Idxs>
void check_less_or_equal (const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
 Throw an exception if y is not less than each element of high.
 
template<typename T_y , typename T_high , require_stan_scalar_t< T_y > * = nullptr, require_dense_dynamic_t< T_high > * = nullptr, typename... Idxs>
void check_less_or_equal (const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
 Throw an exception if y is not less than each element of high.
 
template<typename T_y , require_eigen_t< T_y > * = nullptr>
void check_lower_triangular (const char *function, const char *name, const T_y &y)
 Check if the specified matrix is lower triangular.
 
template<typename T1 , typename T2 , require_all_not_matrix_t< T1, T2 > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
void check_matching_dims (const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
 Check if the two containers have the same dimensions.
 
template<bool check_compile, typename Mat1 , typename Mat2 , typename = require_all_eigen_t<Mat1, Mat2>>
void check_matching_dims (const char *function, const char *name1, const Mat1 &y1, const char *name2, const Mat2 &y2)
 Check if the two matrices are of the same size.
 
template<typename T_y1 , typename T_y2 >
void check_matching_sizes (const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
 Check if two structures at the same size.
 
template<typename T1 , typename T2 >
void check_multiplicable (const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
 Check if the matrices can be multiplied.
 
template<typename T_y >
void check_nonnegative (const char *function, const char *name, const T_y &y)
 Check if y is non-negative.
 
template<typename T_y >
void check_nonzero_size (const char *function, const char *name, const T_y &y)
 Check if the specified matrix/vector is of non-zero size.
 
template<typename T_y >
void check_not_nan (const char *function, const char *name, const T_y &y)
 Check if y is not NaN.
 
template<typename T_y , require_vector_t< T_y > * = nullptr, require_not_std_vector_t< T_y > * = nullptr>
void check_ordered (const char *function, const char *name, const T_y &y)
 Throw an exception if the specified vector is not sorted into strictly increasing order.
 
template<typename T_y , require_std_vector_vt< is_stan_scalar, T_y > * = nullptr>
void check_ordered (const char *function, const char *name, const T_y &y)
 Throw an exception if the specified vector is not sorted into strictly increasing order.
 
template<typename EigMat , require_matrix_t< EigMat > * = nullptr>
void check_pos_definite (const char *function, const char *name, const EigMat &y)
 Check if the specified square, symmetric matrix is positive definite.
 
template<typename Derived >
void check_pos_definite (const char *function, const char *name, const Eigen::LDLT< Derived > &cholesky)
 Check if the specified LDLT decomposition of a matrix is positive definite.
 
template<typename Derived >
void check_pos_definite (const char *function, const char *name, const Eigen::LLT< Derived > &cholesky)
 Check if the specified LLT decomposition was successful.
 
template<typename EigMat , require_matrix_t< EigMat > * = nullptr>
void check_pos_semidefinite (const char *function, const char *name, const EigMat &y)
 Check if the specified matrix is positive definite.
 
template<typename Derived >
void check_pos_semidefinite (const char *function, const char *name, const Eigen::LDLT< Derived > &cholesky)
 Check if the specified matrix is positive semidefinite.
 
template<typename T_y >
void check_positive (const char *function, const char *name, const T_y &y)
 Check if y is positive.
 
void check_positive (const char *function, const char *name, const char *expr, int size)
 Check if size is positive.
 
template<typename T_y >
void check_positive_finite (const char *function, const char *name, const T_y &y)
 Check if y is positive and finite.
 
template<typename Vec , require_vector_t< Vec > * = nullptr, require_not_std_vector_t< Vec > * = nullptr>
void check_positive_ordered (const char *function, const char *name, const Vec &y)
 Throw an exception if the specified the vector contains negative values or is not sorted into strictly increasing order.
 
template<typename StdVec , require_std_vector_t< StdVec > * = nullptr>
void check_positive_ordered (const char *function, const char *name, const StdVec &y)
 Throw an exception if any of the vectors in a standard vector contains negative values or is not sorted into strictly increasing order.
 
void check_range (const char *function, const char *name, int max, int index, int nested_level, const char *error_msg)
 Check if specified index is within range.
 
void check_range (const char *function, const char *name, int max, int index, const char *error_msg)
 Check if specified index is within range.
 
void check_range (const char *function, const char *name, int max, int index)
 Check if specified index is within range.
 
template<typename T_y , typename = require_matrix_t<T_y>>
void check_row_index (const char *function, const char *name, const T_y &y, size_t i)
 Check if the specified index is a valid row of the matrix This check is 1-indexed by default.
 
template<typename T , require_matrix_t< T > * = nullptr>
void check_simplex (const char *function, const char *name, const T &theta)
 Throw an exception if the specified vector is not a simplex.
 
template<typename T_size1 , typename T_size2 >
void check_size_match (const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
 Check if the provided sizes match.
 
template<typename T_size1 , typename T_size2 >
void check_size_match (const char *function, const char *expr_i, const char *name_i, T_size1 i, const char *expr_j, const char *name_j, T_size2 j)
 Check if the provided sizes match.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
void check_sorted (const char *function, const char *name, const EigVec &y)
 Check if the specified vector is sorted into increasing order (repeated values are okay).
 
template<typename T_y >
void check_sorted (const char *function, const char *name, const std::vector< T_y > &y)
 Check if the specified vector is sorted into increasing order (repeated values are okay).
 
template<typename T_y , require_any_t< is_matrix< T_y >, is_prim_or_rev_kernel_expression< T_y > > * = nullptr>
void check_square (const char *function, const char *name, const T_y &y)
 Check if the specified matrix is square.
 
template<typename T >
void check_std_vector_index (const char *function, const char *name, const std::vector< T > &y, int i)
 Check if the specified index is valid in std vector This check is 1-indexed by default.
 
template<typename EigMat , require_matrix_t< EigMat > * = nullptr>
void check_symmetric (const char *function, const char *name, const EigMat &y)
 Check if the specified matrix is symmetric.
 
template<typename Vec , require_vector_t< Vec > * = nullptr, require_not_std_vector_t< Vec > * = nullptr>
void check_unit_vector (const char *function, const char *name, const Vec &theta)
 Throw an exception if the specified vector does not have unit Euclidiean length.
 
template<typename StdVec , require_std_vector_t< StdVec > * = nullptr>
void check_unit_vector (const char *function, const char *name, const StdVec &theta)
 Throw an exception if the each element in a standard vector does not have unit Euclidiean length.
 
template<typename Mat , require_any_t< is_matrix< Mat >, is_prim_or_rev_kernel_expression< Mat > > * = nullptr>
void check_vector (const char *function, const char *name, const Mat &x)
 Check the input is either a row vector or column vector or a matrix with a single row or column.
 
template<typename T , require_any_t< is_vector< T >, is_prim_or_rev_kernel_expression< T > > * = nullptr>
void check_vector_index (const char *function, const char *name, const T &y, size_t i)
 Check if the specified index is a valid element of the row or column vector This check is 1-indexed by default.
 
template<typename T >
void domain_error (const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
 
template<typename T >
void domain_error (const char *function, const char *name, const T &y, const char *msg1)
 
template<typename T >
void domain_error_vec (const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
 
template<typename T >
void domain_error_vec (const char *function, const char *name, const T &y, size_t i, const char *msg1)
 
template<typename F , typename T , typename... Indexings, require_stan_scalar_t< T > * = nullptr>
void elementwise_check (const F &is_good, const char *function, const char *name, const T &x, const char *must_be, const Indexings &... indexings)
 Check that the predicate holds for the value of x.
 
template<typename F , typename T , typename... Indexings, require_eigen_t< T > * = nullptr, std::enable_if_t<(Eigen::internal::traits< T >::Flags &Eigen::LinearAccessBit)||T::IsVectorAtCompileTime > * = nullptr>
void elementwise_check (const F &is_good, const char *function, const char *name, const T &x, const char *must_be, const Indexings &... indexings)
 Check that the predicate holds for all elements of the value of x.
 
template<typename F , typename T >
bool elementwise_is (const F &is_good, const T &x)
 Check that the predicate holds for the value of x, working elementwise on containers.
 
template<typename T_omega , typename T_Gamma , typename T_rho , require_all_eigen_t< T_omega, T_Gamma > * = nullptr, require_eigen_col_vector_t< T_rho > * = nullptr>
void hmm_check (const T_omega &log_omegas, const T_Gamma &Gamma, const T_rho &rho, const char *function)
 Check arguments for hidden Markov model functions with a discrete latent state (lpdf, rng for latent states, and marginal probabilities for latent sates).
 
template<typename T >
void invalid_argument (const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
 Throw an invalid_argument exception with a consistently formatted message.
 
template<typename T >
void invalid_argument (const char *function, const char *name, const T &y, const char *msg1)
 Throw an invalid_argument exception with a consistently formatted message.
 
template<typename T >
void invalid_argument_vec (const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
 Throw an invalid argument exception with a consistently formatted message.
 
template<typename T >
void invalid_argument_vec (const char *function, const char *name, const T &y, size_t i, const char *msg)
 Throw an invalid argument exception with a consistently formatted message.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr>
bool is_cholesky_factor (const EigMat &y)
 Return true if y is a valid Cholesky factor, if number of rows is not less than the number of columns, if there are no 0 columns, and no element in matrix is NaN.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr>
bool is_cholesky_factor_corr (const EigMat &y)
 Return true if y is a valid Cholesky factor, if the number of rows is not less than the number of columns, if there are no zero columns, and no element in matrix is NaN.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
bool is_column_index (const EigMat &y, size_t i)
 Return true if column index is in bounds.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr>
bool is_corr_matrix (const EigMat &y)
 Return true if the matrix is square and not 0x0, if the matrix is symmetric, diagonals are near 1, positive definite, and no elements are NaN A valid correlation matrix is symmetric, has a unit diagonal (all 1 values), and has all values between -1 and 1 (inclusive).
 
template<typename T >
bool is_ldlt_factor (LDLT_factor< T > &A)
 Return true if the specified LDLT factor is invalid.
 
template<typename T_y , typename T_high >
bool is_less_or_equal (const T_y &y, const T_high &high)
 Return true if y is less or equal to high.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr>
bool is_lower_triangular (const EigMat &y)
 Return true is matrix is lower triangular.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
bool is_mat_finite (const EigMat &y)
 Return true is the specified matrix is finite.
 
template<typename EigMat1 , typename EigMat2 , require_all_matrix_t< EigMat1, EigMat2 > * = nullptr>
bool is_matching_dims (const EigMat1 &y1, const EigMat2 &y2)
 Return true if the two matrices are of the same size.
 
template<bool check_compile, typename EigMat1 , typename EigMat2 , require_all_matrix_t< EigMat1, EigMat2 > * = nullptr>
bool is_matching_dims (const EigMat1 &y1, const EigMat2 &y2)
 Return true if the two matrices are of the same size.
 
template<typename T_y1 , typename T_y2 >
bool is_matching_size (const T_y1 &y1, const T_y2 &y2)
 Return true if two structures are the same size.
 
template<typename T_y >
bool is_nonzero_size (const T_y &y)
 Returns true if the specified matrix/vector is size nonzero.
 
template<typename T_y >
bool is_not_nan (const T_y &y)
 Return true if y is not NaN.
 
template<typename T_y >
bool is_ordered (const std::vector< T_y > &y)
 Return true if the vector is sorted into strictly increasing order.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr>
bool is_pos_definite (const EigMat &y)
 Return true if the matrix is square or if the matrix has non-zero size, or if the matrix is symmetric, or if it is positive definite, or if no element is NaN.
 
template<typename Derived >
bool is_pos_definite (const Eigen::LDLT< Derived > &cholesky)
 Return true if the matrix is positive definite.
 
template<typename Derived >
bool is_pos_definite (const Eigen::LLT< Derived > &cholesky)
 Return true if diagonal of the L matrix is positive.
 
template<typename T_y >
bool is_positive (const T_y &y)
 Return true if y is positive.
 
bool is_positive (int size)
 Return true if size is positive.
 
template<typename T_y >
bool is_scal_finite (const T_y &y)
 Return true if y is finite.
 
template<typename T_size1 , typename T_size2 >
bool is_size_match (T_size1 i, T_size2 j)
 Return true if the provided sizes match.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
bool is_square (const EigMat &y)
 Return true if the matrix is square.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr>
bool is_symmetric (const EigMat &y)
 Return true if the matrix is square, and no element not on the main diagonal is NaN.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
bool is_unit_vector (const EigVec &theta)
 Return true if the vector is not a unit vector or if any element is NaN.
 
void out_of_range (const char *function, int max, int index, const char *msg1="", const char *msg2="")
 Throw an out_of_range exception with a consistently formatted message.
 
void system_error (const char *function, const char *name, const int &y, const char *msg1, const char *msg2)
 Throw a system error with a consistently formatted message.
 
void system_error (const char *function, const char *name, const int &y, const char *msg1)
 Throw a system error with a consistently formatted message.
 
template<typename T >
void throw_domain_error (const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
 Throw a domain error with a consistently formatted message.
 
template<typename T >
void throw_domain_error (const char *function, const char *name, const T &y, const char *msg1)
 Throw a domain error with a consistently formatted message.
 
template<typename T , require_eigen_t< T > * = nullptr>
void throw_domain_error_mat (const char *function, const char *name, const T &y, size_t i, size_t j, const char *msg1, const char *msg2)
 Throw a domain error with a consistently formatted message for matrices.
 
template<typename T >
void throw_domain_error_mat (const char *function, const char *name, const T &y, size_t i, size_t j, const char *msg)
 Throw a domain error with a consistently formatted message for matrices.
 
template<typename T >
void throw_domain_error_vec (const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
 Throw a domain error with a consistently formatted message.
 
template<typename T >
void throw_domain_error_vec (const char *function, const char *name, const T &y, size_t i, const char *msg)
 Throw a domain error with a consistently formatted message.
 
void validate_non_negative_index (const char *var_name, const char *expr, int val)
 
void validate_positive_index (const char *var_name, const char *expr, int val)
 Check that simplex is at least size 1.
 
void validate_unit_vector_index (const char *var_name, const char *expr, int val)
 Check that unit vector is at least size 2.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
abs (T x)
 Return the absolute value of the specified arithmetic argument.
 
template<typename T , require_complex_t< T > * = nullptr>
auto abs (T x)
 Return the absolute value (also known as the norm, modulus, or magnitude) of the specified complex argument.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_not_stan_scalar_t< Container > * = nullptr>
auto abs (const Container &x)
 Returns the elementwise abs() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto abs (const Container &x)
 Version of abs() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto acos (const Container &x)
 Returns the elementwise acos() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto acos (const Container &x)
 Version of acos() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
double acosh (double x)
 Return the inverse hyperbolic cosine of the specified value.
 
double acosh (int x)
 Integer version of acosh.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto acosh (const T &x)
 Return the elementwise application of acosh() to specified argument container.
 
template<typename ScalarA , typename ScalarB , require_all_stan_scalar_t< ScalarA, ScalarB > * = nullptr, require_all_not_var_t< ScalarA, ScalarB > * = nullptr>
return_type_t< ScalarA, ScalarB > add (const ScalarA &a, const ScalarB &b)
 Return the sum of the specified scalars.
 
template<typename Mat1 , typename Mat2 , require_all_eigen_t< Mat1, Mat2 > * = nullptr, require_all_not_st_var< Mat1, Mat2 > * = nullptr>
auto add (const Mat1 &m1, const Mat2 &m2)
 Return the sum of the specified matrices.
 
template<typename Mat , typename Scal , require_eigen_t< Mat > * = nullptr, require_stan_scalar_t< Scal > * = nullptr, require_all_not_st_var< Mat, Scal > * = nullptr>
auto add (const Mat &m, const Scal c)
 Return the sum of the specified matrix and specified scalar.
 
template<typename Scal , typename Mat , require_stan_scalar_t< Scal > * = nullptr, require_eigen_t< Mat > * = nullptr, require_all_not_st_var< Scal, Mat > * = nullptr>
auto add (const Scal c, const Mat &m)
 Return the sum of the specified scalar and specified matrix.
 
template<typename T_m , typename T_a , typename = require_eigen_t<T_m>, typename = require_any_t<is_eigen_vector<T_a>, is_stan_scalar<T_a>>>
Eigen::Matrix< return_type_t< T_m, T_a >, Eigen::Dynamic, Eigen::Dynamic > add_diag (const T_m &mat, const T_a &to_add)
 Returns a Matrix with values added along the main diagonal.
 
template<typename T , require_t< std::is_convertible< T, bool > > * = nullptr>
constexpr bool all (T x)
 Return true if all values in the input are true.
 
template<typename ContainerT , require_eigen_st< std::is_integral, ContainerT > * = nullptr>
bool all (const ContainerT &x)
 Return true if all values in the input are true.
 
template<typename... Types>
bool all (const std::tuple< Types... > &x)
 Return true if all values in the input are true.
 
template<typename InnerT >
bool all (const std::vector< InnerT > &x)
 Return true if all values in the input are true.
 
template<typename T , require_t< std::is_convertible< T, bool > > * = nullptr>
constexpr bool any (T x)
 Return true if any values in the input are true.
 
template<typename ContainerT , require_eigen_st< std::is_integral, ContainerT > * = nullptr>
bool any (const ContainerT &x)
 Return true if any values in the input are true.
 
template<typename... Types>
bool any (const std::tuple< Types... > &x)
 Return true if any values in the input are true.
 
template<typename InnerT >
bool any (const std::vector< InnerT > &x)
 Return true if any values in the input are true.
 
template<typename T1 , typename T2 >
append_return_type< std::vector< T1 >, std::vector< T2 > >::type append_array (const std::vector< T1 > &x, const std::vector< T2 > &y)
 Return the concatenation of two specified vectors in the order of the arguments.
 
template<typename T1 >
std::vector< T1 > append_array (const std::vector< T1 > &x, const std::vector< T1 > &y)
 Return the concatenation of two specified vectors in the order of the arguments.
 
template<typename T1 , typename T2 , typename = require_all_eigen_t<T1, T2>>
auto append_col (const T1 &A, const T2 &B)
 Return the result of appending the second argument matrix after the first argument matrix, that is, putting them side by side, with the first matrix followed by the second matrix.
 
template<typename Scal , typename RowVec , require_stan_scalar_t< Scal > * = nullptr, require_t< is_eigen_row_vector< RowVec > > * = nullptr>
Eigen::Matrix< return_type_t< Scal, RowVec >, 1, Eigen::Dynamic > append_col (const Scal &A, const RowVec &B)
 Return the result of stacking an scalar on top of the a row vector, with the result being a row vector.
 
template<typename RowVec , typename Scal , require_t< is_eigen_row_vector< RowVec > > * = nullptr, require_stan_scalar_t< Scal > * = nullptr>
Eigen::Matrix< return_type_t< RowVec, Scal >, 1, Eigen::Dynamic > append_col (const RowVec &A, const Scal &B)
 Return the result of stacking a row vector on top of the an scalar, with the result being a row vector.
 
template<typename T1 , typename T2 , require_all_eigen_t< T1, T2 > * = nullptr>
auto append_row (const T1 &A, const T2 &B)
 Return the result of stacking the rows of the first argument matrix on top of the second argument matrix.
 
template<typename Scal , typename ColVec , require_stan_scalar_t< Scal > * = nullptr, require_t< is_eigen_col_vector< ColVec > > * = nullptr>
Eigen::Matrix< return_type_t< Scal, ColVec >, Eigen::Dynamic, 1 > append_row (const Scal &A, const ColVec &B)
 Return the result of stacking an scalar on top of the a vector, with the result being a vector.
 
template<typename ColVec , typename Scal , require_t< is_eigen_col_vector< ColVec > > * = nullptr, require_stan_scalar_t< Scal > * = nullptr>
Eigen::Matrix< return_type_t< ColVec, Scal >, Eigen::Dynamic, 1 > append_row (const ColVec &A, const Scal &B)
 Return the result of stacking a vector on top of the an scalar, with the result being a vector.
 
template<typename V >
arg (const std::complex< V > &z)
 Return the phase angle of the complex argument.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
as_array_or_scalar (T &&v)
 Returns specified input value.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
T & as_array_or_scalar (T &v)
 Returns a reference to rvalue specified input value.
 
template<typename T , typename = require_eigen_t<T>, require_not_eigen_array_t< T > * = nullptr>
auto as_array_or_scalar (T &&v)
 Converts a matrix type to an array.
 
template<typename T >
bool as_bool (const T &x)
 Return true if the argument is not equal to zero (in the != operator sense) and false otherwise.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
as_column_vector_or_scalar (const T &a)
 no-op that passes the scalar
 
template<typename T , typename S >
internal::empty_broadcast_array< T, S, void > & as_column_vector_or_scalar (internal::empty_broadcast_array< T, S, void > &a)
 No-op used when working with operands and partials.
 
template<typename T , require_eigen_col_vector_t< T > * = nullptr>
T && as_column_vector_or_scalar (T &&a)
 no-op that returns a column vector.
 
template<typename T , require_eigen_row_vector_t< T > * = nullptr, require_not_eigen_col_vector_t< T > * = nullptr>
auto as_column_vector_or_scalar (T &&a)
 Converts a row vector to an eigen column vector.
 
template<typename T >
auto as_value_array_or_scalar (T &&v)
 Extract the value from an object.
 
template<typename T >
auto as_value_column_array_or_scalar (T &&a)
 Extract the value from an object and for eigen vectors and std::vectors convert to an eigen column array and for scalars return a scalar.
 
template<typename T >
auto as_value_column_vector_or_scalar (T &&a)
 Extract values from input argument and transform to a column vector.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto asin (const Container &x)
 Returns the elementwise asin() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto asin (const Container &x)
 Version of asin() that accepts std::vectors, Eigen Matrix/Array objects, or expressions, and containers of these.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto asinh (const T &x)
 Returns the elementwise asinh() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<int N>
void print_mat_size (std::ostream &o)
 Helper function to return the matrix size as either "dynamic" or "1".
 
template<typename T_lhs , typename T_rhs , require_all_stan_scalar_t< T_lhs, T_rhs > * = nullptr>
void assign (T_lhs &x, const T_rhs &y)
 Copy the right-hand side's value to the left-hand side variable.
 
template<typename T_lhs , typename T_rhs , require_all_eigen_t< T_lhs, T_rhs > * = nullptr>
void assign (T_lhs &&x, const T_rhs &y)
 Copy the right-hand side's value to the left-hand side variable.
 
template<typename T_lhs , typename T_rhs >
void assign (std::vector< T_lhs > &x, const std::vector< T_rhs > &y)
 Copy the right-hand side's value to the left-hand side variable.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto atan (const Container &x)
 Returns the elementwise atan() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto atan (const Container &x)
 Version of atan() that accepts std::vectors, Eigen Matrix/Array objects, or expressions, and containers of these.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
double atan2 (T1 y, T2 x)
 Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_var_matrix_t< T1, T2 > * = nullptr>
auto atan2 (const T1 &a, const T2 &b)
 Enables the vectorized application of the atan2 function, when the first and/or second arguments are containers.
 
double atanh (double x)
 Return the inverse hyperbolic tangent of the specified value.
 
double atanh (int x)
 Integer version of atanh.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto atanh (const T &x)
 Return the elementwise application of atanh() to specified argument container.
 
template<typename T >
void autocorrelation (const std::vector< T > &y, std::vector< T > &ac, Eigen::FFT< T > &fft)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.
 
template<typename T , typename DerivedA , typename DerivedB >
void autocorrelation (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &ac, Eigen::FFT< T > &fft)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.
 
template<typename T >
void autocorrelation (const std::vector< T > &y, std::vector< T > &ac)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result.
 
template<typename T , typename DerivedA , typename DerivedB >
void autocorrelation (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &ac)
 Write autocorrelation estimates for every lag for the specified input sequence into the specified result.
 
template<typename T >
void autocovariance (const std::vector< T > &y, std::vector< T > &acov, Eigen::FFT< T > &fft)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.
 
template<typename T , typename DerivedA , typename DerivedB >
void autocovariance (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &acov, Eigen::FFT< T > &fft)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result using the specified FFT engine.
 
template<typename T >
void autocovariance (const std::vector< T > &y, std::vector< T > &acov)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result.
 
template<typename T , typename DerivedA , typename DerivedB >
void autocovariance (const Eigen::MatrixBase< DerivedA > &y, Eigen::MatrixBase< DerivedB > &acov)
 Write autocovariance estimates for every lag for the specified input sequence into the specified result.
 
template<typename T2 , require_arithmetic_t< T2 > * = nullptr>
T2 bessel_first_kind (int v, const T2 z)
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_not_var_matrix_t< T2 > * = nullptr>
auto bessel_first_kind (const T1 &a, const T2 &b)
 Enables the vectorized application of the bessel first kind function, when the first and/or second arguments are containers.
 
template<typename T2 , require_arithmetic_t< T2 > * = nullptr>
T2 bessel_second_kind (int v, const T2 z)
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto bessel_second_kind (const T1 &a, const T2 &b)
 Enables the vectorized application of the bessel second kind function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > beta (const T1 a, const T2 b)
 Return the beta function applied to the specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_var_matrix_t< T1, T2 > * = nullptr>
auto beta (const T1 &a, const T2 &b)
 Enables the vectorized application of the beta function, when the first and/or second arguments are containers.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
binary_log_loss (int y, const T &y_hat)
 Returns the log loss function for binary classification with specified reference and response values.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_not_var_matrix_t< T2 > * = nullptr>
auto binary_log_loss (const T1 &a, const T2 &b)
 Enables the vectorized application of the binary log loss function, when the first and/or second arguments are containers.
 
template<typename T_n , typename T_k , require_all_stan_scalar_t< T_n, T_k > * = nullptr>
return_type_t< T_n, T_k > binomial_coefficient_log (const T_n n, const T_k k)
 Return the log of the binomial coefficient for the specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto binomial_coefficient_log (const T1 &a, const T2 &b)
 Enables the vectorized application of the binomial coefficient log function, when the first and/or second arguments are containers.
 
template<typename T , require_matrix_t< T > * = nullptr>
auto block (const T &m, size_t i, size_t j, size_t nrows, size_t ncols)
 Return a nrows x ncols submatrix starting at (i-1, j-1).
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto cbrt (const T &x)
 Returns the elementwise cbrt() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto ceil (const Container &x)
 Returns the elementwise ceil() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename T , require_eigen_t< T > * = nullptr>
plain_type_t< T > chol2inv (const T &L)
 Returns the inverse of the matrix whose Cholesky factor is L.
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr>
Eigen::Matrix< value_type_t< EigVec >, Eigen::Dynamic, Eigen::Dynamic > cholesky_corr_constrain (const EigVec &y, int K)
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
Eigen::Matrix< value_type_t< EigVec >, Eigen::Dynamic, Eigen::Dynamic > cholesky_corr_constrain (const EigVec &y, int K, return_type_t< EigVec > &lp)
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto cholesky_corr_constrain (const T &y, int K, return_type_t< T > &lp)
 Return The cholesky of a KxK correlation matrix.
 
template<typename T , require_eigen_t< T > * = nullptr>
auto cholesky_corr_free (const T &x)
 Overload of cholesky_corr_free() to untransform each matrix in a standard vector.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_eigen_vt< is_var, EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::ColsAtCompileTime > cholesky_decompose (const EigMat &m)
 Return the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square, symmetric matrix.
 
template<typename T , require_eigen_col_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > cholesky_factor_constrain (const T &x, int M, int N)
 Return the Cholesky factor of the specified size read from the specified vector.
 
template<typename T , require_eigen_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > cholesky_factor_constrain (const T &x, int M, int N, return_type_t< T > &lp)
 Return the Cholesky factor of the specified size read from the specified vector and increment the specified log probability reference with the log absolute Jacobian determinant adjustment of the transform.
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto cholesky_factor_constrain (const T &x, int M, int N, return_type_t< T > &lp)
 Return the Cholesky factor of the specified size read from the specified vector.
 
template<typename T , require_eigen_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, 1 > cholesky_factor_free (const T &y)
 Return the unconstrained vector of parameters corresponding to the specified Cholesky factor.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto cholesky_factor_free (const T &x)
 Overload of cholesky_factor_free() to untransform each matrix in a standard vector.
 
int choose (int n, int k)
 Return the binomial coefficient for the specified integer arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto choose (const T1 &a, const T2 &b)
 Enables the vectorized application of the binomial coefficient function, when the first and/or second arguments are containers.
 
template<typename T , require_matrix_t< T > * = nullptr>
auto col (const T &m, size_t j)
 Return the specified column of the specified matrix using start-at-1 indexing.
 
template<typename T , require_matrix_t< T > * = nullptr>
Eigen::Index cols (const T &m)
 Return the number of columns in the specified matrix, vector, or row vector.
 
template<typename Mat1 , typename Mat2 , require_all_eigen_t< Mat1, Mat2 > * = nullptr, require_all_not_eigen_vt< is_var, Mat1, Mat2 > * = nullptr>
Eigen::Matrix< return_type_t< Mat1, Mat2 >, 1, Mat1::ColsAtCompileTime > columns_dot_product (const Mat1 &v1, const Mat2 &v2)
 Returns the dot product of columns of the specified matrices.
 
template<typename T , require_eigen_t< T > * = nullptr, require_not_eigen_vt< is_var, T > * = nullptr>
Eigen::Matrix< value_type_t< T >, 1, T::ColsAtCompileTime > columns_dot_self (const T &x)
 Returns the dot product of each column of a matrix with itself.
 
template<typename M , require_eigen_dense_dynamic_t< M > * = nullptr>
Eigen::Matrix< complex_return_t< scalar_type_t< M > >, -1, -1 > complex_schur_decompose_u (const M &m)
 Return the unitary matrix of the complex Schur decomposition of the specified square matrix.
 
template<typename M , require_eigen_dense_dynamic_t< M > * = nullptr>
Eigen::Matrix< complex_return_t< scalar_type_t< M > >, -1, -1 > complex_schur_decompose_t (const M &m)
 Return the Schur form matrix of the complex Schur decomposition of the specified square matrix.
 
template<typename M , require_eigen_dense_dynamic_t< M > * = nullptr>
std::tuple< Eigen::Matrix< complex_return_t< scalar_type_t< M > >, -1, -1 >, Eigen::Matrix< complex_return_t< scalar_type_t< M > >, -1, -1 > > complex_schur_decompose (const M &m)
 Return the complex Schur decomposition of the specified square matrix.
 
template<typename V >
std::complex< V > conj (const std::complex< V > &z)
 Return the complex conjugate the complex argument.
 
template<typename Eig , require_eigen_vt< is_complex, Eig > * = nullptr>
auto conj (const Eig &z)
 Return the complex conjugate the Eigen object.
 
template<typename StdVec , require_std_vector_st< is_complex, StdVec > * = nullptr>
auto conj (const StdVec &z)
 Return the complex conjugate the vector with complex scalar components.
 
static constexpr double e ()
 Return the base of the natural logarithm.
 
static constexpr double egamma ()
 Return the Euler's gamma constant.
 
static constexpr double pi ()
 Return the value of pi.
 
static constexpr double positive_infinity ()
 Return positive infinity.
 
static constexpr double negative_infinity ()
 Return negative infinity.
 
static constexpr double not_a_number ()
 Return (quiet) not-a-number.
 
static constexpr double machine_precision ()
 Returns the difference between 1.0 and the next value representable.
 
static constexpr double log10 ()
 Returns the natural logarithm of ten.
 
static constexpr double sqrt2 ()
 Returns the square root of two.
 
template<typename T , typename U >
copysign (const T &x, const U &y)
 Return the negation of the first argument if the first and second argument have different signs, otherwise return a copy of the first argument.
 
template<typename T , typename U >
copysign_non_zero (const T &x, const U &y)
 Return the negation of the first argument if the first and second arguments have different signs and the first argument is not zero, otherwise return a copy of the first argument.
 
template<typename T , typename U >
std::complex< T > copysign (const std::complex< T > &x, const std::complex< U > &y)
 Return the complex number composed of the real and complex parts with signs copied from the real and complex parts of the first arguments to the real and complex parts of the second.
 
template<typename T >
plain_type_t< T > corr_constrain (const T &x)
 Return the result of transforming the specified scalar or container of values to have a valid correlation value between -1 and 1 (inclusive).
 
template<typename T_x , typename T_lp >
auto corr_constrain (const T_x &x, T_lp &lp)
 Return the result of transforming the specified scalar or container of values to have a valid correlation value between -1 and 1 (inclusive).
 
template<bool Jacobian, typename T_x , typename T_lp >
auto corr_constrain (const T_x &x, T_lp &lp)
 Return the result of transforming the specified scalar or container of values to have a valid correlation value between -1 and 1 (inclusive).
 
template<typename T >
corr_free (const T &y)
 Return the unconstrained scalar that when transformed to a valid correlation produces the specified value.
 
template<typename T , require_eigen_col_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > corr_matrix_constrain (const T &x, Eigen::Index k)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.
 
template<typename T , require_eigen_col_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > corr_matrix_constrain (const T &x, Eigen::Index k, return_type_t< T > &lp)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto corr_matrix_constrain (const T &x, Eigen::Index k, return_type_t< T > &lp)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.
 
template<bool Jacobian, typename T , require_std_vector_t< T > * = nullptr>
auto corr_matrix_constrain (const T &y, int K, return_type_t< T > &lp)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.
 
template<typename T , require_eigen_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, 1 > corr_matrix_free (const T &y)
 Return the vector of unconstrained partial correlations that define the specified correlation matrix when transformed.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto corr_matrix_free (const T &x)
 Overload of corr_matrix_free() to untransform each matrix in a standard vector.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto cos (const Container &x)
 Returns the elementwise cos() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto cos (const Container &x)
 Version of cos() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto cosh (const Container &x)
 Returns the elementwise cosh() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto cosh (const Container &x)
 Version of cosh() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_sigma, T_l >, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x > &x, const T_sigma &sigma, const T_l &length_scale)
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_sigma, T_l >, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x > &x, const T_sigma &sigma, const std::vector< T_l > &length_scale)
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_sigma, T_l >, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const T_l &length_scale)
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_sigma, T_l >, Eigen::Dynamic, Eigen::Dynamic > cov_exp_quad (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const std::vector< T_l > &length_scale)
 
template<typename T , require_eigen_col_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain (const T &x, Eigen::Index K)
 Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).
 
template<typename T , require_eigen_col_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain (const T &x, Eigen::Index K, return_type_t< T > &lp)
 Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto cov_matrix_constrain (const T &x, Eigen::Index K, return_type_t< T > &lp)
 Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).
 
template<typename T , require_eigen_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain_lkj (const T &x, size_t k)
 Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values.
 
template<typename T , require_eigen_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain_lkj (const T &x, size_t k, return_type_t< T > &lp)
 Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values and increment the specified log probability reference with the log absolute Jacobian determinant.
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto cov_matrix_constrain_lkj (const T &x, size_t k, return_type_t< T > &lp)
 Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values.
 
template<typename T , require_eigen_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, 1 > cov_matrix_free (const T &y)
 The covariance matrix derived from the symmetric view of the lower-triangular view of the K by K specified matrix is freed to return a vector of size K + (K choose 2).
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto cov_matrix_free (const T &x)
 Overload of cov_matrix_free() to untransform each matrix in a standard vector.
 
template<typename T , require_eigen_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, 1 > cov_matrix_free_lkj (const T &y)
 Return the vector of unconstrained partial correlations and deviations that transform to the specified covariance matrix.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto cov_matrix_free_lkj (const T &x)
 Overload of cov_matrix_free_lkj() to untransform each matrix in a standard vector.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
auto crossprod (const EigMat &M)
 Returns the result of pre-multiplying a matrix by its own transpose.
 
template<typename T >
const std::tuple< Eigen::Matrix< T, Eigen::Dynamic, 1 >, std::vector< int >, std::vector< int > > csr_extract (const Eigen::SparseMatrix< T, Eigen::RowMajor > &A)
 Extract the non-zero values, column indexes for non-zero values, and the NZE index for each entry from a sparse matrix.
 
template<typename T , require_eigen_dense_base_t< T > * = nullptr>
const std::tuple< Eigen::Matrix< scalar_type_t< T >, Eigen::Dynamic, 1 >, std::vector< int >, std::vector< int > > csr_extract (const T &A)
 
template<typename T >
const std::vector< int > csr_extract_u (const Eigen::SparseMatrix< T, Eigen::RowMajor > &A)
 Extract the NZE index for each entry from a sparse matrix.
 
template<typename T , require_eigen_dense_base_t< T > * = nullptr>
const std::vector< int > csr_extract_u (const T &A)
 Extract the NZE index for each entry from a sparse matrix.
 
template<typename T >
const std::vector< int > csr_extract_v (const Eigen::SparseMatrix< T, Eigen::RowMajor > &A)
 Extract the column indexes for non-zero value from a sparse matrix.
 
template<typename T , require_eigen_dense_base_t< T > * = nullptr>
const std::vector< int > csr_extract_v (const T &A)
 Extract the column indexes for non-zero values from a dense matrix by converting to sparse and calling the sparse matrix extractor.
 
template<typename T >
const Eigen::Matrix< T, Eigen::Dynamic, 1 > csr_extract_w (const Eigen::SparseMatrix< T, Eigen::RowMajor > &A)
 
template<typename T , require_eigen_dense_base_t< T > * = nullptr>
const Eigen::Matrix< scalar_type_t< T >, Eigen::Dynamic, 1 > csr_extract_w (const T &A)
 
template<typename T1 , typename T2 , require_all_not_rev_matrix_t< T1, T2 > * = nullptr>
Eigen::Matrix< return_type_t< T1, T2 >, Eigen::Dynamic, 1 > csr_matrix_times_vector (int m, int n, const T1 &w, const std::vector< int > &v, const std::vector< int > &u, const T2 &b)
 
template<typename T >
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > csr_to_dense_matrix (int m, int n, const T &w, const std::vector< int > &v, const std::vector< int > &u)
 Construct a dense Eigen matrix from the CSR format components.
 
int csr_u_to_z (const std::vector< int > &u, int i)
 Return the z vector computed from the specified u vector at the index for the z vector.
 
template<typename T >
std::vector< T > cumulative_sum (const std::vector< T > &x)
 Return the cumulative sum of the specified vector.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr, require_not_st_var< EigVec > * = nullptr>
auto cumulative_sum (const EigVec &m)
 Return the cumulative sum of the specified vector.
 
template<typename T , require_eigen_vt< std::is_arithmetic, T > * = nullptr>
value_type_t< T > determinant (const T &m)
 Returns the determinant of the specified square matrix.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
Eigen::Matrix< value_type_t< EigVec >, Eigen::Dynamic, Eigen::Dynamic > diag_matrix (const EigVec &v)
 Return a square diagonal matrix with the specified vector of coefficients as the diagonal values.
 
template<typename T1 , typename T2 , require_eigen_t< T1 > * = nullptr, require_eigen_vector_t< T2 > * = nullptr, require_all_not_st_var< T1, T2 > * = nullptr>
auto diag_post_multiply (const T1 &m1, const T2 &m2)
 Return the product of the matrix and the diagonal matrix formed from the vector or row_vector.
 
template<typename T1 , typename T2 , require_eigen_vector_t< T1 > * = nullptr, require_eigen_t< T2 > * = nullptr, require_all_not_st_var< T1, T2 > * = nullptr>
auto diag_pre_multiply (const T1 &m1, const T2 &m2)
 Return the product of the diagonal matrix formed from the vector or row_vector and a matrix.
 
template<typename T , require_matrix_t< T > * = nullptr>
auto diagonal (const T &m)
 Return a column vector of the diagonal elements of the specified matrix.
 
double digamma (double x)
 Return the derivative of the log gamma function at the specified value.
 
template<typename T , require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto digamma (const T &x)
 Vectorized version of digamma().
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
void dims (const T &x, std::vector< int > &result)
 Pushes dimensions of given argument into given result vector.
 
template<typename T , typename Alloc >
void dims (const std::vector< T, Alloc > &x, std::vector< int > &result)
 Pushes dimensions of given argument into given result vector.
 
template<typename T >
std::vector< int > dims (const T &x)
 Determines dimensions of an argument.
 
template<typename T1 , typename T2 , require_all_stan_scalar_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > distance (const T1 &x1, const T2 &x2)
 Returns the distance between two scalars.
 
template<typename Scal1 , typename Scal2 , require_all_stan_scalar_t< Scal1, Scal2 > * = nullptr>
return_type_t< Scal1, Scal2 > divide (const Scal1 &x, const Scal2 &y)
 Return the division of the first scalar by the second scalar.
 
int divide (int x, int y)
 
template<typename T1 , typename T2 , require_any_eigen_t< T1, T2 > * = nullptr, require_all_not_st_var< T1, T2 > * = nullptr>
auto divide (const T1 &m, const T2 &c)
 Return matrix divided by scalar.
 
template<typename T_x , typename T_v >
std::vector< Eigen::Matrix< return_type_t< T_x, T_v, double >, Eigen::Dynamic, 1 > > divide_columns (const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 > > &x, const std::vector< T_v > &vec)
 Takes Stan data type vector[n] x[D] and divides column vector in x element-wise by the values in vec.
 
double dot (const std::vector< double > &x, const std::vector< double > &y)
 
template<typename Vec1 , typename Vec2 , require_all_eigen_vector_t< Vec1, Vec2 > * = nullptr, require_not_var_t< return_type_t< Vec1, Vec2 > > * = nullptr>
auto dot_product (const Vec1 &v1, const Vec2 &v2)
 Returns the dot product of the specified vectors.
 
template<typename Scalar1 , typename Scalar2 , require_all_stan_scalar_t< Scalar1, Scalar2 > * = nullptr, require_all_not_var_t< Scalar1, Scalar2 > * = nullptr>
auto dot_product (const Scalar1 *v1, const Scalar2 *v2, size_t length)
 Returns the dot product of the specified arrays.
 
template<typename Scalar1 , typename Scalar2 , typename Alloc1 , typename Alloc2 , require_all_stan_scalar_t< Scalar1, Scalar2 > * = nullptr>
return_type_t< Scalar1, Scalar2 > dot_product (const std::vector< Scalar1, Alloc1 > &v1, const std::vector< Scalar2, Alloc2 > &v2)
 Returns the dot product of the specified arrays.
 
double dot_self (const std::vector< double > &x)
 
template<typename T , require_eigen_t< T > * = nullptr, require_not_eigen_vt< is_var, T > * = nullptr>
value_type_t< T > dot_self (const T &v)
 Returns squared norm of a vector or matrix.
 
template<typename T_a , typename T_b , require_any_eigen_t< T_a, T_b > * = nullptr, require_any_st_autodiff< T_a, T_b > * = nullptr, require_not_st_same< T_a, T_b > * = nullptr>
auto operator< (const T_a &a, const T_b &b)
 
template<typename T_a , typename T_b , require_any_eigen_t< T_a, T_b > * = nullptr, require_any_st_autodiff< T_a, T_b > * = nullptr, require_not_st_same< T_a, T_b > * = nullptr>
auto operator<= (const T_a &a, const T_b &b)
 
template<typename T_a , typename T_b , require_any_eigen_t< T_a, T_b > * = nullptr, require_any_st_autodiff< T_a, T_b > * = nullptr, require_not_st_same< T_a, T_b > * = nullptr>
auto operator> (const T_a &a, const T_b &b)
 
template<typename T_a , typename T_b , require_any_eigen_t< T_a, T_b > * = nullptr, require_any_st_autodiff< T_a, T_b > * = nullptr, require_not_st_same< T_a, T_b > * = nullptr>
auto operator>= (const T_a &a, const T_b &b)
 
template<typename T_a , typename T_b , require_any_eigen_t< T_a, T_b > * = nullptr, require_any_st_autodiff< T_a, T_b > * = nullptr, require_not_st_same< T_a, T_b > * = nullptr>
auto operator== (const T_a &a, const T_b &b)
 
template<typename T_a , typename T_b , require_any_eigen_t< T_a, T_b > * = nullptr, require_any_st_autodiff< T_a, T_b > * = nullptr, require_not_st_same< T_a, T_b > * = nullptr>
auto operator!= (const T_a &a, const T_b &b)
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_vt_complex< EigMat > * = nullptr>
std::tuple< Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, -1 >, Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, 1 > > eigendecompose (const EigMat &m)
 Return the eigendecomposition of a (real-valued) matrix.
 
template<typename EigCplxMat , require_eigen_matrix_dynamic_vt< is_complex, EigCplxMat > * = nullptr>
std::tuple< Eigen::Matrix< complex_return_t< value_type_t< EigCplxMat > >, -1, -1 >, Eigen::Matrix< complex_return_t< value_type_t< EigCplxMat > >, -1, 1 > > eigendecompose (const EigCplxMat &m)
 Return the eigendecomposition of a (complex-valued) matrix.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_st_var< EigMat > * = nullptr>
std::tuple< Eigen::Matrix< value_type_t< EigMat >, -1, -1 >, Eigen::Matrix< value_type_t< EigMat >, -1, 1 > > eigendecompose_sym (const EigMat &m)
 Return the eigendecomposition of the specified symmetric matrix.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_vt_complex< EigMat > * = nullptr>
Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, 1 > eigenvalues (const EigMat &m)
 Return the eigenvalues of a (real-valued) matrix.
 
template<typename EigCplxMat , require_eigen_matrix_dynamic_vt< is_complex, EigCplxMat > * = nullptr>
Eigen::Matrix< complex_return_t< value_type_t< EigCplxMat > >, -1, 1 > eigenvalues (const EigCplxMat &m)
 Return the eigenvalues of a (complex-valued) matrix.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_st_var< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, -1, 1 > eigenvalues_sym (const EigMat &m)
 Return the eigenvalues of the specified symmetric matrix in ascending order of magnitude.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_vt_complex< EigMat > * = nullptr>
Eigen::Matrix< complex_return_t< value_type_t< EigMat > >, -1, -1 > eigenvectors (const EigMat &m)
 Return the eigenvectors of a (real-valued) matrix.
 
template<typename EigCplxMat , require_eigen_matrix_dynamic_vt< is_complex, EigCplxMat > * = nullptr>
Eigen::Matrix< complex_return_t< value_type_t< EigCplxMat > >, -1, -1 > eigenvectors (const EigCplxMat &m)
 Return the eigenvectors of a (complex-valued) matrix.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_st_var< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > eigenvectors_sym (const EigMat &m)
 
template<typename Mat1 , typename Mat2 , require_all_eigen_t< Mat1, Mat2 > * = nullptr, require_all_not_st_var< Mat1, Mat2 > * = nullptr>
auto elt_divide (const Mat1 &m1, const Mat2 &m2)
 Return the elementwise division of the specified matrices.
 
template<typename Mat , typename Scal , require_matrix_t< Mat > * = nullptr, require_stan_scalar_t< Scal > * = nullptr>
auto elt_divide (const Mat &m, Scal s)
 Return the elementwise division of the specified matrix by the specified scalar.
 
template<typename Scal , typename Mat , require_stan_scalar_t< Scal > * = nullptr, require_eigen_t< Mat > * = nullptr>
auto elt_divide (Scal s, const Mat &m)
 Return the elementwise division of the specified scalar by the specified matrix.
 
template<typename Scal1 , typename Scal2 , require_all_stan_scalar_t< Scal1, Scal2 > * = nullptr>
auto elt_divide (Scal1 s1, Scal2 s2)
 
template<typename Mat1 , typename Mat2 , require_all_eigen_t< Mat1, Mat2 > * = nullptr, require_all_not_st_var< Mat1, Mat2 > * = nullptr>
auto elt_multiply (const Mat1 &m1, const Mat2 &m2)
 Return the elementwise multiplication of the specified matrices.
 
template<typename Scalar1 , typename Scalar2 , require_all_stan_scalar_t< Scalar1, Scalar2 > * = nullptr>
auto elt_multiply (const Scalar1 &a, const Scalar2 &b)
 Return the elementwise multiplication of the specified scalars.
 
template<typename T1 , typename T2 , require_any_matrix_t< T1, T2 > * = nullptr, require_any_stan_scalar_t< T1, T2 > * = nullptr>
auto elt_multiply (const T1 &A, const T2 &B)
 Return specified matrix multiplied by specified scalar.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto erf (const T &x)
 Returns the elementwise erf() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto erfc (const T &x)
 Returns the elementwise erfc() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename T , require_same_t< std::decay_t< T >, plain_type_t< T > > * = nullptr>
eval (T &&arg)
 Inputs which have a plain_type equal to the own time are forwarded unmodified (for Eigen expressions these types are different)
 
template<typename T , require_not_same_t< std::decay_t< T >, plain_type_t< T > > * = nullptr>
decltype(auto) eval (const T &arg)
 Inputs which have a plain_type different from their own type are Eval'd (this catches Eigen expressions)
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr>
auto exp (const Container &x)
 Return the elementwise exp() of the specified argument, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto exp (const Container &x)
 Version of exp() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto exp2 (const T &x)
 Return the elementwise exp2() of the specified argument, which may be a scalar or any Stan container of numeric scalars.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto expm1 (const T &x)
 Return the elementwise expm1() of the specified argument, which may be a scalar or any Stan container of numeric scalars.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
auto fabs (T x)
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr, require_not_stan_scalar_t< Container > * = nullptr>
auto fabs (const Container &x)
 Returns the elementwise fabs() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto fabs (const Container &x)
 Version of fabs() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T_Sigma , typename T_CPCs , typename T_sds , require_eigen_t< T_Sigma > * = nullptr, require_all_eigen_vector_t< T_CPCs, T_sds > * = nullptr, require_all_vt_same< T_Sigma, T_CPCs, T_sds > * = nullptr>
bool factor_cov_matrix (const T_Sigma &Sigma, T_CPCs &&CPCs, T_sds &&sds)
 This function is intended to make starting values, given a covariance matrix Sigma.
 
template<typename T_U , typename T_CPCs , require_eigen_t< T_U > * = nullptr, require_eigen_vector_t< T_CPCs > * = nullptr, require_vt_same< T_U, T_CPCs > * = nullptr>
void factor_U (const T_U &U, T_CPCs &&CPCs)
 This function is intended to make starting values, given a unit upper-triangular matrix U such that U'DU is a correlation matrix.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
return_type_t< T > falling_factorial (const T &x, int n)
 Return the falling factorial function evaluated at the inputs.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_var_matrix_t< T1, T2 > * = nullptr>
auto falling_factorial (const T1 &a, const T2 &b)
 Enables the vectorized application of the falling factorial function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
double fdim (T1 x, T2 y)
 Return the positive difference of the specified values (C++11).
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto fdim (const T1 &a, const T2 &b)
 Enables the vectorized application of the fdim function, when the first and/or second arguments are containers.
 
template<typename V , require_eigen_vector_vt< is_complex, V > * = nullptr, require_not_var_t< base_type_t< value_type_t< V > > > * = nullptr>
Eigen::Matrix< scalar_type_t< V >, -1, 1 > fft (const V &x)
 Return the discrete Fourier transform of the specified complex vector.
 
template<typename V , require_eigen_vector_vt< is_complex, V > * = nullptr, require_not_var_t< base_type_t< value_type_t< V > > > * = nullptr>
Eigen::Matrix< scalar_type_t< V >, -1, 1 > inv_fft (const V &y)
 Return the inverse discrete Fourier transform of the specified complex vector.
 
template<typename M , require_eigen_dense_dynamic_vt< is_complex, M > * = nullptr, require_not_var_t< base_type_t< value_type_t< M > > > * = nullptr>
Eigen::Matrix< scalar_type_t< M >, -1, -1 > fft2 (const M &x)
 Return the two-dimensional discrete Fourier transform of the specified complex matrix.
 
template<typename M , require_eigen_dense_dynamic_vt< is_complex, M > * = nullptr, require_not_var_t< base_type_t< value_type_t< M > > > * = nullptr>
Eigen::Matrix< scalar_type_t< M >, -1, -1 > inv_fft2 (const M &y)
 Return the two-dimensional inverse discrete Fourier transform of the specified complex matrix.
 
template<typename EigMat , typename S , require_eigen_t< EigMat > * = nullptr, require_stan_scalar_t< S > * = nullptr>
void fill (EigMat &x, const S &y)
 Fill the specified container with the specified value.
 
template<typename T , typename S , require_t< std::is_assignable< std::decay_t< T > &, std::decay_t< S > > > * = nullptr>
void fill (T &x, S &&y)
 Fill the specified container with the specified value.
 
template<typename Vec , typename S , require_std_vector_t< Vec > * = nullptr>
void fill (Vec &x, S &&y)
 Fill the specified container with the specified value.
 
double finite_diff_stepsize (double u)
 Return the stepsize for finite difference evaluations at the specified scalar.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr>
auto floor (const Container &x)
 Returns the elementwise floor() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr>
auto floor (const Container &x)
 Version of floor() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T1 , typename T2 , typename T3 , require_all_arithmetic_t< T1, T2, T3 > * = nullptr>
double fma (T1 x, T2 y, T3 z)
 Return the product of the first two arguments plus the third argument.
 
template<typename T1 , typename T2 , typename T3 , require_any_matrix_t< T1, T2, T3 > * = nullptr, require_not_var_t< return_type_t< T1, T2, T3 > > * = nullptr>
auto fma (T1 &&x, T2 &&y, T3 &&z)
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
double fmax (T1 x, T2 y)
 Return the greater of the two specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto fmax (const T1 &a, const T2 &b)
 Enables the vectorized application of the fmax function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
double fmin (T1 x, T2 y)
 Return the lesser of the two specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto fmin (const T1 &a, const T2 &b)
 Enables the vectorized application of the fmin function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
double fmod (const T1 &a, const T2 &b)
 Returns the floating-point remainder of numerator/denominator (rounded towards zero).
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto fmod (const T1 &a, const T2 &b)
 Enables the vectorized application of the fmod function, when the first and/or second arguments are containers.
 
double gamma_p (double z, double a)
 Return the value of the normalized, lower-incomplete gamma function applied to the specified argument.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto gamma_p (const T1 &a, const T2 &b)
 Enables the vectorized application of the gamma_p function, when the first and/or second arguments are containers.
 
double gamma_q (double x, double a)
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto gamma_q (const T1 &a, const T2 &b)
 Enables the vectorized application of the gamma_q function, when the first and/or second arguments are containers.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_vt_var< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::ColsAtCompileTime, EigMat::RowsAtCompileTime > generalized_inverse (const EigMat &G)
 Returns the Moore-Penrose generalized inverse of the specified matrix.
 
template<typename T >
const T & get_base1 (const std::vector< T > &x, size_t i, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one index.
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< T > > &x, size_t i1, size_t i2, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< T > > > &x, size_t i1, size_t i2, size_t i3, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< T > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
const T & get_base1 (const std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, size_t i8, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_eigen_vector_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, 1, Eigen::Dynamic > get_base1 (const EigMat &x, size_t m, const char *error_msg, size_t idx)
 Return a copy of the row of the specified matrix at the specified base-one row index.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
const value_type_t< EigMat > & get_base1 (const EigMat &x, size_t m, size_t n, const char *error_msg, size_t idx)
 Return a reference to the value of the specified matrix at the specified base-one row and column indexes.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
const value_type_t< EigVec > & get_base1 (const EigVec &x, size_t m, const char *error_msg, size_t idx)
 Return a reference to the value of the specified Eigen vector at the specified base-one index.
 
template<typename T >
T & get_base1_lhs (std::vector< T > &x, size_t i, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one index.
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< T > > &x, size_t i1, size_t i2, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< T > > > &x, size_t i1, size_t i2, size_t i3, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< T > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
T & get_base1_lhs (std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< T > > > > > > > > &x, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5, size_t i6, size_t i7, size_t i8, const char *error_msg, size_t idx)
 Return a reference to the value of the specified vector at the specified base-one indexes.
 
template<typename T >
Eigen::Block< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > > get_base1_lhs (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x, size_t m, const char *error_msg, size_t idx)
 Return a copy of the row of the specified vector at the specified base-one row index.
 
template<typename T >
T & get_base1_lhs (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &x, size_t m, size_t n, const char *error_msg, size_t idx)
 Return a reference to the value of the specified matrix at the specified base-one row and column indexes.
 
template<typename T >
T & get_base1_lhs (Eigen::Matrix< T, Eigen::Dynamic, 1 > &x, size_t m, const char *error_msg, size_t idx)
 Return a reference to the value of the specified column vector at the specified base-one index.
 
template<typename T >
T & get_base1_lhs (Eigen::Matrix< T, 1, Eigen::Dynamic > &x, size_t n, const char *error_msg, size_t idx)
 Return a reference to the value of the specified row vector at the specified base-one index.
 
template<typename T >
get_imag (const std::complex< T > &z)
 Return the imaginary component of the complex argument.
 
template<typename Eig , require_eigen_vt< is_complex, Eig > * = nullptr>
auto get_imag (const Eig &z)
 Return the real component of the complex argument.
 
template<typename StdVec , require_std_vector_st< is_complex, StdVec > * = nullptr>
auto get_imag (const StdVec &z)
 Return the real component of the complex argument.
 
template<typename T_lp , typename T_lp_accum >
return_type_t< T_lp, T_lp_accum > get_lp (const T_lp &lp, const accumulator< T_lp_accum > &lp_accum)
 
template<typename T >
get_real (const std::complex< T > &z)
 Return the real component of the complex argument.
 
template<typename Eig , require_eigen_vt< is_complex, Eig > * = nullptr>
auto get_real (const Eig &z)
 Return the real component of the complex argument.
 
template<typename StdVec , require_std_vector_st< is_complex, StdVec > * = nullptr>
auto get_real (const StdVec &z)
 Return the real component of the complex argument.
 
template<typename T_x , typename T_sigma >
Eigen::Matrix< return_type_t< T_x, T_sigma >, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 > > &x, const T_sigma &sigma)
 Returns a dot product covariance matrix.
 
template<typename T_x , typename T_sigma >
Eigen::Matrix< return_type_t< T_x, T_sigma >, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< T_x > &x, const T_sigma &sigma)
 Returns a dot product covariance matrix.
 
template<typename T_x1 , typename T_x2 , typename T_sigma >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_sigma >, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 > > &x1, const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 > > &x2, const T_sigma &sigma)
 Returns a dot product covariance matrix of differing x's.
 
template<typename T_x1 , typename T_x2 , typename T_sigma >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_sigma >, Eigen::Dynamic, Eigen::Dynamic > gp_dot_prod_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma)
 Returns a dot product covariance matrix of differing x's.
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_sigma, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< T_x > &x, const T_sigma &sigma, const T_l &length_scale)
 Returns a squared exponential kernel.
 
template<typename T_x , typename T_sigma , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_sigma, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< Eigen::Matrix< T_x, -1, 1 > > &x, const T_sigma &sigma, const std::vector< T_l > &length_scale)
 Returns a squared exponential kernel.
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_sigma, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const T_l &length_scale)
 Returns a squared exponential kernel.
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exp_quad_cov (const std::vector< Eigen::Matrix< T_x1, -1, 1 > > &x1, const std::vector< Eigen::Matrix< T_x2, -1, 1 > > &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a squared exponential kernel.
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< T_x > &x, const T_s &sigma, const T_l &length_scale)
 Returns a Matern exponential covariance Matrix.
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< Eigen::Matrix< T_x, -1, 1 > > &x, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern exponential covariance matrix.
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_s &sigma, const T_l &length_scale)
 Returns a Matern exponential cross covariance matrix.
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_exponential_cov (const std::vector< Eigen::Matrix< T_x1, -1, 1 > > &x1, const std::vector< Eigen::Matrix< T_x2, -1, 1 > > &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern exponential cross covariance matrix.
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< T_x > &x, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 3/2 covariance matrix.
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< Eigen::Matrix< T_x, -1, 1 > > &x, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 3/2 covariance matrix.
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 3/2 cross covariance matrix.
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern32_cov (const std::vector< Eigen::Matrix< T_x1, -1, 1 > > &x1, const std::vector< Eigen::Matrix< T_x2, -1, 1 > > &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 3/2 cross covariance matrix.
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< T_x > &x, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 5/2 covariance matrix with one input vector.
 
template<typename T_x , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 > > &x, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 5/2 covariance matrix with one input vector with automatic relevance determination (ARD).
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_s &sigma, const T_l &length_scale)
 Returns a Matern 5/2 covariance matrix with two different input vectors.
 
template<typename T_x1 , typename T_x2 , typename T_s , typename T_l >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_s, T_l >, Eigen::Dynamic, Eigen::Dynamic > gp_matern52_cov (const std::vector< Eigen::Matrix< T_x1, Eigen::Dynamic, 1 > > &x1, const std::vector< Eigen::Matrix< T_x2, Eigen::Dynamic, 1 > > &x2, const T_s &sigma, const std::vector< T_l > &length_scale)
 Returns a Matern 5/2 covariance matrix with two input vectors with automatic relevance determination (ARD).
 
template<typename T_x , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< return_type_t< T_x, T_sigma, T_l, T_p >, Eigen::Dynamic, Eigen::Dynamic > gp_periodic_cov (const std::vector< T_x > &x, const T_sigma &sigma, const T_l &l, const T_p &p)
 Returns a periodic covariance matrix \( \mathbf{K} \) using the input \( \mathbf{X} \).
 
template<typename T_x1 , typename T_x2 , typename T_sigma , typename T_l , typename T_p >
Eigen::Matrix< return_type_t< T_x1, T_x2, T_sigma, T_l, T_p >, Eigen::Dynamic, Eigen::Dynamic > gp_periodic_cov (const std::vector< T_x1 > &x1, const std::vector< T_x2 > &x2, const T_sigma &sigma, const T_l &l, const T_p &p)
 Returns a periodic covariance matrix \( \mathbf{K} \) using inputs \( \mathbf{X}_1 \) and \( \mathbf{X}_2 \).
 
template<bool ReturnSameT, typename T1 , typename T2 , typename T3 , typename T_z , require_not_t< std::integral_constant< bool, ReturnSameT > > * = nullptr>
auto grad_2F1 (const T1 &a1, const T2 &a2, const T3 &b1, const T_z &z, double precision=1e-14, int max_steps=1e6)
 Calculate the gradients of the hypergeometric function (2F1) as the power series stopping when the series converges to within precision or throwing when the function takes max_steps steps.
 
template<typename T1 , typename T2 , typename T3 , typename T_z >
auto grad_2F1 (const T1 &a1, const T2 &a2, const T3 &b1, const T_z &z, double precision=1e-14, int max_steps=1e6)
 Calculate the gradients of the hypergeometric function (2F1) as the power series stopping when the series converges to within precision or throwing when the function takes max_steps steps.
 
template<typename T >
void grad_F32 (T *g, const T &a1, const T &a2, const T &a3, const T &b1, const T &b2, const T &z, const T &precision=1e-6, int max_steps=1e5)
 Gradients of the hypergeometric function, 3F2.
 
void grad_inc_beta (double &g1, double &g2, double a, double b, double z)
 
template<bool calc_a = true, bool calc_b = true, bool calc_z = true, typename TpFq , typename Ta , typename Tb , typename Tz , typename T_Rtn = return_type_t<Ta, Tb, Tz>, typename Ta_Rtn = promote_scalar_t<T_Rtn, plain_type_t<Ta>>, typename Tb_Rtn = promote_scalar_t<T_Rtn, plain_type_t<Tb>>>
std::tuple< Ta_Rtn, Tb_Rtn, T_Rtn > grad_pFq (const TpFq &pfq_val, const Ta &a, const Tb &b, const Tz &z, double precision=1e-14, int max_steps=1e6)
 Returns the gradient of generalized hypergeometric function wrt to the input arguments: \( _pF_q(a_1,...,a_p;b_1,...,b_q;z) \).
 
template<typename T >
void grad_reg_inc_beta (T &g1, T &g2, const T &a, const T &b, const T &z, const T &digammaA, const T &digammaB, const T &digammaSum, const T &betaAB)
 Computes the gradients of the regularized incomplete beta function.
 
template<typename T1 , typename T2 >
return_type_t< T1, T2 > grad_reg_inc_gamma (T1 a, T2 z, T1 g, T1 dig, double precision=1e-6, int max_steps=1e5)
 Gradient of the regularized incomplete gamma functions igamma(a, z)
 
template<typename T1 , typename T2 >
return_type_t< T1, T2 > grad_reg_lower_inc_gamma (const T1 &a, const T2 &z, double precision=1e-10, int max_steps=1e5)
 Computes the gradient of the lower regularized incomplete gamma function.
 
template<typename T , require_vector_t< T > * = nullptr>
auto head (const T &v, size_t n)
 Return the specified number of elements as a vector or row vector (same as input) from the front of the specified vector or row vector.
 
template<typename T >
std::vector< T > head (const std::vector< T > &sv, size_t n)
 Return the specified number of elements as a standard vector from the front of the specified standard vector.
 
template<typename Ta , typename Tz , require_all_arithmetic_t< Ta, Tz > * = nullptr>
return_type_t< Ta, Tz > hypergeometric_1f0 (const Ta &a, const Tz &z)
 Returns the Hypergeometric 1F0 function applied to the input arguments: \( _1F_0(a;;z) = \sum_{k=1}^{\infty}\frac{\left(a\right)_kz^k}{k!}\).
 
template<typename Ta1 , typename Ta2 , typename Tb , typename Tz , typename ScalarT = return_type_t<Ta1, Ta1, Tb, Tz>, typename OptT = boost::optional<ScalarT>, require_all_arithmetic_t< Ta1, Ta2, Tb, Tz > * = nullptr>
return_type_t< Ta1, Ta1, Tb, Tz > hypergeometric_2F1 (const Ta1 &a1, const Ta2 &a2, const Tb &b, const Tz &z)
 Returns the Gauss hypergeometric function applied to the input arguments: \(_2F_1(a_1,a_2;b;z)\).
 
template<typename Ta , typename Tb , typename Tz , require_all_eigen_t< Ta, Tb > * = nullptr, require_stan_scalar_t< Tz > * = nullptr>
return_type_t< Ta, Tb, Tz > hypergeometric_2F2 (const Ta &a, const Tb &b, const Tz &z)
 Returns the generalized hypergeometric function applied to the input arguments: \(_2F_2(a_1,a_2;b_1,b_2;z)\).
 
template<typename Ta , typename Tb , typename Tz , require_all_vector_t< Ta, Tb > * = nullptr, require_stan_scalar_t< Tz > * = nullptr>
auto hypergeometric_3F2 (const Ta &a, const Tb &b, const Tz &z)
 Hypergeometric function (3F2).
 
template<typename Ta , typename Tb , typename Tz , require_all_stan_scalar_t< Ta, Tb, Tz > * = nullptr>
auto hypergeometric_3F2 (const std::initializer_list< Ta > &a, const std::initializer_list< Tb > &b, const Tz &z)
 Hypergeometric function (3F2).
 
template<typename Ta , typename Tb , typename Tz , require_all_eigen_st< std::is_arithmetic, Ta, Tb > * = nullptr, require_arithmetic_t< Tz > * = nullptr>
return_type_t< Ta, Tb, Tz > hypergeometric_pFq (const Ta &a, const Tb &b, const Tz &z)
 Returns the generalized hypergeometric function applied to the input arguments: \(_pF_q(a_1,...,a_p;b_1,...,b_q;z)\).
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
double hypot (T1 x, T2 y)
 Return the length of the hypotenuse of a right triangle with opposite and adjacent side lengths given by the specified arguments (C++11).
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
auto hypot (const T1 &a, const T2 &b)
 Enables the vectorized application of the hypot function, when the first and/or second arguments are containers.
 
template<typename T >
std::complex< T > i_times (const std::complex< T > &z)
 Return the specified complex number multiplied by i.
 
template<typename T >
std::complex< T > neg_i_times (const std::complex< T > &z)
 Return the specified complex number multiplied by -i.
 
template<typename V >
std::complex< V > complex_negate (const std::complex< V > &z)
 Return the complex negation of the specified complex argument.
 
template<bool Jacobian = false, typename T , typename... Types, require_all_not_var_matrix_t< T, Types... > * = nullptr>
auto identity_constrain (T &&x, Types &&...)
 Returns the result of applying the identity constraint transform to the input.
 
template<typename T , typename... Types, require_all_not_var_matrix_t< T, Types... > * = nullptr>
auto identity_free (T &&x, Types &&...)
 Returns the result of applying the inverse of the identity constraint transform to the input.
 
template<typename T_true , typename T_false >
return_type_t< T_true, T_false > if_else (const bool c, const T_true y_true, const T_false y_false)
 Return the second argument if the first argument is true and otherwise return the second argument.
 
template<typename T , require_autodiff_t< T > >
imag (const std::complex< T > &z)
 Return the imaginary component of the complex argument.
 
double inc_beta (double a, double b, double x)
 The normalized incomplete beta function of a, b, with outcome x.
 
template<typename T1 , typename T2 , typename T3 , require_any_container_t< T1, T2, T3 > * = nullptr, require_all_not_var_matrix_t< T1, T2, T3 > * = nullptr>
auto inc_beta (const T1 &a, const T2 &b, const T3 &c)
 Enables the vectorized application of the inc_beta function, when any arguments are containers.
 
template<typename T >
inc_beta_dda (T a, T b, T z, T digamma_a, T digamma_ab)
 Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to a.
 
template<typename T >
inc_beta_ddb (T a, T b, T z, T digamma_b, T digamma_ab)
 Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to b.
 
template<typename T >
inc_beta_ddz (T a, T b, T z)
 Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to z.
 
template<>
double inc_beta_ddz (double a, double b, double z)
 
template<typename T , typename V , require_all_stan_scalar_t< T, V > * = nullptr, require_convertible_t< V, T > * = nullptr>
void initialize (T &x, V v)
 
template<typename T , int R, int C, typename V >
void initialize (Eigen::Matrix< T, R, C > &x, const V &v)
 
template<typename T , typename V >
void initialize (std::vector< T > &x, const V &v)
 
template<typename EigMat , typename S , require_eigen_t< EigMat > * = nullptr, require_stan_scalar_t< S > * = nullptr>
void initialize_fill (EigMat &x, const S &y)
 Fill the specified container with the specified value.
 
template<typename T , typename S , require_t< std::is_assignable< std::decay_t< T > &, std::decay_t< S > > > * = nullptr>
void initialize_fill (T &x, S &&y)
 Fill the specified container with the specified value.
 
template<typename Vec , typename S , require_std_vector_t< Vec > * = nullptr>
void initialize_fill (Vec &x, S &&y)
 Fill the specified container with the specified value.
 
template<typename T >
int int_step (const T &y)
 The integer step, or Heaviside, function.
 
template<typename T , require_not_container_st< std::is_arithmetic, T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto inv (const T &x)
 Return the elementwise 1.0 / x of the specified argument, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto inv (const Container &x)
 Version of inv() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
double inv_cloglog (double x)
 The inverse complementary log-log function.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto inv_cloglog (const Container &x)
 Vectorized version of inv_cloglog().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto inv_cloglog (const Container &x)
 Version of inv_cloglog() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
auto inv_erfc (const T &x)
 The inverse complementary error function for variables.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr, require_not_arithmetic_t< T > * = nullptr>
auto inv_erfc (const T &x)
 Returns the elementwise inv_erfc() of the input, which may be a scalar or any Stan container of numeric scalars.
 
double inv_inc_beta (double a, double b, double p)
 The inverse of the normalized incomplete beta function of a, b, with probability p.
 
template<typename T1 , typename T2 , typename T3 , require_any_container_t< T1, T2, T3 > * = nullptr>
auto inv_inc_beta (const T1 &a, const T2 &b, const T3 &c)
 Enables the vectorized application of the inv_inc_beta function, when any arguments are containers.
 
double inv_logit (double a)
 Returns the inverse logit function applied to the argument.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto inv_logit (const T &x)
 Vectorized version of inv_logit().
 
double inv_Phi (double p)
 Return the value of the inverse standard normal cumulative distribution function at the specified argument.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto inv_Phi (const T &x)
 Vectorized version of inv_Phi().
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
auto inv_sqrt (T x)
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_not_stan_scalar_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto inv_sqrt (const Container &x)
 Return the elementwise 1 / sqrt(x)} of the specified argument, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_not_var_matrix_t< Container > * = nullptr, require_container_st< std::is_arithmetic, Container > * = nullptr>
auto inv_sqrt (const Container &x)
 Version of inv_sqrt() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto inv_square (const Container &x)
 Returns 1 / square(x).
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto inv_square (const Container &x)
 Version of inv_square() that accepts Eigen Matrix/Array objects or expressions.
 
template<typename Vector , require_vector_t< Vector > * = nullptr>
void inverse_softmax (const Vector &simplex, Vector &y)
 Writes the inverse softmax of the simplex argument into the second argument.
 
template<typename EigMat >
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > inverse_spd (const EigMat &m)
 Returns the inverse of the specified symmetric, pos/neg-definite matrix.
 
template<typename T >
bool is_any_nan (const T &x)
 Returns true if the input is NaN and false otherwise.
 
template<typename T , typename... Ts>
bool is_any_nan (const T &x, const Ts &... xs)
 Returns true if any input is NaN and false otherwise.
 
bool is_inf (double x)
 Returns true if the input is infinite and false otherwise.
 
template<typename T >
bool is_integer (T x)
 Returns true if the input is an integer and false otherwise.
 
template<typename T , require_integral_t< T > * = nullptr>
bool is_nan (T x)
 Tests if the input is Not a Number (NaN)
 
template<typename T , require_eigen_t< T > * = nullptr>
bool is_nan (const T &x)
 
template<typename T >
bool is_nonpositive_integer (T x)
 Returns true if the input is a nonpositive integer and false otherwise.
 
template<typename T >
bool is_uninitialized (T x)
 Returns true if the specified variable is uninitialized.
 
template<typename ADType , require_autodiff_t< ADType > * = nullptr>
bool isfinite (ADType &&v)
 Return true if specified argument is finite (not infinite and not not-a-number).
 
template<typename T , typename = require_autodiff_t<T>>
bool isinf (const T &v)
 Return true if specified argument is infinite (positive or negative).
 
template<typename T , typename = require_autodiff_t<T>>
bool isnan (const T &x)
 Return true if specified argument is not-a-number.
 
template<typename ADType , require_autodiff_t< ADType > * = nullptr>
bool isnormal (ADType &&v)
 Return true if specified argument is normal.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
double lambert_w0 (const T &x)
 Compute the Lambert W function on W0 branch for a value x.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
double lambert_wm1 (const T &x)
 Compute the Lambert W function on W-1 branch for a value x.
 
template<typename T , require_not_stan_scalar_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto lambert_w0 (const T &x)
 Vectorized version of lambert_w0().
 
template<typename T , require_not_stan_scalar_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto lambert_wm1 (const T &x)
 Vectorized version of lambert_wm1().
 
template<typename T , typename L , require_all_stan_scalar_t< T, L > * = nullptr, require_all_not_st_var< T, L > * = nullptr>
auto lb_constrain (const T &x, const L &lb)
 Return the lower-bounded value for the specified unconstrained input and specified lower bound.
 
template<typename T , typename L , require_eigen_t< T > * = nullptr, require_stan_scalar_t< L > * = nullptr, require_all_not_st_var< T, L > * = nullptr>
auto lb_constrain (T &&x, L &&lb)
 Specialization of lb_constrain to apply a scalar lower bound elementwise to each input.
 
template<typename T , typename L , require_eigen_t< T > * = nullptr, require_stan_scalar_t< L > * = nullptr, require_all_not_st_var< T, L > * = nullptr>
auto lb_constrain (const T &x, const L &lb, return_type_t< T, L > &lp)
 Specialization of lb_constrain to apply a scalar lower bound elementwise to each input.
 
template<typename T , typename L , require_not_std_vector_t< L > * = nullptr>
auto lb_constrain (const std::vector< T > &x, const L &lb)
 Specialization of lb_constrain to apply a container of lower bounds elementwise to each input element.
 
template<typename T , typename L , require_not_std_vector_t< L > * = nullptr>
auto lb_constrain (const std::vector< T > &x, const L &lb, return_type_t< T, L > &lp)
 Specialization of lb_constrain to apply a container of lower bounds elementwise to each input element.
 
template<typename T , typename L >
auto lb_constrain (const std::vector< T > &x, const std::vector< L > &lb)
 Specialization of lb_constrain to apply a container of lower bounds elementwise to each input element.
 
template<typename T , typename L >
auto lb_constrain (const std::vector< T > &x, const std::vector< L > &lb, return_type_t< T, L > &lp)
 Specialization of lb_constrain to apply a container of lower bounds elementwise to each input element.
 
template<bool Jacobian, typename T , typename L >
auto lb_constrain (const T &x, const L &lb, return_type_t< T, L > &lp)
 Specialization of lb_constrain to apply a container of lower bounds elementwise to each input element.
 
template<typename T , typename L , require_not_std_vector_t< T > * = nullptr, require_stan_scalar_t< L > * = nullptr>
auto lb_free (T &&y, L &&lb)
 Return the unconstrained value that produces the specified lower-bound constrained value.
 
template<typename T , typename L , require_all_eigen_t< T, L > * = nullptr>
auto lb_free (T &&y, L &&lb)
 Return the free matrix that corresponds to the specified lower-bounded matrix with respect to the specified lower bound.
 
template<typename T , typename L , require_not_std_vector_t< L > * = nullptr>
auto lb_free (const std::vector< T > y, const L &lb)
 Return the free variable that corresponds to the specified lower-bounded variable with respect to the specified lower bound.
 
template<typename T , typename L >
auto lb_free (const std::vector< T > y, const std::vector< L > &lb)
 Return the free variable that corresponds to the specified lower-bounded variable with respect to the specified lower bound.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > lbeta (const T1 a, const T2 b)
 Return the log of the beta function applied to the specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto lbeta (const T1 &a, const T2 &b)
 Enables the vectorized application of the lbeta function, when the first and/or second arguments are containers.
 
template<typename T1 , require_arithmetic_t< T1 > * = nullptr>
double ldexp (T1 a, int b)
 Returns the product of a (the significand) and 2 to power b (the exponent).
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T1, T2 > * = nullptr>
auto ldexp (const T1 &a, const T2 &b)
 Enables the vectorized application of the ldexp function, when the first and/or second arguments are containers.
 
template<typename T , require_matrix_t< T > * = nullptr>
auto make_ldlt_factor (const T &A)
 Make an LDLT_factor with matrix type plain_type_t<T>
 
double lgamma (double x)
 Return the natural logarithm of the gamma function applied to the specified argument.
 
double lgamma (int x)
 Return the natural logarithm of the gamma function applied to the specified argument.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto lgamma (const T &x)
 Vectorized version of lgamma().
 
template<typename T >
return_type_t< T > lgamma_stirling (const T x)
 Return the Stirling approximation to the lgamma function.
 
template<typename T >
return_type_t< T > lgamma_stirling_diff (const T x)
 Return the difference between log of the gamma function and its Stirling approximation.
 
std::vector< double > linspaced_array (int K, double low, double high)
 Return an array of linearly spaced elements.
 
std::vector< int > linspaced_int_array (int K, int low, int high)
 Return an array of linearly spaced integers.
 
auto linspaced_row_vector (int K, double low, double high)
 Return a row vector of linearly spaced elements.
 
auto linspaced_vector (int K, double low, double high)
 Return a vector of linearly spaced elements.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
return_type_t< T > lmgamma (int k, T x)
 Return the natural logarithm of the multivariate gamma function with the specified dimensions and argument.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto lmgamma (const T1 &a, const T2 &b)
 Enables the vectorized application of the natural log of the multivariate gamma function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > lmultiply (const T1 a, const T2 b)
 Return the first argument times the log of the second argument.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_var_matrix_t< T1, T2 > * = nullptr>
auto lmultiply (const T1 &a, const T2 &b)
 Return the result of applying lmultiply to the arguments elementwise, with broadcasting if one of the arguments is a scalar.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto log (const Container &x)
 Return the elementwise natural log of the specified argument, which may be a scalar or any Stan container of numeric scalars.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto log (const Container &x)
 Version of log() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename Container , require_not_var_matrix_t< Container > * = nullptr, require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto log10 (const Container &x)
 Vectorized version of log10().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto log10 (const Container &x)
 Version of log10() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
double log1m (double x)
 Return the natural logarithm of one minus the specified value.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto log1m (const T &x)
 Vectorized version of log1m().
 
double log1m_exp (double a)
 Calculates the natural logarithm of one minus the exponential of the specified value without overflow,.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto log1m_exp (const T &x)
 Vectorized version of log1m_exp().
 
double log1m_inv_logit (double u)
 Returns the natural logarithm of 1 minus the inverse logit of the specified argument.
 
double log1m_inv_logit (int u)
 Return the natural logarithm of one minus the inverse logit of the specified argument.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
apply_scalar_unary< log1m_inv_logit_fun, T >::return_t log1m_inv_logit (const T &x)
 Return the elementwise application of log1m_inv_logit() to specified argument container.
 
double log1p (double x)
 Return the natural logarithm of one plus the specified value.
 
double log1p (int x)
 Return the natural logarithm of one plus the specified argument.
 
template<typename T , require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto log1p (const T &x)
 Return the elementwise application of log1p() to specified argument container.
 
double log1p_exp (double a)
 Calculates the log of 1 plus the exponential of the specified value without overflow.
 
template<typename T , require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto log1p_exp (const T &x)
 Vectorized version of log1p_exp().
 
constexpr double log2 ()
 Return natural logarithm of two.
 
template<typename T , require_not_var_matrix_t< T > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto log2 (const T &x)
 Return the elementwise application of log2() to specified argument container.
 
template<typename T , require_not_rev_matrix_t< T > * = nullptr>
value_type_t< T > log_determinant_ldlt (LDLT_factor< T > &A)
 Returns log(abs(det(A))) given a LDLT_factor of A.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_vt_var< EigMat > * = nullptr>
value_type_t< EigMat > log_determinant_spd (const EigMat &m)
 Returns the log absolute determinant of the specified square matrix.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > log_diff_exp (const T1 x, const T2 y)
 The natural logarithm of the difference of the natural exponentiation of x and the natural exponentiation of y.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto log_diff_exp (const T1 &a, const T2 &b)
 Enables the vectorized application of the log_diff_exp function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > log_falling_factorial (const T1 x, const T2 n)
 Return the natural log of the falling factorial of the specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto log_falling_factorial (const T1 &a, const T2 &b)
 Enables the vectorized application of the log_falling_factorial function, when the first and/or second arguments are containers.
 
double log_inv_logit (double u)
 Returns the natural logarithm of the inverse logit of the specified argument.
 
double log_inv_logit (int u)
 Returns the natural logarithm of the inverse logit of the specified argument.
 
template<typename T , require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto log_inv_logit (const T &x)
 Return the elementwise application of log_inv_logit() to specified argument container.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > log_inv_logit_diff (const T1 &x, const T2 &y)
 Returns the natural logarithm of the difference of the inverse logits of the specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto log_inv_logit_diff (const T1 &a, const T2 &b)
 Enables the vectorized application of the log_inv_logit_diff function, when the first and/or second arguments are containers.
 
template<typename T_theta , typename T_lambda1 , typename T_lambda2 , require_all_arithmetic_t< T_theta, T_lambda1, T_lambda2 > * = nullptr>
double log_mix (T_theta theta, T_lambda1 lambda1, T_lambda2 lambda2)
 Return the log mixture density with specified mixing proportion and log densities.
 
template<typename T_theta , typename T_lam , require_any_vector_t< T_theta, T_lam > * = nullptr>
return_type_t< T_theta, T_lam > log_mix (const T_theta &theta, const T_lam &lambda)
 Return the log mixture density with specified mixing proportions and log densities.
 
template<typename T_theta , typename T_lam , require_vector_t< T_lam > * = nullptr>
return_type_t< T_theta, std::vector< T_lam > > log_mix (const T_theta &theta, const std::vector< T_lam > &lambda)
 Return the log mixture density given specified mixing proportions and array of log density vectors.
 
template<typename T1 , typename T2 , require_all_stan_scalar_t< T1, T2 > * = nullptr>
return_type_t< T1, T2, double > log_modified_bessel_first_kind (const T1 v, const T2 z)
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto log_modified_bessel_first_kind (const T1 &a, const T2 &b)
 Enables the vectorized application of the log_modified_bessel_first_kind function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > log_rising_factorial (const T1 &x, const T2 &n)
 Return the natural logarithm of the rising factorial from the first specified argument to the second.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto log_rising_factorial (const T1 &a, const T2 &b)
 Enables the vectorized application of the log_rising_factorial function, when the first and/or second arguments are containers.
 
template<typename Container , require_st_arithmetic< Container > * = nullptr, require_container_t< Container > * = nullptr>
auto log_softmax (const Container &x)
 Return the natural logarithm of the softmax of the specified vector.
 
template<typename T1 , typename T2 , require_all_not_st_var< T1, T2 > * = nullptr, require_all_stan_scalar_t< T1, T2 > * = nullptr>
return_type_t< T1, T2 > log_sum_exp (const T2 &a, const T1 &b)
 Calculates the log sum of exponentials without overflow.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto log_sum_exp (const T1 &a, const T2 &b)
 Enables the vectorized application of the log_sum_exp function, when the first and/or second arguments are containers.
 
template<typename T1 , typename T2 , require_all_stan_scalar_t< T1, T2 > * = nullptr>
std::tuple< return_type_t< T1, T2 >, int > log_sum_exp_signed (const T1 &a, int a_sign, const T2 &b, int b_sign)
 Calculates the log sum of exponentials without overflow, accounting for the signs of the inputs.
 
template<typename T , typename = require_autodiff_t<T>>
double logb (const T &x)
 Returns the value of the unbiased radix-independent exponent from the floating-point argument.
 
template<typename T1 , typename T2 >
int logical_and (const T1 x1, const T2 x2)
 The logical and function which returns 1 if both arguments are unequal to zero and 0 otherwise.
 
template<typename T1 , typename T2 >
int logical_eq (const T1 x1, const T2 x2)
 Return 1 if the first argument is equal to the second.
 
template<typename T1 , typename T2 >
bool logical_gt (const T1 x1, const T2 x2)
 Return 1 if the first argument is strictly greater than the second.
 
template<typename T1 , typename T2 >
bool logical_gte (const T1 x1, const T2 x2)
 Return 1 if the first argument is greater than or equal to the second.
 
template<typename T1 , typename T2 >
bool logical_lt (T1 x1, T2 x2)
 Return 1 if the first argument is strictly less than the second.
 
template<typename T1 , typename T2 >
bool logical_lte (const T1 x1, const T2 x2)
 Return 1 if the first argument is less than or equal to the second.
 
template<typename T >
int logical_negation (const T &x)
 The logical negation function which returns one if the input is equal to zero and zero otherwise.
 
template<typename T1 , typename T2 >
int logical_neq (const T1 x1, const T2 x2)
 Return 1 if the first argument is unequal to the second.
 
template<typename T1 , typename T2 >
int logical_or (T1 x1, T2 x2)
 The logical or function which returns 1 if either argument is unequal to zero and 0 otherwise.
 
double logit (double u)
 Return the log odds of the argument.
 
double logit (int u)
 Return the log odds of the argument.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto logit (const Container &x)
 Return the elementwise application of logit() to specified argument container.
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto logit (const Container &x)
 Version of logit() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T , typename L , typename U , require_all_stan_scalar_t< T, L, U > * = nullptr, require_not_var_t< return_type_t< T, L, U > > * = nullptr>
auto lub_constrain (T &&x, L &&lb, U &&ub)
 Return the lower and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds.
 
template<typename T , typename L , typename U , require_all_stan_scalar_t< T, L, U > * = nullptr, require_not_var_t< return_type_t< T, L, U > > * = nullptr>
auto lub_constrain (T &&x, L &&lb, U &&ub, return_type_t< T, L, U > &lp)
 Return the lower- and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds and increment the specified log density with the log absolute Jacobian determinant.
 
template<typename T , typename L , typename U , require_eigen_t< T > * = nullptr, require_all_stan_scalar_t< L, U > * = nullptr, require_not_var_t< return_type_t< T, L, U > > * = nullptr>
auto lub_constrain (const T &x, const L &lb, const U &ub)
 Overload for Eigen matrix and scalar bounds.
 
template<typename T , typename L , typename U , require_eigen_t< T > * = nullptr, require_all_stan_scalar_t< L, U > * = nullptr, require_not_var_t< return_type_t< T, L, U > > * = nullptr>
auto lub_constrain (const T &x, const L &lb, const U &ub, return_type_t< T, L, U > &lp)
 Overload for Eigen matrix and scalar bounds plus lp.
 
template<typename T , typename L , typename U , require_all_eigen_t< T, L, U > * = nullptr, require_not_var_t< return_type_t< T, L, U > > * = nullptr>
auto lub_constrain (const T &x, const L &lb, const U &ub)
 Overload for Eigen matrix and matrix bounds.
 
template<typename T , typename L , typename U , require_all_not_std_vector_t< L, U > * = nullptr>
auto lub_constrain (const std::vector< T > &x, const L &lb, const U &ub)
 Overload for array of x and non-array lb and ub.
 
template<typename T , typename L , typename U , require_all_not_std_vector_t< L, U > * = nullptr>
auto lub_constrain (const std::vector< T > &x, const L &lb, const U &ub, return_type_t< T, L, U > &lp)
 Overload for array of x and non-array lb and ub with lp.
 
template<typename T , typename L , typename U , require_not_std_vector_t< L > * = nullptr>
auto lub_constrain (const std::vector< T > &x, const L &lb, const std::vector< U > &ub)
 Overload for array of x and ub and non-array lb.
 
template<typename T , typename L , typename U , require_not_std_vector_t< L > * = nullptr>
auto lub_constrain (const std::vector< T > &x, const L &lb, const std::vector< U > &ub, return_type_t< T, L, U > &lp)
 Overload for array of x and ub and non-array lb with lp.
 
template<typename T , typename L , typename U , require_not_std_vector_t< U > * = nullptr>
auto lub_constrain (const std::vector< T > &x, const std::vector< L > &lb, const U &ub)
 Overload for array of x and lb and non-array ub.
 
template<typename T , typename L , typename U , require_not_std_vector_t< U > * = nullptr>
auto lub_constrain (const std::vector< T > &x, const std::vector< L > &lb, const U &ub, return_type_t< T, L, U > &lp)
 Overload for array of x and lb and non-array ub with lp.
 
template<typename T , typename L , typename U >
auto lub_constrain (const std::vector< T > &x, const std::vector< L > &lb, const std::vector< U > &ub)
 Overload for array of x, lb, and ub with lp.
 
template<typename T , typename L , typename U >
auto lub_constrain (const std::vector< T > &x, const std::vector< L > &lb, const std::vector< U > &ub, return_type_t< T, L, U > &lp)
 Overload for array of x, lb, and ub.
 
template<bool Jacobian, typename T , typename L , typename U >
auto lub_constrain (const T &x, const L &lb, const U &ub, return_type_t< T, L, U > &lp)
 Return the lower and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds.
 
template<typename T >
Eigen::Array< T, Eigen::Dynamic, 1 > make_nu (const T &eta, size_t K)
 Return the degrees of freedom for the t distribution that corresponds to the shape parameter in the LKJ distribution.
 
template<typename T , typename = require_eigen_t<T>>
plain_type_t< T > matrix_exp (const T &A_in)
 Return the matrix exponential of the input matrix.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > matrix_exp_2x2 (const EigMat &A)
 Return the matrix exponential of a 2x2 matrix.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_all_st_same< double, EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< double, Eigen::Dynamic, EigMat2::ColsAtCompileTime > matrix_exp_multiply (const EigMat1 &A, const EigMat2 &B)
 Return product of exp(A) and B, where A is a NxN double matrix, B is a NxCb double matrix, and t is a double.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::ColsAtCompileTime > matrix_exp_pade (const EigMat &arg)
 Computes the matrix exponential, using a Pade approximation, coupled with scaling and squaring.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_vt_var< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::ColsAtCompileTime > matrix_power (const EigMat &M, const int n)
 Returns the nth power of the specific matrix.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::ColsAtCompileTime > operator^ (const EigMat &M, const int n)
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
auto max (T1 x, T2 y)
 Returns the maximum value of the two specified scalar arguments.
 
template<typename T , require_container_t< T > * = nullptr>
value_type_t< T > max (const T &m)
 Returns the maximum value in the specified matrix, vector, row vector or std vector.
 
template<typename T1 , typename... Ts>
size_t max_size (const T1 &x1, const Ts &... xs)
 Calculate the size of the largest input.
 
template<typename T1 , typename... Ts>
size_t max_size_mvt (const T1 &x1, const Ts &... xs)
 Calculate the size of the largest multivariate input.
 
template<typename T1 , typename T2 , require_all_eigen_vt< std::is_arithmetic, T1, T2 > * = nullptr>
Eigen::Matrix< return_type_t< T1, T2 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left (const T1 &A, const T2 &b)
 Returns the solution of the system Ax=b.
 
template<typename T , typename EigMat , require_eigen_t< EigMat > * = nullptr, require_all_not_st_var< T, EigMat > * = nullptr, require_any_not_t< std::is_arithmetic< value_type_t< T > >, is_fvar< value_type_t< EigMat > > > * = nullptr>
Eigen::Matrix< return_type_t< T, EigMat >, Eigen::Dynamic, EigMat::ColsAtCompileTime > mdivide_left_ldlt (LDLT_factor< T > &A, const EigMat &b)
 Returns the solution of the system Ax=b given an LDLT_factor of A.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_all_not_vt_var< EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< return_type_t< EigMat1, EigMat2 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_left_spd (const EigMat1 &A, const EigMat2 &b)
 Returns the solution of the system Ax=b where A is symmetric positive definite.
 
template<Eigen::UpLoType TriView, typename T1 , typename T2 , require_all_eigen_t< T1, T2 > * = nullptr, require_all_not_eigen_vt< is_var, T1, T2 > * = nullptr>
auto mdivide_left_tri (const T1 &A, const T2 &b)
 Returns the solution of the system Ax=b when A is triangular.
 
template<Eigen::UpLoType TriView, typename T , require_eigen_t< T > * = nullptr>
plain_type_t< T > mdivide_left_tri (const T &A)
 Returns the solution of the system Ax=b when A is triangular and b=I.
 
template<typename T1 , typename T2 , require_all_eigen_t< T1, T2 > * = nullptr, require_all_not_eigen_vt< is_fvar, T1, T2 > * = nullptr>
Eigen::Matrix< return_type_t< T1, T2 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left_tri_low (const T1 &A, const T2 &b)
 Return the result of left dividing the second argument by the first argument.
 
template<typename T , require_eigen_t< T > * = nullptr, require_not_eigen_vt< is_fvar, T > * = nullptr>
plain_type_t< T > mdivide_left_tri_low (const T &A)
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_all_not_vt_fvar< EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< return_type_t< EigMat1, EigMat2 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_right (const EigMat1 &b, const EigMat2 &A)
 Returns the solution of the system xA=b.
 
template<typename EigMat , typename T , require_all_matrix_t< EigMat, T > * = nullptr, require_any_not_st_arithmetic< EigMat, T > * = nullptr>
auto mdivide_right_ldlt (const EigMat &b, LDLT_factor< T > &A)
 Returns the solution of the system xA=b given an LDLT_factor of A.
 
template<typename EigMat , typename T , require_all_matrix_t< EigMat, T > * = nullptr, require_all_st_arithmetic< EigMat, T > * = nullptr>
Eigen::Matrix< double, EigMat::RowsAtCompileTime, T::ColsAtCompileTime > mdivide_right_ldlt (const EigMat &b, LDLT_factor< T > &A)
 Returns the solution of the system xA=b given an LDLT_factor of A.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< return_type_t< EigMat1, EigMat2 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_right_spd (const EigMat1 &b, const EigMat2 &A)
 Returns the solution of the system xA=b where A is symmetric positive definite.
 
template<Eigen::UpLoType TriView, typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr>
auto mdivide_right_tri (const EigMat1 &b, const EigMat2 &A)
 Returns the solution of the system xA=b when A is triangular.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_all_not_vt_fvar< EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< return_type_t< EigMat1, EigMat2 >, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_right_tri_low (const EigMat1 &b, const EigMat2 &A)
 Returns the solution of the system x tri(A) = b when tri(A) is a lower triangular view of the matrix A.
 
template<typename T , require_container_t< T > * = nullptr>
return_type_t< T > mean (const T &m)
 Returns the sample mean (i.e., average) of the coefficients in the specified std vector, vector, row vector, or matrix.
 
template<typename T1 , typename T2 , require_all_arithmetic_t< T1, T2 > * = nullptr>
auto min (T1 x, T2 y)
 Returns the minimum coefficient of the two specified scalar arguments.
 
template<typename T , require_container_t< T > * = nullptr>
value_type_t< T > min (const T &m)
 Returns the minimum coefficient in the specified matrix, vector, row vector or std vector.
 
template<typename T , require_not_std_vector_t< T > * = nullptr>
auto minus (const T &x)
 Returns the negation of the specified scalar or matrix.
 
template<typename T >
auto minus (const std::vector< T > &x)
 Return the negation of the each element of a vector.
 
template<typename T2 , require_arithmetic_t< T2 > * = nullptr>
T2 modified_bessel_first_kind (int v, const T2 z)
 
double modified_bessel_first_kind (int v, int z)
 This function exists because when z is of type integer, cyl_bessel_i(v, z) returns an integer.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto modified_bessel_first_kind (const T1 &a, const T2 &b)
 Enables the vectorized application of the modified_bessel_first_kind function, when the first and/or second arguments are containers.
 
template<typename T2 , require_arithmetic_t< T2 > * = nullptr>
T2 modified_bessel_second_kind (int v, const T2 z)
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto modified_bessel_second_kind (const T1 &a, const T2 &b)
 Enables the vectorized application of the modified_bessel_second_kind function, when the first and/or second arguments are containers.
 
int modulus (int x, int y)
 
template<typename Mat , typename Scal , require_stan_scalar_t< Scal > * = nullptr, require_eigen_t< Mat > * = nullptr, require_all_not_st_var< Scal, Mat > * = nullptr, require_all_not_complex_t< Scal, value_type_t< Mat > > * = nullptr>
auto multiply (const Mat &m, Scal c)
 Return specified matrix multiplied by specified scalar.
 
template<typename Mat , typename Scal , require_any_complex_t< value_type_t< Mat >, Scal > * = nullptr, require_eigen_t< Mat > * = nullptr, require_not_eigen_t< Scal > * = nullptr>
auto multiply (const Mat &m, Scal c)
 Return the product of the specified matrix and scalar, one of which must have a complex value type.
 
template<typename Mat , typename Scal , require_any_complex_t< value_type_t< Mat >, Scal > * = nullptr, require_eigen_t< Mat > * = nullptr, require_not_eigen_t< Scal > * = nullptr>
auto multiply (const Scal &m, const Mat &c)
 Return the product of the specified matrix and scalar, one of which must have a complex value type.
 
template<typename Scal , typename Mat , require_stan_scalar_t< Scal > * = nullptr, require_eigen_t< Mat > * = nullptr, require_all_not_st_var< Scal, Mat > * = nullptr, require_all_not_complex_t< Scal, value_type_t< Mat > > * = nullptr>
auto multiply (Scal c, const Mat &m)
 Return specified scalar multiplied by specified matrix.
 
template<typename Mat1 , typename Mat2 , require_all_eigen_vt< std::is_arithmetic, Mat1, Mat2 > * = nullptr, require_not_eigen_row_and_col_t< Mat1, Mat2 > * = nullptr>
auto multiply (const Mat1 &m1, const Mat2 &m2)
 Return the product of the specified matrices.
 
template<typename RowVec , typename ColVec , require_not_var_t< return_type_t< RowVec, ColVec > > * = nullptr, require_eigen_row_and_col_t< RowVec, ColVec > * = nullptr>
auto multiply (const RowVec &rv, const ColVec &v)
 Return the scalar product of the specified row vector and specified column vector.
 
template<typename Scalar1 , typename Scalar2 , require_all_stan_scalar_t< Scalar1, Scalar2 > * = nullptr>
return_type_t< Scalar1, Scalar2 > multiply (Scalar1 m, Scalar2 c)
 Return product of scalars.
 
template<typename T_a , typename T_b , require_all_arithmetic_t< T_a, T_b > * = nullptr>
return_type_t< T_a, T_b > multiply_log (const T_a a, const T_b b)
 Calculate the value of the first argument times log of the second argument while behaving properly with 0 inputs.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_var_matrix_t< T1, T2 > * = nullptr>
auto multiply_log (const T1 &a, const T2 &b)
 Enables the vectorized application of the multiply_log function, when the first and/or second arguments are containers.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_st_autodiff< EigMat > * = nullptr>
matrix_d multiply_lower_tri_self_transpose (const EigMat &L)
 Returns the result of multiplying the lower triangular portion of the input matrix by its own transpose.
 
template<typename V >
norm (const std::complex< V > &z)
 Return the squared magnitude of the complex argument.
 
template<typename T , require_eigen_vt< std::is_arithmetic, T > * = nullptr>
double norm1 (const T &v)
 Returns L1 norm of a vector.
 
template<typename T , require_eigen_vt< std::is_arithmetic, T > * = nullptr>
double norm2 (const T &v)
 Returns L2 norm of a vector.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
int num_elements (const T &x)
 Returns 1, the number of elements in a primitive type.
 
template<typename T >
int num_elements (const std::vector< T > &v)
 Returns the number of elements in the specified vector.
 
template<typename T , typename M , typename S , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T, M, S > * = nullptr>
auto offset_multiplier_constrain (const T &x, const M &mu, const S &sigma)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier.
 
template<typename T , typename M , typename S , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T, M, S > * = nullptr>
auto offset_multiplier_constrain (const T &x, const M &mu, const S &sigma, return_type_t< T, M, S > &lp)
 Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier, incrementing the specified reference with the log absolute Jacobian determinant of the transform.
 
template<typename T , typename M , typename S , require_all_not_std_vector_t< M, S > * = nullptr>
auto offset_multiplier_constrain (const std::vector< T > &x, const M &mu, const S &sigma)
 Overload for array of x and non-array mu and sigma.
 
template<typename T , typename M , typename S , require_all_not_std_vector_t< M, S > * = nullptr>
auto offset_multiplier_constrain (const std::vector< T > &x, const M &mu, const S &sigma, return_type_t< T, M, S > &lp)
 Overload for array of x and non-array mu and sigma with lp.
 
template<typename T , typename M , typename S , require_not_std_vector_t< M > * = nullptr>
auto offset_multiplier_constrain (const std::vector< T > &x, const M &mu, const std::vector< S > &sigma)
 Overload for array of x and sigma and non-array mu.
 
template<typename T , typename M , typename S , require_not_std_vector_t< M > * = nullptr>
auto offset_multiplier_constrain (const std::vector< T > &x, const M &mu, const std::vector< S > &sigma, return_type_t< T, M, S > &lp)
 Overload for array of x and sigma and non-array mu with lp.
 
template<typename T , typename M , typename S , require_not_std_vector_t< S > * = nullptr>
auto offset_multiplier_constrain (const std::vector< T > &x, const std::vector< M > &mu, const S &sigma)
 Overload for array of x and mu and non-array sigma.
 
template<typename T , typename M , typename S , require_not_std_vector_t< S > * = nullptr>
auto offset_multiplier_constrain (const std::vector< T > &x, const std::vector< M > &mu, const S &sigma, return_type_t< T, M, S > &lp)
 Overload for array of x and mu and non-array sigma with lp.
 
template<typename T , typename M , typename S >
auto offset_multiplier_constrain (const std::vector< T > &x, const std::vector< M > &mu, const std::vector< S > &sigma)
 Overload for array of x, mu, and sigma.
 
template<typename T , typename M , typename S >
auto offset_multiplier_constrain (const std::vector< T > &x, const std::vector< M > &mu, const std::vector< S > &sigma, return_type_t< T, M, S > &lp)
 Overload for array of x, mu, and sigma with lp.
 
template<typename T , typename M , typename S >
auto offset_multiplier_free (const T &y, const M &mu, const S &sigma)
 Return the unconstrained variable that transforms to the specified offset and multiplier constrained variable given the specified offset and multiplier.
 
template<typename T , typename M , typename S , require_all_not_std_vector_t< M, S > * = nullptr>
auto offset_multiplier_free (const std::vector< T > &x, const M &mu, const S &sigma)
 Overload for array of x and non-array mu and sigma.
 
template<typename T , typename M , typename S , require_not_std_vector_t< M > * = nullptr>
auto offset_multiplier_free (const std::vector< T > &x, const M &mu, const std::vector< S > &sigma)
 Overload for array of x and sigma and non-array mu.
 
template<typename T , typename M , typename S , require_not_std_vector_t< S > * = nullptr>
auto offset_multiplier_free (const std::vector< T > &x, const std::vector< M > &mu, const S &sigma)
 Overload for array of x and mu and non-array sigma.
 
template<typename T , typename M , typename S >
auto offset_multiplier_free (const std::vector< T > &x, const std::vector< M > &mu, const std::vector< S > &sigma)
 Overload for array of x, mu, and sigma.
 
std::vector< double > one_hot_array (int K, int k)
 Return an array with 1 in the k-th position and zero elsewhere.
 
std::vector< int > one_hot_int_array (int K, int k)
 Return an integer array with 1 in the k-th position and zero elsewhere.
 
Eigen::RowVectorXd one_hot_row_vector (int K, int k)
 Return a row vector with 1 in the k-th position and zero elsewhere.
 
Eigen::VectorXd one_hot_vector (int K, int k)
 Return a vector with 1 in the k-th position and zero elsewhere.
 
std::vector< double > ones_array (int K)
 Return an array of ones.
 
std::vector< int > ones_int_array (int K)
 Return an integer array of ones.
 
auto ones_row_vector (int K)
 Return a row vector of ones.
 
auto ones_vector (int K)
 Return a vector of ones.
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr, require_not_st_var< EigVec > * = nullptr>
plain_type_t< EigVec > ordered_constrain (const EigVec &x)
 Return an increasing ordered vector derived from the specified free vector.
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr>
auto ordered_constrain (const EigVec &x, value_type_t< EigVec > &lp)
 Return a positive valued, increasing ordered vector derived from the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto ordered_constrain (const T &x, return_type_t< T > &lp)
 Return a positive valued, increasing ordered vector derived from the specified free vector.
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr>
plain_type_t< EigVec > ordered_free (const EigVec &y)
 Return the vector of unconstrained scalars that transform to the specified positive ordered vector.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto ordered_free (const T &x)
 Overload of ordered_free() to untransform each Eigen vector in a standard vector.
 
double owens_t (double h, double a)
 Return the result of applying Owen's T function to the specified arguments.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_var_and_matrix_types< T1, T2 > * = nullptr>
auto owens_t (const T1 &a, const T2 &b)
 Enables the vectorized application of the owens_t function, when the first and/or second arguments are containers.
 
double Phi (double x)
 The unit normal cumulative distribution function.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto Phi (const T &x)
 Vectorized version of Phi().
 
double Phi_approx (double x)
 Return an approximation of the unit normal CDF.
 
double Phi_approx (int x)
 Return an approximation of the unit normal CDF.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto Phi_approx (const T &x)
 Return the elementwise application of Phi_approx() to specified argument container.
 
template<typename T >
plus (T &&x)
 Returns the unary plus of the input.
 
template<typename T_theta , typename T_scalar = scalar_type_t<T_theta>, require_eigen_vector_t< T_theta > * = nullptr>
plain_type_t< T_theta > poisson_binomial_log_probs (int y, const T_theta &theta)
 Returns the last row of the log probability matrix of the Poisson-Binomial distribution given the number of successes and a vector of success probabilities.
 
template<typename T_y , typename T_theta , require_vt_integral< T_y > * = nullptr>
auto poisson_binomial_log_probs (const T_y &y, const T_theta &theta)
 
std::complex< double > polar (double r, double theta)
 Returns the complex number with specified magnitude and phase angle.
 
std::complex< double > polar (double r, int theta)
 
std::complex< double > polar (int r, double theta)
 
std::complex< double > polar (int r, int theta)
 
template<typename T >
auto positive_constrain (const T &x)
 Return the positive value for the specified unconstrained input.
 
template<typename T , typename S >
auto positive_constrain (const T &x, S &lp)
 Return the positive value for the specified unconstrained input, incrementing the scalar reference with the log absolute Jacobian determinant.
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto positive_constrain (const T &x, return_type_t< T > &lp)
 Return the positive value for the specified unconstrained input.
 
template<typename T >
positive_free (const T &y)
 Return the unconstrained value corresponding to the specified positive-constrained value.
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr, require_not_st_var< EigVec > * = nullptr>
auto positive_ordered_constrain (const EigVec &x)
 Return an increasing positive ordered vector derived from the specified free vector.
 
template<typename Vec , require_col_vector_t< Vec > * = nullptr>
auto positive_ordered_constrain (const Vec &x, return_type_t< Vec > &lp)
 Return a positive valued, increasing positive ordered vector derived from the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<bool Jacobian, typename Vec , require_not_std_vector_t< Vec > * = nullptr>
auto positive_ordered_constrain (const Vec &x, return_type_t< Vec > &lp)
 Return a positive valued, increasing positive ordered vector derived from the specified free vector.
 
template<bool Jacobian, typename T , require_std_vector_t< T > * = nullptr>
auto positive_ordered_constrain (const T &x, return_type_t< T > &lp)
 Return a positive valued, increasing positive ordered vector derived from the specified free vector.
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr>
auto positive_ordered_free (const EigVec &y)
 Return the vector of unconstrained scalars that transform to the specified positive ordered vector.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto positive_ordered_free (const T &x)
 Overload of positive_ordered_free() to untransform each Eigen vector in a standard vector.
 
template<typename T1 , typename T2 , require_all_t< disjunction< is_complex< T1 >, std::is_arithmetic< T1 > >, disjunction< is_complex< T2 >, std::is_arithmetic< T2 > > > * = nullptr>
auto pow (const T1 &a, const T2 &b)
 Return the first argument raised to the power of the second argument.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_not_matrix_st< is_var, T1, T2 > * = nullptr>
auto pow (const T1 &a, const T2 &b)
 Returns the elementwise raising of the first argument to the power of the second argument.
 
template<typename T >
std::enable_if< std::is_arithmetic< T >::value, T >::type primitive_value (T x)
 Return the value of the specified arithmetic argument unmodified with its own declared type.
 
template<typename T >
std::enable_if<!std::is_arithmetic< T >::value, double >::type primitive_value (const T &x)
 Return the primitive value of the specified argument.
 
template<typename T >
prob_constrain (const T &x)
 Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar.
 
template<typename T >
prob_constrain (const T &x, T &lp)
 Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<bool Jacobian, typename T >
auto prob_constrain (const T &x, T &lp)
 Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar.
 
template<typename T >
prob_free (const T &y)
 Return the free scalar that when transformed to a probability produces the specified scalar.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
prod (const T &v)
 Returns the product of given scalar.
 
template<typename T >
prod (const std::vector< T > &v)
 Returns the product of the coefficients of the specified standard vector.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
value_type_t< EigMat > prod (const EigMat &v)
 Returns the product of the coefficients of the specified column vector.
 
template<typename V >
std::complex< V > proj (const std::complex< V > &z)
 Return the projection of the complex argument onto the Riemann sphere.
 
template<typename PromotionScalar , typename UnPromotedType , require_constructible_t< PromotionScalar, UnPromotedType > * = nullptr, require_not_same_t< PromotionScalar, UnPromotedType > * = nullptr, require_all_not_tuple_t< PromotionScalar, UnPromotedType > * = nullptr>
constexpr auto promote_scalar (UnPromotedType &&x)
 Promote a scalar to another scalar type.
 
template<typename PromotionScalar , typename UnPromotedType , require_same_t< PromotionScalar, scalar_type_t< UnPromotedType > > * = nullptr>
constexpr auto promote_scalar (UnPromotedType &&x) noexcept
 No-op overload when promoting a type's scalar to the type it already has.
 
template<typename PromotionScalar , typename UnPromotedType , require_eigen_t< UnPromotedType > * = nullptr, require_not_same_t< PromotionScalar, value_type_t< UnPromotedType > > * = nullptr>
auto promote_scalar (UnPromotedType &&x)
 Promote the scalar type of an eigen matrix to the requested type.
 
template<typename PromotionScalars , typename UnPromotedTypes , require_all_tuple_t< PromotionScalars, UnPromotedTypes > * = nullptr, require_not_same_t< PromotionScalars, UnPromotedTypes > * = nullptr>
constexpr promote_scalar_t< PromotionScalars, UnPromotedTypes > promote_scalar (UnPromotedTypes &&x)
 Promote the scalar type of a tuples elements to the requested types.
 
template<typename T >
Eigen::Matrix< T, -1, -1 > pseudo_eigenvalues (const Eigen::Matrix< T, -1, -1 > &m)
 
template<typename T >
Eigen::Matrix< T, -1, -1 > pseudo_eigenvectors (const Eigen::Matrix< T, -1, -1 > &m)
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
std::tuple< Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic >, Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > > qr (const EigMat &m)
 Returns the fat QR decomposition.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > qr_Q (const EigMat &m)
 Returns the orthogonal factor of the fat QR decomposition.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > qr_R (const EigMat &m)
 Returns the upper triangular factor of the fat QR decomposition.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
std::tuple< Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic >, Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > > qr_thin (const EigMat &m)
 Returns the thin QR decomposition.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > qr_thin_Q (const EigMat &m)
 Returns the orthogonal factor of the thin QR decomposition.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > qr_thin_R (const EigMat &m)
 Returns the upper triangular factor of the thin QR decomposition.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_not_eigen_col_vector_t< EigMat2 > * = nullptr, require_vt_same< EigMat1, EigMat2 > * = nullptr, require_all_vt_arithmetic< EigMat1, EigMat2 > * = nullptr>
auto quad_form (const EigMat1 &A, const EigMat2 &B)
 Return the quadratic form \( B^T A B \).
 
template<typename EigMat , typename ColVec , require_eigen_t< EigMat > * = nullptr, require_eigen_col_vector_t< ColVec > * = nullptr, require_vt_same< EigMat, ColVec > * = nullptr, require_all_vt_arithmetic< EigMat, ColVec > * = nullptr>
value_type_t< EigMat > quad_form (const EigMat &A, const ColVec &B)
 Return the quadratic form \( B^T A B \).
 
template<typename EigMat , typename EigVec , require_eigen_t< EigMat > * = nullptr, require_eigen_vector_t< EigVec > * = nullptr>
auto quad_form_diag (const EigMat &mat, const EigVec &vec)
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_not_eigen_col_vector_t< EigMat2 > * = nullptr, require_vt_same< EigMat1, EigMat2 > * = nullptr, require_all_vt_arithmetic< EigMat1, EigMat2 > * = nullptr>
plain_type_t< EigMat2 > quad_form_sym (const EigMat1 &A, const EigMat2 &B)
 Return the quadratic form \( B^T A B \) of a symmetric matrix.
 
template<typename EigMat , typename ColVec , require_eigen_t< EigMat > * = nullptr, require_eigen_col_vector_t< ColVec > * = nullptr, require_vt_same< EigMat, ColVec > * = nullptr, require_all_vt_arithmetic< EigMat, ColVec > * = nullptr>
value_type_t< EigMat > quad_form_sym (const EigMat &A, const ColVec &B)
 Return the quadratic form \( B^T A B \) of a symmetric matrix.
 
template<typename T , require_vector_t< T > * = nullptr, require_vector_vt< std::is_arithmetic, T > * = nullptr>
double quantile (const T &samples_vec, const double p)
 Return sample quantiles corresponding to the given probabilities.
 
template<typename T , typename Tp , require_all_vector_t< T, Tp > * = nullptr, require_vector_vt< std::is_arithmetic, T > * = nullptr, require_std_vector_vt< std::is_arithmetic, Tp > * = nullptr>
std::vector< double > quantile (const T &samples_vec, const Tp &ps)
 Return sample quantiles corresponding to the given probabilities.
 
template<typename C , require_container_t< C > * = nullptr>
int rank (const C &v, int s)
 Return the number of components of v less than v[s].
 
template<typename T , require_eigen_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > read_corr_L (const T &CPCs, size_t K)
 Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations.
 
template<typename T , require_eigen_vector_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > read_corr_L (const T &CPCs, size_t K, value_type_t< T > &log_prob)
 Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation.
 
template<typename T_CPCs , require_eigen_vector_t< T_CPCs > * = nullptr>
Eigen::Matrix< value_type_t< T_CPCs >, Eigen::Dynamic, Eigen::Dynamic > read_corr_matrix (const T_CPCs &CPCs, size_t K)
 Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations.
 
template<typename T_CPCs , require_eigen_vector_t< T_CPCs > * = nullptr>
Eigen::Matrix< value_type_t< T_CPCs >, Eigen::Dynamic, Eigen::Dynamic > read_corr_matrix (const T_CPCs &CPCs, size_t K, value_type_t< T_CPCs > &log_prob)
 Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation.
 
template<typename T_CPCs , typename T_sds , require_all_eigen_vector_t< T_CPCs, T_sds > * = nullptr, require_vt_same< T_CPCs, T_sds > * = nullptr>
Eigen::Matrix< value_type_t< T_CPCs >, Eigen::Dynamic, Eigen::Dynamic > read_cov_L (const T_CPCs &CPCs, const T_sds &sds, value_type_t< T_CPCs > &log_prob)
 This is the function that should be called prior to evaluating the density of any elliptical distribution.
 
template<typename T_CPCs , typename T_sds , require_all_eigen_vector_t< T_CPCs, T_sds > * = nullptr, require_vt_same< T_CPCs, T_sds > * = nullptr>
Eigen::Matrix< value_type_t< T_CPCs >, Eigen::Dynamic, Eigen::Dynamic > read_cov_matrix (const T_CPCs &CPCs, const T_sds &sds, value_type_t< T_CPCs > &log_prob)
 A generally worse alternative to call prior to evaluating the density of an elliptical distribution.
 
template<typename T_CPCs , typename T_sds , require_all_eigen_vector_t< T_CPCs, T_sds > * = nullptr, require_vt_same< T_CPCs, T_sds > * = nullptr>
Eigen::Matrix< value_type_t< T_CPCs >, Eigen::Dynamic, Eigen::Dynamic > read_cov_matrix (const T_CPCs &CPCs, const T_sds &sds)
 Builds a covariance matrix from CPCs and standard deviations.
 
template<typename T , require_autodiff_t< T > >
real (const std::complex< T > &z)
 Return the real component of the complex argument.
 
template<typename T_ret , typename In , require_std_vector_t< T_ret > * = nullptr>
std::vector< plain_type_t< In > > rep_array (const In &x, int n)
 
template<typename In >
std::vector< plain_type_t< In > > rep_array (const In &x, int n)
 
template<typename In >
std::vector< std::vector< plain_type_t< In > > > rep_array (const In &x, int m, int n)
 
template<typename In >
std::vector< std::vector< std::vector< plain_type_t< In > > > > rep_array (const In &x, int k, int m, int n)
 
template<typename Ret , typename T , require_eigen_matrix_dynamic_vt< is_stan_scalar, Ret > * = nullptr, require_stan_scalar_t< T > * = nullptr>
auto rep_matrix (const T &x, int m, int n)
 Implementation of rep_matrix returning an Eigen matrix with scalar type equal to the input scalar type.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
auto rep_matrix (const T &x, int m, int n)
 Default Implementation of rep_matrix returning an Eigen matrix with scalar type equal to the input scalar type.
 
template<typename Vec , require_eigen_vector_t< Vec > * = nullptr>
auto rep_matrix (const Vec &x, int n)
 Implementation of rep_matrix returning an Eigen matrix from an Eigen vector.
 
template<typename T_ret , typename T , require_eigen_row_vector_t< T_ret > * = nullptr, require_stan_scalar_t< T > * = nullptr>
auto rep_row_vector (const T &x, int n)
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
auto rep_row_vector (const T &x, int n)
 
template<typename T_ret , typename T , require_eigen_col_vector_t< T_ret > * = nullptr, require_stan_scalar_t< T > * = nullptr>
auto rep_vector (const T &x, int n)
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
auto rep_vector (const T &x, int n)
 
template<typename T >
void resize (T &x, std::vector< int > dims)
 Recursively resize the specified vector of vectors, which must bottom out at scalar values, Eigen vectors or Eigen matrices.
 
template<typename T >
std::vector< T > reverse (const std::vector< T > &x)
 Return a copy of the specified array in reversed order.
 
template<typename T , typename = require_vector_t<T>>
auto reverse (const T &x)
 Return a copy of the specified vector or row vector in reversed order.
 
template<typename T , require_arithmetic_t< T > * = nullptr>
return_type_t< T > rising_factorial (const T &x, int n)
 Return the rising factorial function evaluated at the inputs.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr>
auto rising_factorial (const T1 &a, const T2 &b)
 Enables the vectorized application of the rising_factorial function, when the first and/or second arguments are containers.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto round (const Container &x)
 Vectorized version of round().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto round (const Container &x)
 Version of round() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T , require_matrix_t< T > * = nullptr>
auto row (const T &m, size_t i)
 Return the specified row of the specified matrix, using start-at-1 indexing.
 
template<typename T , require_matrix_t< T > * = nullptr>
int rows (const T &m)
 Return the number of rows in the specified matrix, vector, or row vector.
 
template<typename Mat1 , typename Mat2 , require_all_eigen_t< Mat1, Mat2 > * = nullptr, require_all_not_eigen_vt< is_var, Mat1, Mat2 > * = nullptr>
Eigen::Matrix< return_type_t< Mat1, Mat2 >, Mat1::RowsAtCompileTime, 1 > rows_dot_product (const Mat1 &v1, const Mat2 &v2)
 Returns the dot product of rows of the specified matrices.
 
template<typename T , require_eigen_t< T > * = nullptr, require_not_st_var< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, T::RowsAtCompileTime, 1 > rows_dot_self (const T &x)
 Returns the dot product of each row of a matrix with itself.
 
template<typename T , typename = require_autodiff_t<T>>
double scalbn (const T &x, int n)
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_vt< std::is_arithmetic, EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< double, Eigen::Dynamic, EigMat2::ColsAtCompileTime > scale_matrix_exp_multiply (const double &t, const EigMat1 &A, const EigMat2 &B)
 Return product of exp(At) and B, where A is a NxN double matrix, B is a NxCb double matrix, and t is a double.
 
template<typename Tt , typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_any_autodiff_t< Tt, value_type_t< EigMat1 >, value_type_t< EigMat2 > > * = nullptr>
Eigen::Matrix< return_type_t< Tt, EigMat1, EigMat2 >, Eigen::Dynamic, EigMat2::ColsAtCompileTime > scale_matrix_exp_multiply (const Tt &t, const EigMat1 &A, const EigMat2 &B)
 Return product of exp(At) and B, where A is a NxN matrix, B is a NxCb matrix and t is a scalar.
 
void scaled_add (std::vector< double > &x, const std::vector< double > &y, double lambda)
 
template<typename T , require_container_t< T > * = nullptr, require_not_st_var< T > * = nullptr>
auto sd (const T &m)
 Returns the unbiased sample standard deviation of the coefficients in the specified std vector, column vector, row vector, or matrix.
 
template<typename Vec , require_vector_t< Vec > * = nullptr>
auto segment (const Vec &v, size_t i, size_t n)
 Return the specified number of elements as a row/column vector starting from the specified element - 1 of the specified row/column vector.
 
template<typename T >
std::vector< T > segment (const std::vector< T > &sv, size_t i, size_t n)
 
template<typename T_true , typename T_false , typename ReturnT = return_type_t<T_true, T_false>, require_all_stan_scalar_t< T_true, T_false > * = nullptr>
ReturnT select (const bool c, const T_true y_true, const T_false y_false)
 If first argument is true return the second argument, else return the third argument.
 
template<typename T_true , typename T_false , typename T_return = return_type_t<T_true, T_false>, typename T_true_plain = promote_scalar_t<T_return, plain_type_t<T_true>>, typename T_false_plain = promote_scalar_t<T_return, plain_type_t<T_false>>, require_all_container_t< T_true, T_false > * = nullptr, require_all_same_t< T_true_plain, T_false_plain > * = nullptr>
T_true_plain select (const bool c, T_true &&y_true, T_false &&y_false)
 If first argument is true return the second argument, else return the third argument.
 
template<typename T_true , typename T_false , typename ReturnT = promote_scalar_t<return_type_t<T_true, T_false>, plain_type_t<T_true>>, require_container_t< T_true > * = nullptr, require_stan_scalar_t< T_false > * = nullptr>
ReturnT select (const bool c, const T_true &y_true, const T_false &y_false)
 If first argument is true return the second argument, else return the third argument.
 
template<typename T_true , typename T_false , typename ReturnT = promote_scalar_t<return_type_t<T_true, T_false>, plain_type_t<T_false>>, require_stan_scalar_t< T_true > * = nullptr, require_container_t< T_false > * = nullptr>
ReturnT select (const bool c, const T_true y_true, const T_false y_false)
 If first argument is true return the second argument, else return the third argument.
 
template<typename T_bool , typename T_true , typename T_false , require_eigen_array_vt< std::is_integral, T_bool > * = nullptr, require_all_stan_scalar_t< T_true, T_false > * = nullptr>
auto select (const T_bool c, const T_true y_true, const T_false y_false)
 If first argument is true return the second argument, else return the third argument.
 
template<typename T >
deserializer< T > to_deserializer (const std::vector< T > &vals)
 Return a deserializer based on the specified values.
 
template<typename T >
deserializer< T > to_deserializer (const Eigen::Matrix< T, -1, 1 > &vals)
 Return a deserializer based on the specified values.
 
template<typename T >
deserializer< T > to_deserializer (const std::complex< T > &vals)
 
template<typename U >
void serialize_helper (serializer< U > &s)
 
template<typename U , typename T , typename... Ts>
void serialize_helper (serializer< U > &s, const T &x, const Ts... xs)
 
template<typename U , typename... Ts>
std::vector< U > serialize (const Ts... xs)
 Serialize the specified sequence of objects, which all must have scalar types assignable to the result scalar type.
 
template<typename T >
std::vector< real_return_t< T > > serialize_return (const T &x)
 Serialized the specified single argument.
 
template<typename... Ts>
Eigen::VectorXd serialize_args (const Ts... xs)
 Serialize the specified sequence of structured objects with double-based scalars into an Eigen vector of double values.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
int sign (const T &z)
 
template<typename ADType , require_autodiff_t< ADType > * = nullptr>
bool signbit (ADType &&v)
 Return true if the specified argument is negative and false otherwise.
 
template<typename Vec , require_eigen_vector_t< Vec > * = nullptr, require_not_st_var< Vec > * = nullptr>
plain_type_t< Vec > simplex_constrain (const Vec &y)
 Return the simplex corresponding to the specified free vector.
 
template<typename Vec , require_eigen_vector_t< Vec > * = nullptr, require_not_st_var< Vec > * = nullptr>
plain_type_t< Vec > simplex_constrain (const Vec &y, value_type_t< Vec > &lp)
 Return the simplex corresponding to the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<bool Jacobian, typename Vec , require_not_std_vector_t< Vec > * = nullptr>
plain_type_t< Vec > simplex_constrain (const Vec &y, return_type_t< Vec > &lp)
 Return the simplex corresponding to the specified free vector.
 
template<bool Jacobian, typename T , require_std_vector_t< T > * = nullptr>
auto simplex_constrain (const T &y, return_type_t< T > &lp)
 Return the simplex corresponding to the specified free vector.
 
template<typename Vec , require_eigen_vector_t< Vec > * = nullptr>
plain_type_t< Vec > simplex_free (const Vec &x)
 Return an unconstrained vector that when transformed produces the specified simplex.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto simplex_free (const T &x)
 Overload of simplex_free() to untransform each Eigen vector in a standard vector.
 
template<typename T , require_not_container_st< std::is_arithmetic, T > * = nullptr, require_not_var_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto sin (const T &x)
 Vectorized version of sin().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto sin (const Container &x)
 Version of sin() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_st_var< EigMat > * = nullptr>
auto singular_values (const EigMat &m)
 Return the vector of the singular values of the specified matrix in decreasing order of magnitude.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto sinh (const Container &x)
 Vectorized version of sinh().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto sinh (const Container &x)
 Version of sinh() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename ScalarT , require_stan_scalar_t< ScalarT > * = nullptr>
size_t size_mvt (const ScalarT &)
 Provides the size of a multivariate argument.
 
template<typename MatrixT , require_matrix_t< MatrixT > * = nullptr>
size_t size_mvt (const MatrixT &)
 
template<typename MatrixT , require_matrix_t< MatrixT > * = nullptr>
size_t size_mvt (const std::vector< MatrixT > &x)
 
template<typename T >
bool size_zero (const T &x)
 Returns 1 if input is of length 0, returns 0 otherwise.
 
template<typename T , typename... Ts>
bool size_zero (const T &x, const Ts &... xs)
 Returns 1 if any inputs are of length 0, returns 0 otherwise.
 
template<typename ColVec , require_eigen_col_vector_vt< std::is_arithmetic, ColVec > * = nullptr>
plain_type_t< ColVec > softmax (const ColVec &v)
 Return the softmax of the specified vector.
 
template<typename T >
std::vector< T > sort_asc (std::vector< T > xs)
 Return the specified standard vector in ascending order.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
plain_type_t< EigVec > sort_asc (EigVec &&xs)
 Return the specified vector in ascending order.
 
template<typename T >
std::vector< T > sort_desc (std::vector< T > xs)
 Return the specified standard vector in descending order.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
plain_type_t< EigVec > sort_desc (EigVec &&xs)
 Return the specified vector in descending order.
 
template<bool ascending, typename C >
std::vector< int > sort_indices (const C &xs)
 Return an integer array of indices of the specified container sorting the values in ascending or descending order based on the value of the first template parameter.
 
template<typename C >
std::vector< int > sort_indices_asc (const C &xs)
 Return a sorted copy of the argument container in ascending order.
 
template<typename C >
std::vector< int > sort_indices_desc (const C &xs)
 Return a sorted copy of the argument container in ascending order.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr>
auto sqrt (const Container &x)
 Vectorized version of sqrt().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr>
auto sqrt (const Container &x)
 Version of sqrt() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
double square (double x)
 Return the square of the specified argument.
 
template<typename Container , require_not_stan_scalar_t< Container > * = nullptr, require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto square (const Container &x)
 Vectorized version of square().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto square (const Container &x)
 Version of square() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename Scal1 , typename Scal2 , require_all_stan_scalar_t< Scal1, Scal2 > * = nullptr, require_all_not_var_t< Scal1, Scal2 > * = nullptr>
return_type_t< Scal1, Scal2 > squared_distance (const Scal1 &x1, const Scal2 &x2)
 Returns the squared distance.
 
template<typename EigVec1 , typename EigVec2 , require_all_eigen_vector_t< EigVec1, EigVec2 > * = nullptr, require_all_not_eigen_vt< is_var, EigVec1, EigVec2 > * = nullptr>
return_type_t< EigVec1, EigVec2 > squared_distance (const EigVec1 &v1, const EigVec2 &v2)
 Returns the squared distance between the specified vectors of the same dimensions.
 
template<typename T , require_not_container_t< T > * = nullptr, require_not_tuple_t< T > * = nullptr>
void stan_print (std::ostream *o, const T &x)
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
void stan_print (std::ostream *o, const EigVec &x)
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_eigen_vector_t< EigMat > * = nullptr>
void stan_print (std::ostream *o, const EigMat &x)
 
template<typename T , require_tuple_t< T > * = nullptr>
void stan_print (std::ostream *o, const T &x)
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
step (const T &y)
 The step, or Heaviside, function.
 
template<typename T , require_container_t< T > * = nullptr>
auto step (const T &x)
 Return the elementwise application of step() to specified argument container.
 
template<typename Mat , require_eigen_matrix_dynamic_t< Mat > * = nullptr, require_not_st_var< Mat > * = nullptr>
plain_type_t< Mat > stochastic_column_constrain (const Mat &y)
 Return a column stochastic matrix.
 
template<typename Mat , require_eigen_matrix_dynamic_t< Mat > * = nullptr, require_not_st_var< Mat > * = nullptr>
plain_type_t< Mat > stochastic_column_constrain (const Mat &y, value_type_t< Mat > &lp)
 Return a column stochastic matrix and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<bool Jacobian, typename Mat , require_not_std_vector_t< Mat > * = nullptr>
plain_type_t< Mat > stochastic_column_constrain (const Mat &y, return_type_t< Mat > &lp)
 Return a column stochastic matrix.
 
template<bool Jacobian, typename T , require_std_vector_t< T > * = nullptr>
auto stochastic_column_constrain (const T &y, return_type_t< T > &lp)
 Return a vector of column stochastic matrices.
 
template<typename Mat , require_eigen_matrix_dynamic_t< Mat > * = nullptr, require_not_st_var< Mat > * = nullptr>
plain_type_t< Mat > stochastic_column_free (const Mat &y)
 Return an unconstrained matrix that when transformed produces the specified columnwise stochastic matrix.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto stochastic_column_free (const T &y)
 Overload that untransforms each Eigen matrix in a standard vector.
 
template<typename Mat , require_eigen_matrix_dynamic_t< Mat > * = nullptr, require_not_st_var< Mat > * = nullptr>
plain_type_t< Mat > stochastic_row_constrain (const Mat &y)
 Return a row stochastic matrix.
 
template<typename Mat , require_eigen_matrix_dynamic_t< Mat > * = nullptr, require_not_st_var< Mat > * = nullptr>
plain_type_t< Mat > stochastic_row_constrain (const Mat &y, value_type_t< Mat > &lp)
 Return a row stochastic matrix.
 
template<bool Jacobian, typename Mat , require_not_std_vector_t< Mat > * = nullptr>
plain_type_t< Mat > stochastic_row_constrain (const Mat &y, return_type_t< Mat > &lp)
 Return a row stochastic matrix.
 
template<bool Jacobian, typename T , require_std_vector_t< T > * = nullptr>
auto stochastic_row_constrain (const T &y, return_type_t< T > &lp)
 Return a row stochastic matrix.
 
template<typename Mat , require_eigen_matrix_dynamic_t< Mat > * = nullptr, require_not_st_var< Mat > * = nullptr>
plain_type_t< Mat > stochastic_row_free (const Mat &y)
 Return an unconstrained matrix that when transformed produces the specified simplex matrix.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto stochastic_row_free (const T &y)
 Overload that untransforms each Eigen matrix in a standard vector.
 
template<typename T , require_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto sub_col (const T &m, size_t i, size_t j, size_t nrows)
 Return a nrows x 1 subcolumn starting at (i-1, j-1).
 
template<typename T , require_matrix_t< T > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto sub_row (const T &m, size_t i, size_t j, size_t ncols)
 Return a 1 x ncols subrow starting at (i-1, j-1).
 
template<typename ScalarA , typename ScalarB , require_all_stan_scalar_t< ScalarA, ScalarB > * = nullptr, require_all_not_var_t< ScalarA, ScalarB > * = nullptr>
return_type_t< ScalarA, ScalarB > subtract (const ScalarA &a, const ScalarB &b)
 Return the result of subtracting the second scalar from the first scalar.
 
template<typename Mat1 , typename Mat2 , require_all_eigen_t< Mat1, Mat2 > * = nullptr, require_all_not_st_var< Mat1, Mat2 > * = nullptr>
auto subtract (const Mat1 &m1, const Mat2 &m2)
 Return the result of subtracting the second specified matrix from the first specified matrix.
 
template<typename Scal , typename Mat , require_stan_scalar_t< Scal > * = nullptr, require_eigen_t< Mat > * = nullptr, require_all_not_st_var< Mat, Scal > * = nullptr>
auto subtract (const Scal c, const Mat &m)
 Return the result of subtracting the specified matrix from the specified scalar.
 
template<typename Mat , typename Scal , require_eigen_t< Mat > * = nullptr, require_stan_scalar_t< Scal > * = nullptr, require_all_not_st_var< Scal, Mat > * = nullptr>
auto subtract (const Mat &m, const Scal c)
 Return the result of subtracting the specified scalar from the specified matrix.
 
template<typename T , require_stan_scalar_t< T > * = nullptr>
sum (T &&m)
 Returns specified input value.
 
template<typename T , require_not_var_t< T > * = nullptr>
sum (const std::vector< T > &m)
 Return the sum of the values in the specified standard vector.
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_st_var< EigMat > * = nullptr>
std::tuple< Eigen::Matrix< value_type_t< EigMat >, -1, -1 >, Eigen::Matrix< base_type_t< EigMat >, -1, 1 >, Eigen::Matrix< value_type_t< EigMat >, -1, -1 > > svd (const EigMat &m)
 Given input matrix m, return the singular value decomposition (U,D,V) such that m = U*diag(D)*V^{T}
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_st_var< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > svd_U (const EigMat &m)
 Given input matrix m, return matrix U where m = UDV^{T}
 
template<typename EigMat , require_eigen_matrix_dynamic_t< EigMat > * = nullptr, require_not_st_var< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > svd_V (const EigMat &m)
 Given input matrix m, return matrix V where m = UDV^{T}
 
template<typename T , require_eigen_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > symmetrize_from_lower_tri (const T &m)
 Return a symmetric matrix using elements from the lower triangular part of the input matrix.
 
template<typename T , require_eigen_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > symmetrize_from_upper_tri (const T &m)
 Return a symmetric matrix using elements from the upper triangular part of the input matrix.
 
template<typename T , require_vector_t< T > * = nullptr>
auto tail (const T &v, size_t n)
 Return the specified number of elements as a vector or row vector (same as input) from the back of the specified vector or row vector.
 
template<typename T >
std::vector< T > tail (const std::vector< T > &sv, size_t n)
 Return the specified number of elements as a standard vector from the back of the specified standard vector.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto tan (const Container &x)
 Vectorized version of tan().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto tan (const Container &x)
 Version of tan() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename Container , require_not_container_st< std::is_arithmetic, Container > * = nullptr, require_not_var_matrix_t< Container > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< Container > * = nullptr>
auto tanh (const Container &x)
 Vectorized version of tanh().
 
template<typename Container , require_container_st< std::is_arithmetic, Container > * = nullptr>
auto tanh (const Container &x)
 Version of tanh() that accepts std::vectors, Eigen Matrix/Array objects or expressions, and containers of these.
 
template<typename T , require_eigen_vt< std::is_arithmetic, T > * = nullptr>
Eigen::Matrix< value_type_t< T >, T::RowsAtCompileTime, T::RowsAtCompileTime > tcrossprod (const T &M)
 Returns the result of post-multiplying a matrix by its own transpose.
 
double tgamma (double x)
 Return the gamma function applied to the specified argument.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto tgamma (const T &x)
 Vectorized version of tgamma().
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
std::vector< value_type_t< EigMat > > to_array_1d (const EigMat &matrix)
 
template<typename T >
std::vector< T > to_array_1d (const std::vector< T > &x)
 
template<typename T >
std::vector< typename scalar_type< T >::type > to_array_1d (const std::vector< std::vector< T > > &x)
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
std::vector< std::vector< value_type_t< EigMat > > > to_array_2d (const EigMat &matrix)
 
template<typename T = double, typename S = double, require_all_not_container_t< T, S > * = nullptr>
constexpr std::complex< stan::real_return_t< T, S > > to_complex (const T &re=0, const S &im=0)
 Return a complex value from a real component and an imaginary component.
 
template<typename T1 , typename T2 , require_any_container_t< T1, T2 > * = nullptr, require_all_st_stan_scalar< T1, T2 > * = nullptr>
auto to_complex (const T1 &re, const T2 &im)
 Return a complex valued container from a real component and an imaginary component.
 
template<typename T , require_integral_t< T > * = nullptr>
to_int (T x)
 Returns the input scalar as an integer type.
 
template<typename T , require_floating_point_t< T > * = nullptr>
int to_int (T x)
 Returns the input scalar as an integer type.
 
template<typename Container , require_std_vector_st< std::is_arithmetic, Container > * = nullptr>
auto to_int (const Container &x)
 Returns the elementwise to_int() of the input, which may be a scalar or any Stan container of numeric scalars.
 
template<typename EigMat , require_eigen_dense_dynamic_t< EigMat > * = nullptr>
EigMat to_matrix (EigMat &&x)
 Returns a matrix with dynamic dimensions constructed from an Eigen matrix.
 
template<typename EigVec , require_eigen_vector_t< EigVec > * = nullptr>
auto to_matrix (EigVec &&matrix)
 Returns a matrix with dynamic dimensions constructed from an Eigen row or column vector.
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< Eigen::Matrix< T, 1, Eigen::Dynamic > > &x)
 Returns a matrix representation of a standard vector of Eigen row vectors with the same dimensions and indexing order.
 
template<typename T >
Eigen::Matrix< return_type_t< T, double >, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< std::vector< T > > &x)
 Returns a matrix representation of the standard vector of standard vectors with the same dimensions and indexing order.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > to_matrix (EigMat &&x, int m, int n)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.
 
template<typename T >
auto to_matrix (const std::vector< T > &x, int m, int n)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.
 
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< int > &x, int m, int n)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > to_matrix (EigMat &&x, int m, int n, bool col_major)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.
 
template<typename T >
Eigen::Matrix< return_type_t< T, double >, Eigen::Dynamic, Eigen::Dynamic > to_matrix (const std::vector< T > &x, int m, int n, bool col_major)
 Returns a matrix representation of the vector in column-major order with the specified number of rows and columns.
 
template<typename T >
ref_type_t< T && > to_ref (T &&a)
 This evaluates expensive Eigen expressions.
 
template<bool Cond, typename T , std::enable_if_t<!Cond > * = nullptr>
to_ref_if (T &&a)
 No-op that should be optimized away.
 
template<bool Cond, typename T , std::enable_if_t< Cond > * = nullptr>
ref_type_t< T && > to_ref_if (T &&a)
 If the condition is true, evaluates expensive Eigen expressions.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, 1, Eigen::Dynamic > to_row_vector (const EigMat &matrix)
 
template<typename T >
Eigen::Matrix< T, 1, Eigen::Dynamic > to_row_vector (const std::vector< T > &vec)
 
Eigen::Matrix< double, 1, Eigen::Dynamic > to_row_vector (const std::vector< int > &vec)
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, 1 > to_vector (const EigMat &matrix)
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > to_vector (const std::vector< T > &vec)
 
Eigen::Matrix< double, Eigen::Dynamic, 1 > to_vector (const std::vector< int > &vec)
 
template<typename T , require_eigen_t< T > * = nullptr, require_not_st_var< T > * = nullptr>
value_type_t< T > trace (const T &m)
 Returns the trace of the specified matrix.
 
template<typename EigMat1 , typename T2 , typename EigMat3 , require_not_col_vector_t< EigMat1 > * = nullptr, require_all_not_st_var< EigMat1, T2, EigMat3 > * = nullptr>
return_type_t< EigMat1, T2, EigMat3 > trace_gen_inv_quad_form_ldlt (const EigMat1 &D, LDLT_factor< T2 > &A, const EigMat3 &B)
 Compute the trace of an inverse quadratic form.
 
template<typename EigVec , typename T , typename EigMat , require_col_vector_t< EigVec > * = nullptr, require_all_not_st_var< EigVec, T, EigMat > * = nullptr>
return_type_t< EigVec, T, EigMat > trace_gen_inv_quad_form_ldlt (const EigVec &D, LDLT_factor< T > &A, const EigMat &B)
 Compute the trace of an inverse quadratic form.
 
template<typename TD , typename TA , typename TB , typename = require_all_eigen_t<TD, TA, TB>, typename = require_all_not_vt_var<TD, TA, TB>, typename = require_any_not_vt_arithmetic<TD, TA, TB>>
auto trace_gen_quad_form (const TD &D, const TA &A, const TB &B)
 Return the trace of D times the quadratic form of B and A.
 
template<typename EigMatD , typename EigMatA , typename EigMatB , require_all_eigen_vt< std::is_arithmetic, EigMatD, EigMatA, EigMatB > * = nullptr>
double trace_gen_quad_form (const EigMatD &D, const EigMatA &A, const EigMatB &B)
 Return the trace of D times the quadratic form of B and A.
 
template<typename T , typename EigMat2 , typename = require_all_not_st_var<T, EigMat2>>
return_type_t< T, EigMat2 > trace_inv_quad_form_ldlt (LDLT_factor< T > &A, const EigMat2 &B)
 Compute the trace of an inverse quadratic form.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_vt< std::is_arithmetic, EigMat1, EigMat2 > * = nullptr>
return_type_t< EigMat1, EigMat2 > trace_quad_form (const EigMat1 &A, const EigMat2 &B)
 Compute trace(B^T A B).
 
template<typename T , require_matrix_t< T > * = nullptr>
auto transpose (const T &m)
 Transposes a matrix.
 
template<typename T >
trigamma_impl (const T &x)
 Return the trigamma function applied to the argument.
 
double trigamma (double u)
 Return the second derivative of the log Gamma function evaluated at the specified argument.
 
double trigamma (int u)
 Return the second derivative of the log Gamma function evaluated at the specified argument.
 
template<typename T , require_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto trigamma (const T &x)
 Return the elementwise application of trigamma() to specified argument container.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr>
auto trunc (const T &x)
 Return the elementwise application of trunc() to specified argument container.
 
template<typename T , typename U , require_all_stan_scalar_t< T, U > * = nullptr, require_all_not_st_var< T, U > * = nullptr>
auto ub_constrain (const T &x, const U &ub)
 Return the upper-bounded value for the specified unconstrained matrix and upper bound.
 
template<typename T , typename U , require_all_stan_scalar_t< T, U > * = nullptr, require_all_not_st_var< T, U > * = nullptr>
auto ub_constrain (const T &x, const U &ub, std::decay_t< return_type_t< T, U > > &lp)
 Return the upper-bounded value for the specified unconstrained scalar and upper bound and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<typename T , typename U , require_eigen_t< T > * = nullptr, require_stan_scalar_t< U > * = nullptr, require_all_not_st_var< T, U > * = nullptr>
auto ub_constrain (const T &x, const U &ub)
 Specialization of ub_constrain to apply a scalar upper bound elementwise to each input.
 
template<typename T , typename U , require_eigen_t< T > * = nullptr, require_stan_scalar_t< U > * = nullptr, require_all_not_st_var< T, U > * = nullptr>
auto ub_constrain (const T &x, const U &ub, std::decay_t< return_type_t< T, U > > &lp)
 Specialization of ub_constrain to apply a scalar upper bound elementwise to each input.
 
template<typename T , typename U , require_not_std_vector_t< U > * = nullptr>
auto ub_constrain (const std::vector< T > &x, const U &ub)
 Specialization of ub_constrain to apply a scalar upper bound elementwise to each input element.
 
template<typename T , typename U , require_not_std_vector_t< U > * = nullptr>
auto ub_constrain (const std::vector< T > &x, const U &ub, return_type_t< T, U > &lp)
 Specialization of ub_constrain to apply a scalar upper bound elementwise to each input element.
 
template<typename T , typename U >
auto ub_constrain (const std::vector< T > &x, const std::vector< U > &ub)
 Specialization of ub_constrain to apply a container of upper bounds elementwise to each input element.
 
template<typename T , typename U >
auto ub_constrain (const std::vector< T > &x, const std::vector< U > &ub, return_type_t< T, U > &lp)
 Specialization of ub_constrain to apply a container of upper bounds elementwise to each input element.
 
template<bool Jacobian, typename T , typename U >
auto ub_constrain (const T &x, const U &ub, return_type_t< T, U > &lp)
 Specialization of ub_constrain to apply a container of upper bounds elementwise to each input element.
 
template<typename T , typename U , require_not_std_vector_t< T > * = nullptr, require_stan_scalar_t< U > * = nullptr>
auto ub_free (T &&y, U &&ub)
 Return the free scalar that corresponds to the specified upper-bounded value with respect to the specified upper bound.
 
template<typename T , typename U , require_all_eigen_t< T, U > * = nullptr>
auto ub_free (T &&y, U &&ub)
 Return the free matrix that corresponds to the specified upper-bounded matrix with respect to the specified upper bound.
 
template<typename T , typename U , require_not_std_vector_t< U > * = nullptr>
auto ub_free (const std::vector< T > y, const U &ub)
 Return the free variable that corresponds to the specified upper-bounded variable with respect to the specified upper bound.
 
template<typename T , typename U >
auto ub_free (const std::vector< T > y, const std::vector< U > &ub)
 Return the free variable that corresponds to the specified upper-bounded variable with respect to the specified upper bound.
 
auto uniform_simplex (int K)
 Return a uniform simplex of size K.
 
template<typename T , require_eigen_col_vector_t< T > * = nullptr, require_not_vt_autodiff< T > * = nullptr>
plain_type_t< T > unit_vector_constrain (const T &y)
 Return the unit length vector corresponding to the free vector y.
 
template<typename T1 , typename T2 , require_eigen_col_vector_t< T1 > * = nullptr, require_all_not_vt_autodiff< T1, T2 > * = nullptr>
plain_type_t< T1 > unit_vector_constrain (const T1 &y, T2 &lp)
 Return the unit length vector corresponding to the free vector y.
 
template<bool Jacobian, typename T , require_not_std_vector_t< T > * = nullptr>
auto unit_vector_constrain (const T &y, return_type_t< T > &lp)
 Return the unit length vector corresponding to the free vector y.
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr>
auto unit_vector_free (EigVec &&x)
 Transformation of a unit length vector to a "free" vector However, we are just fixing the unidentified radius to 1.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto unit_vector_free (const T &x)
 Overload of unit_vector_free() to untransform each Eigen vector in a standard vector.
 
std::vector< int > unitspaced_array (int low, int high)
 Return an array of integers in an ordered sequence.
 
template<typename T , require_st_arithmetic< T > * = nullptr>
value_of (T &&x)
 Inputs that are arithmetic types or containers of airthmetric types are returned from value_of unchanged.
 
template<typename T , require_complex_t< T > * = nullptr, require_t< std::is_arithmetic< typename std::decay_t< T >::value_type > > * = nullptr>
auto value_of (T &&x)
 
template<typename T , require_std_vector_t< T > * = nullptr, require_not_st_arithmetic< T > * = nullptr>
auto value_of (const T &x)
 For std::vectors of non-arithmetic types, return a std::vector composed of value_of applied to each element.
 
template<typename EigMat , require_eigen_dense_base_t< EigMat > * = nullptr, require_not_st_arithmetic< EigMat > * = nullptr>
auto value_of (EigMat &&M)
 For Eigen matrices and expressions of non-arithmetic types, return an expression that represents the Eigen::Matrix resulting from applying value_of elementwise.
 
template<typename T , typename = require_stan_scalar_t<T>>
double value_of_rec (const T x)
 Return the value of the specified scalar argument converted to a double value.
 
double value_of_rec (double x)
 Return the specified argument.
 
template<typename T >
std::complex< double > value_of_rec (const std::complex< T > &x)
 Recursively apply value-of to the parts of the argument.
 
template<typename T , require_not_same_t< double, T > * = nullptr>
std::vector< double > value_of_rec (const std::vector< T > &x)
 Convert a std::vector of type T to a std::vector of doubles.
 
template<typename T , require_std_vector_t< T > * = nullptr, require_vt_same< double, T > * = nullptr>
value_of_rec (T &&x)
 Return the specified argument.
 
template<typename T , typename = require_not_st_same<T, double>, typename = require_eigen_t<T>>
auto value_of_rec (T &&M)
 Convert a matrix of type T to a matrix of doubles.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr, require_not_vt_var< EigMat > * = nullptr>
value_type_t< EigMat > variance (const EigMat &m)
 Returns the sample variance (divide by length - 1) of the coefficients in the specified matrix.
 
template<typename StdVec , require_std_vector_t< StdVec > * = nullptr, require_not_vt_var< StdVec > * = nullptr>
value_type_t< StdVec > variance (const StdVec &v)
 Returns the sample variance (divide by length - 1) of the coefficients in the specified standard vector.
 
template<typename Vec , typename... Args>
auto vec_concat (const Vec &v1, const Args &... args)
 Get the event stack from a vector of events and other arguments.
 
std::vector< double > zeros_array (int K)
 Return an array of zeros.
 
std::vector< int > zeros_int_array (int K)
 Return an integer array of zeros.
 
auto zeros_row_vector (int K)
 Return a row vector of zeros.
 
auto zeros_vector (int K)
 Return a vector of zeros.
 
template<class F , class Tuple , typename... PreArgs>
constexpr decltype(auto) apply (F &&f, Tuple &&t, PreArgs &&... pre_args)
 
template<typename T1 , typename T2 , typename F , require_all_stan_scalar_t< T1, T2 > * = nullptr>
auto apply_scalar_binary (const T1 &x, const T2 &y, const F &f)
 Base template function for vectorization of binary scalar functions defined by applying a functor to a combination of scalars, containers of matching sizes, or a combination of a scalar and a container.
 
template<typename T1 , typename T2 , typename F , require_all_eigen_t< T1, T2 > * = nullptr>
auto apply_scalar_binary (T1 &&x, T2 &&y, F &&f)
 Specialization for use with two Eigen inputs.
 
template<typename T1 , typename T2 , typename F , require_eigen_vector_vt< is_stan_scalar, T1 > * = nullptr, require_std_vector_vt< std::is_integral, T2 > * = nullptr>
auto apply_scalar_binary (T1 &&x, T2 &&y, F &&f)
 Specialization for use with one Eigen vector (row or column) and a one-dimensional std::vector of integer types.
 
template<typename T1 , typename T2 , typename F , require_eigen_matrix_dynamic_vt< is_stan_scalar, T1 > * = nullptr, require_std_vector_vt< is_std_vector, T2 > * = nullptr, require_std_vector_st< std::is_integral, T2 > * = nullptr>
auto apply_scalar_binary (const T1 &x, const T2 &y, const F &f)
 Specialization for use with one Eigen matrix and a two-dimensional std::vector of integer types.
 
template<typename T1 , typename T2 , typename F , require_std_vector_vt< is_stan_scalar, T1 > * = nullptr, require_stan_scalar_t< T2 > * = nullptr>
auto apply_scalar_binary (const T1 &x, const T2 &y, const F &f)
 Specialization for use when the first input is a (non-nested) std::vector and the second is a scalar.
 
template<typename F , typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
auto apply_scalar_ternary (const F &f, const T1 &x, const T2 &y, const T3 &z)
 Base template function for vectorization of ternary scalar functions defined by applying a functor to a combination of scalars, containers of matching sizes, or a combination of a scalar and a container.
 
template<typename F , typename T1 , typename T2 , typename T3 , require_all_eigen_t< T1, T2, T3 > * = nullptr>
auto apply_scalar_ternary (F &&f, T1 &&x, T2 &&y, T3 &&z)
 Specialization for use with three Eigen inputs.
 
template<typename F , typename T1 , typename T2 , typename T3 , require_any_container_t< T1, T2 > * = nullptr, require_stan_scalar_t< T3 > * = nullptr>
auto apply_scalar_ternary (const F &f, const T1 &x, const T2 &y, const T3 &z)
 Specialization for use where the third argument is a scalar.
 
template<typename F >
void finite_diff_gradient (const F &f, const Eigen::VectorXd &x, double &fx, Eigen::VectorXd &grad_fx, double epsilon=1e-03)
 Calculate the value and the gradient of the specified function at the specified argument using finite difference.
 
template<typename F , typename VectorT , typename ScalarT = return_type_t<VectorT>>
void finite_diff_gradient_auto (const F &f, const VectorT &x, ScalarT &fx, VectorT &grad_fx)
 Calculate the value and the gradient of the specified function at the specified argument using finite difference.
 
template<typename F , typename T >
constexpr auto for_each (F &&f, T &&t)
 Apply a function to each element of a tuple.
 
template<typename F , typename T1 , typename T2 >
constexpr auto for_each (F &&f, T1 &&t1, T2 &&t2)
 Apply a function to each element of two tuples.
 
template<typename F , typename T1 , typename T2 , typename T3 >
constexpr auto for_each (F &&f, T1 &&t1, T2 &&t2, T3 &&t3)
 Apply a function to each element of three tuples.
 
template<typename F , typename T_a , typename T_b , typename ParsTuple , typename TAbsErr , typename TRelErr >
auto hcubature (const F &integrand, const ParsTuple &pars, const int dim, const Eigen::Matrix< T_a, Eigen::Dynamic, 1 > &a, const Eigen::Matrix< T_b, Eigen::Dynamic, 1 > &b, const int max_eval, const TAbsErr reqAbsError, const TRelErr reqRelError)
 Compute the [dim]-dimensional integral of the function \(f\) from \(a\) to \(b\) within specified relative and absolute tolerances or maximum number of evaluations.
 
template<typename F >
double integrate (const F &f, double a, double b, double relative_tolerance)
 Integrate a single variable function f from a to b to within a specified relative tolerance.
 
template<typename F , typename... Args, require_all_st_arithmetic< Args... > * = nullptr>
double integrate_1d_impl (const F &f, double a, double b, double relative_tolerance, std::ostream *msgs, const Args &... args)
 Compute the integral of the single variable function f from a to b to within a specified relative tolerance.
 
template<typename F >
double integrate_1d (const F &f, double a, double b, const std::vector< double > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs, const double relative_tolerance=std::sqrt(EPSILON))
 Compute the integral of the single variable function f from a to b to within a specified relative tolerance.
 
template<typename F , typename T_y0 , typename T_param , typename T_t0 , typename T_ts >
auto integrate_ode_rk45 (const F &f, const std::vector< T_y0 > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-6, double absolute_tolerance=1e-6, int max_num_steps=1e6)
 
template<int call_id, typename F , typename T_shared_param , typename T_job_param , require_eigen_col_vector_t< T_shared_param > * = nullptr>
Eigen::Matrix< return_type_t< T_shared_param, T_job_param >, Eigen::Dynamic, 1 > map_rect (const T_shared_param &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)
 Map N function evaluations to parameters and data which are in rectangular format.
 
std::vector< int > mpi_map_chunks (std::size_t num_jobs, std::size_t chunk_size=1)
 Maps jobs of given chunk size to workers and returning a vector of counts.
 
template<typename T >
std::unique_lock< std::mutex > mpi_broadcast_command ()
 Broadcasts default constructible commands to the cluster.
 
std::unique_lock< std::mutex > mpi_broadcast_command (std::shared_ptr< mpi_command > &command)
 Broadcasts a command instance to the listening cluster.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... Args, require_eigen_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_ckrk_tol_impl (const char *function_name, const F &f, const T_y0 &y0_arg, T_t0 t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using Boost's Cash-Karp54 solver.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... Args, require_eigen_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_ckrk_tol (const F &f, const T_y0 &y0_arg, T_t0 t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using Boost's Cash-Karp solver.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... Args, require_eigen_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_ckrk (const F &f, const T_y0 &y0, T_t0 t0, const std::vector< T_ts > &ts, std::ostream *msgs, const Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using Boost's Cash-Karp Runge-Kutta solver with defaults for relative_tolerance, absolute_tolerance, and max_num_steps.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... Args, require_eigen_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_rk45_tol_impl (const char *function_name, const F &f, const T_y0 &y0_arg, T_t0 t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the non-stiff Runge-Kutta 45 solver in Boost.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... Args, require_eigen_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_rk45_tol (const F &f, const T_y0 &y0_arg, T_t0 t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the non-stiff Runge-Kutta 45 solver in Boost.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... Args, require_eigen_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > ode_rk45 (const F &f, const T_y0 &y0, T_t0 t0, const std::vector< T_ts > &ts, std::ostream *msgs, const Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the non-stiff Runge-Kutta 45 solver in Boost with defaults for relative_tolerance, absolute_tolerance, and max_num_steps.
 
template<typename F , typename T_y0_t0 , typename T_t0 , typename T_t , typename... Args, typename = require_all_arithmetic_t<T_y0_t0, T_t0, T_t, scalar_type_t<Args>...>>
Eigen::VectorXd ode_store_sensitivities (const F &f, const std::vector< double > &coupled_state, const Eigen::Matrix< T_y0_t0, Eigen::Dynamic, 1 > &y0, T_t0 t0, T_t t, std::ostream *msgs, const Args &... args)
 When all arguments are arithmetic, there are no sensitivities to store, so the function just returns the current coupled_state.
 
template<std::size_t I, class... Types>
constexpr auto & edge (internal::partials_propagator< Types... > &x) noexcept
 Access the edge of an partials_propagator
 
template<std::size_t I, class... Types>
constexpr auto & partials (internal::partials_propagator< Types... > &x) noexcept
 Access the partials for an edge of an partials_propagator
 
template<std::size_t I, class... Types>
constexpr auto & partials_vec (internal::partials_propagator< Types... > &x) noexcept
 Access the partials_vec for an edge of a partials_propagator
 
template<typename... Ops>
auto make_partials_propagator (Ops &&... ops)
 Construct an partials_propagator.
 
template<typename ReduceFunction , typename Vec , typename = require_vector_like_t<Vec>, typename... Args>
auto reduce_sum (Vec &&vmapped, int grainsize, std::ostream *msgs, Args &&... args)
 Call an instance of the function ReduceFunction on every element of an input sequence and sum these terms.
 
template<typename ReduceFunction , typename Vec , typename = require_vector_like_t<Vec>, typename... Args>
auto reduce_sum_static (Vec &&vmapped, int grainsize, std::ostream *msgs, Args &&... args)
 Call an instance of the function ReduceFunction on every element of an input sequence and sum these terms.
 
template<typename T_desired , typename T_actual , typename = std::enable_if_t<std::is_same<std::decay_t<T_actual>, std::decay_t<T_desired>>::value && !is_eigen<T_desired>::value>>
T_actual && forward_as (T_actual &&a)
 Assume which type we get.
 
template<typename T_desired , typename T_actual , typename = std::enable_if_t< !std::is_same<std::decay<T_actual>, std::decay<T_desired>>::value && (!is_eigen<T_desired>::value || !is_eigen<T_actual>::value)>>
T_desired forward_as (const T_actual &a)
 Assume which type we get.
 
template<typename T_desired , typename T_actual , require_eigen_t< T_desired > * = nullptr, std::enable_if_t< std::is_same< value_type_t< T_actual >, value_type_t< T_desired > >::value &&is_eigen< T_desired >::value &&is_eigen< T_actual >::value &&internal::eigen_static_size_match(T_desired::RowsAtCompileTime, std::decay_t< T_actual >::RowsAtCompileTime) &&internal::eigen_static_size_match(T_desired::ColsAtCompileTime, std::decay_t< T_actual >::ColsAtCompileTime)> * = nullptr>
T_actual && forward_as (T_actual &&a)
 Assume which type we get.
 
template<typename T_desired , typename T_actual , require_all_eigen_t< T_desired, T_actual > * = nullptr, std::enable_if_t< !std::is_same< value_type_t< T_actual >, value_type_t< T_desired > >::value||!internal::eigen_static_size_match(T_desired::RowsAtCompileTime, std::decay_t< T_actual >::RowsAtCompileTime)||!internal::eigen_static_size_match(T_desired::ColsAtCompileTime, std::decay_t< T_actual >::ColsAtCompileTime)> * = nullptr>
T_desired forward_as (const T_actual &a)
 Assume which type we get.
 
template<typename T , typename... Ptrs, std::enable_if_t< sizeof...(Ptrs) > = 1>
Ptrs holder (T &&arg, Ptrs *... pointers)
 
template<typename T >
holder (T &&arg)
 
template<typename F , typename... Args, require_not_plain_type_t< decltype(std::declval< F >()(std::declval< Args & >()...))> * = nullptr>
auto make_holder (const F &func, Args &&... args)
 Constructs an expression from given arguments using given functor.
 
template<std::size_t N, class F >
constexpr auto index_apply (F &&f)
 Calls given callable with an index sequence.
 
template<typename CondSum , typename T , require_t< CondSum > * = nullptr>
auto possibly_sum (T &&x)
 Conditionally sum the input at compile time.
 
template<typename CondSum , typename T1 , require_not_t< CondSum > * = nullptr>
auto possibly_sum (T1 &&x)
 Conditionally sum the input at compile time.
 
template<bool Condition, typename T1 , typename T2 , std::enable_if_t< Condition > * = nullptr>
T1 static_select (T1 &&a, T2 &&b)
 Returns one of the arguments that can be of different type, depending on the compile time condition.
 
template<bool Condition, typename T1 , typename T2 , std::enable_if_t<!Condition > * = nullptr>
T2 static_select (T1 &&a, T2 &&b)
 
template<typename T_n , typename T_prob >
return_type_t< T_prob > bernoulli_ccdf_log (const T_n &n, const T_prob &theta)
 
template<typename T_n , typename T_prob , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_prob > * = nullptr>
return_type_t< T_prob > bernoulli_cdf (const T_n &n, const T_prob &theta)
 Returns the CDF of the Bernoulli distribution.
 
template<typename T_n , typename T_prob >
return_type_t< T_prob > bernoulli_cdf_log (const T_n &n, const T_prob &theta)
 
template<typename T_n , typename T_prob , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_prob > * = nullptr>
return_type_t< T_prob > bernoulli_lccdf (const T_n &n, const T_prob &theta)
 Returns the log CCDF of the Bernoulli distribution.
 
template<typename T_n , typename T_prob , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_prob > * = nullptr>
return_type_t< T_prob > bernoulli_lcdf (const T_n &n, const T_prob &theta)
 Returns the log CDF of the Bernoulli distribution.
 
template<bool propto, typename T_n , typename T_prob >
return_type_t< T_prob > bernoulli_log (const T_n &n, const T_prob &theta)
 
template<typename T_y , typename T_prob >
return_type_t< T_prob > bernoulli_log (const T_y &n, const T_prob &theta)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_alpha, T_beta > bernoulli_logit_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_alpha, T_beta > bernoulli_logit_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , require_matrix_t< T_x > * = nullptr>
return_type_t< T_x, T_alpha, T_beta > bernoulli_logit_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with Bernoulli distribution and logit link function.
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_beta, T_alpha > bernoulli_logit_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<typename T_x , typename T_alpha , typename T_beta , class RNG >
VectorBuilder< true, int, T_alpha >::type bernoulli_logit_glm_rng (const T_x &x, const T_alpha &alpha, const T_beta &beta, RNG &rng)
 Returns a draw from the Generalized Linear Model (GLM) with Bernoulli distribution and logit link function.
 
template<bool propto, typename T_n , typename T_prob >
return_type_t< T_prob > bernoulli_logit_log (const T_n &n, const T_prob &theta)
 
template<typename T_n , typename T_prob >
return_type_t< T_prob > bernoulli_logit_log (const T_n &n, const T_prob &theta)
 
template<bool propto, typename T_n , typename T_prob , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_prob > * = nullptr>
return_type_t< T_prob > bernoulli_logit_lpmf (const T_n &n, const T_prob &theta)
 Returns the log PMF of the logit-parametrized Bernoulli distribution.
 
template<typename T_n , typename T_prob >
return_type_t< T_prob > bernoulli_logit_lpmf (const T_n &n, const T_prob &theta)
 
template<typename T_t , class RNG >
VectorBuilder< true, int, T_t >::type bernoulli_logit_rng (const T_t &t, RNG &rng)
 Return a Bernoulli random variate with logit-parameterized chance of success using the specified random number generator.
 
template<bool propto, typename T_n , typename T_prob , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_prob > * = nullptr>
return_type_t< T_prob > bernoulli_lpmf (const T_n &n, const T_prob &theta)
 Returns the log PMF of the Bernoulli distribution.
 
template<typename T_y , typename T_prob >
return_type_t< T_prob > bernoulli_lpmf (const T_y &n, const T_prob &theta)
 
template<typename T_theta , class RNG >
VectorBuilder< true, int, T_theta >::type bernoulli_rng (const T_theta &theta, RNG &rng)
 Return a Bernoulli random variate with specified chance of success parameter using the specified random number generator.
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_ccdf_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_cdf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the CDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_cdf_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_lccdf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the log CCDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_lcdf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the log CDF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.
 
template<bool propto, typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_log (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<bool propto, typename T_n , typename T_N , typename T_size1 , typename T_size2 , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_N, T_size1, T_size2 > * = nullptr>
return_type_t< T_size1, T_size2 > beta_binomial_lpmf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 Returns the log PMF of the Beta-Binomial distribution with given population size, prior success, and prior failure parameters.
 
template<typename T_n , typename T_N , typename T_size1 , typename T_size2 >
return_type_t< T_size1, T_size2 > beta_binomial_lpmf (const T_n &n, const T_N &N, const T_size1 &alpha, const T_size2 &beta)
 
template<typename T_N , typename T_shape1 , typename T_shape2 , class RNG >
VectorBuilder< true, int, T_N, T_shape1, T_shape2 >::type beta_binomial_rng (const T_N &N, const T_shape1 &alpha, const T_shape2 &beta, RNG &rng)
 Return a beta-binomial random variate with the specified population size, success, and failure parameters using the given random number generator.
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_ccdf_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_cdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 Calculates the beta cumulative distribution function for the given variate and scale variables.
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_cdf_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_lccdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta_param)
 Returns the beta log complementary cumulative distribution function for the given probability, success, and failure parameters.
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_lcdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta_param)
 Returns the beta log cumulative distribution function for the given probability, success, and failure parameters.
 
template<bool propto, typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_log (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<bool propto, typename T_y , typename T_scale_succ , typename T_scale_fail , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale_succ, T_scale_fail > * = nullptr>
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_lpdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 The log of the beta density for the specified scalar(s) given the specified sample stan::math::size(s).
 
template<typename T_y , typename T_scale_succ , typename T_scale_fail >
return_type_t< T_y, T_scale_succ, T_scale_fail > beta_lpdf (const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
 
template<typename T_y , typename T_loc , typename T_prec >
return_type_t< T_y, T_loc, T_prec > beta_proportion_ccdf_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 
template<typename T_y , typename T_loc , typename T_prec >
return_type_t< T_y, T_loc, T_prec > beta_proportion_cdf_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 
template<typename T_y , typename T_loc , typename T_prec >
return_type_t< T_y, T_loc, T_prec > beta_proportion_lccdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 Returns the beta log complementary cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lccdf(y | mu, kappa) = beta_lccdf(y | mu * kappa, (1 - mu) * kappa).
 
template<typename T_y , typename T_loc , typename T_prec >
return_type_t< T_y, T_loc, T_prec > beta_proportion_lcdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 Returns the beta log cumulative distribution function for specified probability, location, and precision parameters: beta_proportion_lcdf(y | mu, kappa) = beta_lcdf(y | mu * kappa, (1 - mu) * kappa).
 
template<bool propto, typename T_y , typename T_loc , typename T_prec >
return_type_t< T_y, T_loc, T_prec > beta_proportion_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 
template<typename T_y , typename T_loc , typename T_prec >
return_type_t< T_y, T_loc, T_prec > beta_proportion_log (const T_y &y, const T_loc &mu, const T_prec &kappa)
 
template<bool propto, typename T_y , typename T_loc , typename T_prec , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_prec > * = nullptr>
return_type_t< T_y, T_loc, T_prec > beta_proportion_lpdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 The log of the beta density for specified y, location, and precision: beta_proportion_lpdf(y | mu, kappa) = beta_lpdf(y | mu * kappa, (1 - mu) * kappa).
 
template<typename T_y , typename T_loc , typename T_prec >
return_type_t< T_y, T_loc, T_prec > beta_proportion_lpdf (const T_y &y, const T_loc &mu, const T_prec &kappa)
 
template<typename T_loc , typename T_prec , class RNG >
VectorBuilder< true, double, T_loc, T_prec >::type beta_proportion_rng (const T_loc &mu, const T_prec &kappa, RNG &rng)
 Return a Beta random variate specified probability, location, and precision parameters: beta_proportion_rng(y | mu, kappa) = beta_rng(y | mu * kappa, (1 - mu) * kappa).
 
template<typename T_shape1 , typename T_shape2 , class RNG >
VectorBuilder< true, double, T_shape1, T_shape2 >::type beta_rng (const T_shape1 &alpha, const T_shape2 &beta, RNG &rng)
 Return a Beta random variate with the supplied success and failure parameters using the given random number generator.
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_ccdf_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_cdf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the CDF for the binomial distribution evaluated at the specified success, population size, and chance of success.
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_cdf_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_lccdf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the log CCDF for the binomial distribution evaluated at the specified success, population size, and chance of success.
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_lcdf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the log CDF for the binomial distribution evaluated at the specified success, population size, and chance of success.
 
template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_log (const T_n &n, const T_N &N, const T_prob &theta)
 
template<bool propto, typename T_n , typename T_N , typename T_x , typename T_alpha , typename T_beta , require_matrix_t< T_x > * = nullptr>
return_type_t< T_x, T_alpha, T_beta > binomial_logit_glm_lpmf (const T_n &n, const T_N &N, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with Binomial distribution and logit link function.
 
template<typename T_n , typename T_N , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_beta, T_alpha > binomial_logit_glm_lpmf (const T_n &n, const T_N &N, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_logit_log (const T_n &n, const T_N &N, const T_prob &alpha)
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_logit_log (const T_n &n, const T_N &N, const T_prob &alpha)
 
template<bool propto, typename T_n , typename T_N , typename T_prob , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_N, T_prob > * = nullptr>
return_type_t< T_prob > binomial_logit_lpmf (const T_n &n, const T_N &N, const T_prob &alpha)
 Binomial log PMF in logit parametrization.
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_logit_lpmf (const T_n &n, const T_N &N, const T_prob &alpha)
 
template<bool propto, typename T_n , typename T_N , typename T_prob , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_N, T_prob > * = nullptr>
return_type_t< T_prob > binomial_lpmf (const T_n &n, const T_N &N, const T_prob &theta)
 Returns the log PMF for the binomial distribution evaluated at the specified success, population size, and chance of success.
 
template<typename T_n , typename T_N , typename T_prob >
return_type_t< T_prob > binomial_lpmf (const T_n &n, const T_N &N, const T_prob &theta)
 
template<typename T_N , typename T_theta , class RNG >
VectorBuilder< true, int, T_N, T_theta >::type binomial_rng (const T_N &N, const T_theta &theta, RNG &rng)
 Return a pseudorandom binomial random variable for the given population size and chance of success parameters using the specified random number generator.
 
template<bool propto, typename T_n , typename T_prob >
return_type_t< T_prob > categorical_log (const T_n &ns, const T_prob &theta)
 
template<typename T_n , typename T_prob >
return_type_t< T_prob > categorical_log (const T_n &ns, const T_prob &theta)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , require_matrix_t< T_x > * = nullptr, require_col_vector_t< T_alpha > * = nullptr, require_matrix_t< T_beta > * = nullptr>
return_type_t< T_x, T_alpha, T_beta > categorical_logit_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with categorical distribution and logit (softmax) link function.
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_alpha, T_beta > categorical_logit_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_n , typename T_prob >
return_type_t< T_prob > categorical_logit_log (const T_n &ns, const T_prob &beta)
 
template<typename T_n , typename T_prob >
return_type_t< T_prob > categorical_logit_log (const T_n &ns, const T_prob &beta)
 
template<bool propto, typename T_prob , require_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > categorical_logit_lpmf (int n, const T_prob &beta)
 
template<bool propto, typename T_prob , require_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > categorical_logit_lpmf (const std::vector< int > &ns, const T_prob &beta)
 
template<typename T_n , typename T_prob , require_st_integral< T_n > * = nullptr, require_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > categorical_logit_lpmf (const T_n &ns, const T_prob &beta)
 
template<class RNG >
int categorical_logit_rng (const Eigen::VectorXd &beta, RNG &rng)
 Return a draw from a Categorical distribution given a a vector of unnormalized log probabilities and a psuedo-random number generator.
 
template<bool propto, typename T_prob , require_eigen_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > categorical_lpmf (int n, const T_prob &theta)
 
template<bool propto, typename T_prob , require_eigen_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > categorical_lpmf (const std::vector< int > &ns, const T_prob &theta)
 
template<typename T_n , typename T_prob , require_st_integral< T_n > * = nullptr, require_eigen_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > categorical_lpmf (const T_n &ns, const T_prob &theta)
 
template<class RNG >
int categorical_rng (const Eigen::Matrix< double, Eigen::Dynamic, 1 > &theta, RNG &rng)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > cauchy_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > cauchy_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the cauchy cumulative distribution function for the given location, and scale.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > cauchy_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > cauchy_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the cauchy log complementary cumulative distribution function for the given location, and scale.
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > cauchy_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the cauchy log cumulative distribution function for the given location, and scale.
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > cauchy_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s).
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > cauchy_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > cauchy_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the Cauchy density for the specified scalar(s) given the specified location parameter(s) and scale parameter(s).
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > cauchy_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type cauchy_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a Cauchy random variate for the given location and scale using the specified random number generator.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_ccdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_cdf (const T_y &y, const T_dof &nu)
 Returns the chi square cumulative distribution function for the given variate and degrees of freedom.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_cdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_lccdf (const T_y &y, const T_dof &nu)
 Returns the chi square log complementary cumulative distribution function for the given variate and degrees of freedom.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_lcdf (const T_y &y, const T_dof &nu)
 Returns the chi square log cumulative distribution function for the given variate and degrees of freedom.
 
template<bool propto, typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_log (const T_y &y, const T_dof &nu)
 The log of a chi-squared density for y with the specified degrees of freedom parameter.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_log (const T_y &y, const T_dof &nu)
 
template<bool propto, typename T_y , typename T_dof , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_dof > * = nullptr>
return_type_t< T_y, T_dof > chi_square_lpdf (const T_y &y, const T_dof &nu)
 The log of a chi-squared density for y with the specified degrees of freedom parameter.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > chi_square_lpdf (const T_y &y, const T_dof &nu)
 
template<typename T_deg , class RNG >
VectorBuilder< true, double, T_deg >::type chi_square_rng (const T_deg &nu, RNG &rng)
 Return a chi squared random variate with nu degrees of freedom using the specified random number generator.
 
template<bool propto, typename T_prob , typename T_prior_size >
return_type_t< T_prob, T_prior_size > dirichlet_log (const T_prob &theta, const T_prior_size &alpha)
 The log of the Dirichlet density for the given theta and a vector of prior sample sizes, alpha.
 
template<typename T_prob , typename T_prior_size >
return_type_t< T_prob, T_prior_size > dirichlet_log (const T_prob &theta, const T_prior_size &alpha)
 
template<bool propto, typename T_prob , typename T_prior_size , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_prob, T_prior_size > * = nullptr>
return_type_t< T_prob, T_prior_size > dirichlet_lpdf (const T_prob &theta, const T_prior_size &alpha)
 The log of the Dirichlet density for the given theta and a vector of prior sample sizes, alpha.
 
template<typename T_prob , typename T_prior_size >
return_type_t< T_prob, T_prior_size > dirichlet_lpdf (const T_prob &theta, const T_prior_size &alpha)
 
template<bool propto, typename T_prob , typename T_prior_size >
return_type_t< T_prob, T_prior_size > dirichlet_lpmf (const T_prob &theta, const T_prior_size &alpha)
 
template<typename T_prob , typename T_prior_size >
return_type_t< T_prob, T_prior_size > dirichlet_lpmf (const T_prob &theta, const T_prior_size &alpha)
 
template<bool propto, typename T_prior_size , require_eigen_col_vector_t< T_prior_size > * = nullptr>
return_type_t< T_prior_size > dirichlet_multinomial_lpmf (const std::vector< int > &ns, const T_prior_size &alpha)
 The log of the Dirichlet-Multinomial probability for the given integer vector \(n\) and a vector of prior sample sizes, \(\alpha\).
 
template<typename T_prior_size >
return_type_t< T_prior_size > dirichlet_multinomial_lpmf (const std::vector< int > &ns, const T_prior_size &alpha)
 
template<class RNG >
std::vector< int > dirichlet_multinomial_rng (const Eigen::Matrix< double, Eigen::Dynamic, 1 > &alpha, int N, RNG &rng)
 Return a draw from a Dirichlet-Multinomial distribution with specified parameters \(\alpha\) and \(N\) and pseudo-random number generator rng.
 
template<class RNG >
Eigen::VectorXd dirichlet_rng (const Eigen::Matrix< double, Eigen::Dynamic, 1 > &alpha, RNG &rng)
 Return a draw from a Dirichlet distribution with specified parameters and pseudo-random number generator.
 
template<typename T_y , typename T_lower , typename T_upper >
double discrete_range_ccdf_log (const T_y &y, const T_lower &lower, const T_upper &upper)
 
template<typename T_y , typename T_lower , typename T_upper >
double discrete_range_cdf (const T_y &y, const T_lower &lower, const T_upper &upper)
 Return the CDF of a discrete range distribution for the given y, lower and upper bounds (all integers).
 
template<typename T_y , typename T_lower , typename T_upper >
double discrete_range_cdf_log (const T_y &y, const T_lower &lower, const T_upper &upper)
 
template<typename T_y , typename T_lower , typename T_upper >
double discrete_range_lccdf (const T_y &y, const T_lower &lower, const T_upper &upper)
 Return the log CCDF of a discrete range distribution for the given y, lower and upper bounds (all integers).
 
template<typename T_y , typename T_lower , typename T_upper >
double discrete_range_lcdf (const T_y &y, const T_lower &lower, const T_upper &upper)
 Return the log CDF of a discrete range distribution for the given y, lower and upper bounds (all integers).
 
template<bool propto, typename T_y , typename T_lower , typename T_upper >
double discrete_range_log (const T_y &y, const T_lower &lower, const T_upper &upper)
 
template<typename T_y , typename T_lower , typename T_upper >
double discrete_range_log (const T_y &y, const T_lower &lower, const T_upper &upper)
 
template<bool propto, typename T_y , typename T_lower , typename T_upper >
double discrete_range_lpmf (const T_y &y, const T_lower &lower, const T_upper &upper)
 Return the log PMF of a discrete range for the given y, lower and upper bound (all integers).
 
template<typename T_y , typename T_lower , typename T_upper >
double discrete_range_lpmf (const T_y &y, const T_lower &lower, const T_upper &upper)
 
template<typename T_lower , typename T_upper , class RNG >
VectorBuilder< true, int, T_lower, T_upper >::type discrete_range_rng (const T_lower &lower, const T_upper &upper, RNG &rng)
 Return an integer random variate between the given lower and upper bounds (inclusive) using the specified random number generator.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > double_exponential_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > double_exponential_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential cumulative density function.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > double_exponential_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > double_exponential_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential log complementary cumulative density function.
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > double_exponential_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential log cumulative density function.
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > double_exponential_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > double_exponential_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > double_exponential_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Returns the double exponential log probability density function.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > double_exponential_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type double_exponential_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a double exponential random variate with the given location and scale using the specified random number generator.
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_inv_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_inv_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_inv_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_inv_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_inv_scale >
return_type_t< T_y, T_loc, T_scale, T_inv_scale > exp_mod_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda)
 
template<typename T_loc , typename T_scale , typename T_inv_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale, T_inv_scale >::type exp_mod_normal_rng (const T_loc &mu, const T_scale &sigma, const T_inv_scale &lambda, RNG &rng)
 Return an exponentially modified normal random variate for the given location, scale, and inverse scale using the specified random number generator.
 
template<typename T_y , typename T_inv_scale >
return_type_t< T_y, T_inv_scale > exponential_ccdf_log (const T_y &y, const T_inv_scale &beta)
 
template<typename T_y , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_inv_scale > * = nullptr>
return_type_t< T_y, T_inv_scale > exponential_cdf (const T_y &y, const T_inv_scale &beta)
 Calculates the exponential cumulative distribution function for the given y and beta.
 
template<typename T_y , typename T_inv_scale >
return_type_t< T_y, T_inv_scale > exponential_cdf_log (const T_y &y, const T_inv_scale &beta)
 
template<typename T_y , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_inv_scale > * = nullptr>
return_type_t< T_y, T_inv_scale > exponential_lccdf (const T_y &y, const T_inv_scale &beta)
 
template<typename T_y , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_inv_scale > * = nullptr>
return_type_t< T_y, T_inv_scale > exponential_lcdf (const T_y &y, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_inv_scale >
return_type_t< T_y, T_inv_scale > exponential_log (const T_y &y, const T_inv_scale &beta)
 
template<typename T_y , typename T_inv_scale >
return_type_t< T_y, T_inv_scale > exponential_log (const T_y &y, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_inv_scale > * = nullptr>
return_type_t< T_y, T_inv_scale > exponential_lpdf (const T_y &y, const T_inv_scale &beta)
 The log of an exponential density for y with the specified inverse scale parameter.
 
template<typename T_y , typename T_inv_scale >
return_type_t< T_y, T_inv_scale > exponential_lpdf (const T_y &y, const T_inv_scale &beta)
 
template<typename T_inv , class RNG >
VectorBuilder< true, double, T_inv >::type exponential_rng (const T_inv &beta, RNG &rng)
 Return a exponential random variate with inverse scale beta using the specified random number generator.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > frechet_ccdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > frechet_cdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > frechet_cdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > frechet_lccdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > frechet_lcdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > frechet_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > frechet_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > frechet_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > frechet_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type frechet_rng (const T_shape &alpha, const T_scale &sigma, RNG &rng)
 Return a pseudorandom Frechet variate for the given shape and scale parameters using the specified random number generator.
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_ccdf_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_cdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 The cumulative density function for a gamma distribution for y with the specified shape and inverse scale parameters.
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_cdf_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_lccdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_lcdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 The log of a gamma density for y with the specified shape and inverse scale parameters.
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_log (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_inv_scale > * = nullptr>
return_type_t< T_y, T_shape, T_inv_scale > gamma_lpdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 The log of a gamma density for y with the specified shape and inverse scale parameters.
 
template<typename T_y , typename T_shape , typename T_inv_scale >
return_type_t< T_y, T_shape, T_inv_scale > gamma_lpdf (const T_y &y, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_shape , typename T_inv , class RNG >
VectorBuilder< true, double, T_shape, T_inv >::type gamma_rng (const T_shape &alpha, const T_inv &beta, RNG &rng)
 Return a gamma random variate for the given shape and inverse scale parameters using the specified random number generator.
 
template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type_t< T_y, T_F, T_G, T_V, T_W, T_m0, T_C0 > gaussian_dlm_obs_log (const T_y &y, const T_F &F, const T_G &G, const T_V &V, const T_W &W, const T_m0 &m0, const T_C0 &C0)
 
template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type_t< T_y, T_F, T_G, T_V, T_W, T_m0, T_C0 > gaussian_dlm_obs_log (const T_y &y, const T_F &F, const T_G &G, const T_V &V, const T_W &W, const T_m0 &m0, const T_C0 &C0)
 
template<bool propto, typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 , require_all_eigen_matrix_dynamic_t< T_y, T_F, T_G, T_V, T_W, T_C0 > * = nullptr, require_eigen_col_vector_t< T_m0 > * = nullptr>
return_type_t< T_y, T_F, T_G, T_V, T_W, T_m0, T_C0 > gaussian_dlm_obs_lpdf (const T_y &y, const T_F &F, const T_G &G, const T_V &V, const T_W &W, const T_m0 &m0, const T_C0 &C0)
 The log of a Gaussian dynamic linear model (GDLM).
 
template<typename T_y , typename T_F , typename T_G , typename T_V , typename T_W , typename T_m0 , typename T_C0 >
return_type_t< T_y, T_F, T_G, T_V, T_W, T_m0, T_C0 > gaussian_dlm_obs_lpdf (const T_y &y, const T_F &F, const T_G &G, const T_V &V, const T_W &W, const T_m0 &m0, const T_C0 &C0)
 
template<class RNG >
Eigen::MatrixXd gaussian_dlm_obs_rng (const Eigen::MatrixXd &F, const Eigen::MatrixXd &G, const Eigen::MatrixXd &V, const Eigen::MatrixXd &W, const Eigen::VectorXd &m0, const Eigen::MatrixXd &C0, const int T, RNG &rng)
 Simulate random draw from Gaussian dynamic linear model (GDLM).
 
template<class RNG >
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > gaussian_dlm_obs_rng (const Eigen::MatrixXd &F, const Eigen::MatrixXd &G, const Eigen::VectorXd &V, const Eigen::MatrixXd &W, const Eigen::VectorXd &m0, const Eigen::MatrixXd &C0, const int T, RNG &rng)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > gumbel_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > gumbel_cdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel distribution cumulative distribution for the given location and scale.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > gumbel_cdf_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > gumbel_lccdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel log complementary cumulative distribution for the given location and scale.
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > gumbel_lcdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel log cumulative distribution for the given location and scale.
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > gumbel_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > gumbel_log (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > gumbel_lpdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 Returns the Gumbel log probability density for the given location and scale.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > gumbel_lpdf (const T_y &y, const T_loc &mu, const T_scale &beta)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type gumbel_rng (const T_loc &mu, const T_scale &beta, RNG &rng)
 Return a Gumbel random variate with the given location and scale using the specified random number generator.
 
template<typename T_omega , typename T_Gamma , typename T_rho , require_all_eigen_t< T_omega, T_Gamma > * = nullptr, require_eigen_col_vector_t< T_rho > * = nullptr>
Eigen::MatrixXd hmm_hidden_state_prob (const T_omega &log_omegas, const T_Gamma &Gamma, const T_rho &rho)
 For a hidden Markov model with observation y, hidden state x, and parameters theta, compute the marginal probability vector for each x, given y and theta, p(x_i | y, theta).
 
template<typename T_omega , typename T_Gamma , typename T_rho , class RNG , require_all_eigen_t< T_omega, T_Gamma > * = nullptr, require_eigen_col_vector_t< T_rho > * = nullptr>
std::vector< int > hmm_latent_rng (const T_omega &log_omegas, const T_Gamma &Gamma, const T_rho &rho, RNG &rng)
 For a hidden Markov model with observation y, hidden state x, and parameters theta, generate samples from the posterior distribution of the hidden states, x.
 
template<typename T_omega , typename T_Gamma , typename T_rho , typename T_alpha >
auto hmm_marginal_val (const Eigen::Matrix< T_omega, Eigen::Dynamic, Eigen::Dynamic > &omegas, const T_Gamma &Gamma_val, const T_rho &rho_val, Eigen::Matrix< T_alpha, Eigen::Dynamic, Eigen::Dynamic > &alphas, Eigen::Matrix< T_alpha, Eigen::Dynamic, 1 > &alpha_log_norms, T_alpha &norm_norm)
 
template<typename T_omega , typename T_Gamma , typename T_rho , require_all_eigen_t< T_omega, T_Gamma > * = nullptr, require_eigen_col_vector_t< T_rho > * = nullptr>
auto hmm_marginal (const T_omega &log_omegas, const T_Gamma &Gamma, const T_rho &rho)
 For a Hidden Markov Model with observation y, hidden state x, and parameters theta, return the log marginal density, log p(y | theta).
 
template<bool propto, typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_log (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_log (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<bool propto, typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_lpmf (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<typename T_n , typename T_N , typename T_a , typename T_b >
double hypergeometric_lpmf (const T_n &n, const T_N &N, const T_a &a, const T_b &b)
 
template<class RNG >
int hypergeometric_rng (int N, int a, int b, RNG &rng)
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_ccdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_cdf (const T_y &y, const T_dof &nu)
 Returns the inverse chi square cumulative distribution function for the given variate and degrees of freedom.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_cdf_log (const T_y &y, const T_dof &nu)
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_lccdf (const T_y &y, const T_dof &nu)
 Returns the inverse chi square log complementary cumulative distribution function for the given variate and degrees of freedom.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_lcdf (const T_y &y, const T_dof &nu)
 Returns the inverse chi square log cumulative distribution function for the given variate and degrees of freedom.
 
template<bool propto, typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_log (const T_y &y, const T_dof &nu)
 The log of an inverse chi-squared density for y with the specified degrees of freedom parameter.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_log (const T_y &y, const T_dof &nu)
 
template<bool propto, typename T_y , typename T_dof , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_dof > * = nullptr>
return_type_t< T_y, T_dof > inv_chi_square_lpdf (const T_y &y, const T_dof &nu)
 The log of an inverse chi-squared density for y with the specified degrees of freedom parameter.
 
template<typename T_y , typename T_dof >
return_type_t< T_y, T_dof > inv_chi_square_lpdf (const T_y &y, const T_dof &nu)
 
template<typename T_deg , class RNG >
VectorBuilder< true, double, T_deg >::type inv_chi_square_rng (const T_deg &nu, RNG &rng)
 Return a pseudorandom inverse chi squared variate with the nu degrees of freedom using the specified random number generator.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_ccdf_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_cdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 The CDF of an inverse gamma density for y with the specified shape and scale parameters.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_cdf_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_lccdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_lcdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 The log of an inverse gamma density for y with the specified shape and scale parameters.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_log (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > inv_gamma_lpdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 The log of an inverse gamma density for y with the specified shape and scale parameters.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > inv_gamma_lpdf (const T_y &y, const T_shape &alpha, const T_scale &beta)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type inv_gamma_rng (const T_shape &alpha, const T_scale &beta, RNG &rng)
 Return a pseudorandom inverse gamma variate for the given shape and scale parameters using the specified random number generator.
 
template<bool propto, typename T_y , typename T_dof , typename T_scale , require_stan_scalar_t< T_dof > * = nullptr, require_all_matrix_t< T_y, T_scale > * = nullptr>
return_type_t< T_y, T_dof, T_scale > inv_wishart_cholesky_lpdf (const T_y &L_Y, const T_dof &nu, const T_scale &L_S)
 Return the natural logarithm of the unnormalized inverse wishart density of the specified lower-triangular Cholesky factor variate, positive degrees of freedom, and lower-triangular Cholesky factor of the scale matrix.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > inv_wishart_cholesky_lpdf (const T_y &L_Y, const T_dof &nu, const T_scale &L_S)
 
template<class RNG >
Eigen::MatrixXd inv_wishart_cholesky_rng (double nu, const Eigen::MatrixXd &L_S, RNG &rng)
 Return a random Cholesky factor of a covariance matrix of the specified dimensionality drawn from the inverse Wishart distribution with the specified degrees of freedom using the specified random number generator.
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > inv_wishart_log (const T_y &W, const T_dof &nu, const T_scale &S)
 The log of the Inverse-Wishart density for the given W, degrees of freedom, and scale matrix.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > inv_wishart_log (const T_y &W, const T_dof &nu, const T_scale &S)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > inv_wishart_lpdf (const T_y &W, const T_dof &nu, const T_scale &S)
 The log of the Inverse-Wishart density for the given W, degrees of freedom, and scale matrix.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > inv_wishart_lpdf (const T_y &W, const T_dof &nu, const T_scale &S)
 
template<class RNG >
Eigen::MatrixXd inv_wishart_rng (double nu, const Eigen::MatrixXd &S, RNG &rng)
 
template<bool propto, typename T_covar , typename T_shape >
return_type_t< T_covar, T_shape > lkj_corr_cholesky_log (const T_covar &L, const T_shape &eta)
 
template<typename T_covar , typename T_shape >
return_type_t< T_covar, T_shape > lkj_corr_cholesky_log (const T_covar &L, const T_shape &eta)
 
template<bool propto, typename T_covar , typename T_shape >
return_type_t< T_covar, T_shape > lkj_corr_cholesky_lpdf (const T_covar &L, const T_shape &eta)
 
template<typename T_covar , typename T_shape >
return_type_t< T_covar, T_shape > lkj_corr_cholesky_lpdf (const T_covar &L, const T_shape &eta)
 
template<class RNG >
Eigen::MatrixXd lkj_corr_cholesky_rng (size_t K, double eta, RNG &rng)
 
template<bool propto, typename T_y , typename T_shape >
return_type_t< T_y, T_shape > lkj_corr_log (const T_y &y, const T_shape &eta)
 
template<typename T_y , typename T_shape >
return_type_t< T_y, T_shape > lkj_corr_log (const T_y &y, const T_shape &eta)
 
template<typename T_shape >
return_type_t< double, T_shape > do_lkj_constant (const T_shape &eta, const unsigned int &K)
 
template<bool propto, typename T_y , typename T_shape >
return_type_t< T_y, T_shape > lkj_corr_lpdf (const T_y &y, const T_shape &eta)
 
template<typename T_y , typename T_shape >
return_type_t< T_y, T_shape > lkj_corr_lpdf (const T_y &y, const T_shape &eta)
 
template<class RNG >
Eigen::MatrixXd lkj_corr_rng (size_t K, double eta, RNG &rng)
 Return a random correlation matrix (symmetric, positive definite, unit diagonal) of the specified dimensionality drawn from the LKJ distribution with the specified degrees of freedom using the specified random number generator.
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > lkj_cov_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > lkj_cov_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape , require_eigen_matrix_dynamic_t< T_y > * = nullptr, require_all_eigen_col_vector_t< T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_shape > lkj_cov_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > lkj_cov_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &eta)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > logistic_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > logistic_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > logistic_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > logistic_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > logistic_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > logistic_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > logistic_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > logistic_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > logistic_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type logistic_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a Logistic random variate for the given location and scale using the specified random number generator.
 
template<typename T_y , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_scale, T_shape > loglogistic_cdf (const T_y &y, const T_scale &alpha, const T_shape &beta)
 The loglogistic cumulative distribution function for the specified scalar(s) given the specified scales(s) and shape(s).
 
template<bool propto, typename T_y , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_scale, T_shape > loglogistic_log (const T_y &y, const T_scale &alpha, const T_shape &beta)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type_t< T_y, T_scale, T_shape > loglogistic_log (const T_y &y, const T_scale &alpha, const T_shape &beta)
 
template<bool propto, typename T_y , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_scale, T_shape > loglogistic_lpdf (const T_y &y, const T_scale &alpha, const T_shape &beta)
 The log of the loglogistic density for the specified scalar(s) given the specified scales(s) and shape(s).
 
template<typename T_y , typename T_scale , typename T_shape >
return_type_t< T_y, T_scale, T_shape > loglogistic_lpdf (const T_y &y, const T_scale &alpha, const T_shape &beta)
 
template<typename T_scale , typename T_shape , class RNG >
VectorBuilder< true, double, T_scale, T_shape >::type loglogistic_rng (const T_scale &alpha, const T_shape &beta, RNG &rng)
 Return a loglogistic random variate for the given scale and shape parameters using the specified random number generator.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > lognormal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > lognormal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > lognormal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > lognormal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > lognormal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > lognormal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > lognormal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > lognormal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > lognormal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type lognormal_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a lognormal random variate for the given location and scale using the specified random number generator.
 
template<bool propto, typename T_y , typename T_Mu , typename T_Sigma , typename T_D , require_all_matrix_t< T_y, T_Mu, T_Sigma, T_D > * = nullptr>
return_type_t< T_y, T_Mu, T_Sigma, T_D > matrix_normal_prec_log (const T_y &y, const T_Mu &Mu, const T_Sigma &Sigma, const T_D &D)
 The log of the matrix normal density for the given y, mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices.
 
template<typename T_y , typename T_Mu , typename T_Sigma , typename T_D , require_all_matrix_t< T_y, T_Mu, T_Sigma, T_D > * = nullptr>
return_type_t< T_y, T_Mu, T_Sigma, T_D > matrix_normal_prec_log (const T_y &y, const T_Mu &Mu, const T_Sigma &Sigma, const T_D &D)
 
template<bool propto, typename T_y , typename T_Mu , typename T_Sigma , typename T_D , require_all_matrix_t< T_y, T_Mu, T_Sigma, T_D > * = nullptr>
return_type_t< T_y, T_Mu, T_Sigma, T_D > matrix_normal_prec_lpdf (const T_y &y, const T_Mu &Mu, const T_Sigma &Sigma, const T_D &D)
 The log of the matrix normal density for the given y, mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices.
 
template<typename T_y , typename T_Mu , typename T_Sigma , typename T_D , require_all_matrix_t< T_y, T_Mu, T_Sigma, T_D > * = nullptr>
return_type_t< T_y, T_Mu, T_Sigma, T_D > matrix_normal_prec_lpdf (const T_y &y, const T_Mu &Mu, const T_Sigma &Sigma, const T_D &D)
 
template<class RNG >
Eigen::MatrixXd matrix_normal_prec_rng (const Eigen::MatrixXd &Mu, const Eigen::MatrixXd &Sigma, const Eigen::MatrixXd &D, RNG &rng)
 Sample from the the matrix normal distribution for the given Mu, Sigma and D where Sigma and D are given as precision matrices, not covariance matrices.
 
template<bool propto, typename T_y , typename T_covar , typename T_w >
return_type_t< T_y, T_covar, T_w > multi_gp_cholesky_log (const T_y &y, const T_covar &L, const T_w &w)
 The log of a multivariate Gaussian Process for the given y, w, and a Cholesky factor L of the kernel matrix Sigma.
 
template<typename T_y , typename T_covar , typename T_w >
return_type_t< T_y, T_covar, T_w > multi_gp_cholesky_log (const T_y &y, const T_covar &L, const T_w &w)
 
template<bool propto, typename T_y , typename T_covar , typename T_w , require_all_eigen_matrix_dynamic_t< T_y, T_covar > * = nullptr, require_eigen_col_vector_t< T_w > * = nullptr>
return_type_t< T_y, T_covar, T_w > multi_gp_cholesky_lpdf (const T_y &y, const T_covar &L, const T_w &w)
 The log of a multivariate Gaussian Process for the given y, w, and a Cholesky factor L of the kernel matrix Sigma.
 
template<typename T_y , typename T_covar , typename T_w >
return_type_t< T_y, T_covar, T_w > multi_gp_cholesky_lpdf (const T_y &y, const T_covar &L, const T_w &w)
 
template<bool propto, typename T_y , typename T_covar , typename T_w >
return_type_t< T_y, T_covar, T_w > multi_gp_log (const T_y &y, const T_covar &Sigma, const T_w &w)
 The log of a multivariate Gaussian Process for the given y, Sigma, and w.
 
template<typename T_y , typename T_covar , typename T_w >
return_type_t< T_y, T_covar, T_w > multi_gp_log (const T_y &y, const T_covar &Sigma, const T_w &w)
 
template<bool propto, typename T_y , typename T_covar , typename T_w , require_all_matrix_t< T_y, T_covar > * = nullptr, require_col_vector_t< T_w > * = nullptr>
return_type_t< T_y, T_covar, T_w > multi_gp_lpdf (const T_y &y, const T_covar &Sigma, const T_w &w)
 The log of a multivariate Gaussian Process for the given y, Sigma, and w.
 
template<typename T_y , typename T_covar , typename T_w >
return_type_t< T_y, T_covar, T_w > multi_gp_lpdf (const T_y &y, const T_covar &Sigma, const T_w &w)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_cholesky_log (const T_y &y, const T_loc &mu, const T_covar &L)
 The log of the multivariate normal density for the given y, mu, and a Cholesky factor L of the variance matrix.
 
template<typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_cholesky_log (const T_y &y, const T_loc &mu, const T_covar &L)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar , require_any_not_vector_vt< is_stan_scalar, T_y, T_loc > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar > * = nullptr>
return_type_t< T_y, T_loc, T_covar > multi_normal_cholesky_lpdf (const T_y &y, const T_loc &mu, const T_covar &L)
 The log of the multivariate normal density for the given y, mu, and a Cholesky factor L of the variance matrix.
 
template<typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_cholesky_lpdf (const T_y &y, const T_loc &mu, const T_covar &L)
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_normal_cholesky_rng (const T_loc &mu, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &L, RNG &rng)
 Return a multivariate normal random variate with the given location and Cholesky factorization of the covariance using the specified random number generator.
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar , require_any_not_vector_vt< is_stan_scalar, T_y, T_loc > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar > * = nullptr>
return_type_t< T_y, T_loc, T_covar > multi_normal_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_prec_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_prec_log (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_prec_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_y , typename T_loc , typename T_covar >
return_type_t< T_y, T_loc, T_covar > multi_normal_prec_lpdf (const T_y &y, const T_loc &mu, const T_covar &Sigma)
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_normal_prec_rng (const T_loc &mu, const Eigen::MatrixXd &S, RNG &rng)
 Return a multivariate normal random variate with the given location and precision using the specified random number generator.
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_normal_rng (const T_loc &mu, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &S, RNG &rng)
 Return a multivariate normal random variate with the given location and covariance using the specified random number generator.
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_covar , require_any_not_vector_vt< is_stan_scalar, T_y, T_dof, T_loc > * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar > * = nullptr>
return_type_t< T_y, T_dof, T_loc, T_covar > multi_student_t_cholesky_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_covar &L)
 The log of the multivariate student t density for the given y, mu, nu, and a Cholesky factor L of the scale matrix.
 
template<typename T_y , typename T_dof , typename T_loc , typename T_covar >
return_type_t< T_y, T_dof, T_loc, T_covar > multi_student_t_cholesky_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_covar &L)
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_student_t_cholesky_rng (double nu, const T_loc &mu, const Eigen::MatrixXd &L, RNG &rng)
 Return a multivariate student-t random variate with the given degrees of freedom location and Cholesky factor the scale matrix using the specified random number generator.
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > multi_student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 Return the log of the multivariate Student t distribution at the specified arguments.
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > multi_student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > multi_student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 The log of the multivariate student t density for the given y, mu, nu, and scale matrix.
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > multi_student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &Sigma)
 
template<typename T_loc , class RNG >
StdVectorBuilder< true, Eigen::VectorXd, T_loc >::type multi_student_t_rng (double nu, const T_loc &mu, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &S, RNG &rng)
 Return a multivariate student-t random variate with the given degrees of freedom location and Cholesky factor the scale matrix using the specified random number generator.
 
template<bool propto, typename T_prob >
return_type_t< T_prob > multinomial_log (const std::vector< int > &ns, const T_prob &theta)
 
template<typename T_prob >
return_type_t< T_prob > multinomial_log (const std::vector< int > &ns, const T_prob &theta)
 
template<bool propto, typename T_beta , require_eigen_col_vector_t< T_beta > * = nullptr>
return_type_t< T_beta > multinomial_logit_log (const std::vector< int > &ns, const T_beta &beta)
 
template<typename T_beta , require_eigen_col_vector_t< T_beta > * = nullptr>
return_type_t< T_beta > multinomial_logit_log (const std::vector< int > &ns, const T_beta &beta)
 
template<bool propto, typename T_beta , typename T_prob = scalar_type_t<T_beta>, require_eigen_col_vector_t< T_beta > * = nullptr>
return_type_t< T_prob > multinomial_logit_lpmf (const std::vector< int > &ns, const T_beta &beta)
 Multinomial log PMF in log parametrization.
 
template<typename T_beta , require_eigen_col_vector_t< T_beta > * = nullptr>
return_type_t< T_beta > multinomial_logit_lpmf (const std::vector< int > &ns, const T_beta &beta)
 
template<class RNG , typename T_beta , require_eigen_col_vector_t< T_beta > * = nullptr>
std::vector< int > multinomial_logit_rng (const T_beta &beta, int N, RNG &rng)
 Return a draw from a Multinomial distribution given a a vector of unnormalized log probabilities and a pseudo-random number generator.
 
template<bool propto, typename T_prob , require_eigen_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > multinomial_lpmf (const std::vector< int > &ns, const T_prob &theta)
 
template<typename T_prob >
return_type_t< T_prob > multinomial_lpmf (const std::vector< int > &ns, const T_prob &theta)
 
template<class T_theta , class RNG , require_eigen_col_vector_t< T_theta > * = nullptr>
std::vector< int > multinomial_rng (const T_theta &theta, int N, RNG &rng)
 
template<typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_ccdf_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_cdf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_cdf_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_lccdf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_lcdf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<bool propto, typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_log (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type_t< T_x, T_alpha, T_beta, T_precision > neg_binomial_2_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type_t< T_x, T_alpha, T_beta, T_precision > neg_binomial_2_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision , require_matrix_t< T_x > * = nullptr>
return_type_t< T_x, T_alpha, T_beta, T_precision > neg_binomial_2_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 Returns the log PMF of the Generalized Linear Model (GLM) with Negative-Binomial-2 distribution and log link function.
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision >
return_type_t< T_x, T_alpha, T_beta, T_precision > neg_binomial_2_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_precision &phi)
 
template<bool propto, typename T_n , typename T_log_location , typename T_precision >
return_type_t< T_log_location, T_precision > neg_binomial_2_log_log (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<typename T_n , typename T_log_location , typename T_precision >
return_type_t< T_log_location, T_precision > neg_binomial_2_log_log (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<bool propto, typename T_n , typename T_log_location , typename T_precision , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_log_location, T_precision > * = nullptr>
return_type_t< T_log_location, T_precision > neg_binomial_2_log_lpmf (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<typename T_n , typename T_log_location , typename T_precision >
return_type_t< T_log_location, T_precision > neg_binomial_2_log_lpmf (const T_n &n, const T_log_location &eta, const T_precision &phi)
 
template<typename T_loc , typename T_inv , class RNG >
VectorBuilder< true, int, T_loc, T_inv >::type neg_binomial_2_log_rng (const T_loc &eta, const T_inv &phi, RNG &rng)
 Return a negative binomial random variate with the specified log-location and inverse dispersion parameters using the given random number generator.
 
template<bool propto, typename T_n , typename T_location , typename T_precision , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_location, T_precision > * = nullptr>
return_type_t< T_location, T_precision > neg_binomial_2_lpmf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_n , typename T_location , typename T_precision >
return_type_t< T_location, T_precision > neg_binomial_2_lpmf (const T_n &n, const T_location &mu, const T_precision &phi)
 
template<typename T_loc , typename T_prec , class RNG >
VectorBuilder< true, int, T_loc, T_prec >::type neg_binomial_2_rng (const T_loc &mu, const T_prec &phi, RNG &rng)
 Return a negative binomial random variate with the specified location and precision parameters using the given random number generator.
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_ccdf_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_cdf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_cdf_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_lccdf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta_param)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_lcdf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta_param)
 
template<bool propto, typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_log (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<bool propto, typename T_n , typename T_shape , typename T_inv_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_shape, T_inv_scale > * = nullptr>
return_type_t< T_shape, T_inv_scale > neg_binomial_lpmf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_n , typename T_shape , typename T_inv_scale >
return_type_t< T_shape, T_inv_scale > neg_binomial_lpmf (const T_n &n, const T_shape &alpha, const T_inv_scale &beta)
 
template<typename T_shape , typename T_inv , class RNG >
VectorBuilder< true, int, T_shape, T_inv >::type neg_binomial_rng (const T_shape &alpha, const T_inv &beta, RNG &rng)
 Return a negative binomial random variate with the specified shape and inverse scale parameters using the given random number generator.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > normal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > normal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 Calculates the normal cumulative distribution function for the given variate, location, and scale.
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > normal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type_t< T_y, T_x, T_alpha, T_beta, T_scale > normal_id_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type_t< T_y, T_x, T_alpha, T_beta, T_scale > normal_id_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale , require_matrix_t< T_x > * = nullptr>
return_type_t< T_y, T_x, T_alpha, T_beta, T_scale > normal_id_glm_lpdf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 Returns the log PDF of the Generalized Linear Model (GLM) with Normal distribution and id link function.
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_scale >
return_type_t< T_y, T_x, T_alpha, T_beta, T_scale > normal_id_glm_lpdf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > normal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > normal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s).
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_loc, T_scale > normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s).
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma)
 
template<typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_loc, T_scale >::type normal_rng (const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a Normal random variate for the given location and scale using the specified random number generator.
 
template<bool propto, typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type_t< T_y, T_s, T_loc, T_scale > normal_sufficient_log (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type_t< T_y, T_s, T_loc, T_scale > normal_sufficient_log (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type_t< T_y, T_s, T_loc, T_scale > normal_sufficient_lpdf (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 The log of the normal density for the specified scalar(s) given the specified mean(s) and deviation(s).
 
template<typename T_y , typename T_s , typename T_n , typename T_loc , typename T_scale >
return_type_t< T_y, T_s, T_loc, T_scale > normal_sufficient_lpdf (const T_y &y_bar, const T_s &s_squared, const T_n &n_obs, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_x , typename T_beta , typename T_cuts , require_matrix_t< T_x > * = nullptr, require_all_col_vector_t< T_beta, T_cuts > * = nullptr>
return_type_t< T_x, T_beta, T_cuts > ordered_logistic_glm_lpmf (const T_y &y, const T_x &x, const T_beta &beta, const T_cuts &cuts)
 Returns the log PMF of the ordinal regression Generalized Linear Model (GLM).
 
template<typename T_y , typename T_x , typename T_beta , typename T_cuts >
return_type_t< T_x, T_beta, T_cuts > ordered_logistic_glm_lpmf (const T_y &y, const T_x &x, const T_beta &beta, const T_cuts &cuts)
 
template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type_t< T_loc, T_cut > ordered_logistic_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 Returns the (natural) log probability of the integer/s given the vector of continuous location/s and specified cutpoints in an ordered logistic model.
 
template<typename T_y , typename T_loc , typename T_cut >
return_type_t< T_loc, T_cut > ordered_logistic_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 
template<bool propto, typename T_y , typename T_loc , typename T_cut , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_cut > * = nullptr>
return_type_t< T_loc, T_cut > ordered_logistic_lpmf (const T_y &y, const T_loc &lambda, const T_cut &c)
 Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and specified cutpoints in an ordered logistic model.
 
template<typename T_y , typename T_loc , typename T_cut >
return_type_t< T_loc, T_cut > ordered_logistic_lpmf (const T_y &y, const T_loc &lambda, const T_cut &c)
 
template<class RNG >
int ordered_logistic_rng (double eta, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &c, RNG &rng)
 
template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type_t< T_loc, T_cut > ordered_probit_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 Returns the (natural) log probability of the integer/s given the vector of continuous location/s and specified cutpoints in an ordered probit model.
 
template<typename T_y , typename T_loc , typename T_cut >
return_type_t< T_loc, T_cut > ordered_probit_log (const T_y &y, const T_loc &lambda, const T_cut &c)
 
template<bool propto, typename T_y , typename T_loc , typename T_cut >
return_type_t< T_loc, T_cut > ordered_probit_lpmf (const T_y &y, const T_loc &lambda, const T_cut &c)
 Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and array of specified cutpoints in an ordered probit model.
 
template<typename T_y , typename T_loc , typename T_cut >
return_type_t< T_loc, T_cut > ordered_probit_lpmf (const T_y &y, const T_loc &lambda, const T_cut &c)
 
template<class RNG >
int ordered_probit_rng (double eta, const Eigen::VectorXd &c, RNG &rng)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type_t< T_y, T_scale, T_shape > pareto_ccdf_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_scale, T_shape > pareto_cdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type_t< T_y, T_scale, T_shape > pareto_cdf_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_scale, T_shape > pareto_lccdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_scale, T_shape > pareto_lcdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_scale , typename T_shape >
return_type_t< T_y, T_scale, T_shape > pareto_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type_t< T_y, T_scale, T_shape > pareto_log (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_scale, T_shape > pareto_lpdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_y , typename T_scale , typename T_shape >
return_type_t< T_y, T_scale, T_shape > pareto_lpdf (const T_y &y, const T_scale &y_min, const T_shape &alpha)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type pareto_rng (const T_scale &y_min, const T_shape &alpha, RNG &rng)
 Return a Pareto random variate for the given shape and scale parameters using the specified random number generator.
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_cdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_cdf_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_lccdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_lcdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_log (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_lpdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > pareto_type_2_lpdf (const T_y &y, const T_loc &mu, const T_scale &lambda, const T_shape &alpha)
 
template<typename T_loc , typename T_scale , typename T_shape , class RNG >
VectorBuilder< true, double, T_loc, T_scale, T_shape >::type pareto_type_2_rng (const T_loc &mu, const T_scale &lambda, const T_shape &alpha, RNG &rng)
 Return a Pareto type 2 random variate for the given location, scale, and shape using the specified random number generator.
 
template<typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_ccdf_log (const T_y &y, const T_theta &theta)
 
template<bool propto, typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_cdf (const T_y &y, const T_theta &theta)
 Returns the CDF for the Poisson-binomial distribution evaluated at the specified number of successes and probabilities of successes.
 
template<typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_cdf (const T_y &y, const T_theta &theta)
 
template<typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_cdf_log (const T_y &y, const T_theta &theta)
 
template<bool propto, typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_lccdf (const T_y &y, const T_theta &theta)
 Returns the log CCDF for the Poisson-binomial distribution evaluated at the specified number of successes and probabilities of successes.
 
template<typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_lccdf (const T_y &y, const T_theta &theta)
 
template<bool propto, typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_lcdf (const T_y &y, const T_theta &theta)
 Returns the log CDF for the Poisson-binomial distribution evaluated at the specified number of successes and probabilities of successes.
 
template<typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_lcdf (const T_y &y, const T_theta &theta)
 
template<bool propto, typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_log (const T_y &y, const T_theta &theta)
 
template<typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_log (const T_y &y, const T_theta &theta)
 
template<bool propto, typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_lpmf (const T_y &y, const T_theta &theta)
 Returns the log PMF for the Poisson-binomial distribution evaluated at an specified array of numbers of successes and probabilities of successes.
 
template<typename T_y , typename T_theta >
return_type_t< T_theta > poisson_binomial_lpmf (const T_y &y, const T_theta &theta)
 
template<typename T_theta , typename RNG , require_eigen_vt< std::is_arithmetic, T_theta > * = nullptr>
int poisson_binomial_rng (const T_theta &theta, RNG &rng)
 Return a pseudorandom Poisson binomial random variable for the given vector of success parameters using the specified random number generator.
 
template<typename T_n , typename T_rate >
return_type_t< T_rate > poisson_ccdf_log (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type_t< T_rate > poisson_cdf (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type_t< T_rate > poisson_cdf_log (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type_t< T_rate > poisson_lccdf (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type_t< T_rate > poisson_lcdf (const T_n &n, const T_rate &lambda)
 
template<bool propto, typename T_n , typename T_rate >
return_type_t< T_rate > poisson_log (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type_t< T_rate > poisson_log (const T_n &n, const T_rate &lambda)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_alpha, T_beta > poisson_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_alpha, T_beta > poisson_log_glm_log (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , require_matrix_t< T_x > * = nullptr>
return_type_t< T_x, T_alpha, T_beta > poisson_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 Returns the log PMF of the Generalized Linear Model (GLM) with Poisson distribution and log link function.
 
template<typename T_y , typename T_x , typename T_alpha , typename T_beta >
return_type_t< T_x, T_alpha, T_beta > poisson_log_glm_lpmf (const T_y &y, const T_x &x, const T_alpha &alpha, const T_beta &beta)
 
template<bool propto, typename T_n , typename T_log_rate >
return_type_t< T_log_rate > poisson_log_log (const T_n &n, const T_log_rate &alpha)
 
template<typename T_n , typename T_log_rate >
return_type_t< T_log_rate > poisson_log_log (const T_n &n, const T_log_rate &alpha)
 
template<bool propto, typename T_n , typename T_log_rate , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_log_rate > * = nullptr>
return_type_t< T_log_rate > poisson_log_lpmf (const T_n &n, const T_log_rate &alpha)
 
template<typename T_n , typename T_log_rate >
return_type_t< T_log_rate > poisson_log_lpmf (const T_n &n, const T_log_rate &alpha)
 
template<typename T_rate , class RNG >
VectorBuilder< true, int, T_rate >::type poisson_log_rng (const T_rate &alpha, RNG &rng)
 Return a Poisson random variate with specified log rate parameter using the given random number generator.
 
template<bool propto, typename T_n , typename T_rate , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_n, T_rate > * = nullptr>
return_type_t< T_rate > poisson_lpmf (const T_n &n, const T_rate &lambda)
 
template<typename T_n , typename T_rate >
return_type_t< T_rate > poisson_lpmf (const T_n &n, const T_rate &lambda)
 
template<typename T_rate , class RNG >
VectorBuilder< true, int, T_rate >::type poisson_rng (const T_rate &lambda, RNG &rng)
 Return a Poisson random variate with specified rate parameter using the given random number generator.
 
template<typename T_y , typename T_scale >
return_type_t< T_y, T_scale > rayleigh_ccdf_log (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale > * = nullptr>
return_type_t< T_y, T_scale > rayleigh_cdf (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type_t< T_y, T_scale > rayleigh_cdf_log (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale > * = nullptr>
return_type_t< T_y, T_scale > rayleigh_lccdf (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale > * = nullptr>
return_type_t< T_y, T_scale > rayleigh_lcdf (const T_y &y, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_scale >
return_type_t< T_y, T_scale > rayleigh_log (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type_t< T_y, T_scale > rayleigh_log (const T_y &y, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_scale > * = nullptr>
return_type_t< T_y, T_scale > rayleigh_lpdf (const T_y &y, const T_scale &sigma)
 
template<typename T_y , typename T_scale >
return_type_t< T_y, T_scale > rayleigh_lpdf (const T_y &y, const T_scale &sigma)
 
template<typename T_scale , class RNG >
VectorBuilder< true, double, T_scale >::type rayleigh_rng (const T_scale &sigma, RNG &rng)
 Return a Rayleigh random variate with scale parameter sigma using the specified random number generator.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_ccdf_log (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_cdf (const T_y &y, const T_dof &nu, const T_scale &s)
 The CDF of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_cdf_log (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_lccdf (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_lcdf (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_log (const T_y &y, const T_dof &nu, const T_scale &s)
 The log of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_log (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_dof, T_scale > * = nullptr>
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_lpdf (const T_y &y, const T_dof &nu, const T_scale &s)
 The log of a scaled inverse chi-squared density for y with the specified degrees of freedom parameter and scale parameter.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > scaled_inv_chi_square_lpdf (const T_y &y, const T_dof &nu, const T_scale &s)
 
template<typename T_deg , typename T_scale , class RNG >
VectorBuilder< true, double, T_deg, T_scale >::type scaled_inv_chi_square_rng (const T_deg &nu, const T_scale &s, RNG &rng)
 Return a scaled chi square random variate for the given number of degrees of freedom and scale using the specified random number generator.
 
template<typename T_y , typename T_loc , typename T_scale , typename T_skewness >
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_skewness , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_skewness > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 Returns the skew double exponential cumulative density function.
 
template<typename T_y , typename T_loc , typename T_scale , typename T_skewness >
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_skewness , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_skewness > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 Returns the skew double exponential log complementary cumulative density function.
 
template<typename T_y , typename T_loc , typename T_scale , typename T_skewness , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_skewness > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 Returns the skew double exponential log cumulative density function.
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_skewness >
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_skewness >
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_skewness , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_skewness > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 Returns the skew double exponential log probability density function.
 
template<typename T_y , typename T_loc , typename T_scale , typename T_skewness >
return_type_t< T_y, T_loc, T_scale, T_skewness > skew_double_exponential_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_skewness &tau)
 
template<typename T_loc , typename T_scale , typename T_skewness , class RNG >
VectorBuilder< true, double, T_loc, T_scale, T_skewness >::type skew_double_exponential_rng (const T_loc &mu, const T_scale &sigma, const T_skewness &tau, RNG &rng)
 Return a skew double exponential random variate with the given location scale and skewness using the specified random number generator.
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_ccdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_cdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_cdf_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_lccdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_lcdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_log (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale , typename T_shape , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_scale, T_shape > * = nullptr>
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_y , typename T_loc , typename T_scale , typename T_shape >
return_type_t< T_y, T_loc, T_scale, T_shape > skew_normal_lpdf (const T_y &y, const T_loc &mu, const T_scale &sigma, const T_shape &alpha)
 
template<typename T_loc , typename T_scale , typename T_shape , class RNG >
VectorBuilder< true, double, T_loc, T_scale, T_shape >::type skew_normal_rng (const T_loc &mu, const T_scale &sigma, const T_shape &alpha, RNG &rng)
 Return a Skew-normal random variate for the given location, scale, and shape using the specified random number generator.
 
template<typename T_y >
return_type_t< T_y > std_normal_ccdf_log (const T_y &y)
 
template<typename T_y , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y > * = nullptr>
return_type_t< T_y > std_normal_cdf (const T_y &y)
 Calculates the standard normal cumulative distribution function for the given variate.
 
template<typename T_y >
return_type_t< T_y > std_normal_cdf_log (const T_y &y)
 
template<typename T_y , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y > * = nullptr>
return_type_t< T_y > std_normal_lccdf (const T_y &y)
 
template<typename T_y , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y > * = nullptr>
return_type_t< T_y > std_normal_lcdf (const T_y &y)
 
template<bool propto, typename T_y >
return_type_t< T_y > std_normal_log (const T_y &y)
 The log of a standard normal density for the specified scalar(s).
 
template<typename T_y >
return_type_t< T_y > std_normal_log (const T_y &y)
 
double std_normal_log_qf (double log_p)
 The inverse of the unit normal cumulative distribution function evaluated at the log probability.
 
template<typename T , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
auto std_normal_log_qf (const T &x)
 A vectorized version of std_normal_log_qf() that accepts std::vectors, Eigen Matrix/Array objects, or expressions, and containers of these.
 
template<bool propto, typename T_y , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y > * = nullptr>
return_type_t< T_y > std_normal_lpdf (const T_y &y)
 The log of the normal density for the specified scalar(s) given a location of 0 and a scale of 1.
 
template<typename T_y >
return_type_t< T_y > std_normal_lpdf (const T_y &y)
 
template<class RNG >
double std_normal_rng (RNG &rng)
 Return a standard Normal random variate using the specified random number generator.
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_ccdf_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_cdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_cdf_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_lccdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_lcdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 The log of the Student-t density for the given y, nu, mean, and scale parameter.
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_log (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_dof , typename T_loc , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_dof, T_loc, T_scale > * = nullptr>
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 The log of the Student-t density for the given y, nu, mean, and scale parameter.
 
template<typename T_y , typename T_dof , typename T_loc , typename T_scale >
return_type_t< T_y, T_dof, T_loc, T_scale > student_t_lpdf (const T_y &y, const T_dof &nu, const T_loc &mu, const T_scale &sigma)
 
template<typename T_deg , typename T_loc , typename T_scale , class RNG >
VectorBuilder< true, double, T_deg, T_loc, T_scale >::type student_t_rng (const T_deg &nu, const T_loc &mu, const T_scale &sigma, RNG &rng)
 Return a student-t random variate for the given degrees of freedom, location, and scale using the specified random number generator.
 
template<typename T_y , typename T_low , typename T_high >
return_type_t< T_y, T_low, T_high > uniform_ccdf_log (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_low, T_high > * = nullptr>
return_type_t< T_y, T_low, T_high > uniform_cdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high >
return_type_t< T_y, T_low, T_high > uniform_cdf_log (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_low, T_high > * = nullptr>
return_type_t< T_y, T_low, T_high > uniform_lccdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_y , typename T_low , typename T_high , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_low, T_high > * = nullptr>
return_type_t< T_y, T_low, T_high > uniform_lcdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<bool propto, typename T_y , typename T_low , typename T_high >
return_type_t< T_y, T_low, T_high > uniform_log (const T_y &y, const T_low &alpha, const T_high &beta)
 The log of a uniform density for the given y, lower, and upper bound.
 
template<typename T_y , typename T_low , typename T_high >
return_type_t< T_y, T_low, T_high > uniform_log (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<bool propto, typename T_y , typename T_low , typename T_high , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_low, T_high > * = nullptr>
return_type_t< T_y, T_low, T_high > uniform_lpdf (const T_y &y, const T_low &alpha, const T_high &beta)
 The log of a uniform density for the given y, lower, and upper bound.
 
template<typename T_y , typename T_low , typename T_high >
return_type_t< T_y, T_low, T_high > uniform_lpdf (const T_y &y, const T_low &alpha, const T_high &beta)
 
template<typename T_alpha , typename T_beta , class RNG >
VectorBuilder< true, double, T_alpha, T_beta >::type uniform_rng (const T_alpha &alpha, const T_beta &beta, RNG &rng)
 Return a uniform random variate for the given upper and lower bounds using the specified random number generator.
 
template<typename T_x , typename T_mu , typename T_k >
return_type_t< T_x, T_mu, T_k > von_mises_ccdf_log (const T_x &x, const T_mu &mu, const T_k &k)
 
template<typename T_x , typename T_mu , typename T_k >
return_type_t< T_x, T_mu, T_k > von_mises_cdf (const T_x &x, const T_mu &mu, const T_k &k)
 Calculates the cumulative distribution function of the von Mises distribution:
 
template<typename T_x , typename T_mu , typename T_k >
return_type_t< T_x, T_mu, T_k > von_mises_cdf_log (const T_x &x, const T_mu &mu, const T_k &k)
 
template<typename T_x , typename T_mu , typename T_k >
return_type_t< T_x, T_mu, T_k > von_mises_lccdf (const T_x &x, const T_mu &mu, const T_k &k)
 Calculates the log of the complement of the cumulative distribution function of the von Mises distribution:
 
template<typename T_x , typename T_mu , typename T_k >
return_type_t< T_x, T_mu, T_k > von_mises_lcdf (const T_x &x, const T_mu &mu, const T_k &k)
 Calculates the log of the cumulative distribution function of the von Mises distribution:
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > von_mises_log (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > von_mises_log (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<bool propto, typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > von_mises_lpdf (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<typename T_y , typename T_loc , typename T_scale >
return_type_t< T_y, T_loc, T_scale > von_mises_lpdf (T_y const &y, T_loc const &mu, T_scale const &kappa)
 
template<typename T_loc , typename T_conc , class RNG >
VectorBuilder< true, double, T_loc, T_conc >::type von_mises_rng (const T_loc &mu, const T_conc &kappa, RNG &rng)
 Return a von Mises random variate for the given location and concentration using the specified random number generator.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > weibull_ccdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > weibull_cdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull cumulative distribution function for the given location and scale.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > weibull_cdf_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > weibull_lccdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull log complementary cumulative distribution function for the given location and scale.
 
template<typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > weibull_lcdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull log cumulative distribution function for the given location and scale.
 
template<bool propto, typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > weibull_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > weibull_log (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<bool propto, typename T_y , typename T_shape , typename T_scale , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_shape, T_scale > * = nullptr>
return_type_t< T_y, T_shape, T_scale > weibull_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 Returns the Weibull log probability density for the given location and scale.
 
template<typename T_y , typename T_shape , typename T_scale >
return_type_t< T_y, T_shape, T_scale > weibull_lpdf (const T_y &y, const T_shape &alpha, const T_scale &sigma)
 
template<typename T_shape , typename T_scale , class RNG >
VectorBuilder< true, double, T_shape, T_scale >::type weibull_rng (const T_shape &alpha, const T_scale &sigma, RNG &rng)
 Return a Weibull random variate for the given shape and scale parameters using the specified random number generator.
 
template<bool propto = false, typename T_y , typename T_a , typename T_t0 , typename T_w , typename T_v , typename T_sv >
auto wiener_lpdf (const T_y &y, const T_a &a, const T_t0 &t0, const T_w &w, const T_v &v, const T_sv &sv, const double &precision_derivatives=1e-4)
 Log-density function for the 5-parameter Wiener density.
 
template<bool propto = false, typename T_y , typename T_a , typename T_t0 , typename T_w , typename T_v , typename T_sv , typename T_sw , typename T_st0 >
auto wiener_lpdf (const T_y &y, const T_a &a, const T_t0 &t0, const T_w &w, const T_v &v, const T_sv &sv, const T_sw &sw, const T_st0 &st0, const double &precision_derivatives=1e-4)
 The log of the first passage time density function for a (Wiener) drift diffusion model with up to 7 parameters, where \(y\in \mathbb{R}_{+}\) is the reacion time, \(a \in \mathbb{R}_{+}\) the boundary separation, \(t_0 \in \mathbb{R}_{\geq 0}\) the non-decision time, \(w \in (0, 1)\) the relative starting point (aka a-priori bias), \(v \in \mathbb{R}\) the drifte rate, \(s_v \in \mathbb{R}_{\geq 0}\) the inter-trial variability of the drift rate, \(s_w \in [0, 1)\) the inter-trial variability of the relative starting point, and \(s_{t_0} \in \mathbb{R}_{\geq 0}\) the inter-trial variability of the non-decision time.
 
template<bool propto, typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type_t< T_y, T_alpha, T_tau, T_beta, T_delta > wiener_log (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 The log of the first passage time density function for a (Wiener) drift diffusion model for the given \(y\), boundary separation \(\alpha\), nondecision time \(\tau\), relative bias \(\beta\), and drift rate \(\delta\).
 
template<typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type_t< T_y, T_alpha, T_tau, T_beta, T_delta > wiener_log (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 
template<bool propto, typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type_t< T_y, T_alpha, T_tau, T_beta, T_delta > wiener_lpdf (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 The log of the first passage time density function for a (Wiener) drift diffusion model for the given \(y\), boundary separation \(\alpha\), nondecision time \(\tau\), relative bias \(\beta\), and drift rate \(\delta\).
 
template<typename T_y , typename T_alpha , typename T_tau , typename T_beta , typename T_delta >
return_type_t< T_y, T_alpha, T_tau, T_beta, T_delta > wiener_lpdf (const T_y &y, const T_alpha &alpha, const T_tau &tau, const T_beta &beta, const T_delta &delta)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale , require_stan_scalar_t< T_dof > * = nullptr, require_all_matrix_t< T_y, T_scale > * = nullptr>
return_type_t< T_y, T_dof, T_scale > wishart_cholesky_lpdf (const T_y &L_Y, const T_dof &nu, const T_scale &L_S)
 Return the natural logarithm of the unnormalized Wishart density of the specified lower-triangular Cholesky factor variate, positive degrees of freedom, and lower-triangular Cholesky factor of the scale matrix.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > wishart_cholesky_lpdf (const T_y &LW, const T_dof &nu, const T_scale &L_S)
 
template<class RNG >
Eigen::MatrixXd wishart_cholesky_rng (double nu, const Eigen::MatrixXd &L_S, RNG &rng)
 Return a random Cholesky factor of the inverse covariance matrix of the specified dimensionality drawn from the Wishart distribution with the specified degrees of freedom using the specified random number generator.
 
template<bool propto, typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > wishart_log (const T_y &W, const T_dof &nu, const T_scale &S)
 The log of the Wishart density for the given W, degrees of freedom, and scale matrix.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > wishart_log (const T_y &W, const T_dof &nu, const T_scale &S)
 
template<bool propto, typename T_y , typename T_dof , typename T_scale , require_stan_scalar_t< T_dof > * = nullptr, require_all_matrix_t< T_y, T_scale > * = nullptr>
return_type_t< T_y, T_dof, T_scale > wishart_lpdf (const T_y &W, const T_dof &nu, const T_scale &S)
 The log of the Wishart density for the given W, degrees of freedom, and scale matrix.
 
template<typename T_y , typename T_dof , typename T_scale >
return_type_t< T_y, T_dof, T_scale > wishart_lpdf (const T_y &W, const T_dof &nu, const T_scale &S)
 
template<class RNG >
Eigen::MatrixXd wishart_rng (double nu, const Eigen::MatrixXd &S, RNG &rng)
 
template<typename... Pargs>
double * accumulate_adjoints (double *dest, const var &x, Pargs &&... args)
 Accumulate adjoints from x into storage pointed to by dest, increment the adjoint storage pointer, recursively accumulate the adjoints of the rest of the arguments, and return final position of storage pointer.
 
template<typename VarVec , require_std_vector_vt< is_var, VarVec > * = nullptr, typename... Pargs>
double * accumulate_adjoints (double *dest, VarVec &&x, Pargs &&... args)
 Accumulate adjoints from std::vector x into storage pointed to by dest, increment the adjoint storage pointer, recursively accumulate the adjoints of the rest of the arguments, and return final position of storage pointer.
 
template<typename VecContainer , require_std_vector_st< is_var, VecContainer > * = nullptr, require_std_vector_vt< is_container, VecContainer > * = nullptr, typename... Pargs>
double * accumulate_adjoints (double *dest, VecContainer &&x, Pargs &&... args)
 Accumulate adjoints from x (a std::vector of containers containing vars) into storage pointed to by dest, increment the adjoint storage pointer, recursively accumulate the adjoints of the rest of the arguments, and return final position of storage pointer.
 
template<typename EigT , require_eigen_vt< is_var, EigT > * = nullptr, typename... Pargs>
double * accumulate_adjoints (double *dest, EigT &&x, Pargs &&... args)
 Accumulate adjoints from x (an Eigen type containing vars) into storage pointed to by dest, increment the adjoint storage pointer, recursively accumulate the adjoints of the rest of the arguments, and return final position of storage pointer.
 
template<typename Arith , require_st_arithmetic< Arith > * = nullptr, typename... Pargs>
double * accumulate_adjoints (double *dest, Arith &&x, Pargs &&... args)
 Ignore arithmetic types.
 
double * accumulate_adjoints (double *dest)
 End accumulate_adjoints recursion and return pointer.
 
template<int R, int C>
vari ** build_vari_array (const Eigen::Matrix< var, R, C > &x)
 Allocates and populates a flat array of vari pointers in the autodiff arena with the varis pointed to by the vars in the input Eigen matrix.
 
template<typename T , typename F >
internal::callback_vari< plain_type_t< T >, F > * make_callback_vari (T &&value, F &&functor)
 Creates a new vari with given value and a callback that implements the reverse pass (chain).
 
template<typename T , typename F >
var_value< plain_type_t< T > > make_callback_var (T &&value, F &&functor)
 Creates a new var initialized with a callback_vari with a given value and reverse-pass callback functor.
 
template<typename T >
auto make_chainable_ptr (T &&obj)
 Store the given object in a chainable_object so it is destructed only when the chainable stack memory is recovered and return a pointer to the underlying object.
 
template<typename T >
auto make_unsafe_chainable_ptr (T &&obj)
 Store the given object in a chainable_object so it is destructed only when the chainable stack memory is recovered and return a pointer to the underlying object This function differs from make_chainable_object in that this class does not evaluate expressions.
 
template<typename... Pargs>
size_t count_vars (Pargs &&... args)
 Count the number of vars in the input argument list.
 
template<typename Arith , typename = require_arithmetic_t<scalar_type_t<Arith>>>
Arith deep_copy_vars (Arith &&arg)
 Forward arguments that do not contain vars.
 
auto deep_copy_vars (const var &arg)
 Copy the value of a var but reallocate a new vari.
 
template<typename VarVec , require_std_vector_vt< is_var, VarVec > * = nullptr>
auto deep_copy_vars (VarVec &&arg)
 Copy the vars in arg but reallocate new varis for them.
 
template<typename VecContainer , require_std_vector_st< is_var, VecContainer > * = nullptr, require_std_vector_vt< is_container, VecContainer > * = nullptr>
auto deep_copy_vars (VecContainer &&arg)
 Copy the vars in arg but reallocate new varis for them.
 
template<typename EigT , require_eigen_vt< is_var, EigT > * = nullptr>
auto deep_copy_vars (EigT &&arg)
 Copy the vars in arg but reallocate new varis for them.
 
static bool empty_nested ()
 Return true if there is no nested autodiff being executed.
 
static void grad ()
 Compute the gradient for all variables starting from the end of the AD tape.
 
template<typename Vari >
static void grad (Vari *vi)
 Compute the gradient for all variables starting from the specified root variable implementation.
 
static size_t nested_size ()
 
var operator+ (const var &a, const var &b)
 Addition operator for variables (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator+ (const var &a, Arith b)
 Addition operator for variable and scalar (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator+ (Arith a, const var &b)
 Addition operator for scalar and variable (C++).
 
template<typename VarMat1 , typename VarMat2 , require_all_rev_matrix_t< VarMat1, VarMat2 > * = nullptr>
auto add (const VarMat1 &a, const VarMat2 &b)
 Addition operator for matrix variables (C++).
 
template<typename Arith , typename VarMat , require_st_arithmetic< Arith > * = nullptr, require_rev_matrix_t< VarMat > * = nullptr>
auto add (const VarMat &a, const Arith &b)
 Addition operator for a matrix variable and arithmetic (C++).
 
template<typename Arith , typename VarMat , require_st_arithmetic< Arith > * = nullptr, require_rev_matrix_t< VarMat > * = nullptr>
auto add (const Arith &a, const VarMat &b)
 Addition operator for an arithmetic type and matrix variable (C++).
 
template<typename Var , typename EigMat , require_var_vt< std::is_arithmetic, Var > * = nullptr, require_eigen_vt< std::is_arithmetic, EigMat > * = nullptr>
auto add (const Var &a, const EigMat &b)
 Addition operator for an arithmetic matrix and variable (C++).
 
template<typename EigMat , typename Var , require_eigen_vt< std::is_arithmetic, EigMat > * = nullptr, require_var_vt< std::is_arithmetic, Var > * = nullptr>
auto add (const EigMat &a, const Var &b)
 Addition operator for a variable and arithmetic matrix (C++).
 
template<typename Var , typename VarMat , require_var_vt< std::is_arithmetic, Var > * = nullptr, require_rev_matrix_t< VarMat > * = nullptr>
auto add (const Var &a, const VarMat &b)
 Addition operator for a variable and variable matrix (C++).
 
template<typename Var , typename VarMat , require_var_vt< std::is_arithmetic, Var > * = nullptr, require_rev_matrix_t< VarMat > * = nullptr>
auto add (const VarMat &a, const Var &b)
 Addition operator for a variable matrix and variable (C++).
 
template<typename T1 , typename T2 , require_any_var_vt< std::is_arithmetic, T1, T2 > * = nullptr, require_any_arithmetic_t< T1, T2 > * = nullptr>
auto add (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 , require_all_var_vt< std::is_arithmetic, T1, T2 > * = nullptr>
auto add (const T1 &a, const T2 &b)
 
template<typename VarMat1 , typename VarMat2 , require_any_var_matrix_t< VarMat1, VarMat2 > * = nullptr>
auto operator+ (const VarMat1 &a, const VarMat2 &b)
 Addition operator for matrix variables.
 
var operator/ (const var &dividend, const var &divisor)
 Division operator for two variables (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator/ (const var &dividend, Arith divisor)
 Division operator for dividing a variable by a scalar (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator/ (Arith dividend, const var &divisor)
 Division operator for dividing a scalar by a variable (C++).
 
template<typename Scalar , typename Mat , require_matrix_t< Mat > * = nullptr, require_stan_scalar_t< Scalar > * = nullptr, require_all_st_var_or_arithmetic< Scalar, Mat > * = nullptr, require_any_st_var< Scalar, Mat > * = nullptr>
auto divide (const Mat &m, Scalar c)
 Return matrix divided by scalar.
 
template<typename Scalar , typename Mat , require_matrix_t< Mat > * = nullptr, require_stan_scalar_t< Scalar > * = nullptr, require_all_st_var_or_arithmetic< Scalar, Mat > * = nullptr, require_any_st_var< Scalar, Mat > * = nullptr>
auto divide (Scalar c, const Mat &m)
 Return scalar divided by matrix.
 
template<typename Mat1 , typename Mat2 , require_all_matrix_st< is_var_or_arithmetic, Mat1, Mat2 > * = nullptr, require_any_matrix_st< is_var, Mat1, Mat2 > * = nullptr>
auto divide (const Mat1 &m1, const Mat2 &m2)
 Return a matrix divided by a matrix elementwise.
 
template<typename T1 , typename T2 , require_any_var_matrix_t< T1, T2 > * = nullptr>
auto operator/ (const T1 &dividend, const T2 &divisor)
 
std::complex< varoperator/ (const std::complex< var > &x1, const std::complex< var > &x2)
 
bool operator== (const var &a, const var &b)
 Equality operator comparing two variables' values (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator== (const var &a, Arith b)
 Equality operator comparing a variable's value and a double (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator== (Arith a, const var &b)
 Equality operator comparing a scalar and a variable's value (C++).
 
bool operator== (const var &x, const std::complex< var > &z)
 Return true if the real number is equal to the real part of the complex number, and the imaginary part of the complex number is zero.
 
bool operator== (const std::complex< var > &z, const var &y)
 Return true if the real number is equal to the real part of the complex number, and the imaginary part of the complex number is zero.
 
bool operator> (const var &a, const var &b)
 Greater than operator comparing variables' values (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator> (const var &a, Arith b)
 Greater than operator comparing variable's value and double (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator> (Arith a, const var &b)
 Greater than operator comparing a double and a variable's value (C++).
 
bool operator>= (const var &a, const var &b)
 Greater than or equal operator comparing two variables' values (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator>= (const var &a, Arith b)
 Greater than or equal operator comparing variable's value and double (C++).
 
template<typename Arith , typename Var , require_arithmetic_t< Arith > * = nullptr>
bool operator>= (Arith a, const var &b)
 Greater than or equal operator comparing double and variable's value (C++).
 
bool operator< (const var &a, const var &b)
 Less than operator comparing variables' values (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator< (const var &a, Arith b)
 Less than operator comparing variable's value and a double (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator< (Arith a, const var &b)
 Less than operator comparing a double and variable's value (C++).
 
bool operator<= (const var &a, const var &b)
 Less than or equal operator comparing two variables' values (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator<= (const var &a, Arith b)
 Less than or equal operator comparing a variable's value and a scalar (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator<= (Arith a, const var &b)
 Less than or equal operator comparing a double and variable's value (C++).
 
bool operator&& (const var &x, const var &y)
 Return the logical conjunction of the values of the two arguments as defined by &&.
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator&& (const var &x, Arith y)
 Return the logical conjunction of the values of the two arguments as defined by &&.
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator&& (Arith x, const var &y)
 Return the logical conjunction of the values of the two arguments as defined by &&.
 
bool operator|| (const var &x, const var &y)
 Return the logical disjunction of the values of the two arguments as defined by ||.
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator|| (const var &x, Arith y)
 Return the logical disjunction of the values of the two arguments as defined by ||.
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator|| (Arith x, const var &y)
 Return the logical disjunction of the values of the two arguments as defined by ||.
 
var operator* (const var &a, const var &b)
 Multiplication operator for two variables (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator* (const var &a, Arith b)
 Multiplication operator for a variable and a scalar (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator* (Arith a, const var &b)
 Multiplication operator for a scalar and a variable (C++).
 
std::complex< stan::math::varoperator* (const std::complex< stan::math::var > &x, const std::complex< stan::math::var > &y)
 Return the product of std::complex<var> arguments.
 
std::complex< stan::math::varoperator* (const std::complex< double > &x, const std::complex< stan::math::var > &y)
 Return the product of std::complex<double> and std::complex<var> arguments.
 
std::complex< stan::math::varoperator* (const std::complex< stan::math::var > &x, const std::complex< double > &y)
 Return the product of std::complex<double> and std::complex<var> arguments.
 
bool operator!= (const var &a, const var &b)
 Inequality operator comparing two variables' values (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator!= (const var &a, Arith b)
 Inequality operator comparing a variable's value and a double (C++).
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
bool operator!= (Arith a, const var &b)
 Inequality operator comparing a double and a variable's value (C++).
 
bool operator!= (const var &x, const std::complex< var > &z)
 Return false if the real number is equal to the real part of the complex number, and the imaginary part of the complex number is zero.
 
bool operator!= (const std::complex< var > &z, const var &y)
 Return false if the real number is equal to the real part of the complex number, and the imaginary part of the complex number is zero.
 
var operator- (const var &a, const var &b)
 Subtraction operator for variables.
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator- (const var &a, Arith b)
 Subtraction operator for variable and scalar.
 
template<typename Arith , require_arithmetic_t< Arith > * = nullptr>
var operator- (Arith a, const var &b)
 Subtraction operator for scalar and variable.
 
template<typename VarMat1 , typename VarMat2 , require_all_rev_matrix_t< VarMat1, VarMat2 > * = nullptr>
auto subtract (const VarMat1 &a, const VarMat2 &b)
 Subtraction operator for matrix variables.
 
template<typename Arith , typename VarMat , require_st_arithmetic< Arith > * = nullptr, require_rev_matrix_t< VarMat > * = nullptr>
auto subtract (const VarMat &a, const Arith &b)
 Subtraction operator for a matrix variable and arithmetic.
 
template<typename Arith , typename VarMat , require_st_arithmetic< Arith > * = nullptr, require_rev_matrix_t< VarMat > * = nullptr>
auto subtract (const Arith &a, const VarMat &b)
 Subtraction operator for an arithmetic type and matrix variable.
 
template<typename Var , typename EigMat , require_var_vt< std::is_arithmetic, Var > * = nullptr, require_eigen_vt< std::is_arithmetic, EigMat > * = nullptr>
auto subtract (const Var &a, const EigMat &b)
 Subtraction operator for an arithmetic matrix and variable.
 
template<typename EigMat , typename Var , require_eigen_vt< std::is_arithmetic, EigMat > * = nullptr, require_var_vt< std::is_arithmetic, Var > * = nullptr>
auto subtract (const EigMat &a, const Var &b)
 Subtraction operator for a variable and arithmetic matrix.
 
template<typename Var , typename VarMat , require_var_vt< std::is_arithmetic, Var > * = nullptr, require_rev_matrix_t< VarMat > * = nullptr>
auto subtract (const Var &a, const VarMat &b)
 Subtraction operator for a variable and variable matrix.
 
template<typename Var , typename VarMat , require_rev_matrix_t< VarMat > * = nullptr, require_var_vt< std::is_arithmetic, Var > * = nullptr>
auto subtract (const VarMat &a, const Var &b)
 Subtraction operator for a variable matrix and variable.
 
template<typename T1 , typename T2 , require_any_var_vt< std::is_arithmetic, T1, T2 > * = nullptr, require_any_arithmetic_t< T1, T2 > * = nullptr>
auto subtract (const T1 &a, const T2 &b)
 
template<typename T1 , typename T2 , require_all_var_vt< std::is_arithmetic, T1, T2 > * = nullptr>
auto subtract (const T1 &a, const T2 &b)
 
template<typename VarMat1 , typename VarMat2 , require_any_var_matrix_t< VarMat1, VarMat2 > * = nullptr>
auto operator- (const VarMat1 &a, const VarMat2 &b)
 Addition operator for matrix variables.
 
varoperator-- (var &a)
 Prefix decrement operator for variables (C++).
 
var operator-- (var &a, int)
 Postfix decrement operator for variables (C++).
 
varoperator++ (var &a)
 Prefix increment operator for variables (C++).
 
var operator++ (var &a, int)
 Postfix increment operator for variables (C++).
 
var operator- (const var &a)
 Unary negation operator for variables (C++).
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto operator- (const T &a)
 Compute additive inverse of input.
 
bool operator! (const var &x)
 Return the negation of the value of the argument as defined by !.
 
var operator+ (const var &a)
 Unary plus operator for variables (C++).
 
template<typename Arith , typename VecVar , typename VecArith , typename... ContainerOperands, typename... ContainerGradients>
var precomputed_gradients (Arith value, const VecVar &operands, const VecArith &gradients, const std::tuple< ContainerOperands... > &container_operands=std::tuple<>(), const std::tuple< ContainerGradients... > &container_gradients=std::tuple<>())
 This function returns a var for an expression that has the specified value, vector of operands, and vector of partial derivatives of value with respect to the operands.
 
void print_stack (std::ostream &o)
 Prints the autodiff variable stack.
 
template<typename EigVar , typename EigVari , typename EigDbl >
void read_vi_val_adj (const EigVar &VarMat, EigVari &VariMat, EigDbl &ValMat, EigDbl &AdjMat)
 Function applying the vi_val_adj_functor to extract the vari*, values, and adjoints of a given var matrix into separate matrices.
 
template<typename EigRev , typename EigDbl >
void read_val_adj (const EigRev &VarMat, EigDbl &ValMat, EigDbl &AdjMat)
 Function applying the val_adj_functor to extract the values and adjoints of a given var or vari matrix into separate matrices.
 
template<typename EigVar , typename EigVari , typename EigDbl >
void read_vi_val (const EigVar &VarMat, EigVari &VariMat, EigDbl &ValMat)
 Function applying the vi_val_functor to extract the varis and and values of a given var matrix into separate matrices.
 
template<typename EigVar , typename EigVari , typename EigDbl >
void read_vi_adj (const EigVar &VarMat, EigVari &VariMat, EigDbl &AdjMat)
 Function applying the vi_adj_functor to extract the varis and and adjoints of a given var matrix into separate matrices.
 
static void recover_memory ()
 Recover memory used for all variables for reuse.
 
static void recover_memory_nested ()
 Recover only the memory used for the top nested call.
 
template<typename F >
void reverse_pass_callback (F &&functor)
 Puts a callback on the autodiff stack to be called in reverse pass.
 
template<typename... Pargs>
vari ** save_varis (vari **dest, const var &x, Pargs &&... args)
 Save the vari pointer in x into the memory pointed to by dest, increment the dest storage pointer, recursively call save_varis on the rest of the arguments, and return the final value of the dest storage pointer.
 
template<typename VarVec , require_std_vector_vt< is_var, VarVec > * = nullptr, typename... Pargs>
vari ** save_varis (vari **dest, VarVec &&x, Pargs &&... args)
 Save the vari pointers in x into the memory pointed to by dest, increment the dest storage pointer, recursively call save_varis on the rest of the arguments, and return the final value of the dest storage pointer.
 
template<typename VecContainer , require_std_vector_st< is_var, VecContainer > * = nullptr, require_std_vector_vt< is_container, VecContainer > * = nullptr, typename... Pargs>
vari ** save_varis (vari **dest, VecContainer &&x, Pargs &&... args)
 Save the vari pointers in x into the memory pointed to by dest, increment the dest storage pointer, recursively call save_varis on the rest of the arguments, and return the final value of the dest storage pointer.
 
template<typename EigT , require_eigen_vt< is_var, EigT > * = nullptr, typename... Pargs>
vari ** save_varis (vari **dest, EigT &&x, Pargs &&... args)
 Save the vari pointers in x into the memory pointed to by dest, increment the dest storage pointer, recursively call save_varis on the rest of the arguments, and return the final value of the dest storage pointer.
 
template<typename Arith , require_st_arithmetic< Arith > * = nullptr, typename... Pargs>
vari ** save_varis (vari **dest, Arith &&x, Pargs &&... args)
 Ignore arithmetic types.
 
vari ** save_varis (vari **dest)
 End save_varis recursion and return pointer.
 
static void set_zero_all_adjoints ()
 Reset all adjoint values in the stack to zero.
 
static void set_zero_all_adjoints_nested ()
 Reset all adjoint values in the top nested portion of the stack to zero.
 
static void start_nested ()
 Record the current position so that recover_memory_nested() can find it.
 
template<typename Vari >
static void grad (Vari *vi)
 
void zero_adjoints () noexcept
 End of recursion for set_zero_adjoints.
 
template<typename T , require_st_arithmetic< T > * = nullptr>
void zero_adjoints (T &x) noexcept
 Do nothing for non-autodiff arguments.
 
void zero_adjoints (var &x)
 Zero the adjoint of the vari in the first argument.
 
template<typename EigMat , require_eigen_vt< is_autodiff, EigMat > * = nullptr>
void zero_adjoints (EigMat &x)
 Zero the adjoints of the varis of every var in an Eigen::Matrix container.
 
template<typename StdVec , require_std_vector_st< is_autodiff, StdVec > * = nullptr>
void zero_adjoints (StdVec &x)
 Zero the adjoints of every element in a vector.
 
template<typename T >
auto abs (const var_value< T > &a)
 Return the absolute value of the variable (std).
 
var abs (const std::complex< var > &z)
 Return the absolute value of the complex argument.
 
var acos (const var &x)
 Return the principal value of the arc cosine of a variable, in radians (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto acos (const VarMat &x)
 Return the principal value of the arc cosine of a variable, in radians (cmath).
 
std::complex< varacos (const std::complex< var > &x)
 Return the arc cosine of the complex argument.
 
var acosh (const var &x)
 The inverse hyperbolic cosine function for variables (C99).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto acosh (const VarMat &x)
 The inverse hyperbolic cosine function for variables (C99).
 
std::complex< varacosh (const std::complex< var > &z)
 Return the hyperbolic arc cosine of the complex argument.
 
template<typename T , require_var_t< T > * = nullptr>
auto & adjoint_of (const T &x)
 Returns a reference to a variable's adjoint.
 
template<typename T , require_not_var_t< T > * = nullptr>
internal::nonexisting_adjoint adjoint_of (const T &x)
 Returns a reference to a variable's adjoint.
 
template<typename Scal , typename RowVec , require_stan_scalar_t< Scal > * = nullptr, require_t< is_eigen_row_vector< RowVec > > * = nullptr>
auto append_col (const Scal &A, const var_value< RowVec > &B)
 Return the result of stacking an scalar on top of the a row vector, with the result being a row vector.
 
template<typename RowVec , typename Scal , require_t< is_eigen_row_vector< RowVec > > * = nullptr, require_stan_scalar_t< Scal > * = nullptr>
auto append_col (const var_value< RowVec > &A, const Scal &B)
 Return the result of stacking a row vector on top of the an scalar, with the result being a row vector.
 
template<typename Scal , typename ColVec , require_stan_scalar_t< Scal > * = nullptr, require_t< is_eigen_col_vector< ColVec > > * = nullptr>
auto append_row (const Scal &A, const var_value< ColVec > &B)
 Return the result of stacking an scalar on top of the a vector, with the result being a vector.
 
template<typename ColVec , typename Scal , require_t< is_eigen_col_vector< ColVec > > * = nullptr, require_stan_scalar_t< Scal > * = nullptr>
auto append_row (const var_value< ColVec > &A, const Scal &B)
 Return the result of stacking a vector on top of the an scalar, with the result being a vector.
 
var arg (const std::complex< var > &z)
 Return the phase angle of the complex argument.
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto as_array_or_scalar (T &&v)
 Converts a var_value<T> with inner Eigen matrix type to an var_value<T> with an inner array.
 
int as_bool (const var &v)
 Return 1 if the argument is unequal to zero and 0 otherwise.
 
var asin (const var &x)
 Return the principal value of the arc sine, in radians, of the specified variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto asin (const VarMat &x)
 Return the principal value of the arc sine, in radians, of the specified variable (cmath).
 
std::complex< varasin (const std::complex< var > &z)
 Return the arc sine of the complex argument.
 
var asinh (const var &x)
 The inverse hyperbolic sine function for variables (C99).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto asinh (const VarMat &x)
 The inverse hyperbolic sine function for variables (C99).
 
std::complex< varasinh (const std::complex< var > &z)
 Return the hyperbolic arcsine of the complex argument.
 
var atan (const var &x)
 Return the principal value of the arc tangent, in radians, of the specified variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto atan (const VarMat &x)
 Return the principal value of the arc tangent, in radians, of the specified variable (cmath).
 
std::complex< varatan (const std::complex< var > &z)
 Return the arc tangent of the complex argument.
 
var atan2 (const var &a, const var &b)
 Return the principal value of the arc tangent, in radians, of the first variable divided by the second (cmath).
 
var atan2 (const var &a, double b)
 Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath).
 
var atan2 (double a, const var &b)
 Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath).
 
template<typename Mat1 , typename Mat2 , require_any_var_matrix_t< Mat1, Mat2 > * = nullptr, require_all_matrix_t< Mat1, Mat2 > * = nullptr>
auto atan2 (const Mat1 &a, const Mat2 &b)
 
template<typename Scalar , typename VarMat , require_var_matrix_t< VarMat > * = nullptr, require_stan_scalar_t< Scalar > * = nullptr>
auto atan2 (const Scalar &a, const VarMat &b)
 
template<typename VarMat , typename Scalar , require_var_matrix_t< VarMat > * = nullptr, require_stan_scalar_t< Scalar > * = nullptr>
auto atan2 (const VarMat &a, const Scalar &b)
 
var atanh (const var &x)
 The inverse hyperbolic tangent function for variables (C99).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto atanh (const VarMat &x)
 The inverse hyperbolic tangent function for variables (C99).
 
std::complex< varatanh (const std::complex< var > &z)
 Return the hyperbolic arc tangent of the complex argument.
 
var bessel_first_kind (int v, const var &a)
 
template<typename T1 , typename T2 , require_st_integral< T1 > * = nullptr, require_eigen_t< T2 > * = nullptr>
auto bessel_first_kind (const T1 &v, const var_value< T2 > &a)
 Overload with var_value<Matrix> for int, std::vector<int>, and std::vector<std::vector<int>>
 
var bessel_second_kind (int v, const var &a)
 
template<typename T1 , typename T2 , require_st_integral< T1 > * = nullptr, require_eigen_t< T2 > * = nullptr>
auto bessel_second_kind (const T1 &v, const var_value< T2 > &a)
 Overload with var_value<Matrix> for int, std::vector<int>, and std::vector<std::vector<int>>
 
var beta (const var &a, const var &b)
 Returns the beta function and gradients for two var inputs.
 
var beta (const var &a, double b)
 Returns the beta function and gradient for first var input.
 
var beta (double a, const var &b)
 Returns the beta function and gradient for second var input.
 
template<typename Mat1 , typename Mat2 , require_any_var_matrix_t< Mat1, Mat2 > * = nullptr, require_all_matrix_t< Mat1, Mat2 > * = nullptr>
auto beta (const Mat1 &a, const Mat2 &b)
 
template<typename Scalar , typename VarMat , require_var_matrix_t< VarMat > * = nullptr, require_stan_scalar_t< Scalar > * = nullptr>
auto beta (const Scalar &a, const VarMat &b)
 
template<typename VarMat , typename Scalar , require_var_matrix_t< VarMat > * = nullptr, require_stan_scalar_t< Scalar > * = nullptr>
auto beta (const VarMat &a, const Scalar &b)
 
var binary_log_loss (int y, const var &y_hat)
 The log loss function for variables (stan).
 
template<typename Mat , require_eigen_t< Mat > * = nullptr>
auto binary_log_loss (int y, const var_value< Mat > &y_hat)
 Overload with int and var_value<Matrix>
 
template<typename StdVec , typename Mat , require_eigen_t< Mat > * = nullptr, require_st_integral< StdVec > * = nullptr>
auto binary_log_loss (const StdVec &y, const var_value< Mat > &y_hat)
 Overload with var_value<Matrix> for std::vector<int> and std::vector<std::vector<int>>
 
var cbrt (const var &a)
 Returns the cube root of the specified variable (C99).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto cbrt (const VarMat &a)
 Returns the cube root of the specified variable (C99).
 
var ceil (const var &a)
 Return the ceiling of the specified variable (cmath).
 
template<typename T , require_matrix_t< T > * = nullptr>
auto ceil (const var_value< T > &a)
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cholesky_corr_constrain (const T &y, int K)
 Return the Cholesky factor of the correlation matrix of the sepcified size read from the unconstrained vector y.
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cholesky_corr_constrain (const T &y, int K, scalar_type_t< T > &lp)
 Return the Cholesky factor of the correlation matrix of the sepcified size read from the unconstrained vector y.
 
template<typename EigMat , require_eigen_vt< is_var, EigMat > * = nullptr>
auto cholesky_decompose (const EigMat &A)
 Reverse mode specialization of cholesky decomposition.
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto cholesky_decompose (const T &A)
 Reverse mode specialization of Cholesky decomposition.
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cholesky_factor_constrain (const T &x, int M, int N)
 Return the Cholesky factor of the specified size read from the specified vector.
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cholesky_factor_constrain (const T &x, int M, int N, scalar_type_t< T > &lp)
 Return the Cholesky factor of the specified size read from the specified vector and increment the specified log probability reference with the log Jacobian adjustment of the transform.
 
template<typename Mat1 , typename Mat2 , require_all_matrix_t< Mat1, Mat2 > * = nullptr, require_any_var_matrix_t< Mat1, Mat2 > * = nullptr>
auto columns_dot_product (const Mat1 &v1, const Mat2 &v2)
 Returns the dot product of columns of the specified matrices.
 
template<typename Mat , require_eigen_vt< is_var, Mat > * = nullptr>
Eigen::Matrix< var, 1, Mat::ColsAtCompileTime > columns_dot_self (const Mat &x)
 Returns the dot product of each column of a matrix with itself.
 
template<typename Mat , require_var_matrix_t< Mat > * = nullptr>
auto columns_dot_self (const Mat &x)
 Returns the dot product of each column of a matrix with itself.
 
std::complex< varconj (const std::complex< var > &z)
 Return the complex conjugate of the complex argument.
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > corr_matrix_constrain (const T &x, Eigen::Index k)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > corr_matrix_constrain (const T &x, Eigen::Index k, scalar_type_t< T > &lp)
 Return the correlation matrix of the specified dimensionality derived from the specified vector of unconstrained values.
 
var cos (var a)
 Return the cosine of a radian-scaled variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto cos (const VarMat &a)
 Return the cosine of a radian-scaled variable (cmath).
 
std::complex< varcos (const std::complex< var > &z)
 Return the cosine of the complex argument.
 
var cosh (const var &a)
 Return the hyperbolic cosine of the specified variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto cosh (const VarMat &a)
 Return the hyperbolic cosine of the specified variable (cmath).
 
std::complex< varcosh (const std::complex< var > &z)
 Return the hyperbolic cosine of the complex argument.
 
template<typename T_x , typename = require_arithmetic_t<typename scalar_type<T_x>::type>>
Eigen::Matrix< var, -1, -1 > cov_exp_quad (const std::vector< T_x > &x, const var &sigma, const var &l)
 
template<typename T_x , typename = require_arithmetic_t<typename scalar_type<T_x>::type>>
Eigen::Matrix< var, -1, -1 > cov_exp_quad (const std::vector< T_x > &x, double sigma, const var &l)
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cov_matrix_constrain (const T &x, Eigen::Index K)
 Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cov_matrix_constrain (const T &x, Eigen::Index K, scalar_type_t< T > &lp)
 Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cov_matrix_constrain_lkj (const T &x, size_t k)
 Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values.
 
template<typename T , require_var_vector_t< T > * = nullptr>
var_value< Eigen::MatrixXd > cov_matrix_constrain_lkj (const T &x, size_t k, scalar_type_t< T > &lp)
 Return the covariance matrix of the specified dimensionality derived from constraining the specified vector of unconstrained values and increment the specified log probability reference with the log absolute Jacobian determinant.
 
template<typename T1 , typename T2 , require_any_rev_matrix_t< T1, T2 > * = nullptr>
auto csr_matrix_times_vector (int m, int n, const T1 &w, const std::vector< int > &v, const std::vector< int > &u, const T2 &b)
 
template<typename EigVec , require_rev_vector_t< EigVec > * = nullptr>
auto cumulative_sum (const EigVec &x)
 Return the cumulative sum of the specified vector.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
var determinant (const T &m)
 
var digamma (const var &a)
 Return the derivative of the log gamma function at the specified value.
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto digamma (const T &a)
 Return the elementwise derivative of the log gamma function at the given input vector.
 
template<typename T >
void dims (const var_value< T > &x, std::vector< int > &result)
 Pushes dimensions of given argument into given result vector.
 
template<typename T >
void dims (const vari_value< T > &x, std::vector< int > &result)
 Pushes dimensions of given argument into given result vector.
 
template<typename T1 , typename T2 , require_all_vector_t< T1, T2 > * = nullptr, require_not_complex_t< return_type_t< T1, T2 > > * = nullptr, require_all_not_std_vector_t< T1, T2 > * = nullptr, require_any_st_var< T1, T2 > * = nullptr>
var dot_product (const T1 &v1, const T2 &v2)
 Returns the dot product.
 
template<typename T , require_eigen_vector_vt< is_var, T > * = nullptr>
var dot_self (const T &v)
 Returns the dot product of a vector of var with itself.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
auto eigendecompose_sym (const T &m)
 Return the decomposition of the specified symmetric matrix.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
auto eigenvalues_sym (const T &m)
 Return the eigenvalues of the specified symmetric matrix.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
auto eigenvectors_sym (const T &m)
 Return the eigenvectors of the specified symmetric matrix.
 
var erf (const var &a)
 The error function for variables (C99).
 
template<typename T , require_matrix_t< T > * = nullptr>
auto erf (const var_value< T > &a)
 
var erfc (const var &a)
 The complementary error function for variables (C99).
 
template<typename T , require_matrix_t< T > * = nullptr>
auto erfc (const var_value< T > &a)
 
var exp (const var &a)
 Return the exponentiation of the specified variable (cmath).
 
std::complex< varexp (const std::complex< var > &z)
 Return the exponentiation (base e) of the specified complex number.
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto exp (const T &x)
 Return the exponentiation of the elements of x.
 
var exp2 (const var &a)
 Exponentiation base 2 function for variables (C99).
 
template<typename T , require_eigen_t< T > * = nullptr>
auto exp2 (const var_value< T > &a)
 
var expm1 (const var &a)
 The exponentiation of the specified variable minus 1 (C99).
 
template<typename T , require_eigen_t< T > * = nullptr>
auto expm1 (const var_value< T > &a)
 
var fabs (const var &a)
 Return the absolute value of the variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto fabs (const VarMat &a)
 Return the absolute value of the variable (cmath).
 
var falling_factorial (const var &a, int b)
 
template<typename T1 , typename T2 , require_eigen_t< T1 > * = nullptr, require_st_integral< T2 > * = nullptr>
auto falling_factorial (const var_value< T1 > &a, const T2 &b)
 
var fdim (const var &a, const var &b)
 Return the positive difference between the first variable's the value and the second's (C99, C++11).
 
var fdim (double a, const var &b)
 Return the positive difference between the first value and the value of the second variable (C99, C++11).
 
var fdim (const var &a, double b)
 Return the positive difference between the first variable's value and the second value (C99, C++11).
 
template<typename V , require_eigen_vector_vt< is_complex, V > * = nullptr, require_var_t< base_type_t< value_type_t< V > > > * = nullptr>
plain_type_t< V > fft (const V &x)
 Return the discrete Fourier transform of the specified complex vector.
 
template<typename V , require_eigen_vector_vt< is_complex, V > * = nullptr, require_var_t< base_type_t< value_type_t< V > > > * = nullptr>
plain_type_t< V > inv_fft (const V &y)
 Return the inverse discrete Fourier transform of the specified complex vector.
 
template<typename M , require_eigen_dense_dynamic_vt< is_complex, M > * = nullptr, require_var_t< base_type_t< value_type_t< M > > > * = nullptr>
plain_type_t< M > fft2 (const M &x)
 Return the two-dimensional discrete Fourier transform of the specified complex matrix.
 
template<typename M , require_eigen_dense_dynamic_vt< is_complex, M > * = nullptr, require_var_t< base_type_t< value_type_t< M > > > * = nullptr>
plain_type_t< M > inv_fft2 (const M &y)
 Return the two-dimensional inverse discrete Fourier transform of the specified complex matrix.
 
template<typename VarMat , typename S , require_var_matrix_t< VarMat > * = nullptr, require_var_t< S > * = nullptr>
void fill (VarMat &x, const S &y)
 Fill the specified container with the specified value.
 
var floor (const var &a)
 Return the floor of the specified variable (cmath).
 
template<typename T , require_eigen_t< T > * = nullptr>
auto floor (const var_value< T > &a)
 
var fma (const var &x, const var &y, const var &z)
 The fused multiply-add function for three variables (C99).
 
template<typename Tc , require_arithmetic_t< Tc > * = nullptr>
var fma (const var &x, const var &y, Tc &&z)
 The fused multiply-add function for two variables and a value (C99).
 
template<typename Tb , require_arithmetic_t< Tb > * = nullptr>
var fma (const var &x, Tb &&y, const var &z)
 The fused multiply-add function for a variable, value, and variable (C99).
 
template<typename Tb , typename Tc , require_all_arithmetic_t< Tb, Tc > * = nullptr>
var fma (const var &x, Tb &&y, Tc &&z)
 The fused multiply-add function for a variable and two values (C99).
 
template<typename Ta , typename Tc , require_all_arithmetic_t< Ta, Tc > * = nullptr>
var fma (Ta &&x, const var &y, Tc &&z)
 The fused multiply-add function for a value, variable, and value (C99).
 
template<typename Ta , typename Tb , require_all_arithmetic_t< Ta, Tb > * = nullptr>
var fma (Ta &&x, Tb &&y, const var &z)
 The fused multiply-add function for two values and a variable, and value (C99).
 
template<typename Ta , require_arithmetic_t< Ta > * = nullptr>
var fma (Ta &&x, const var &y, const var &z)
 The fused multiply-add function for a value and two variables (C99).
 
template<typename T1 , typename T2 , typename T3 , require_any_matrix_t< T1, T2, T3 > * = nullptr, require_var_t< return_type_t< T1, T2, T3 > > * = nullptr>
auto fma (const T1 &x, const T2 &y, const T3 &z)
 The fused multiply-add function for three variables (C99).
 
var fmax (const var &a, const var &b)
 Returns the maximum of the two variable arguments (C99).
 
var fmax (const var &a, double b)
 Returns the maximum of the variable and scalar, promoting the scalar to a variable if it is larger (C99).
 
var fmax (double a, const var &b)
 Returns the maximum of a scalar and variable, promoting the scalar to a variable if it is larger (C99).
 
var fmin (const var &a, const var &b)
 Returns the minimum of the two variable arguments (C99).
 
var fmin (const var &a, double b)
 Returns the minimum of the variable and scalar, promoting the scalar to a variable if it is larger (C99).
 
var fmin (double a, const var &b)
 Returns the minimum of a scalar and variable, promoting the scalar to a variable if it is larger (C99).
 
var fmod (const var &a, const var &b)
 Return the floating point remainder after dividing the first variable by the second (cmath).
 
var fmod (const var &a, double b)
 Return the floating point remainder after dividing the the first variable by the second scalar (cmath).
 
var fmod (double a, const var &b)
 Return the floating point remainder after dividing the first scalar by the second variable (cmath).
 
template<typename T , require_var_matrix_t< T > * = nullptr>
Eigen::Matrix< var, T::RowsAtCompileTime, T::ColsAtCompileTime > from_var_value (const T &a)
 Converts var_value into an Eigen Matrix.
 
template<typename T , require_any_t< conjunction< is_eigen< T >, is_var< scalar_type_t< T > > >, std::is_same< std::decay_t< T >, var >, bool_constant<!std::is_same< scalar_type_t< T >, var >::value > > * = nullptr>
from_var_value (T &&a)
 This is a no-op for Eigen containers of vars, scalars or prim types.
 
template<typename T >
auto from_var_value (const std::vector< T > &a)
 Convert the elements of the std::vector input to var_value types if possible.
 
var gamma_p (const var &a, const var &b)
 
var gamma_p (const var &a, double b)
 
var gamma_p (double a, const var &b)
 
var gamma_q (const var &a, const var &b)
 
var gamma_q (const var &a, double b)
 
var gamma_q (double a, const var &b)
 
template<typename VarMat , require_rev_matrix_t< VarMat > * = nullptr>
auto generalized_inverse (const VarMat &G)
 
template<typename T_x , typename T_sigma , require_st_arithmetic< T_x > * = nullptr, require_stan_scalar_t< T_sigma > * = nullptr>
Eigen::Matrix< var, -1, -1 > gp_exp_quad_cov (const std::vector< T_x > &x, const T_sigma sigma, const var length_scale)
 Returns a squared exponential kernel.
 
template<typename T_x , typename T_sigma , require_st_arithmetic< T_x > * = nullptr, require_stan_scalar_t< T_sigma > * = nullptr>
Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > gp_periodic_cov (const std::vector< T_x > &x, const T_sigma sigma, const var l, const var p)
 Returns a periodic covariance matrix \( \mathbf{K} \) using the input \( \mathbf{X} \).
 
void grad (var &v, Eigen::Matrix< var, Eigen::Dynamic, 1 > &x, Eigen::VectorXd &g)
 Propagate chain rule to calculate gradients starting from the specified variable.
 
void grad_inc_beta (var &g1, var &g2, const var &a, const var &b, const var &z)
 Gradient of the incomplete beta function beta(a, b, z) with respect to the first two arguments.
 
template<typename Ta , typename Tz , require_all_stan_scalar_t< Ta, Tz > * = nullptr, require_any_var_t< Ta, Tz > * = nullptr>
var hypergeometric_1f0 (const Ta &a, const Tz &z)
 Returns the Hypergeometric 1F0 function applied to the input arguments: \( _1F_0(a;;z) = \sum_{k=1}^{\infty}\frac{\left(a\right)_kz^k}{k!}\).
 
template<typename Ta , typename Tb , typename Tz , bool grad_a = !is_constant<Ta>::value, bool grad_b = !is_constant<Tb>::value, bool grad_z = !is_constant<Tz>::value, require_all_matrix_t< Ta, Tb > * = nullptr, require_return_type_t< is_var, Ta, Tb, Tz > * = nullptr>
var hypergeometric_pFq (const Ta &a, const Tb &b, const Tz &z)
 Returns the generalized hypergeometric function (pFq) applied to the input arguments.
 
var hypot (const var &a, const var &b)
 Returns the length of the hypotenuse of a right triangle with sides of the specified lengths (C99).
 
var hypot (const var &a, double b)
 Returns the length of the hypotenuse of a right triangle with sides of the specified lengths (C99).
 
var hypot (double a, const var &b)
 Returns the length of the hypotenuse of a right triangle with sides of the specified lengths (C99).
 
var if_else (bool c, const var &y_true, const var &y_false)
 If the specified condition is true, return the first variable, otherwise return the second variable.
 
var if_else (bool c, double y_true, const var &y_false)
 If the specified condition is true, return a new variable constructed from the first scalar, otherwise return the second variable.
 
var if_else (bool c, const var &y_true, double y_false)
 If the specified condition is true, return the first variable, otherwise return a new variable constructed from the second scalar.
 
var inc_beta (const var &a, const var &b, const var &c)
 
template<typename VarMat , typename S , require_var_matrix_t< VarMat > * = nullptr, require_stan_scalar_t< S > * = nullptr>
void initialize_fill (VarMat &x, const S &y)
 Fill the specified container with the specified value.
 
void initialize_variable (var &variable, const var &value)
 Initialize variable to value.
 
template<int R, int C>
void initialize_variable (Eigen::Matrix< var, R, C > &matrix, const var &value)
 Initialize every cell in the matrix to the specified value.
 
template<typename T >
void initialize_variable (std::vector< T > &variables, const var &value)
 Initialize the variables in the standard vector recursively.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto inv (const var_value< T > &a)
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto inv_cloglog (const var_value< T > &a)
 Return the inverse complementary log-log function applied specified variable (stan).
 
var inv_erfc (const var &a)
 The inverse complementary error function for variables.
 
template<typename T , require_matrix_t< T > * = nullptr>
auto inv_erfc (const var_value< T > &a)
 
template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr, require_any_var_t< T1, T2, T3 > * = nullptr>
var inv_inc_beta (const T1 &a, const T2 &b, const T3 &p)
 The inverse of the normalized incomplete beta function of a, b, with probability p.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto inv_logit (const var_value< T > &a)
 The inverse logit function for variables (stan).
 
var inv_Phi (const var &p)
 The inverse of unit normal cumulative density function.
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto inv_Phi (const T &p)
 Return the elementwise inverse of unit normal cumulative density function.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto inv_sqrt (const var_value< T > &a)
 
var inv_square (const var &a)
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
auto inverse (const T &m)
 Reverse mode specialization of calculating the inverse of the matrix.
 
int is_inf (const var &v)
 Returns 1 if the input's value is infinite and 0 otherwise.
 
bool is_nan (const var &v)
 Returns 1 if the input's value is NaN and 0 otherwise.
 
bool is_uninitialized (var x)
 Returns true if the specified variable is uninitialized.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto lambert_w0 (const var_value< T > &a)
 Return the Lambert W function on W0 branch applied to the specified variable.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto lambert_wm1 (const var_value< T > &a)
 Return the Lambert W function on W-1 branch applied to the specified variable.
 
template<typename T , typename L , require_all_stan_scalar_t< T, L > * = nullptr, require_any_var_t< T, L > * = nullptr>
auto lb_constrain (const T &x, const L &lb, var &lp)
 Return the lower-bounded value for the specified unconstrained input and specified lower bound.
 
template<typename T , typename L , require_matrix_t< T > * = nullptr, require_stan_scalar_t< L > * = nullptr, require_any_st_var< T, L > * = nullptr>
auto lb_constrain (const T &x, const L &lb)
 Specialization of lb_constrain to apply a scalar lower bound elementwise to each input.
 
var lbeta (const var &a, const var &b)
 Returns the natural logarithm of the beta function and its gradients.
 
var lbeta (const var &a, double b)
 Returns the natural logarithm of the beta function and its gradients.
 
var lbeta (double a, const var &b)
 Returns the natural logarithm of the beta function and its gradients.
 
var ldexp (const var &a, int b)
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto lgamma (const var_value< T > &a)
 The log gamma function for variables (C99).
 
var lmgamma (int a, const var &b)
 
var lmultiply (const var &a, const var &b)
 Return the value of a*log(b).
 
var lmultiply (const var &a, double b)
 Return the value of a*log(b).
 
var lmultiply (double a, const var &b)
 Return the value of a*log(b).
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log (const var_value< T > &a)
 Return the natural log of the specified variable (cmath).
 
std::complex< varlog (const std::complex< var > &z)
 Return the natural logarithm (base e) of the specified complex argument.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log10 (const var_value< T > &a)
 Return the base 10 log of the specified variable (cmath).
 
std::complex< varlog10 (const std::complex< var > &z)
 Return the base 10 logarithm of the specified complex number.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log1m (const var_value< T > &a)
 The log (1 - x) function for variables.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log1m_exp (const var_value< T > &x)
 Return the log of 1 minus the exponential of the specified variable.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log1m_inv_logit (const var_value< T > &u)
 Return the natural logarithm of one minus the inverse logit of the specified argument.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log1p (const var_value< T > &a)
 The log (1 + x) function for variables (C99).
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log1p_exp (const var_value< T > &a)
 Return the log of 1 plus the exponential of the specified variable.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto log2 (const var_value< T > &a)
 Returns the base 2 logarithm of the specified variable (C99).
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
var log_determinant (const T &m)
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
var log_determinant_ldlt (LDLT_factor< T > &A)
 Returns the log det of the matrix whose LDLT factorization is given.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
var log_determinant_spd (const T &M)
 Returns the log det of a symmetric, positive-definite matrix.
 
var log_diff_exp (const var &a, const var &b)
 Returns the log difference of the exponentiated arguments.
 
var log_diff_exp (const var &a, double b)
 Returns the log difference of the exponentiated arguments.
 
var log_diff_exp (double a, const var &b)
 Returns the log difference of the exponentiated arguments.
 
var log_falling_factorial (const var &a, double b)
 
var log_falling_factorial (const var &a, const var &b)
 
var log_falling_factorial (double a, const var &b)
 
template<typename T , require_arithmetic_t< T > * = nullptr>
auto log_inv_logit (const var_value< T > &u)
 Return the natural logarithm of the inverse logit of the specified argument.
 
var log_inv_logit_diff (const var &a, double b)
 
var log_inv_logit_diff (const var &a, const var &b)
 
var log_inv_logit_diff (double a, const var &b)
 
void log_mix_partial_helper (double theta_val, double lambda1_val, double lambda2_val, double &one_m_exp_lam2_m_lam1, double &one_m_t_prod_exp_lam2_m_lam1, double &one_d_t_plus_one_m_t_prod_exp_lam2_m_lam1)
 
template<typename T_theta , typename T_lambda1 , typename T_lambda2 , require_any_var_t< T_theta, T_lambda1, T_lambda2 > * = nullptr>
return_type_t< T_theta, T_lambda1, T_lambda2 > log_mix (const T_theta &theta, const T_lambda1 &lambda1, const T_lambda2 &lambda2)
 Return the log mixture density with specified mixing proportion and log densities and its derivative at each.
 
var log_rising_factorial (const var &a, double b)
 
var log_rising_factorial (const var &a, const var &b)
 
var log_rising_factorial (double a, const var &b)
 
var log_sum_exp (const var &a, const var &b)
 Returns the log sum of exponentials.
 
var log_sum_exp (const var &a, double b)
 Returns the log sum of exponentials.
 
var log_sum_exp (double a, const var &b)
 Returns the log sum of exponentials.
 
template<typename T , require_eigen_st< is_var, T > * = nullptr, require_not_var_matrix_t< T > * = nullptr>
var log_sum_exp (const T &v)
 Returns the log sum of exponentials of the input.
 
template<typename T , require_var_matrix_t< T > * = nullptr>
var log_sum_exp (const T &x)
 Returns the log sum of exponentials of the input.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto logit (const var_value< T > &u)
 Return the log odds of the specified argument.
 
template<typename T , typename L , typename U , require_all_matrix_t< T, L > * = nullptr, require_stan_scalar_t< U > * = nullptr, require_var_t< return_type_t< T, L, U > > * = nullptr>
auto lub_constrain (const T &x, const L &lb, const U &ub, std::decay_t< return_type_t< T, L, U > > &lp)
 Specialization for Eigen matrix with matrix lower bound and scalar upper bound plus lp.
 
template<typename Ta , typename Tb , require_all_eigen_t< Ta, Tb > * = nullptr, require_any_st_autodiff< Ta, Tb > * = nullptr>
Eigen::Matrix< return_type_t< Ta, Tb >, -1, Tb::ColsAtCompileTime > matrix_exp_multiply (const Ta &A, const Tb &B)
 Wrapper of matrix_exp_action function for a more literal name.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
plain_type_t< T > matrix_power (const T &M, const int n)
 Returns the nth power of the specific matrix.
 
template<typename T1 , typename T2 , require_all_matrix_t< T1, T2 > * = nullptr, require_any_st_var< T1, T2 > * = nullptr>
auto mdivide_left (const T1 &A, const T2 &B)
 Return the solution X of AX = B.
 
template<typename T1 , typename T2 , require_all_matrix_t< T1, T2 > * = nullptr, require_any_st_var< T1, T2 > * = nullptr>
auto mdivide_left_ldlt (LDLT_factor< T1 > &A, const T2 &B)
 Returns the solution of the system Ax=b given an LDLT_factor of A.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_matrix_base_vt< is_var, EigMat1, EigMat2 > * = nullptr>
Eigen::Matrix< var, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_left_spd (const EigMat1 &A, const EigMat2 &b)
 
template<typename EigMat1 , typename EigMat2 , require_eigen_matrix_base_vt< is_var, EigMat1 > * = nullptr, require_eigen_matrix_base_vt< std::is_arithmetic, EigMat2 > * = nullptr>
Eigen::Matrix< var, EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime > mdivide_left_spd (const EigMat1 &A, const EigMat2 &b)
 
template<typename T1 , typename T2 , require_all_matrix_t< T1, T2 > * = nullptr, require_any_var_matrix_t< T1, T2 > * = nullptr>
auto mdivide_left_spd (const T1 &A, const T2 &B)
 Returns the solution of the system Ax=B where A is symmetric positive definite.
 
template<Eigen::UpLoType TriView, typename T1 , typename T2 , require_all_eigen_vt< is_var, T1, T2 > * = nullptr>
Eigen::Matrix< var, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left_tri (const T1 &A, const T2 &b)
 
template<Eigen::UpLoType TriView, typename T1 , typename T2 , require_eigen_vt< std::is_arithmetic, T1 > * = nullptr, require_eigen_vt< is_var, T2 > * = nullptr>
Eigen::Matrix< var, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left_tri (const T1 &A, const T2 &b)
 
var modified_bessel_first_kind (int v, const var &a)
 
var modified_bessel_second_kind (int v, const var &a)
 
template<typename T1 , typename T2 , require_all_matrix_t< T1, T2 > * = nullptr, require_return_type_t< is_var, T1, T2 > * = nullptr, require_row_and_col_vector_t< T1, T2 > * = nullptr>
var multiply (const T1 &A, const T2 &B)
 Return the product of a row vector times a column vector as a scalar.
 
template<typename T1 , typename T2 , require_not_matrix_t< T1 > * = nullptr, require_matrix_t< T2 > * = nullptr, require_return_type_t< is_var, T1, T2 > * = nullptr, require_not_row_and_col_vector_t< T1, T2 > * = nullptr>
auto multiply (const T1 &A, const T2 &B)
 Return specified matrix multiplied by specified scalar where at least one input has a scalar type of a var_value.
 
template<typename T1 , typename T2 , require_matrix_t< T1 > * = nullptr, require_not_matrix_t< T2 > * = nullptr, require_any_st_var< T1, T2 > * = nullptr, require_not_complex_t< value_type_t< T1 > > * = nullptr, require_not_complex_t< value_type_t< T2 > > * = nullptr, require_not_row_and_col_vector_t< T1, T2 > * = nullptr>
auto multiply (const T1 &A, const T2 &B)
 Return specified matrix multiplied by specified scalar where at least one input has a scalar type of a var_value.
 
template<typename T1 , typename T2 , require_any_var_matrix_t< T1, T2 > * = nullptr>
auto operator* (const T1 &a, const T2 &b)
 Operator overload for multiplying a var_value<Matrix>.
 
var multiply_log (const var &a, const var &b)
 Return the value of a*log(b).
 
var multiply_log (const var &a, double b)
 Return the value of a*log(b).
 
var multiply_log (double a, const var &b)
 Return the value of a*log(b).
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
auto multiply_lower_tri_self_transpose (const T &L)
 
var norm (const std::complex< var > &z)
 Return the squared magnitude of the complex argument.
 
template<typename T , require_eigen_vector_vt< is_var, T > * = nullptr>
var norm1 (const T &v)
 Returns the L1 norm of a vector of var.
 
template<typename T , require_eigen_vector_vt< is_var, T > * = nullptr>
var norm2 (const T &v)
 Returns the L2 norm of a vector of var.
 
template<typename T , require_rev_col_vector_t< T > * = nullptr>
auto ordered_constrain (const T &x)
 Return an increasing ordered vector derived from the specified free vector.
 
template<typename VarVec , require_var_col_vector_t< VarVec > * = nullptr>
auto ordered_constrain (const VarVec &x, scalar_type_t< VarVec > &lp)
 Return a positive valued, increasing ordered vector derived from the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<typename Var1 , typename Var2 , require_all_st_var< Var1, Var2 > * = nullptr, require_all_not_std_vector_t< Var1, Var2 > * = nullptr>
auto owens_t (const Var1 &h, const Var2 &a)
 The Owen's T function of h and a.
 
template<typename Var , typename Arith , require_st_arithmetic< Arith > * = nullptr, require_all_not_std_vector_t< Var, Arith > * = nullptr, require_st_var< Var > * = nullptr>
auto owens_t (const Var &h, const Arith &a)
 The Owen's T function of h and a.
 
template<typename Arith , typename Var , require_st_arithmetic< Arith > * = nullptr, require_all_not_std_vector_t< Var, Arith > * = nullptr, require_st_var< Var > * = nullptr>
auto owens_t (const Arith &h, const Var &a)
 The Owen's T function of h and a.
 
var Phi (const var &a)
 The unit normal cumulative density function for variables (stan).
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto Phi (const T &a)
 Elementwise unit normal cumulative density function for varmat types.
 
var Phi_approx (const var &a)
 Approximation of the unit normal CDF for variables (stan).
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto Phi_approx (const T &a)
 
std::complex< varpolar (const var &r, const var &theta)
 Returns complex number with specified magnitude and phase angle.
 
template<typename T >
std::complex< varpolar (T r, const var &theta)
 Returns complex number with specified magnitude and phase angle.
 
template<typename T >
std::complex< varpolar (const var &r, T theta)
 Returns complex number with specified magnitude and phase angle.
 
template<typename T , require_rev_col_vector_t< T > * = nullptr>
auto positive_ordered_constrain (const T &x)
 Return an increasing positive ordered vector derived from the specified free vector.
 
template<typename Scal1 , typename Scal2 , require_any_st_var< Scal1, Scal2 > * = nullptr, require_all_stan_scalar_t< Scal1, Scal2 > * = nullptr>
var pow (const Scal1 &base, const Scal2 &exponent)
 Return the base raised to the power of the exponent (cmath).
 
template<typename Mat1 , typename Mat2 , require_all_st_var_or_arithmetic< Mat1, Mat2 > * = nullptr, require_any_matrix_st< is_var, Mat1, Mat2 > * = nullptr, require_all_not_stan_scalar_t< Mat1, Mat2 > * = nullptr>
auto pow (const Mat1 &base, const Mat2 &exponent)
 Return the base raised to the power of the exponent (cmath).
 
template<typename Mat1 , typename Scal1 , require_all_st_var_or_arithmetic< Mat1, Scal1 > * = nullptr, require_all_matrix_st< is_var, Mat1 > * = nullptr, require_stan_scalar_t< Scal1 > * = nullptr>
auto pow (const Mat1 &base, const Scal1 &exponent)
 Return the base raised to the power of the exponent (cmath).
 
template<typename Scal1 , typename Mat1 , require_all_st_var_or_arithmetic< Scal1, Mat1 > * = nullptr, require_stan_scalar_t< Scal1 > * = nullptr, require_all_matrix_st< is_var, Mat1 > * = nullptr>
auto pow (Scal1 base, const Mat1 &exponent)
 Return the base scalar raised to the power of the exponent matrix elementwise.
 
std::complex< varpow (const std::complex< var > &x, const std::complex< var > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename T , typename = require_arithmetic_t<T>>
std::complex< varpow (const std::complex< var > &x, const std::complex< T > y)
 Return the first argument raised to the power of the second argument.
 
std::complex< varpow (const std::complex< var > &x, const var &y)
 Return the first argument raised to the power of the second argument.
 
template<typename T , typename = require_arithmetic_t<T>>
std::complex< varpow (const std::complex< var > &x, T y)
 Return the first argument raised to the power of the second argument.
 
template<typename T , typename = require_arithmetic_t<T>>
std::complex< varpow (std::complex< T > x, const std::complex< var > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename T , typename = require_arithmetic_t<T>>
std::complex< varpow (std::complex< T > x, const var &y)
 Return the first argument raised to the power of the second argument.
 
std::complex< varpow (const var &x, const std::complex< var > &y)
 Return the first argument raised to the power of the second argument.
 
template<typename T , typename = require_arithmetic_t<T>>
std::complex< varpow (const var &x, std::complex< T > y)
 Return the first argument raised to the power of the second argument.
 
template<typename T , typename = require_arithmetic_t<T>>
std::complex< varpow (T x, const std::complex< var > &y)
 Return the first argument raised to the power of the second argument.
 
std::complex< varpow (const std::complex< var > &x, int y)
 Return the first argument raised to the power of the second argument.
 
double primitive_value (const var &v)
 Return the primitive double value for the specified autodiff variable.
 
std::complex< varproj (const std::complex< var > &z)
 Return the projection of the complex argument onto the Riemann sphere.
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_not_eigen_col_vector_t< EigMat2 > * = nullptr, require_any_vt_var< EigMat1, EigMat2 > * = nullptr>
promote_scalar_t< var, EigMat2 > quad_form (const EigMat1 &A, const EigMat2 &B, bool symmetric=false)
 Return the quadratic form \( B^T A B \).
 
template<typename EigMat , typename ColVec , require_eigen_t< EigMat > * = nullptr, require_eigen_col_vector_t< ColVec > * = nullptr, require_any_vt_var< EigMat, ColVec > * = nullptr>
var quad_form (const EigMat &A, const ColVec &B, bool symmetric=false)
 Return the quadratic form \( B^T A B \).
 
template<typename Mat1 , typename Mat2 , require_all_matrix_t< Mat1, Mat2 > * = nullptr, require_not_col_vector_t< Mat2 > * = nullptr, require_any_var_matrix_t< Mat1, Mat2 > * = nullptr>
auto quad_form (const Mat1 &A, const Mat2 &B, bool symmetric=false)
 Return the quadratic form \( B^T A B \).
 
template<typename Mat , typename Vec , require_matrix_t< Mat > * = nullptr, require_col_vector_t< Vec > * = nullptr, require_any_var_matrix_t< Mat, Vec > * = nullptr>
var quad_form (const Mat &A, const Vec &B, bool symmetric=false)
 Return the quadratic form \( B^T A B \).
 
template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_any_vt_var< EigMat1, EigMat2 > * = nullptr>
auto quad_form_sym (const EigMat1 &A, const EigMat2 &B)
 Return the quadratic form \( B^T A B \) of a symmetric matrix.
 
template<typename T , require_var_vector_t< T > * = nullptr>
auto read_corr_L (const T &CPCs, size_t K)
 Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations.
 
template<typename T1 , typename T2 , require_var_vector_t< T1 > * = nullptr, require_stan_scalar_t< T2 > * = nullptr>
auto read_corr_L (const T1 &CPCs, size_t K, T2 &log_prob)
 Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation.
 
template<typename T_CPCs , require_var_vector_t< T_CPCs > * = nullptr>
var_value< Eigen::MatrixXd > read_corr_matrix (const T_CPCs &CPCs, size_t K)
 Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations.
 
template<typename T_CPCs , require_var_vector_t< T_CPCs > * = nullptr>
var_value< Eigen::MatrixXd > read_corr_matrix (const T_CPCs &CPCs, size_t K, scalar_type_t< T_CPCs > &log_prob)
 Return the correlation matrix of the specified dimensionality corresponding to the specified canonical partial correlations, incrementing the specified scalar reference with the log absolute determinant of the Jacobian of the transformation.
 
template<typename T_CPCs , typename T_sds , require_any_var_vector_t< T_CPCs, T_sds > * = nullptr, require_vt_same< T_CPCs, T_sds > * = nullptr>
auto read_cov_L (const T_CPCs &CPCs, const T_sds &sds, scalar_type_t< T_CPCs > &log_prob)
 This is the function that should be called prior to evaluating the density of any elliptical distribution.
 
template<typename T_CPCs , typename T_sds , require_all_var_vector_t< T_CPCs, T_sds > * = nullptr>
var_value< Eigen::MatrixXd > read_cov_matrix (const T_CPCs &CPCs, const T_sds &sds, scalar_type_t< T_CPCs > &log_prob)
 A generally worse alternative to call prior to evaluating the density of an elliptical distribution.
 
template<typename T_CPCs , typename T_sds , require_all_var_vector_t< T_CPCs, T_sds > * = nullptr>
var_value< Eigen::MatrixXd > read_cov_matrix (const T_CPCs &CPCs, const T_sds &sds)
 Builds a covariance matrix from CPCs and standard deviations.
 
template<typename Ret , typename Vec , require_var_matrix_t< Ret > * = nullptr, require_var_matrix_t< Vec > * = nullptr>
auto rep_matrix (const Vec &x, int n)
 Impl of rep_matrix returning a var_value<Eigen::Matrix> from a var_value with an inner Eigen vector type.
 
template<typename T_ret , require_var_matrix_t< T_ret > * = nullptr, require_eigen_row_vector_t< value_type_t< T_ret > > * = nullptr>
auto rep_row_vector (var x, int n)
 Overload for var_value<Vector>.
 
template<typename T_ret , require_var_matrix_t< T_ret > * = nullptr, require_eigen_col_vector_t< value_type_t< T_ret > > * = nullptr>
auto rep_vector (var x, int n)
 Overload for var_value<Vector>.
 
var rising_factorial (const var &a, int b)
 
var round (const var &a)
 Returns the rounded form of the specified variable (C99).
 
template<typename Mat1 , typename Mat2 , require_all_eigen_t< Mat1, Mat2 > * = nullptr, require_any_eigen_vt< is_var, Mat1, Mat2 > * = nullptr>
Eigen::Matrix< var, Mat1::RowsAtCompileTime, 1 > rows_dot_product (const Mat1 &v1, const Mat2 &v2)
 Returns the dot product of rows of the specified matrices.
 
template<typename Mat1 , typename Mat2 , require_all_matrix_t< Mat1, Mat2 > * = nullptr, require_any_var_matrix_t< Mat1, Mat2 > * = nullptr>
auto rows_dot_product (const Mat1 &v1, const Mat2 &v2)
 Returns the dot product of rows of the specified matrices.
 
template<typename Mat , require_eigen_vt< is_var, Mat > * = nullptr>
Eigen::Matrix< var, Mat::RowsAtCompileTime, 1 > rows_dot_self (const Mat &x)
 Returns the dot product of each row of a matrix with itself.
 
template<typename Mat , require_var_matrix_t< Mat > * = nullptr>
auto rows_dot_self (const Mat &x)
 Returns the dot product of row row of a matrix with itself.
 
template<typename T , require_eigen_st< is_var, T > * = nullptr>
var sd (const T &x)
 Return the sample standard deviation of a variable which inherits from EigenBase.
 
template<typename T , require_std_vector_st< is_var, T > * = nullptr>
auto sd (const T &m)
 Return the sample standard deviation of the specified std vector, column vector, row vector, matrix, or std vector of any of these types.
 
template<typename T , require_rev_col_vector_t< T > * = nullptr>
auto simplex_constrain (const T &y)
 Return the simplex corresponding to the specified free vector.
 
template<typename T , require_rev_col_vector_t< T > * = nullptr>
auto simplex_constrain (const T &y, scalar_type_t< T > &lp)
 Return the simplex corresponding to the specified free vector and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
var sin (const var &a)
 Return the sine of a radian-scaled variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto sin (const VarMat &a)
 Return the sine of a radian-scaled variable (cmath).
 
std::complex< varsin (const std::complex< var > &z)
 Return the sine of the complex argument.
 
template<typename EigMat , require_rev_matrix_t< EigMat > * = nullptr>
auto singular_values (const EigMat &m)
 Return the singular values of the specified matrix.
 
var sinh (const var &a)
 Return the hyperbolic sine of the specified variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto sinh (const VarMat &a)
 Return the hyperbolic of a radian-scaled variable (cmath).
 
std::complex< varsinh (const std::complex< var > &z)
 Return the hyperbolic sine of the complex argument.
 
template<typename Mat , require_rev_matrix_t< Mat > * = nullptr>
auto softmax (const Mat &alpha)
 Return the softmax of the specified Eigen vector.
 
var sqrt (const var &a)
 Return the square root of the specified variable (cmath).
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto sqrt (const T &a)
 Return elementwise square root of vector.
 
std::complex< varsqrt (const std::complex< var > &z)
 Return the square root of the complex argument.
 
var square (const var &x)
 Return the square of the input variable.
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto square (const T &x)
 Return the elementwise square of x.
 
var squared_distance (const var &a, const var &b)
 Returns the squared distance.
 
var squared_distance (const var &a, double b)
 Returns the squared distance.
 
var squared_distance (double a, const var &b)
 Returns the squared distance.
 
template<typename EigVecVar1 , typename EigVecVar2 , require_all_eigen_vector_vt< is_var, EigVecVar1, EigVecVar2 > * = nullptr>
var squared_distance (const EigVecVar1 &v1, const EigVecVar2 &v2)
 
template<typename EigVecVar , typename EigVecArith , require_eigen_vector_vt< is_var, EigVecVar > * = nullptr, require_eigen_vector_vt< std::is_arithmetic, EigVecArith > * = nullptr>
var squared_distance (const EigVecVar &v1, const EigVecArith &v2)
 
template<typename EigVecArith , typename EigVecVar , require_eigen_vector_vt< std::is_arithmetic, EigVecArith > * = nullptr, require_eigen_vector_vt< is_var, EigVecVar > * = nullptr>
var squared_distance (const EigVecArith &v1, const EigVecVar &v2)
 
template<typename T1 , typename T2 , require_all_vector_t< T1, T2 > * = nullptr, require_any_var_vector_t< T1, T2 > * = nullptr>
var squared_distance (const T1 &A, const T2 &B)
 Compute the squared distance between the elements in two inputs.
 
void stan_print (std::ostream *o, const var &x)
 
var step (const var &a)
 Return the step, or heaviside, function applied to the specified variable (stan).
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
plain_type_t< T > stochastic_column_constrain (const T &y)
 Return a column stochastic matrix.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
plain_type_t< T > stochastic_column_constrain (const T &y, scalar_type_t< T > &lp)
 Return a column stochastic matrix and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
plain_type_t< T > stochastic_row_constrain (const T &y)
 Return a row stochastic matrix.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
plain_type_t< T > stochastic_row_constrain (const T &y, scalar_type_t< T > &lp)
 Return a row stochastic matrix and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.
 
template<typename Alloc >
var sum (const std::vector< var, Alloc > &m)
 Returns the sum of the entries of the specified vector.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
var sum (const T &x)
 Returns the sum of the coefficients of the specified matrix.
 
template<typename EigMat , require_rev_matrix_t< EigMat > * = nullptr>
auto svd (const EigMat &m)
 Given input matrix m, return the singular value decomposition (U,D,V) such that m = U*diag(D)*V^{T}
 
template<typename EigMat , require_rev_matrix_t< EigMat > * = nullptr>
auto svd_U (const EigMat &m)
 Given input matrix m, return matrix U where m = UDV^{T}
 
template<typename EigMat , require_rev_matrix_t< EigMat > * = nullptr>
auto svd_V (const EigMat &m)
 Given input matrix m, return matrix V where m = UDV^{T}
 
var tan (const var &a)
 Return the tangent of a radian-scaled variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto tan (const VarMat &a)
 Return the tangent of a radian-scaled variable (cmath).
 
std::complex< vartan (const std::complex< var > &z)
 Return the tangent of the complex argument.
 
var tanh (const var &a)
 Return the hyperbolic tangent of the specified variable (cmath).
 
template<typename VarMat , require_var_matrix_t< VarMat > * = nullptr>
auto tanh (const VarMat &a)
 Return the hyperbolic tangent of elements of a.
 
std::complex< vartanh (const std::complex< var > &z)
 Return the hyperbolic tangent of the complex argument.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
auto tcrossprod (const T &M)
 Returns the result of post-multiplying a matrix by its own transpose.
 
var tgamma (const var &a)
 Return the Gamma function applied to the specified variable (C99).
 
template<typename T , require_var_matrix_t< T > * = nullptr>
auto tgamma (const T &a)
 Return elementwise gamma function.
 
template<typename T , require_not_same_t< T, arena_t< T > > * = nullptr, require_not_container_t< T > * = nullptr, require_not_matrix_cl_t< T > * = nullptr>
arena_t< T > to_arena (T &&a)
 Converts given argument into a type that either has any dynamic allocation on AD stack or schedules its destructor to be called when AD stack memory is recovered.
 
template<typename T , require_same_t< T, arena_t< T > > * = nullptr, require_not_matrix_cl_t< T > * = nullptr, require_not_std_vector_t< T > * = nullptr>
std::remove_reference_t< T > to_arena (T &&a)
 Converts given argument into a type that either has any dynamic allocation on AD stack or schedules its destructor to be called when AD stack memory is recovered.
 
template<typename T , require_eigen_t< T > * = nullptr, require_not_same_t< T, arena_t< T > > * = nullptr>
arena_t< T > to_arena (const T &a)
 Converts given argument into a type that either has any dynamic allocation on AD stack or schedules its destructor to be called when AD stack memory is recovered.
 
template<typename T >
std::vector< T, arena_allocator< T > > to_arena (const std::vector< T, arena_allocator< T > > &a)
 Converts given argument into a type that either has any dynamic allocation on AD stack or schedules its destructor to be called when AD stack memory is recovered.
 
template<typename T , require_same_t< T, arena_t< T > > * = nullptr>
arena_t< std::vector< T > > to_arena (const std::vector< T > &a)
 Converts given argument into a type that has any dynamic allocation on AD stack.
 
template<bool Condition, typename T , std::enable_if_t<!Condition > * = nullptr>
to_arena_if (T &&a)
 If the condition is true, converts given argument into a type that has any dynamic allocation on AD stack.
 
template<bool Condition, typename T , std::enable_if_t< Condition > * = nullptr>
arena_t< T > to_arena_if (const T &a)
 
template<int Options = Eigen::ColMajor, typename VarMatrix , typename Vec1 , typename Vec2 , require_var_t< VarMatrix > * = nullptr, require_eigen_dense_base_t< value_type_t< VarMatrix > > * = nullptr, require_all_std_vector_vt< std::is_integral, Vec1, Vec2 > * = nullptr>
auto to_soa_sparse_matrix (int m, int n, VarMatrix &&w, Vec1 &&u, Vec2 &&v)
 Create a sparse matrix from the given SoA matrix and indexes.
 
template<int Options = Eigen::ColMajor, typename MatrixVar , typename Vec1 , typename Vec2 , require_eigen_dense_base_vt< is_var, MatrixVar > * = nullptr, require_all_std_vector_vt< std::is_integral, Vec1, Vec2 > * = nullptr>
auto to_soa_sparse_matrix (int m, int n, MatrixVar &&w, Vec1 &&u, Vec2 &&v)
 Create a sparse matrix from the given AoS matrix of vars and indexes.
 
template<int Options = Eigen::ColMajor, typename Mat , typename Vec1 , typename Vec2 , require_eigen_dense_base_vt< std::is_arithmetic, Mat > * = nullptr, require_all_std_vector_vt< std::is_integral, Vec1, Vec2 > * = nullptr>
auto to_soa_sparse_matrix (int m, int n, Mat &&w, Vec1 &&u, Vec2 &&v)
 Create a sparse matrix from the given matrix of floats and indexes.
 
var to_var (double x)
 Converts argument to an automatic differentiation variable.
 
varto_var (var &x)
 Specialization of to_var for non-const var input.
 
const varto_var (const var &x)
 Specialization of to_var for const var input.
 
std::vector< varto_var (const std::vector< double > &v)
 Converts argument to an automatic differentiation variable.
 
const std::vector< var > & to_var (const std::vector< var > &v)
 Specialization of to_var to for const input vector of var.
 
std::vector< var > & to_var (std::vector< var > &v)
 Specialization of to_var to for non-const input vector of var.
 
matrix_v to_var (const matrix_d &m)
 Converts argument to an automatic differentiation variable.
 
matrix_vto_var (matrix_v &m)
 Specialization of to_var for non-const matrices of vars.
 
const matrix_vto_var (const matrix_v &m)
 Specialization of to_var for const matrices of vars.
 
vector_v to_var (const vector_d &v)
 Converts argument to an automatic differentiation variable.
 
const vector_vto_var (const vector_v &v)
 Specialization of to_var for const column vector of vars.
 
vector_vto_var (vector_v &v)
 Specialization of to_var for non-const column vector of vars.
 
row_vector_v to_var (const row_vector_d &rv)
 Converts argument to an automatic differentiation variable.
 
const row_vector_vto_var (const row_vector_v &rv)
 Specialization of to_var for const row vector of vars.
 
row_vector_vto_var (row_vector_v &rv)
 Specialization of to_var for non-const row vector of vars.
 
template<typename T , require_eigen_vt< is_var, T > * = nullptr>
var_value< Eigen::Matrix< double, T::RowsAtCompileTime, T::ColsAtCompileTime > > to_var_value (const T &a)
 Converts an Eigen matrix (or vector or row_vector) or expression of vars into var_value.
 
template<typename T , require_var_t< T > * = nullptr>
to_var_value (T &&a)
 This is a no-op for var_values.
 
template<typename T >
auto to_var_value (const std::vector< T > &a)
 Convert the elements of the std::vector input to var_value types if possible.
 
template<typename EigMat , require_eigen_t< EigMat > * = nullptr>
auto to_vector (const var_value< EigMat > &x)
 Reshape a var_value<Matrix> to a var_value<ColumnVector>.
 
template<typename T , require_rev_matrix_t< T > * = nullptr>
auto trace (const T &m)
 Returns the trace of the specified matrix.
 
template<typename Td , typename Ta , typename Tb , require_not_col_vector_t< Td > * = nullptr, require_all_matrix_t< Td, Ta, Tb > * = nullptr, require_any_st_var< Td, Ta, Tb > * = nullptr>
var trace_gen_inv_quad_form_ldlt (const Td &D, LDLT_factor< Ta > &A, const Tb &B)
 Compute the trace of an inverse quadratic form premultiplied by a square matrix.
 
template<typename Td , typename Ta , typename Tb , require_col_vector_t< Td > * = nullptr, require_all_matrix_t< Ta, Tb > * = nullptr, require_any_st_var< Td, Ta, Tb > * = nullptr>
var trace_gen_inv_quad_form_ldlt (const Td &D, const LDLT_factor< Ta > &A, const Tb &B)
 Compute the trace of an inverse quadratic form.
 
template<typename Td , typename Ta , typename Tb , typename = require_any_var_t<value_type_t<Td>, value_type_t<Ta>, value_type_t<Tb>>, typename = require_all_eigen_t<Td, Ta, Tb>>
var trace_gen_quad_form (const Td &D, const Ta &A, const Tb &B)
 Return the trace of D times the quadratic form of B and A.
 
template<typename T1 , typename T2 , require_all_matrix_t< T1, T2 > * = nullptr, require_any_st_var< T1, T2 > * = nullptr>
var trace_inv_quad_form_ldlt (LDLT_factor< T1 > &A, const T2 &B)
 Compute the trace of an inverse quadratic form premultiplied by a square matrix.
 
template<typename Mat1 , typename Mat2 , require_all_matrix_t< Mat1, Mat2 > * = nullptr, require_any_var_matrix_t< Mat1, Mat2 > * = nullptr>
var trace_quad_form (const Mat1 &A, const Mat2 &B)
 Compute trace(B^T A B).
 
var trigamma (const var &u)
 Return the value of the trigamma function at the specified argument (i.e., the second derivative of the log Gamma function at the specified argument).
 
var trunc (const var &a)
 Returns the truncation of the specified variable (C99).
 
template<typename T , typename U , require_matrix_t< T > * = nullptr, require_stan_scalar_t< U > * = nullptr, require_any_st_var< T, U > * = nullptr>
auto ub_constrain (const T &x, const U &ub, return_type_t< T, U > &lp)
 Specialization of ub_constrain to apply a scalar upper bound elementwise to each input.
 
template<typename T , require_rev_col_vector_t< T > * = nullptr>
auto unit_vector_constrain (const T &y)
 Return the unit length vector corresponding to the free vector y.
 
template<typename T , require_eigen_col_vector_vt< is_var, T > * = nullptr>
auto unit_vector_constrain (const T &y, var &lp)
 Return the unit length vector corresponding to the free vector y.
 
template<typename T >
auto & value_of (const var_value< T > &v)
 Return the value of the specified variable.
 
template<typename T >
auto & value_of_rec (const var_value< T > &v)
 Return the value of the specified variable.
 
var variance (const std::vector< var > &v)
 Return the sample variance of the specified standard vector.
 
template<typename EigMat , require_eigen_vt< is_var, EigMat > * = nullptr>
var variance (const EigMat &m)
 Return the sample variance of the specified vector, row vector, or matrix.
 
template<typename Mat , require_var_matrix_t< Mat > * = nullptr>
var variance (const Mat &x)
 Return the sample variance of the var_value matrix Raise domain error if size is not greater than zero.
 
template<typename F , typename T1 , typename T2 , typename T_u , typename T_f >
Eigen::Matrix< T2, -1, 1 > algebra_solver_fp (const F &f, const Eigen::Matrix< T1, -1, 1 > &x, const Eigen::Matrix< T2, -1, 1 > &y, const std::vector< double > &x_r, const std::vector< int > &x_i, const std::vector< T_u > &u_scale, const std::vector< T_f > &f_scale, std::ostream *msgs=nullptr, double f_tol=1e-8, int max_num_steps=200)
 Return a fixed pointer to the specified system of algebraic equations of form.
 
template<typename T1 , typename T2 >
void algebra_solver_check (const Eigen::Matrix< T1, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< T2, Eigen::Dynamic, 1 > y, const std::vector< double > &dat, const std::vector< int > &dat_int, double function_tolerance, long int max_num_steps)
 
void cvodes_set_options (void *cvodes_mem, long int max_num_steps)
 
template<typename F , typename T_yy , typename T_yp , typename... T_Args, require_all_eigen_col_vector_t< T_yy, T_yp > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_yy, T_yp, T_Args... >, -1, 1 > > dae_tol_impl (const char *func, const F &f, const T_yy &yy0, const T_yp &yp0, double t0, const std::vector< double > &ts, double rtol, double atol, int64_t max_num_steps, std::ostream *msgs, const T_Args &... args)
 Solve the DAE initial value problem f(t, y, y')=0, y(t0) = yy0, y'(t0)=yp0 at a set of times, { t1, t2, t3, ... } using IDAS.
 
template<typename F , typename T_yy , typename T_yp , typename... T_Args, require_all_eigen_col_vector_t< T_yy, T_yp > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_yy, T_yp, T_Args... >, -1, 1 > > dae_tol (const F &f, const T_yy &yy0, const T_yp &yp0, double t0, const std::vector< double > &ts, double rtol, double atol, int64_t max_num_steps, std::ostream *msgs, const T_Args &... args)
 Solve the DAE initial value problem f(t, y, y')=0, y(t0) = yy0, y'(t0)=yp0 at a set of times, { t1, t2, t3, ... } using IDAS.
 
template<typename F , typename T_yy , typename T_yp , typename... T_Args, require_all_eigen_col_vector_t< T_yy, T_yp > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_yy, T_yp, T_Args... >, -1, 1 > > dae (const F &f, const T_yy &yy0, const T_yp &yp0, double t0, const std::vector< double > &ts, std::ostream *msgs, const T_Args &... args)
 Solve the DAE initial value problem f(t, y, y')=0, y(t0) = yy0, y'(t0)=yp0 at a set of times, { t1, t2, t3, ... } using IDAS, assuming default controls (relative tol, absolute tol, max number of steps) = (1.e-10, 1.e-10, 1e8).
 
template<typename F >
void gradient (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, double &fx, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad_fx)
 Calculate the value and the gradient of the specified function at the specified argument.
 
template<typename F , typename EigVec , typename InputIt , require_eigen_vector_vt< std::is_arithmetic, EigVec > * = nullptr>
void gradient (const F &f, const EigVec &x, double &fx, InputIt first_grad_fx, InputIt last_grad_fx)
 Calculate the value and the gradient of the specified function at the specified argument.
 
template<typename F , typename T_y0 , typename T_param , typename T_t0 , typename T_ts >
std::vector< std::vector< return_type_t< T_y0, T_param, T_t0, T_ts > > > integrate_ode_adams (const F &f, const std::vector< T_y0 > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-10, double absolute_tolerance=1e-10, long int max_num_steps=1e8)
 
template<typename F , typename T_y0 , typename T_param , typename T_t0 , typename T_ts >
std::vector< std::vector< return_type_t< T_y0, T_param, T_t0, T_ts > > > integrate_ode_bdf (const F &f, const std::vector< T_y0 > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs=nullptr, double relative_tolerance=1e-10, double absolute_tolerance=1e-10, long int max_num_steps=1e8)
 
template<typename F >
void jacobian (const F &f, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, Eigen::Matrix< double, Eigen::Dynamic, 1 > &fx, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &J)
 
template<typename F1 , typename... Args>
Eigen::VectorXd kinsol_solve (const F1 &f, const Eigen::VectorXd &x, const double scaling_step_tol, const double function_tolerance, const int64_t max_num_steps, const bool custom_jacobian, const int steps_eval_jacobian, const int global_line_search, std::ostream *const msgs, const Args &... args)
 Return the solution to the specified algebraic system, given an initial guess.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... T_Args, require_eigen_col_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, T_Args... >, Eigen::Dynamic, 1 > > ode_adams_tol_impl (const char *function_name, const F &f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the non-stiff Adams-Moulton solver from CVODES.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... T_Args, require_eigen_col_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, T_Args... >, Eigen::Dynamic, 1 > > ode_adams_tol (const F &f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the non-stiff Adams-Moulton solver from CVODES.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... T_Args, require_eigen_col_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, T_Args... >, Eigen::Dynamic, 1 > > ode_adams (const F &f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the non-stiff Adams-Moulton solver in CVODES with defaults for relative_tolerance, absolute_tolerance, and max_num_steps.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename T_abs_tol_fwd , typename T_abs_tol_bwd , typename... T_Args, require_all_eigen_col_vector_t< T_y0, T_abs_tol_fwd, T_abs_tol_bwd > * = nullptr, require_any_not_st_arithmetic< T_y0, T_t0, T_ts, T_Args... > * = nullptr>
auto ode_adjoint_impl (const char *function_name, F &&f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance_forward, const T_abs_tol_fwd &absolute_tolerance_forward, double relative_tolerance_backward, const T_abs_tol_bwd &absolute_tolerance_backward, double relative_tolerance_quadrature, double absolute_tolerance_quadrature, long int max_num_steps, long int num_steps_between_checkpoints, int interpolation_polynomial, int solver_forward, int solver_backward, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the stiff backward differentiation formula BDF solver or the non-stiff Adams solver from CVODES.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename T_abs_tol_fwd , typename T_abs_tol_bwd , typename... T_Args, require_all_eigen_col_vector_t< T_y0, T_abs_tol_fwd, T_abs_tol_bwd > * = nullptr, require_all_st_arithmetic< T_y0, T_t0, T_ts, T_Args... > * = nullptr>
std::vector< Eigen::VectorXd > ode_adjoint_impl (const char *function_name, F &&f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance_forward, const T_abs_tol_fwd &absolute_tolerance_forward, double relative_tolerance_backward, const T_abs_tol_bwd &absolute_tolerance_backward, double relative_tolerance_quadrature, double absolute_tolerance_quadrature, long int max_num_steps, long int num_steps_between_checkpoints, int interpolation_polynomial, int solver_forward, int solver_backward, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the stiff backward differentiation formula BDF solver or the non-stiff Adams solver from CVODES.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename T_abs_tol_fwd , typename T_abs_tol_bwd , typename... T_Args, require_all_eigen_col_vector_t< T_y0, T_abs_tol_fwd, T_abs_tol_bwd > * = nullptr>
auto ode_adjoint_tol_ctl (F &&f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance_forward, const T_abs_tol_fwd &absolute_tolerance_forward, double relative_tolerance_backward, const T_abs_tol_bwd &absolute_tolerance_backward, double relative_tolerance_quadrature, double absolute_tolerance_quadrature, long int max_num_steps, long int num_steps_between_checkpoints, int interpolation_polynomial, int solver_forward, int solver_backward, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the stiff backward differentiation formula BDF solver or the non-stiff Adams solver from CVODES.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... T_Args, require_eigen_col_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, T_Args... >, Eigen::Dynamic, 1 > > ode_bdf_tol_impl (const char *function_name, const F &f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the stiff backward differentiation formula BDF solver from CVODES.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... T_Args, require_eigen_col_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, T_Args... >, Eigen::Dynamic, 1 > > ode_bdf_tol (const F &f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, double relative_tolerance, double absolute_tolerance, long int max_num_steps, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the stiff backward differentiation formula BDF solver from CVODES.
 
template<typename F , typename T_y0 , typename T_t0 , typename T_ts , typename... T_Args, require_eigen_col_vector_t< T_y0 > * = nullptr>
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, T_Args... >, Eigen::Dynamic, 1 > > ode_bdf (const F &f, const T_y0 &y0, const T_t0 &t0, const std::vector< T_ts > &ts, std::ostream *msgs, const T_Args &... args)
 Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the stiff backward differentiation formula (BDF) solver in CVODES with defaults for relative_tolerance, absolute_tolerance, and max_num_steps.
 
template<typename F , typename T_y0_t0 , typename T_t0 , typename T_t , typename... Args, require_any_autodiff_t< T_y0_t0, T_t0, T_t, scalar_type_t< Args >... > * = nullptr>
Eigen::Matrix< var, Eigen::Dynamic, 1 > ode_store_sensitivities (const F &f, const std::vector< double > &coupled_state, const Eigen::Matrix< T_y0_t0, Eigen::Dynamic, 1 > &y0, const T_t0 &t0, const T_t &t, std::ostream *msgs, const Args &... args)
 Build output vars for a state of the ODE solve, storing the sensitivities precomputed using the forward sensitivity problem in precomputed varis.
 
template<typename F , typename T , typename... Args, require_eigen_vector_t< T > * = nullptr, require_all_st_arithmetic< Args... > * = nullptr>
Eigen::VectorXd solve_newton_tol (const F &f, const T &x, const double scaling_step_size, const double function_tolerance, const int64_t max_num_steps, std::ostream *const msgs, const Args &... args)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename F , typename T , typename... T_Args, require_eigen_vector_t< T > * = nullptr, require_any_st_var< T_Args... > * = nullptr>
Eigen::Matrix< var, Eigen::Dynamic, 1 > solve_newton_tol (const F &f, const T &x, const double scaling_step_size, const double function_tolerance, const int64_t max_num_steps, std::ostream *const msgs, const T_Args &... args)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename F , typename T , typename... T_Args, require_eigen_vector_t< T > * = nullptr>
Eigen::Matrix< stan::return_type_t< T_Args... >, Eigen::Dynamic, 1 > solve_newton (const F &f, const T &x, std::ostream *const msgs, const T_Args &... args)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename F , typename T1 , typename T2 , require_all_eigen_vector_t< T1, T2 > * = nullptr>
Eigen::Matrix< scalar_type_t< T2 >, Eigen::Dynamic, 1 > algebra_solver_newton (const F &f, const T1 &x, const T2 &y, const std::vector< double > &dat, const std::vector< int > &dat_int, std::ostream *const msgs=nullptr, const double scaling_step_size=1e-3, const double function_tolerance=1e-6, const long int max_num_steps=200)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename F , typename T , typename... Args, require_eigen_vector_t< T > * = nullptr>
T & solve_powell_call_solver (const F &f, T &x, std::ostream *const msgs, const double relative_tolerance, const double function_tolerance, const int64_t max_num_steps, const Args &... args)
 Solve algebraic equations using Powell solver.
 
template<typename F , typename T , typename... Args, require_eigen_vector_t< T > * = nullptr, require_all_st_arithmetic< Args... > * = nullptr>
Eigen::VectorXd solve_powell_tol (const F &f, const T &x, const double relative_tolerance, const double function_tolerance, const int64_t max_num_steps, std::ostream *const msgs, const Args &... args)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename F , typename T , typename... T_Args, require_eigen_vector_t< T > * = nullptr>
Eigen::Matrix< stan::return_type_t< T_Args... >, Eigen::Dynamic, 1 > solve_powell (const F &f, const T &x, std::ostream *const msgs, const T_Args &... args)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename F , typename T1 , typename T2 , require_all_eigen_vector_t< T1, T2 > * = nullptr>
Eigen::Matrix< value_type_t< T2 >, Eigen::Dynamic, 1 > algebra_solver (const F &f, const T1 &x, const T2 &y, const std::vector< double > &dat, const std::vector< int > &dat_int, std::ostream *msgs=nullptr, const double relative_tolerance=1e-10, const double function_tolerance=1e-6, const int64_t max_num_steps=1e+3)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename F , typename T , typename... T_Args, require_eigen_vector_t< T > * = nullptr, require_any_st_var< T_Args... > * = nullptr>
Eigen::Matrix< var, Eigen::Dynamic, 1 > solve_powell_tol (const F &f, const T &x, const double relative_tolerance, const double function_tolerance, const int64_t max_num_steps, std::ostream *const msgs, const T_Args &... args)
 Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
 
template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto std_normal_log_qf (const var_value< T > &log_p)
 Return the elementwise inverse of unit normal cumulative density function.
 
template<typename T , typename L , typename U , require_not_std_vector_t< T > * = nullptr, require_all_stan_scalar_t< L, U > * = nullptr>
auto lub_free (T &&y, L &&lb, U &&ub)
 lub_free Return the unconstrained variable that transforms to the y given the specified bounds.
 
template<typename T , typename L , typename U , require_all_eigen_t< T, L, U > * = nullptr>
auto lub_free (T &&y, L &&lb, U &&ub)
 Overload for matrix constrained variable, matrix upper bound, matrix lower bound.
 
template<typename T , typename L , typename U , require_all_not_std_vector_t< L, U > * = nullptr>
auto lub_free (const std::vector< T > y, const L &lb, const U &ub)
 Overload for std::vector constrained variable.
 
template<typename T , typename L , typename U , require_not_std_vector_t< L > * = nullptr>
auto lub_free (const std::vector< T > y, const L &lb, const std::vector< U > &ub)
 Overload for std::vector constrained variable and std::vector upper bound.
 
template<typename T , typename L , typename U , require_not_std_vector_t< U > * = nullptr>
auto lub_free (const std::vector< T > y, const std::vector< L > &lb, const U &ub)
 Overload for std::vector constrained variable and std::vector lower bound.
 
template<typename T , typename L , typename U >
auto lub_free (const std::vector< T > y, const std::vector< L > &lb, const std::vector< U > &ub)
 Overload for std::vector constrained variable and std::vector constraints.
 

Variables

static opencl_context opencl_context
 
const double CONSTRAINT_TOLERANCE = 1E-8
 The tolerance for checking arithmetic bounds in rank and in simplexes.
 
static constexpr double EPSILON = std::numeric_limits<double>::epsilon()
 Smallest positive value.
 
static constexpr double INFTY = std::numeric_limits<double>::infinity()
 Positive infinity.
 
static constexpr double NEGATIVE_INFTY = -INFTY
 Negative infinity.
 
static constexpr double NOT_A_NUMBER = std::numeric_limits<double>::quiet_NaN()
 (Quiet) not-a-number value.
 
static constexpr double TWO_PI = boost::math::constants::two_pi<double>()
 Twice the value of \( \pi \), \( 2\pi \).
 
static constexpr double LOG_ZERO = -INFTY
 The natural logarithm of 0, \( \log 0 \).
 
const double LOG_EPSILON = std::log(EPSILON)
 The natural logarithm of machine precision \( \epsilon \), \( \log \epsilon \).
 
static constexpr double LOG_TWO = boost::math::constants::ln_two<double>()
 The natural logarithm of 2, \( \log 2 \).
 
static constexpr double LOG_PI = 1.14472988584940017414342735135
 The natural logarithm of \( \pi \), \( \log \pi \).
 
static constexpr double LOG_HALF = -LOG_TWO
 The natural logarithm of 0.5, \( \log 0.5 = \log 1 - \log 2 \).
 
static constexpr double LOG_TWO_PI = LOG_TWO + LOG_PI
 The natural logarithm of 2 plus the natural logarithm of \( \pi \), \( \log(2\pi) \).
 
static constexpr double LOG_PI_OVER_FOUR = 0.25 * LOG_PI
 The value of one quarter the natural logarithm of \( \pi \), \( \log(\pi) / 4 \).
 
static constexpr double LOG_SQRT_PI = LOG_PI / 2
 The natural logarithm of the square root of \( \pi \), \( \log(sqrt{\pi}) \).
 
static constexpr double LOG_TEN = boost::math::constants::ln_ten<double>()
 The natural logarithm of 10, \( \log 10 \).
 
static constexpr double SQRT_TWO = boost::math::constants::root_two<double>()
 The value of the square root of 2, \( \sqrt{2} \).
 
static constexpr double SQRT_PI = boost::math::constants::root_pi<double>()
 The value of the square root of \( \pi \), \( \sqrt{\pi} \).
 
static constexpr double SQRT_TWO_PI = boost::math::constants::root_two_pi<double>()
 The value of the square root of \( 2\pi \), \( \sqrt{2\pi} \).
 
static constexpr double SQRT_TWO_OVER_SQRT_PI = SQRT_TWO / SQRT_PI
 The square root of 2 divided by the square root of \( \pi \), \( \sqrt{2} / \sqrt{\pi} \).
 
static constexpr double INV_SQRT_TWO = boost::math::constants::one_div_root_two<double>()
 The value of 1 over the square root of 2, \( 1 / \sqrt{2} \).
 
static constexpr double INV_SQRT_PI = boost::math::constants::one_div_root_pi<double>()
 The value of 1 over the square root of \( \pi \), \( 1 / \sqrt{\pi} \).
 
static constexpr double INV_SQRT_TWO_PI = boost::math::constants::one_div_root_two_pi<double>()
 The value of 1 over the square root of \( 2\pi \), \( 1 / \sqrt{2\pi} \).
 
static constexpr double TWO_OVER_SQRT_PI = boost::math::constants::two_div_root_pi<double>()
 The value of 2 over the square root of \( \pi \), \( 2 / \sqrt{\pi} \).
 
static constexpr double HALF_LOG_TWO = 0.5 * LOG_TWO
 The value of half the natural logarithm 2, \( \log(2) / 2 \).
 
static constexpr double HALF_LOG_TWO_PI = 0.5 * LOG_TWO_PI
 The value of half the natural logarithm \( 2\pi \), \( \log(2\pi) / 2 \).
 
const double NEG_LOG_SQRT_TWO_PI = -std::log(SQRT_TWO_PI)
 The value of minus the natural logarithm of the square root of \( 2\pi \), \( -\log(\sqrt{2\pi}) \).
 
const double POISSON_MAX_RATE = std::pow(2.0, 30)
 Largest rate parameter allowed in Poisson RNG.
 
constexpr double lgamma_stirling_diff_useful = 10
 
const std::string MAJOR_VERSION = "4"
 Major version number for Stan math library.
 
const std::string MINOR_VERSION = "8"
 Minor version number for Stan math library.
 
const std::string PATCH_VERSION = "1"
 Patch version for Stan math library.