1 #ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_ARRAY_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_APPEND_ARRAY_HPP 27 template <
typename T1,
typename T2>
28 inline typename append_return_type<std::vector<T1>, std::vector<T2> >::type
31 std::vector<int> zdims;
40 for (
size_t i = 0; i < x.size(); ++i)
42 for (
size_t i = 0; i < y.size(); ++i)
43 assign(z[i + x.size()], y[i]);
56 template <
typename T1>
58 const std::vector<T1>& y) {
61 if (!x.empty() && !y.empty()) {
62 std::vector<int> xdims =
dims(x), ydims =
dims(y);
64 "dimension of y", ydims);
65 for (
size_t i = 1; i < xdims.size(); ++i) {
71 z.reserve(x.size() + y.size());
72 z.insert(z.end(), x.begin(), x.end());
73 z.insert(z.end(), y.begin(), y.end());
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.
void dims(const T &x, std::vector< int > &result)
void resize(T &x, std::vector< int > dims)
Recursively resize the specified vector of vectors, which must bottom out at scalar values...
append_return_type< std::vector< T1 >, std::vector< T2 > >::type append_array(const std::vector< T1 > &x, const std::vector< T2 > &y)
Return the concatenation of two specified vectors in the order of the arguments.
void check_matching_sizes(const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
Check if two structures at the same size.
This template metaprogram is used to compute the return type for append_array.
void assign(T_lhs &x, const T_rhs &y)
Copy the right-hand side's value to the left-hand side variable.