@@ -45,13 +45,15 @@ struct SimulateVectorOptions {
4545 * Simulate a vector of values from a uniform distribution.
4646 *
4747 * @tparam Type_ Type of value to be simulated.
48+ * @tparam Length_ Integer type of the length of the output vector.
49+ *
4850 * @param length Length of the array of values to simulate.
4951 * @param options Simulation options.
5052 *
5153 * @return Vector of simulated values.
5254 */
53- template <typename Type_>
54- std::vector<Type_> simulate_vector (std:: size_t length, const SimulateVectorOptions& options) {
55+ template <typename Type_, typename Length_ >
56+ std::vector<Type_> simulate_vector (const Length_ length, const SimulateVectorOptions& options) {
5557 auto output = sanisizer::create<std::vector<Type_> >(length);
5658 RngEngine rng (options.seed );
5759 std::uniform_real_distribution<> unif (options.lower , options.upper );
@@ -72,6 +74,23 @@ std::vector<Type_> simulate_vector(std::size_t length, const SimulateVectorOptio
7274 return output;
7375}
7476
77+ /* *
78+ * Overload of `simulate_vector()` for simulating the contents of a dense random matrix.
79+ *
80+ * @tparam Type_ Type of value to be simulated.
81+ * @tparam Index_ Integer type of the dimension extents.
82+ *
83+ * @param nrow Number of rows in the matrix.
84+ * @param ncol Number of columns in the matrix.
85+ * @param options Simulation options.
86+ *
87+ * @return Vector of simulated values of length equal to the product of `nrow` and `ncol`.
88+ */
89+ template <typename Type_, typename Index_>
90+ std::vector<Type_> simulate_vector (const Index_ nrow, const Index_ ncol, const SimulateVectorOptions& options) {
91+ return simulate_vector<Type_>(sanisizer::product<typename std::vector<Type_>::size_type>(nrow, ncol), options);
92+ }
93+
7594/* *
7695 * @cond
7796 */
0 commit comments