From 50e19e5b8e396ac81848f85392754c6dbf4feb37 Mon Sep 17 00:00:00 2001 From: Cem Bassoy Date: Sun, 11 Dec 2022 23:13:56 +0100 Subject: [PATCH] fix wrong mtv call from test multiplication. --- .../numeric/ublas/tensor/multiplication.hpp | 2 +- .../test_multiplication_mtv.cpp | 35 ++++++++++++------- test/tensor/test_main.cpp | 24 ------------- 3 files changed, 23 insertions(+), 38 deletions(-) delete mode 100644 test/tensor/test_main.cpp diff --git a/include/boost/numeric/ublas/tensor/multiplication.hpp b/include/boost/numeric/ublas/tensor/multiplication.hpp index ea7901814..668ac5808 100644 --- a/include/boost/numeric/ublas/tensor/multiplication.hpp +++ b/include/boost/numeric/ublas/tensor/multiplication.hpp @@ -344,7 +344,7 @@ void ttv0(SizeType const r, * [n] = size(B(..,:,..)) * * - * @param[in] k if k = 0 + * @param[in] k C[i1] = sum(A[i1,i2] * B[i2]) if k = 1 or C[i2] = sum(A[i1,i2] * B[i1]) if k = 0 * @param[in] m number of rows of A * @param[in] n number of columns of A * @param[out] c pointer to C diff --git a/test/tensor/multiplication/test_multiplication_mtv.cpp b/test/tensor/multiplication/test_multiplication_mtv.cpp index 272407ff4..019b19146 100644 --- a/test/tensor/multiplication/test_multiplication_mtv.cpp +++ b/test/tensor/multiplication/test_multiplication_mtv.cpp @@ -10,13 +10,15 @@ // Google and Fraunhofer IOSB, Ettlingen, Germany // -#include #include "../fixture_utility.hpp" +#include #include #include +#include + BOOST_AUTO_TEST_SUITE(test_multiplication_mtv, - *boost::unit_test::description("Validate Matrix Times Vector") + *boost::unit_test::description("Test Matrix Times Vector") ) @@ -62,11 +64,13 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(test_extents_dynamic, auto wc = ublas::to_strides(nc,layout_type{}); auto c = vector_t (ublas::product(nc), value_type{0}); - ublas::detail::recursive::mtv( + ublas::detail::recursive::mtv( m, - c.data(), nc.data(), wc.data(), - a.data(), na.data(), wa.data(), - b.data()); + na[0], + na[1], + c.data(), 1ul, + a.data(), wa[0], wa[1], + b.data(), 1ul); auto v = value_type{static_cast(na[m])}; BOOST_CHECK(std::equal(c.begin(),c.end(),a.begin(), [v](auto cc, auto aa){return cc == v*aa;})); @@ -123,9 +127,11 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(test_extents_static_rank, ublas::detail::recursive::mtv( m, - c.data(), nc.data(), wc.data(), - a.data(), na.data(), wa.data(), - b.data()); + na[0], + na[1], + c.data(), 1ul, + a.data(), wa[0], wa[1], + b.data(), 1ul); auto v = value_type{static_cast(na[m])}; BOOST_CHECK(std::equal(c.begin(),c.end(),a.begin(), [v](auto cc, auto aa){return cc == v*aa;})); @@ -214,11 +220,14 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(test_extents_static, auto c = std::array >(); std::fill(std::begin(c), std::end(c), value_type{0}); + ublas::detail::recursive::mtv( m, - c.data(), nc.data(), wc.data(), - a.data(), na.data(), wa.data(), - b.data()); + na[0], + na[1], + c.data(), 1ul, + a.data(), wa[0], wa[1], + b.data(), 1ul); auto v = value_type{static_cast(na[m])}; BOOST_CHECK(std::equal(c.begin(),c.end(),a.begin(), [v](auto cc, auto aa){return cc == v*aa;})); @@ -229,4 +238,4 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(test_extents_static, }); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() diff --git a/test/tensor/test_main.cpp b/test/tensor/test_main.cpp deleted file mode 100644 index fbcd35896..000000000 --- a/test/tensor/test_main.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright (c) 2018, Cem Bassoy, cem.bassoy@gmail.com -// Copyright (c) 2019, Amit Singh, amitsingh19975@gmail.com -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// The authors gratefully acknowledge the support of -// Google and Fraunhofer IOSB, Ettlingen, Germany -// - - - -// #include -// #include - -#ifndef BOOST_TEST_DYN_LINK -#define BOOST_TEST_DYN_LINK -#endif -// NOLINTNEXTLINE -#define BOOST_TEST_MODULE MainTensor - -#include