1- #ifndef TEST_UNIT_MATH_SERIALIZER_HPP
2- #define TEST_UNIT_MATH_SERIALIZER_HPP
1+ #ifndef STAN_MATH_PRIM_FUN_SERIALIZER_HPP
2+ #define STAN_MATH_PRIM_FUN_SERIALIZER_HPP
33
4- #include < stan/math.hpp>
4+ #include < stan/math/prim/fun/to_vector .hpp>
55#include < complex>
66#include < string>
77#include < vector>
88
99namespace stan {
10- namespace test {
10+ namespace math {
1111
1212/* *
1313 * A class to store a sequence of values which can be deserialized
@@ -47,7 +47,7 @@ struct deserializer {
4747 * @param vals values to deserialize
4848 */
4949 explicit deserializer (const Eigen::Matrix<T, -1 , 1 >& v_vals)
50- : position_(0 ), vals_(math:: to_array_1d(v_vals)) {}
50+ : position_(0 ), vals_(to_array_1d(v_vals)) {}
5151
5252 /* *
5353 * Read a scalar conforming to the shape of the specified argument,
@@ -94,8 +94,8 @@ struct deserializer {
9494 */
9595 template <typename U, require_std_vector_t <U>* = nullptr ,
9696 require_not_st_complex<U>* = nullptr >
97- typename stan::math:: promote_scalar_type<T, U>::type read (const U& x) {
98- typename stan::math:: promote_scalar_type<T, U>::type y;
97+ typename promote_scalar_type<T, U>::type read (const U& x) {
98+ typename promote_scalar_type<T, U>::type y;
9999 y.reserve (x.size ());
100100 for (size_t i = 0 ; i < x.size (); ++i)
101101 y.push_back (read (x[i]));
@@ -113,9 +113,9 @@ struct deserializer {
113113 * @return deserialized value with shape and size matching argument
114114 */
115115 template <typename U, require_std_vector_st<is_complex, U>* = nullptr >
116- typename stan::math:: promote_scalar_type<std::complex <T>, U>::type read (
116+ typename promote_scalar_type<std::complex <T>, U>::type read (
117117 const U& x) {
118- typename stan::math:: promote_scalar_type<std::complex <T>, U>::type y;
118+ typename promote_scalar_type<std::complex <T>, U>::type y;
119119 y.reserve (x.size ());
120120 for (size_t i = 0 ; i < x.size (); ++i)
121121 y.push_back (read (x[i]));
@@ -258,7 +258,7 @@ struct serializer {
258258 * @return serialized values
259259 */
260260 const Eigen::Matrix<T, -1 , 1 >& vector_vals () {
261- return math:: to_vector (vals_);
261+ return to_vector (vals_);
262262 }
263263};
264264
@@ -338,7 +338,7 @@ std::vector<real_return_t<T>> serialize_return(const T& x) {
338338 */
339339template <typename ... Ts>
340340Eigen::VectorXd serialize_args (const Ts... xs) {
341- return math:: to_vector (serialize<double >(xs...));
341+ return to_vector (serialize<double >(xs...));
342342}
343343
344344} // namespace test
0 commit comments