Nektar++
Functions
Nektar::MatrixSubtractionTests Namespace Reference

Functions

 BOOST_AUTO_TEST_CASE (TestLhsFullRhsFullSubtraction)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

Nektar::MatrixSubtractionTests::BOOST_AUTO_TEST_CASE ( TestLhsFullRhsFullSubtraction  )

Definition at line 232 of file TestNekMatrixOperations.cpp.

233{
234 // double lhs_values[] = {2, 4, 6, 8,
235 // 10, 12, 14, 16,
236 // 18, 20, 22, 24,
237 // 26, 28, 30, 32};
238
239 double lhs_values[] = {2, 10, 18, 26, 4, 12, 20, 28,
240 6, 14, 22, 30, 8, 16, 24, 32};
241
242 std::shared_ptr<NekMatrix<NekDouble, StandardMatrixTag>> lhs1;
243 std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag>> lhs2;
244 std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag>> lhs3;
245
246 GenerateFullMatrices(lhs_values, 2.0, lhs1, lhs2, lhs3);
247 // double rhs_values[] = {4, 8, 12, 16,
248 // 20, 24, 28, 32,
249 // 36, 40, 44, 48,
250 // 52, 56, 60, 64};
251 double rhs_values[] = {4, 20, 36, 52, 8, 24, 40, 56,
252 12, 28, 44, 60, 16, 32, 48, 64};
253 std::shared_ptr<NekMatrix<NekDouble, StandardMatrixTag>> rhs1;
254 std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag>> rhs2;
255 std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag>> rhs3;
256 GenerateFullMatrices(rhs_values, 2.0, rhs1, rhs2, rhs3);
257
258 double result_values[16];
259 std::transform(lhs_values, lhs_values + 16, rhs_values, result_values,
260 std::minus<NekDouble>());
261 NekMatrix<NekDouble> result(4, 4, result_values);
262 RunAllSubCombinations(*lhs1, *lhs2, *lhs3, *rhs1, *rhs2, *rhs3, result);
263}
void GenerateFullMatrices(double values[], double scale, std::shared_ptr< NekMatrix< NekDouble, StandardMatrixTag > > &m1, std::shared_ptr< NekMatrix< NekMatrix< NekDouble >, ScaledMatrixTag > > &m2, std::shared_ptr< NekMatrix< NekMatrix< NekDouble >, BlockMatrixTag > > &m3)
void RunAllSubCombinations(const NekMatrix< NekDouble, StandardMatrixTag > &l1, const NekMatrix< NekMatrix< NekDouble, LhsScaledInnerMatrixType >, ScaledMatrixTag > &l2, const NekMatrix< NekMatrix< NekDouble, LhsBlockInnerMatrixType >, BlockMatrixTag > &l3, const NekMatrix< NekDouble, StandardMatrixTag > &r1, const NekMatrix< NekMatrix< NekDouble, RhsScaledInnerMatrixType >, ScaledMatrixTag > &r2, const NekMatrix< NekMatrix< NekDouble, RhsBlockInnerMatrixType >, BlockMatrixTag > &r3, const NekMatrix< NekDouble, StandardMatrixTag > &result)

References Nektar::GenerateFullMatrices(), and Nektar::RunAllSubCombinations().