Nektar++
Functions
Nektar::DiagonalMatrixOperationsUnitTests Namespace Reference

Functions

 BOOST_AUTO_TEST_CASE (TestDoubleDiagonalVectorMultiplication)
 
 BOOST_AUTO_TEST_CASE (TestDoubleScaledDiagonalVectorMultiplication)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

Nektar::DiagonalMatrixOperationsUnitTests::BOOST_AUTO_TEST_CASE ( TestDoubleDiagonalVectorMultiplication  )

Definition at line 45 of file TestDiagonalMatrixOperations.cpp.

46{
47 double m_buf[] = {1, 2, 3};
48 double v_buf[] = {4, 5, 6};
49
50 NekMatrix<double> m(3, 3, m_buf, eDIAGONAL);
51 NekVector<double> v(3, v_buf);
52
53 double expected_result_buf[] = {4, 10, 18};
54 NekVector<double> expected_result(3, expected_result_buf);
55
56 NekVector<double> result = m * v;
57
58 BOOST_CHECK_EQUAL(expected_result, result);
59}

References Nektar::eDIAGONAL.

◆ BOOST_AUTO_TEST_CASE() [2/2]

Nektar::DiagonalMatrixOperationsUnitTests::BOOST_AUTO_TEST_CASE ( TestDoubleScaledDiagonalVectorMultiplication  )

Definition at line 61 of file TestDiagonalMatrixOperations.cpp.

62{
63 double m_buf[] = {1, 2, 3};
64 double v_buf[] = {4, 5, 6};
65
66 std::shared_ptr<NekMatrix<double>> inner(
67 new NekMatrix<double>(3, 3, m_buf, eDIAGONAL));
68 NekMatrix<NekMatrix<double>, ScaledMatrixTag> m(5.0, inner);
69
70 NekVector<double> v(3, v_buf);
71
72 double expected_result_buf[] = {20, 50, 90};
73 NekVector<double> expected_result(3, expected_result_buf);
74
75 NekVector<double> result = m * v;
76
77 BOOST_CHECK_EQUAL(expected_result, result);
78}

References Nektar::eDIAGONAL.