All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
rep_array.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_ARR_FUN_REP_ARRAY_HPP
#define STAN_MATH_PRIM_ARR_FUN_REP_ARRAY_HPP
#include <stan/math/prim/scal/err/check_nonnegative.hpp>
#include <vector>
namespace stan {
namespace math {
template <typename T>
inline std::vector<T>
rep_array(const T& x, int n) {
using stan::math::check_nonnegative;
check_nonnegative("rep_array", "n", n);
return std::vector<T>(n, x);
}
template <typename T>
inline std::vector<std::vector<T> >
rep_array(const T& x, int m, int n) {
using std::vector;
using stan::math::check_nonnegative;
check_nonnegative("rep_array", "rows", m);
check_nonnegative("rep_array", "cols", n);
return vector<vector<T> >(m, vector<T>(n, x));
}
template <typename T>
inline std::vector<std::vector<std::vector<T> > >
rep_array(const T& x, int k, int m, int n) {
using std::vector;
using stan::math::check_nonnegative;
check_nonnegative("rep_array", "shelfs", k);
check_nonnegative("rep_array", "rows", m);
check_nonnegative("rep_array", "cols", n);
return vector<vector<vector<T> > >(k,
vector<vector<T> >(m,
vector<T>(n, x)));
}
}
}
#endif
stan::math::rep_array
std::vector< T > rep_array(const T &x, int n)
Definition: rep_array.hpp:13
check_nonnegative.hpp
stan::math::check_nonnegative
bool check_nonnegative(const char *function, const char *name, const T_y &y)
Return true if y is non-negative.
Definition: check_nonnegative.hpp:66

[ Stan Home Page ] © 2011–2015, Stan Development Team.