1#ifndef STAN_MATH_PRIM_FUN_APPEND_ROW_HPP
2#define STAN_MATH_PRIM_FUN_APPEND_ROW_HPP
30template <
typename T1,
typename T2, require_all_eigen_t<T1, T2>* =
nullptr>
35 constexpr int col_type
36 = (T1::ColsAtCompileTime == 1 && T2::ColsAtCompileTime == 1)
44 check_size_match(
"append_row",
"columns of A", Acols,
"columns of B", Bcols);
46 Matrix<T_return, Dynamic, col_type> result(Arows + Brows, Acols);
47 result.topRows(Arows) = A.template cast<T_return>();
48 result.bottomRows(Brows) = B.template cast<T_return>();
65template <
typename Scal,
typename ColVec,
68inline Eigen::Matrix<return_type_t<Scal, ColVec>, Eigen::Dynamic, 1>
append_row(
69 const Scal& A,
const ColVec& B) {
74 Matrix<T_return, Dynamic, 1> result(B.size() + 1);
75 result << A, B.template cast<T_return>();
92template <
typename ColVec,
typename Scal,
95inline Eigen::Matrix<return_type_t<ColVec, Scal>, Eigen::Dynamic, 1>
append_row(
96 const ColVec& A,
const Scal& B) {
101 Matrix<T_return, Dynamic, 1> result(A.size() + 1);
102 result << A.template cast<T_return>(), B;
auto append_row(Ta &&a, Tb &&b)
Stack the rows of the first argument on top of the second argument.
require_t< is_stan_scalar< std::decay_t< T > > > require_stan_scalar_t
Require type satisfies is_stan_scalar.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
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.
std::enable_if_t< Check::value > require_t
If condition is true, template is enabled.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...