1 #ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_COL_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_APPEND_COL_HPP 35 template <
typename T1,
typename T2,
int R1,
int C1,
int R2,
int C2>
36 inline Eigen::Matrix<typename return_type<T1, T2>::type,
37 Eigen::Dynamic, Eigen::Dynamic>
39 const Eigen::Matrix<T2, R2, C2>& B) {
51 Matrix<typename return_type<T1, T2>::type, Dynamic, Dynamic>
52 result(Arows, Acols+Bcols);
53 for (
int j = 0; j < Acols; j++)
54 for (
int i = 0; i < Arows; i++)
55 result(i, j) = A(i, j);
57 for (
int j = Acols, k = 0; k < Bcols; j++, k++)
58 for (
int i = 0; i < Arows; i++)
59 result(i, j) = B(i, k);
80 template <
typename T1,
typename T2,
int C1,
int C2>
81 inline Eigen::Matrix<typename return_type<T1, T2>::type,
84 const Eigen::Matrix<T2, 1, C2>& B) {
90 Matrix<typename return_type<T1, T2>::type, 1, Dynamic>
91 result(Asize + Bsize);
92 for (
int i = 0; i < Asize; i++)
94 for (
int i = 0, j = Asize; i < Bsize; i++, j++)
123 template <
typename T,
int R1,
int C1,
int R2,
int C2>
124 inline Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
126 const Eigen::Matrix<T, R2, C2>& B) {
128 using Eigen::Dynamic;
131 "rows of A", A.rows(),
132 "rows of B", B.rows());
134 Matrix<T, Dynamic, Dynamic> result(A.rows(), A.cols()+B.cols());
155 template <
typename T,
int C1,
int C2>
156 inline Eigen::Matrix<T, 1, Eigen::Dynamic>
158 const Eigen::Matrix<T, 1, C2>& B) {
160 using Eigen::Dynamic;
162 Matrix<T, 1, Dynamic> result(A.size()+B.size());
181 template <
typename T1,
typename T2,
int R,
int C>
182 inline Eigen::Matrix<typename return_type<T1, T2>::type,
185 const Eigen::Matrix<T2, R, C>& B) {
186 using Eigen::Dynamic;
190 Matrix<return_type, 1, Dynamic>
191 result(B.size() + 1);
192 result << A, B.template cast<return_type>();
210 template <
typename T1,
typename T2,
int R,
int C>
211 inline Eigen::Matrix<typename return_type<T1, T2>::type,
215 using Eigen::Dynamic;
219 Matrix<return_type, 1, Dynamic>
220 result(A.size() + 1);
221 result << A.template cast<return_type>(), B;
Eigen::Matrix< typename return_type< T1, T2 >::type, Eigen::Dynamic, Eigen::Dynamic > append_col(const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &B)
Return the result of appending the second argument matrix after the first argument matrix...
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