1#ifndef STAN_MATH_FWD_FUN_TO_FVAR_HPP
2#define STAN_MATH_FWD_FUN_TO_FVAR_HPP
13template <
typename T, require_stan_scalar_t<T>* =
nullptr,
14 require_not_fvar_t<T>* =
nullptr>
25template <
typename T, require_fvar_t<scalar_type_t<T>>* =
nullptr>
27 return std::forward<T>(x);
31inline std::vector<fvar<T>>
to_fvar(
const std::vector<T>& v) {
32 std::vector<fvar<T>> x(v.size());
33 for (
size_t i = 0; i < v.size(); ++i) {
40inline std::vector<fvar<T>>
to_fvar(
const std::vector<T>& v,
41 const std::vector<T>& d) {
42 std::vector<fvar<T>> x(v.size());
43 for (
size_t i = 0; i < v.size(); ++i) {
49template <
typename T, require_eigen_t<T>* =
nullptr,
50 require_not_eigen_vt<is_fvar, T>* =
nullptr>
58template <
typename T1,
typename T2, require_all_eigen_t<T1, T2>* =
nullptr,
59 require_vt_same<T1, T2>* =
nullptr>
typename promote_scalar_type< std::decay_t< T >, std::decay_t< S > >::type promote_scalar_t
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.
fvar< T > to_fvar(const T &x)
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
This template class represents scalars used in forward-mode automatic differentiation,...