GCC Code Coverage Report


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