1 #ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_ROW_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_APPEND_ROW_HPP 33 template <
typename T1,
typename T2,
int R1,
int C1,
int R2,
int C2>
34 inline Eigen::Matrix<typename return_type<T1, T2>::type,
35 Eigen::Dynamic, Eigen::Dynamic>
37 const Eigen::Matrix<T2, R2, C2>& B) {
46 "columns of A", Acols,
47 "columns of B", Bcols);
49 Matrix<typename return_type<T1, T2>::type, Dynamic, Dynamic>
50 result(Arows + Brows, Acols);
51 for (
int j = 0; j < Acols; j++) {
52 for (
int i = 0; i < Arows; i++)
53 result(i, j) = A(i, j);
54 for (
int i = Arows, k = 0; k < Brows; i++, k++)
55 result(i, j) = B(k, j);
75 template <
typename T1,
typename T2,
int R1,
int R2>
76 inline Eigen::Matrix<typename return_type<T1, T2>::type,
79 const Eigen::Matrix<T2, R2, 1>& B) {
85 Matrix<typename return_type<T1, T2>::type, 1, Dynamic>
86 result(Asize + Bsize);
87 for (
int i = 0; i < Asize; i++)
89 for (
int i = 0, j = Asize; i < Bsize; i++, j++)
116 template <
typename T,
int R1,
int C1,
int R2,
int C2>
117 inline Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
119 const Eigen::Matrix<T, R2, C2>& B) {
120 using Eigen::Dynamic;
124 "columns of A", A.cols(),
125 "columns of B", B.cols());
127 Matrix<T, Dynamic, Dynamic>
128 result(A.rows() + B.rows(), A.cols());
149 template <
typename T,
int R1,
int R2>
150 inline Eigen::Matrix<T, Eigen::Dynamic, 1>
152 const Eigen::Matrix<T, R2, 1>& B) {
153 using Eigen::Dynamic;
156 Matrix<T, Dynamic, 1> result(A.size()+B.size());
174 template <
typename T1,
typename T2,
int R,
int C>
175 inline Eigen::Matrix<typename return_type<T1, T2>::type,
178 const Eigen::Matrix<T2, R, C>& B) {
179 using Eigen::Dynamic;
183 Matrix<return_type, Dynamic, 1>
184 result(B.size() + 1);
185 result << A, B.template cast<return_type>();
202 template <
typename T1,
typename T2,
int R,
int C>
203 inline Eigen::Matrix<typename return_type<T1, T2>::type,
207 using Eigen::Dynamic;
211 Matrix<return_type, Dynamic, 1>
212 result(A.size() + 1);
213 result << A.template cast<return_type>(), B;
Metaprogram to calculate the base scalar return type resulting from promoting all the scalar types of...
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.
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...