GCC Code Coverage Report


Directory: ./
File: tasks/kurpiakov_a_sp_comp_mat_mul/seq/src/ops_seq.cpp
Date: 2026-04-02 17:12:27
Exec Total Coverage
Lines: 22 22 100.0%
Functions: 6 6 100.0%
Branches: 17 30 56.7%

Line Branch Exec Source
1 #include "kurpiakov_a_sp_comp_mat_mul/seq/include/ops_seq.hpp"
2
3 #include <utility>
4
5 #include "kurpiakov_a_sp_comp_mat_mul/common/include/common.hpp"
6
7 namespace kurpiakov_a_sp_comp_mat_mul {
8
9 namespace {
10
11 160 bool ValidateCSR(const SparseMatrix &m) {
12
2/4
✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 160 times.
160 if (m.rows <= 0 || m.cols <= 0) {
13 return false;
14 }
15
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
160 if (static_cast<int>(m.row_ptr.size()) != m.rows + 1) {
16 return false;
17 }
18
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
160 if (m.row_ptr[0] != 0) {
19 return false;
20 }
21
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
160 if (std::cmp_not_equal(m.values.size(), m.row_ptr[m.rows])) {
22 return false;
23 }
24
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
160 if (m.col_indices.size() != m.values.size()) {
25 return false;
26 }
27
2/2
✓ Branch 0 taken 312 times.
✓ Branch 1 taken 160 times.
472 for (int i = 0; i < m.rows; ++i) {
28
2/2
✓ Branch 0 taken 320 times.
✓ Branch 1 taken 312 times.
632 for (int j = m.row_ptr[i]; j < m.row_ptr[i + 1]; ++j) {
29
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 320 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 320 times.
320 if (m.col_indices[j] < 0 || m.col_indices[j] >= m.cols) {
30 return false;
31 }
32 }
33 }
34 return true;
35 }
36
37 } // namespace
38
39
1/2
✓ Branch 2 taken 80 times.
✗ Branch 3 not taken.
80 KurpiskovACRSMatMulSEQ::KurpiskovACRSMatMulSEQ(const InType &in) {
40 SetTypeOfTask(GetStaticTypeOfTask());
41 GetInput() = in;
42
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 GetOutput() = SparseMatrix();
43 80 }
44
45
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 bool KurpiskovACRSMatMulSEQ::ValidationImpl() {
46 const auto &[a, b] = GetInput();
47
48
2/4
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 80 times.
✗ Branch 3 not taken.
80 if (!ValidateCSR(a) || !ValidateCSR(b)) {
49 return false;
50 }
51
52 80 return a.cols == b.rows;
53 }
54
55 80 bool KurpiskovACRSMatMulSEQ::PreProcessingImpl() {
56 80 return true;
57 }
58
59 80 bool KurpiskovACRSMatMulSEQ::RunImpl() {
60 const auto &[a, b] = GetInput();
61 80 GetOutput() = a.Multiply(b);
62 80 return true;
63 }
64
65 80 bool KurpiskovACRSMatMulSEQ::PostProcessingImpl() {
66 80 return true;
67 }
68
69 } // namespace kurpiakov_a_sp_comp_mat_mul
70