1#ifndef STAN_MATH_REV_CORE_DEEP_COPY_VARS_HPP
2#define STAN_MATH_REV_CORE_DEEP_COPY_VARS_HPP
22template <
typename Arith,
typename = require_arithmetic_t<scalar_type_t<Arith>>>
24 return std::forward<Arith>(
arg);
44template <
typename VarVec, require_std_vector_vt<is_var, VarVec>* =
nullptr>
46 std::vector<var> copy_vec(
arg.size());
47 for (
size_t i = 0; i <
arg.size(); ++i) {
48 copy_vec[i] =
new vari(
arg[i].val(),
false);
60template <
typename VecContainer,
64 std::vector<value_type_t<VecContainer>> copy_vec(
arg.size());
65 for (
size_t i = 0; i <
arg.size(); ++i) {
78template <
typename EigT, require_eigen_vt<is_var, EigT>* =
nullptr>
80 return arg.unaryExpr([](
auto&& x) {
return var(
new vari(x.val(),
false)); })
require_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check... > > require_std_vector_vt
Require type satisfies is_std_vector.
require_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check... > > require_std_vector_st
Require type satisfies is_std_vector.
fvar< T > arg(const std::complex< fvar< T > > &z)
Return the phase angle of the complex argument.
T eval(T &&arg)
Inputs which have a plain_type equal to the own time are forwarded unmodified (for Eigen expressions ...
vari_value< double > vari
Arith deep_copy_vars(Arith &&arg)
Forward arguments that do not contain vars.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...