From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/numeric/ublas/benchmarks/init.hpp | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/boost/libs/numeric/ublas/benchmarks/init.hpp (limited to 'src/boost/libs/numeric/ublas/benchmarks/init.hpp') diff --git a/src/boost/libs/numeric/ublas/benchmarks/init.hpp b/src/boost/libs/numeric/ublas/benchmarks/init.hpp new file mode 100644 index 00000000..1528389c --- /dev/null +++ b/src/boost/libs/numeric/ublas/benchmarks/init.hpp @@ -0,0 +1,37 @@ +// +// Copyright (c) 2018 Stefan Seefeld +// All rights reserved. +// +// This file is part of Boost.uBLAS. It is made available under the +// Boost Software License, Version 1.0. +// (Consult LICENSE or http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +namespace boost { namespace numeric { namespace ublas { namespace benchmark { + +template +void init(vector &v, unsigned long size, int max_value) +{ + v = vector(size); + for (unsigned long i = 0; i < v.size(); ++i) + v(i) = std::rand() % max_value; +} + +template +void init(matrix &m, unsigned long size1, unsigned long size2, int max_value) +{ + m = matrix(size1, size2); + for (unsigned long i = 0; i < m.size1(); ++i) + for (unsigned long j = 0; j < m.size2(); ++j) + m(i, j) = std::rand() % max_value; +} + +template +void init(matrix &m, unsigned long size, int max_value) +{ + return init(m, size, size, max_value); +} + +}}}} -- cgit v1.2.3