1 #ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_COL_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_APPEND_COL_HPP
36 template <
typename T1,
typename T2,
int R1,
int C1,
int R2,
int C2>
37 inline Eigen::Matrix<typename return_type<T1, T2>::type,
38 Eigen::Dynamic, Eigen::Dynamic>
40 const Eigen::Matrix<T2, R2, C2>& B) {
53 Matrix<typename return_type<T1, T2>::type, Dynamic, Dynamic>
54 result(Arows, Acols+Bcols);
55 for (
int j = 0; j < Acols; j++)
56 for (
int i = 0; i < Arows; i++)
57 result(i, j) = A(i, j);
59 for (
int j = Acols, k = 0; k < Bcols; j++, k++)
60 for (
int i = 0; i < Arows; i++)
61 result(i, j) = B(i, k);
82 template <
typename T1,
typename T2,
int C1,
int C2>
83 inline Eigen::Matrix<typename return_type<T1, T2>::type,
86 const Eigen::Matrix<T2, 1, C2>& B) {
92 Matrix<typename return_type<T1, T2>::type, 1, Dynamic>
93 result(Asize + Bsize);
94 for (
int i = 0; i < Asize; i++)
96 for (
int i = 0, j = Asize; i < Bsize; i++, j++)
126 template <
typename T,
int R1,
int C1,
int R2,
int C2>
127 inline Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
129 const Eigen::Matrix<T, R2, C2>& B) {
131 using Eigen::Dynamic;
134 "rows of A", A.rows(),
135 "rows of B", B.rows());
137 Matrix<T, Dynamic, Dynamic> result(A.rows(), A.cols()+B.cols());
158 template <
typename T,
int C1,
int C2>
159 inline Eigen::Matrix<T, 1, Eigen::Dynamic>
161 const Eigen::Matrix<T, 1, C2>& B) {
163 using Eigen::Dynamic;
165 Matrix<T, 1, Dynamic> result(A.size()+B.size());
185 template <
typename T1,
typename T2,
int R,
int C>
186 inline Eigen::Matrix<typename return_type<T1, T2>::type,
189 const Eigen::Matrix<T2, R, C>& B) {
190 using Eigen::Dynamic;
194 Matrix<return_type, 1, Dynamic>
195 result(B.size() + 1);
196 result << A, B.template cast<return_type>();
215 template <
typename T1,
typename T2,
int R,
int C>
216 inline Eigen::Matrix<typename return_type<T1, T2>::type,
220 using Eigen::Dynamic;
224 Matrix<return_type, 1, Dynamic>
225 result(A.size() + 1);
226 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...
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
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.