Nektar++
Functions
Nektar::BandedMatrixMatrixMultiplicationTests Namespace Reference

Functions

 BOOST_AUTO_TEST_CASE (TestMatrixMatrixMultiplication)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

Nektar::BandedMatrixMatrixMultiplicationTests::BOOST_AUTO_TEST_CASE ( TestMatrixMatrixMultiplication  )

Definition at line 431 of file TestBandedMatrixOperations.cpp.

432{
433 // [ 2 10 0 0 ] [ 30 38 0 0 ]
434 // [16 4 12 0 ] [ 0 32 40 0 ]
435 // [22 18 6 14 ] * [ 0 0 34 42 ]
436 // [ 0 24 20 8 ] [ 0 0 0 36 ]
437
438 {
439 double lhs_buf[] = {0, 2, 16, 22, 10, 4, 18, 24,
440 12, 6, 20, 0, 14, 8, 0, 0};
441 double rhs_buf[] = {0, 30, 38, 32, 40, 34, 42, 36};
442
443 NekMatrix<double> lhs1(4, 4, lhs_buf, eBANDED, 2, 1);
444 std::shared_ptr<
445 NekMatrix<NekMatrix<double, StandardMatrixTag>, ScaledMatrixTag>>
446 lhs2;
447 std::shared_ptr<NekMatrix<NekMatrix<double>, BlockMatrixTag>> lhs3;
448
449 NekMatrix<double> rhs1(4, 4, rhs_buf, eBANDED, 0, 1);
450 std::shared_ptr<NekMatrix<NekMatrix<double>, ScaledMatrixTag>> rhs2;
451 std::shared_ptr<NekMatrix<NekMatrix<double>, BlockMatrixTag>> rhs3;
452
453 GenerateMatrices(lhs1, 2.0, 2, 2, lhs2, lhs3);
454 GenerateMatrices(rhs1, 2.0, 2, 2, rhs2, rhs3);
455
456 double result_buf[] = {60, 480, 660, 0, 396, 736, 1412, 768,
457 400, 568, 924, 1640, 0, 504, 756, 1128};
458 NekMatrix<double> result(4, 4, result_buf);
459 }
460}
void GenerateMatrices(const NekMatrix< NumberType, StandardMatrixTag > &m1, NumberType scale, unsigned int blockRows, unsigned int blockColumns, std::shared_ptr< NekMatrix< NekMatrix< NumberType, StandardMatrixTag >, ScaledMatrixTag > > &m2, std::shared_ptr< NekMatrix< NekMatrix< NumberType >, BlockMatrixTag > > &m3)

References Nektar::eBANDED, and Nektar::GenerateMatrices().