GCC Code Coverage Report


Directory: ./
File: tasks/potashnik_m_matrix_mult_complex/seq/src/ops_seq.cpp
Date: 2026-04-02 17:12:27
Exec Total Coverage
Lines: 36 36 100.0%
Functions: 5 5 100.0%
Branches: 20 28 71.4%

Line Branch Exec Source
1 #include "potashnik_m_matrix_mult_complex/seq/include/ops_seq.hpp"
2
3 #include <cstddef>
4 #include <map>
5 #include <utility>
6 #include <vector>
7
8 #include "potashnik_m_matrix_mult_complex/common/include/common.hpp"
9
10 namespace potashnik_m_matrix_mult_complex {
11
12
1/2
✓ Branch 2 taken 80 times.
✗ Branch 3 not taken.
80 PotashnikMMatrixMultComplexSEQ::PotashnikMMatrixMultComplexSEQ(const InType &in) {
13 SetTypeOfTask(GetStaticTypeOfTask());
14 GetInput() = in;
15 80 }
16
17 80 bool PotashnikMMatrixMultComplexSEQ::ValidationImpl() {
18 const auto &matrix_left = std::get<0>(GetInput());
19 const auto &matrix_right = std::get<1>(GetInput());
20 80 return matrix_left.width == matrix_right.height;
21 }
22
23 80 bool PotashnikMMatrixMultComplexSEQ::PreProcessingImpl() {
24 80 return true;
25 }
26
27 80 bool PotashnikMMatrixMultComplexSEQ::RunImpl() {
28 const auto &matrix_left = std::get<0>(GetInput());
29 const auto &matrix_right = std::get<1>(GetInput());
30
31 80 std::vector<Complex> val_left = matrix_left.val;
32
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 std::vector<size_t> row_ind_left = matrix_left.row_ind;
33
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 std::vector<size_t> col_ptr_left = matrix_left.col_ptr;
34 80 size_t height_left = matrix_left.height;
35
36
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 std::vector<Complex> val_right = matrix_right.val;
37
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 std::vector<size_t> row_ind_right = matrix_right.row_ind;
38
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 std::vector<size_t> col_ptr_right = matrix_right.col_ptr;
39 80 size_t width_right = matrix_right.width;
40
41 std::map<std::pair<size_t, size_t>, Complex> buffer;
42
43
2/2
✓ Branch 0 taken 3368 times.
✓ Branch 1 taken 80 times.
3448 for (size_t i = 0; i < matrix_left.Count(); i++) {
44 3368 size_t row_left = row_ind_left[i];
45 3368 size_t col_left = col_ptr_left[i];
46 3368 Complex left_val = val_left[i];
47
48
2/2
✓ Branch 0 taken 192704 times.
✓ Branch 1 taken 3368 times.
196072 for (size_t j = 0; j < matrix_right.Count(); j++) {
49 192704 size_t row_right = row_ind_right[j];
50 192704 size_t col_right = col_ptr_right[j];
51 192704 Complex right_val = val_right[j];
52
53
2/2
✓ Branch 0 taken 23872 times.
✓ Branch 1 taken 168832 times.
192704 if (col_left == row_right) {
54
1/2
✓ Branch 1 taken 23872 times.
✗ Branch 2 not taken.
23872 buffer[{row_left, col_right}] += left_val * right_val;
55 }
56 }
57 }
58
59 80 CCSMatrix matrix_res;
60
61 80 matrix_res.width = width_right;
62 80 matrix_res.height = height_left;
63
2/2
✓ Branch 0 taken 3432 times.
✓ Branch 1 taken 80 times.
3512 for (const auto &[key, value] : buffer) {
64 matrix_res.val.push_back(value);
65
2/2
✓ Branch 0 taken 2904 times.
✓ Branch 1 taken 528 times.
3432 matrix_res.row_ind.push_back(key.first);
66
2/2
✓ Branch 0 taken 2904 times.
✓ Branch 1 taken 528 times.
3432 matrix_res.col_ptr.push_back(key.second);
67 }
68
69
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 GetOutput() = matrix_res;
70 80 return true;
71 80 }
72
73 80 bool PotashnikMMatrixMultComplexSEQ::PostProcessingImpl() {
74 80 return true;
75 }
76
77 } // namespace potashnik_m_matrix_mult_complex
78