summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/multiprecision/test/ublas_interop/test23.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/multiprecision/test/ublas_interop/test23.cpp
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/multiprecision/test/ublas_interop/test23.cpp')
-rw-r--r--src/boost/libs/multiprecision/test/ublas_interop/test23.cpp213
1 files changed, 213 insertions, 0 deletions
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 <class M, int N>
+void test_blas_3<M, N>::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<ublas::matrix<mp_test_type>, 3>;
+#endif
+
+#ifdef USE_DOUBLE
+template struct test_blas_3<ublas::matrix<double>, 3>;
+#endif
+
+#ifdef USE_STD_COMPLEX
+#ifdef USE_FLOAT
+template struct test_blas_3<ublas::matrix<std::complex<mp_test_type> >, 3>;
+#endif
+
+#ifdef USE_DOUBLE
+template struct test_blas_3<ublas::matrix<std::complex<double> >, 3>;
+#endif
+#endif