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 --- .../multiprecision/test/ublas_interop/test23.cpp | 213 +++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 src/boost/libs/multiprecision/test/ublas_interop/test23.cpp (limited to 'src/boost/libs/multiprecision/test/ublas_interop/test23.cpp') diff --git a/src/boost/libs/multiprecision/test/ublas_interop/test23.cpp b/src/boost/libs/multiprecision/test/ublas_interop/test23.cpp new file mode 100644 index 00000000..0c5bef20 --- /dev/null +++ b/src/boost/libs/multiprecision/test/ublas_interop/test23.cpp @@ -0,0 +1,213 @@ +// +// Copyright (c) 2000-2002 +// Joerg Walter, Mathias Koch +// +// 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 +// GeNeSys mbH & Co. KG in producing this work. +// + +#if defined(__GNUC__) && (__GNUC__ >= 9) +#pragma GCC diagnostic ignored "-Wdeprecated-copy" +#endif + +#include "test2.hpp" + +template +void test_blas_3::test() +{ + { + M m1(N, N), m2(N, N), m3(N, N); + + // _t_mm + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), m2, m1); + std::cout << "tmm (m1, 1, m2, m1) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), m2, ublas::trans(m1)); + std::cout << "tmm (m1, 1, m2, trans (m1)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), ublas::trans(m2), m1); + std::cout << "tmm (m1, 1, trans (m2), m1) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), ublas::trans(m2), ublas::trans(m1)); + std::cout << "tmm (m1, 1, trans (m2), trans (m1)) = " << m1 << std::endl; +#ifdef USE_STD_COMPLEX + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), m2, ublas::herm(m1)); + std::cout << "tmm (m1, 1, m2, herm (m1)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), ublas::herm(m2), m1); + std::cout << "tmm (m1, 1, herm (m2), m1) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), ublas::trans(m2), ublas::herm(m1)); + std::cout << "tmm (m1, 1, trans (m2), herm (m1)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), ublas::herm(m2), ublas::trans(m1)); + std::cout << "tmm (m1, 1, herm (m2), trans (m1)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::tmm(m1, value_type(1), ublas::herm(m2), ublas::herm(m1)); + std::cout << "tmm (m1, 1, herm (m2), herm (m1)) = " << m1 << std::endl; +#endif + + // _t_sm + initialize_matrix(m1); + initialize_matrix(m2, ublas::lower_tag()); + initialize_matrix(m3); + ublas::blas_3::tsm(m1, value_type(1), m2, ublas::lower_tag()); + std::cout << "tsm (m1, 1, m2) = " << m1 << " " << ublas::prod(m2, m1) - value_type(1) * m3 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2, ublas::upper_tag()); + ublas::blas_3::tsm(m1, value_type(1), ublas::trans(m2), ublas::lower_tag()); + std::cout << "tsm (m1, 1, trans (m2)) = " << m1 << " " << ublas::prod(ublas::trans(m2), m1) - value_type(1) * m3 << std::endl; +#ifdef USE_STD_COMPLEX + initialize_matrix(m1); + initialize_matrix(m2, ublas::upper_tag()); + ublas::blas_3::tsm(m1, value_type(1), ublas::herm(m2), ublas::lower_tag()); + std::cout << "tsm (m1, 1, herm (m2)) = " << m1 << " " << ublas::prod(ublas::herm(m2), m1) - value_type(1) * m3 << std::endl; +#endif + initialize_matrix(m1); + initialize_matrix(m2, ublas::upper_tag()); + ublas::blas_3::tsm(m1, value_type(1), m2, ublas::upper_tag()); + std::cout << "tsm (m1, 1, m2) = " << m1 << " " << ublas::prod(m2, m1) - value_type(1) * m3 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2, ublas::lower_tag()); + ublas::blas_3::tsm(m1, value_type(1), ublas::trans(m2), ublas::upper_tag()); + std::cout << "tsm (m1, 1, trans (m2)) = " << m1 << " " << ublas::prod(ublas::trans(m2), m1) - value_type(1) * m3 << std::endl; +#ifdef USE_STD_COMPLEX + initialize_matrix(m1); + initialize_matrix(m2, ublas::lower_tag()); + ublas::blas_3::tsm(m1, value_type(1), ublas::herm(m2), ublas::upper_tag()); + std::cout << "tsm (m1, 1, herm (m2)) = " << m1 << " " << ublas::prod(ublas::herm(m2), m1) - value_type(1) * m3 << std::endl; +#endif + + // _g_mm + // _s_mm + // _h_mm + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), m2, m3); + std::cout << "gmm (m1, 1, 1, m2, m3) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), ublas::trans(m2), m3); + std::cout << "gmm (m1, 1, 1, trans (m2), m3) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), m2, ublas::trans(m3)); + std::cout << "gmm (m1, 1, 1, m2, trans (m3)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), ublas::trans(m2), ublas::trans(m3)); + std::cout << "gmm (m1, 1, 1, trans (m2), trans (m3)) = " << m1 << std::endl; +#ifdef USE_STD_COMPLEX + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), ublas::herm(m2), m3); + std::cout << "gmm (m1, 1, 1, herm (m2), m3) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), m2, ublas::herm(m3)); + std::cout << "gmm (m1, 1, 1, m2, herm (m3)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), ublas::herm(m2), ublas::trans(m3)); + std::cout << "gmm (m1, 1, 1, herm (m2), trans (m3)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), ublas::trans(m2), ublas::herm(m3)); + std::cout << "gmm (m1, 1, 1, trans (m2), herm (m3)) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::gmm(m1, value_type(1), value_type(1), ublas::herm(m2), ublas::herm(m3)); + std::cout << "gmm (m1, 1, 1, herm (m2), herm (m3)) = " << m1 << std::endl; +#endif + + // s_rk + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::srk(m1, value_type(1), value_type(1), m2); + std::cout << "srk (m1, 1, 1, m2) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::srk(m1, value_type(1), value_type(1), ublas::trans(m2)); + std::cout << "srk (m1, 1, 1, trans (m2)) = " << m1 << std::endl; + +#ifdef USE_STD_COMPLEX + // h_rk + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::hrk(m1, value_type(1), value_type(1), m2); + std::cout << "hrk (m1, 1, 1, m2) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + ublas::blas_3::hrk(m1, value_type(1), value_type(1), ublas::herm(m2)); + std::cout << "hrk (m1, 1, 1, herm (m2)) = " << m1 << std::endl; +#endif + + // s_r2k + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::sr2k(m1, value_type(1), value_type(1), m2, m3); + std::cout << "sr2k (m1, 1, 1, m2, m3) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::sr2k(m1, value_type(1), value_type(1), ublas::trans(m2), ublas::trans(m3)); + std::cout << "sr2k (m1, 1, 1, trans (m2), trans (m3)) = " << m1 << std::endl; + +#ifdef USE_STD_COMPLEX + // h_r2k + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::hr2k(m1, value_type(1), value_type(1), m2, m3); + std::cout << "hr2k (m1, 1, 1, m2, m3) = " << m1 << std::endl; + initialize_matrix(m1); + initialize_matrix(m2); + initialize_matrix(m3); + ublas::blas_3::hr2k(m1, value_type(1), value_type(1), ublas::herm(m2), ublas::herm(m3)); + std::cout << "hr2k (m1, 1, 1, herm (m2), herm (m3)) = " << m1 << std::endl; +#endif + } +} + +#ifdef USE_FLOAT +template struct test_blas_3, 3>; +#endif + +#ifdef USE_DOUBLE +template struct test_blas_3, 3>; +#endif + +#ifdef USE_STD_COMPLEX +#ifdef USE_FLOAT +template struct test_blas_3 >, 3>; +#endif + +#ifdef USE_DOUBLE +template struct test_blas_3 >, 3>; +#endif +#endif -- cgit v1.2.3