1 #ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_ROW_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_APPEND_ROW_HPP
34 template <
typename T1,
typename T2,
int R1,
int C1,
int R2,
int C2>
35 inline Eigen::Matrix<typename return_type<T1, T2>::type,
36 Eigen::Dynamic, Eigen::Dynamic>
38 const Eigen::Matrix<T2, R2, C2>& B) {
47 "columns of A", Acols,
48 "columns of B", Bcols);
50 Matrix<typename return_type<T1, T2>::type, Dynamic, Dynamic>
51 result(Arows + Brows, Acols);
52 for (
int j = 0; j < Acols; j++) {
53 for (
int i = 0; i < Arows; i++)
54 result(i, j) = A(i, j);
55 for (
int i = Arows, k = 0; k < Brows; i++, k++)
56 result(i, j) = B(k, j);
77 template <
typename T1,
typename T2,
int R1,
int R2>
78 inline Eigen::Matrix<typename return_type<T1, T2>::type,
81 const Eigen::Matrix<T2, R2, 1>& B) {
87 Matrix<typename return_type<T1, T2>::type, 1, Dynamic>
88 result(Asize + Bsize);
89 for (
int i = 0; i < Asize; i++)
91 for (
int i = 0, j = Asize; i < Bsize; i++, j++)
119 template <
typename T,
int R1,
int C1,
int R2,
int C2>
120 inline Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
122 const Eigen::Matrix<T, R2, C2>& B) {
123 using Eigen::Dynamic;
127 "columns of A", A.cols(),
128 "columns of B", B.cols());
130 Matrix<T, Dynamic, Dynamic>
131 result(A.rows() + B.rows(), A.cols());
153 template <
typename T,
int R1,
int R2>
154 inline Eigen::Matrix<T, Eigen::Dynamic, 1>
156 const Eigen::Matrix<T, R2, 1>& B) {
157 using Eigen::Dynamic;
160 Matrix<T, Dynamic, 1> result(A.size()+B.size());
179 template <
typename T1,
typename T2,
int R,
int C>
180 inline Eigen::Matrix<typename return_type<T1, T2>::type,
183 const Eigen::Matrix<T2, R, C>& B) {
184 using Eigen::Dynamic;
188 Matrix<return_type, Dynamic, 1>
189 result(B.size() + 1);
190 result << A, B.template cast<return_type>();
208 template <
typename T1,
typename T2,
int R,
int C>
209 inline Eigen::Matrix<typename return_type<T1, T2>::type,
213 using Eigen::Dynamic;
217 Matrix<return_type, Dynamic, 1>
218 result(A.size() + 1);
219 result << A.template cast<return_type>(), B;
Metaprogram to calculate the base scalar return type resulting from promoting all the scalar types of...
boost::math::tools::promote_args< typename scalar_type< T1 >::type, typename scalar_type< T2 >::type, typename scalar_type< T3 >::type, typename scalar_type< T4 >::type, typename scalar_type< T5 >::type, typename scalar_type< T6 >::type >::type type
Eigen::Matrix< typename return_type< T1, T2 >::type, Eigen::Dynamic, Eigen::Dynamic > append_row(const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &B)
Return the result of stacking the rows of the first argument matrix on top of the second argument mat...
bool check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Return true if the provided sizes match.