| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "chernov_t_ribbon_horizontal_a_matrix_mult/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "chernov_t_ribbon_horizontal_a_matrix_mult/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace chernov_t_ribbon_horizontal_a_matrix_mult { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
16 | ChernovTRibbonHorizontalAMmatrixMultSEQ::ChernovTRibbonHorizontalAMmatrixMultSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 16 | GetOutput() = std::vector<int>(); | |
| 14 | 16 | } | |
| 15 | |||
| 16 | 16 | bool ChernovTRibbonHorizontalAMmatrixMultSEQ::ValidationImpl() { | |
| 17 | const auto &input = GetInput(); | ||
| 18 | |||
| 19 | 16 | int rows_a = std::get<0>(input); | |
| 20 | 16 | int cols_a = std::get<1>(input); | |
| 21 | const auto &matrix_a = std::get<2>(input); | ||
| 22 | |||
| 23 | 16 | int rows_b = std::get<3>(input); | |
| 24 | 16 | int cols_b = std::get<4>(input); | |
| 25 | const auto &matrix_b = std::get<5>(input); | ||
| 26 | |||
| 27 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (cols_a != rows_b) { |
| 28 | return false; | ||
| 29 | } | ||
| 30 | |||
| 31 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (matrix_a.size() != static_cast<size_t>(rows_a) * static_cast<size_t>(cols_a)) { |
| 32 | return false; | ||
| 33 | } | ||
| 34 | |||
| 35 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (matrix_b.size() != static_cast<size_t>(rows_b) * static_cast<size_t>(cols_b)) { |
| 36 | return false; | ||
| 37 | } | ||
| 38 | |||
| 39 |
2/4✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
|
16 | if (rows_a <= 0 || cols_a <= 0 || rows_b <= 0 || cols_b <= 0) { |
| 40 | ✗ | return false; | |
| 41 | } | ||
| 42 | |||
| 43 | return true; | ||
| 44 | } | ||
| 45 | |||
| 46 | 16 | bool ChernovTRibbonHorizontalAMmatrixMultSEQ::PreProcessingImpl() { | |
| 47 | const auto &input = GetInput(); | ||
| 48 | 16 | int rows_a = std::get<0>(input); | |
| 49 | 16 | int cols_b = std::get<4>(input); | |
| 50 | |||
| 51 | 16 | GetOutput() = std::vector<int>(static_cast<size_t>(rows_a) * static_cast<size_t>(cols_b), 0); | |
| 52 | 16 | return true; | |
| 53 | } | ||
| 54 | |||
| 55 | 16 | bool ChernovTRibbonHorizontalAMmatrixMultSEQ::RunImpl() { | |
| 56 | const auto &input = GetInput(); | ||
| 57 | |||
| 58 | 16 | int rows_a = std::get<0>(input); | |
| 59 | 16 | int cols_a = std::get<1>(input); | |
| 60 | const auto &matrix_a = std::get<2>(input); | ||
| 61 | |||
| 62 | 16 | int cols_b = std::get<4>(input); | |
| 63 | const auto &matrix_b = std::get<5>(input); | ||
| 64 | |||
| 65 | auto &output = GetOutput(); | ||
| 66 | |||
| 67 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 16 times.
|
56 | for (int i = 0; i < rows_a; i++) { |
| 68 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 40 times.
|
184 | for (int j = 0; j < cols_b; j++) { |
| 69 | int sum = 0; | ||
| 70 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 144 times.
|
480 | for (int k = 0; k < cols_a; k++) { |
| 71 | 336 | sum += matrix_a[(i * cols_a) + k] * matrix_b[(k * cols_b) + j]; | |
| 72 | } | ||
| 73 | 144 | output[(i * cols_b) + j] = sum; | |
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | 16 | return true; | |
| 78 | } | ||
| 79 | |||
| 80 | 16 | bool ChernovTRibbonHorizontalAMmatrixMultSEQ::PostProcessingImpl() { | |
| 81 | 16 | return !GetOutput().empty(); | |
| 82 | } | ||
| 83 | |||
| 84 | } // namespace chernov_t_ribbon_horizontal_a_matrix_mult | ||
| 85 |