1#ifndef STAN_MATH_PRIM_FUN_TO_ARRAY_1D_HPP
2#define STAN_MATH_PRIM_FUN_TO_ARRAY_1D_HPP
14template <
typename EigMat, require_eigen_t<EigMat>* =
nullptr>
15inline std::vector<value_type_t<EigMat>>
to_array_1d(
const EigMat& matrix) {
17 std::vector<T_val> result(matrix.size());
18 Eigen::Map<Eigen::Matrix<T_val, EigMat::RowsAtCompileTime,
19 EigMat::ColsAtCompileTime>>(
20 result.data(), matrix.rows(), matrix.cols())
34 const std::vector<std::vector<T>>& x) {
35 size_t size1 = x.size();
40 std::vector<T> y(size1 * size2);
41 for (
size_t i = 0, ij = 0; i < size1; i++) {
42 for (
size_t j = 0; j < size2; j++, ij++) {
auto to_array_1d(T_x &&x)
Returns input matrix reshaped into a vector.
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...