35#include <boost/test/unit_test.hpp>
40#include <boost/test/tools/floating_point_comparison.hpp>
41#include <boost/test/unit_test.hpp>
45template <
typename DataType,
typename MatrixType>
51template <
typename DataType>
63 double m_buf[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
64 double v_buf[] = {4, 5, 6};
69 double expected_result_buf[] = {66, 81, 96};
74 BOOST_CHECK_EQUAL(expected_result, result);
79 double m_buf[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
80 double v_buf[] = {4, 5, 6};
85 double expected_result_buf[] = {66, 81, 96};
90 BOOST_CHECK_EQUAL(expected_result, v);
94 TestDoubleSquareFullVectorMultiplicationWithSharedArrayAliasing)
96 double m_buf[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
97 double v_buf[] = {4, 5, 6};
105 double expected_result_buf[] = {66, 81, 96};
110 BOOST_CHECK_EQUAL(expected_result, result);
111 BOOST_CHECK_EQUAL(vector_array[0], 66);
112 BOOST_CHECK_EQUAL(vector_array[1], 81);
113 BOOST_CHECK_EQUAL(vector_array[2], 96);
117 TestDoubleSquareFullVectorMultiplicationWithSharedArrayAliasingAndMatrixTranspose)
119 double m_buf[] = {1, 4, 7, 2, 5, 8, 3, 6, 9};
120 double v_buf[] = {4, 5, 6};
128 double expected_result_buf[] = {66, 81, 96};
133 BOOST_CHECK_EQUAL(expected_result, result);
134 BOOST_CHECK_EQUAL(vector_array[0], 66);
135 BOOST_CHECK_EQUAL(vector_array[1], 81);
136 BOOST_CHECK_EQUAL(vector_array[2], 96);
140 TestDoubleSquareFullVectorMultiplicationWithSharedArrayAliasingAndOverlap)
142 double m_buf[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
143 double v_buf[] = {4, 5, 6, 0};
152 double expected_result_buf[] = {66, 81, 96};
157 BOOST_CHECK_EQUAL(expected_result, result);
158 BOOST_CHECK_EQUAL(vector_array[1], 66);
159 BOOST_CHECK_EQUAL(vector_array[2], 81);
160 BOOST_CHECK_EQUAL(vector_array[3], 96);
165 double m_buf[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
166 double v_buf[] = {4, 5, 6};
168 std::shared_ptr<NekMatrix<double>> inner(
173 double expected_result_buf[] = {462, 567, 672};
178 BOOST_CHECK_EQUAL(expected_result, result);
183 double buf1[] = {1.0, 2.0, 3.0, 4.0};
184 double buf2[] = {5.0, 6.0, 7.0, 8.0};
185 double buf3[] = {9.0, 10.0, 11.0, 12.0};
191 double expected_result_buf[] = {517, 766, 625, 926};
196 BOOST_CHECK_EQUAL(expected_result, m1 * m2 * m3);
198 BOOST_CHECK_EQUAL(expected_result, m1 * (m2 * m3));
203 double buf1[] = {1.0, 2.0, 3.0, 4.0};
204 double buf2[] = {5.0, 6.0, 7.0, 8.0};
205 double buf3[] = {9.0, 11.0, 10.0, 12.0};
211 double expected_result_buf[] = {517, 766, 625, 926};
214 BOOST_CHECK_EQUAL(expected_result, m1 * m2 *
Transpose(m3));
219 double buf1[] = {1.0, 2.0, 3.0, 4.0};
220 double buf2[] = {5.0, 6.0, 7.0, 8.0};
221 double buf3[] = {9.0, 11.0, 10.0, 12.0};
222 double out_buf[] = {0.0, 0.0, 0.0, 0.0};
234 double expected_result_buf[] = {517, 766, 625, 926};
238 BOOST_CHECK_EQUAL(expected_result, result);
239 BOOST_CHECK_EQUAL(array_out_buf[0], 517.0);
240 BOOST_CHECK_EQUAL(array_out_buf[1], 766.0);
241 BOOST_CHECK_EQUAL(array_out_buf[2], 625.0);
242 BOOST_CHECK_EQUAL(array_out_buf[3], 926.0);
243 BOOST_CHECK_EQUAL(result(0, 0), 517.0);
244 BOOST_CHECK_EQUAL(result(1, 0), 766.0);
245 BOOST_CHECK_EQUAL(result(0, 1), 625.0);
246 BOOST_CHECK_EQUAL(result(1, 1), 926.0);
BOOST_AUTO_TEST_CASE(TestDoubleSquareFullVectorMultiplication)
int foo(NekMatrix< DataType, MatrixType > &d)
std::vector< double > d(NPUPPER *NPUPPER)
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)