GCC Code Coverage Report


Directory: ./
File: tasks/batushin_i_striped_matrix_multiplication/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 31 31 100.0%
Functions: 5 5 100.0%
Branches: 15 24 62.5%

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