GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "liulin_y_complex_ccs/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cmath>
5 #include <complex>
6 #include <vector>
7
8 #include "liulin_y_complex_ccs/common/include/common.hpp"
9
10 namespace liulin_y_complex_ccs {
11
12
1/2
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 LiulinYComplexCcs::LiulinYComplexCcs(const InType &in) : BaseTask() {
13 SetTypeOfTask(GetStaticTypeOfTask());
14 GetInput() = in;
15 48 }
16
17 48 bool LiulinYComplexCcs::ValidationImpl() {
18 const auto &first = GetInput().first;
19 const auto &second = GetInput().second;
20 48 return first.count_cols == second.count_rows;
21 }
22
23 48 bool LiulinYComplexCcs::PreProcessingImpl() {
24 const auto &first = GetInput().first;
25 const auto &second = GetInput().second;
26
27 auto &result = GetOutput();
28 48 result.count_rows = first.count_rows;
29
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 result.count_cols = second.count_cols;
30 result.values.clear();
31 result.row_index.clear();
32 48 result.col_index.assign(result.count_cols + 1, 0);
33
34 48 return true;
35 }
36
37 48 bool LiulinYComplexCcs::RunImpl() {
38 const auto &first = GetInput().first;
39 const auto &second = GetInput().second;
40 auto &result = GetOutput();
41
42 48 std::vector<std::complex<double>> dense_col(first.count_rows, {0.0, 0.0});
43 48 std::vector<int> active_rows;
44
1/4
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
48 std::vector<bool> is_active(first.count_rows, false);
45
46
2/2
✓ Branch 0 taken 96 times.
✓ Branch 1 taken 48 times.
144 for (int j = 0; j < second.count_cols; ++j) {
47
2/2
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 96 times.
176 for (int kb = second.col_index[j]; kb < second.col_index[j + 1]; ++kb) {
48 80 int k = second.row_index[kb];
49 80 std::complex<double> b_val = second.values[kb];
50
51
2/2
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 80 times.
160 for (int ka = first.col_index[k]; ka < first.col_index[k + 1]; ++ka) {
52
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
80 int i = first.row_index[ka];
53
2/2
✓ Branch 0 taken 72 times.
✓ Branch 1 taken 8 times.
80 if (!is_active[i]) {
54 is_active[i] = true;
55 active_rows.push_back(i);
56 }
57 80 dense_col[i] += first.values[ka] * b_val;
58 }
59 }
60
61 std::ranges::sort(active_rows);
62
63
2/2
✓ Branch 0 taken 72 times.
✓ Branch 1 taken 96 times.
168 for (int i : active_rows) {
64
1/2
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
72 if (std::abs(dense_col[i]) > 1e-15) {
65
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
72 result.values.push_back(dense_col[i]);
66
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
72 result.row_index.push_back(i);
67 }
68
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
72 dense_col[i] = {0.0, 0.0};
69 is_active[i] = false;
70 }
71
2/2
✓ Branch 0 taken 72 times.
✓ Branch 1 taken 24 times.
96 result.col_index[j + 1] = static_cast<int>(result.values.size());
72 active_rows.clear();
73 }
74
75 48 return true;
76 }
77
78 48 bool LiulinYComplexCcs::PostProcessingImpl() {
79 48 return true;
80 }
81
82 } // namespace liulin_y_complex_ccs
83