GCC Code Coverage Report


Directory: ./
File: tasks/barkalova_m_mult_matrix_ccs/all/src/ops_all.cpp
Date: 2026-06-04 20:25:32
Exec Total Coverage
Lines: 187 193 96.9%
Functions: 11 11 100.0%
Branches: 123 206 59.7%

Line Branch Exec Source
1 #include "barkalova_m_mult_matrix_ccs/all/include/ops_all.hpp"
2
3 #include <mpi.h>
4
5 #include <algorithm>
6 #include <array>
7 #include <cmath>
8 #include <complex>
9 #include <cstddef>
10 #include <exception>
11 #include <utility>
12 #include <vector>
13
14 #include "barkalova_m_mult_matrix_ccs/common/include/common.hpp"
15
16 namespace barkalova_m_mult_matrix_ccs {
17
18
1/2
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
12 BarkalovaMMultMatrixCcsALL::BarkalovaMMultMatrixCcsALL(const InType &in) {
19 SetTypeOfTask(GetStaticTypeOfTask());
20
21 12 int rank = 0;
22
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
23
24
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank == 0) {
25 GetInput() = in;
26 }
27
28 12 GetOutput() = CCSMatrix{};
29 12 }
30
31 12 bool BarkalovaMMultMatrixCcsALL::ValidationImpl() {
32 12 int rank = 0;
33 12 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
34
35
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank != 0) {
36 return true;
37 }
38
39 const auto &[A, B] = GetInput();
40
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (A.cols != B.rows) {
41 return false;
42 }
43
3/6
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
6 if (A.rows <= 0 || A.cols <= 0 || B.rows <= 0 || B.cols <= 0) {
44 return false;
45 }
46
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 if (A.col_ptrs.size() != static_cast<size_t>(A.cols) + 1 || B.col_ptrs.size() != static_cast<size_t>(B.cols) + 1) {
47 return false;
48 }
49
4/8
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
6 if (A.col_ptrs.empty() || A.col_ptrs[0] != 0 || B.col_ptrs.empty() || B.col_ptrs[0] != 0) {
50 return false;
51 }
52
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
12 if (std::cmp_not_equal(A.nnz, A.values.size()) || std::cmp_not_equal(B.nnz, B.values.size())) {
53 return false;
54 }
55 return true;
56 }
57
58 12 bool BarkalovaMMultMatrixCcsALL::PreProcessingImpl() {
59 12 return true;
60 }
61
62 namespace {
63 constexpr double kEpsilon = 1e-10;
64
65 12 void TransponirMatr(const CCSMatrix &a, CCSMatrix &at) {
66 12 at.rows = a.cols;
67 12 at.cols = a.rows;
68 12 at.nnz = a.nnz;
69
70
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if (a.nnz == 0) {
71 at.values.clear();
72 at.row_indices.clear();
73 at.col_ptrs.assign(at.cols + 1, 0);
74 return;
75 }
76
77 12 std::vector<int> row_count(at.cols, 0);
78
2/2
✓ Branch 0 taken 34 times.
✓ Branch 1 taken 12 times.
46 for (int i = 0; i < a.nnz; i++) {
79 34 row_count[a.row_indices[i]]++;
80 }
81
82
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 at.col_ptrs.resize(at.cols + 1);
83 12 at.col_ptrs[0] = 0;
84
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 12 times.
42 for (int i = 0; i < at.cols; i++) {
85 30 at.col_ptrs[i + 1] = at.col_ptrs[i] + row_count[i];
86 }
87
88
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 at.values.resize(a.nnz);
89
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 at.row_indices.resize(a.nnz);
90
91
1/4
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
12 std::vector<int> current_pos(at.cols, 0);
92
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 12 times.
40 for (int col = 0; col < a.cols; col++) {
93
2/2
✓ Branch 0 taken 34 times.
✓ Branch 1 taken 28 times.
62 for (int i = a.col_ptrs[col]; i < a.col_ptrs[col + 1]; i++) {
94 34 int row = a.row_indices[i];
95 34 Complex val = a.values[i];
96 34 int pos = at.col_ptrs[row] + current_pos[row];
97 34 at.values[pos] = val;
98 34 at.row_indices[pos] = col;
99 34 current_pos[row]++;
100 }
101 }
102 }
103
104 24 void BroadcastMatrix(CCSMatrix &matrix) {
105 24 int rank = 0;
106 24 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
107
108 24 std::array<int, 4> meta = {matrix.rows, matrix.cols, matrix.nnz, 0};
109
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
24 if (rank == 0) {
110 12 meta[3] = static_cast<int>(matrix.col_ptrs.size());
111 }
112 24 MPI_Bcast(meta.data(), 4, MPI_INT, 0, MPI_COMM_WORLD);
113
114 24 matrix.rows = meta[0];
115 24 matrix.cols = meta[1];
116 24 matrix.nnz = meta[2];
117 24 int col_ptrs_size = meta[3];
118
119
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
24 if (matrix.nnz == 0) {
120 matrix.values.clear();
121 matrix.row_indices.clear();
122 matrix.col_ptrs.assign(col_ptrs_size, 0);
123 return;
124 }
125
126
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
24 if (rank != 0) {
127 12 matrix.values.resize(matrix.nnz);
128 12 matrix.row_indices.resize(matrix.nnz);
129 12 matrix.col_ptrs.resize(col_ptrs_size);
130 }
131
132 24 MPI_Bcast(matrix.col_ptrs.data(), col_ptrs_size, MPI_INT, 0, MPI_COMM_WORLD);
133 24 MPI_Bcast(matrix.row_indices.data(), matrix.nnz, MPI_INT, 0, MPI_COMM_WORLD);
134
135 24 std::vector<double> values_real(matrix.nnz);
136
1/4
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
24 std::vector<double> values_imag(matrix.nnz);
137
138
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
24 if (rank == 0) {
139
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 12 times.
54 for (int i = 0; i < matrix.nnz; ++i) {
140 42 values_real[i] = matrix.values[i].real();
141 42 values_imag[i] = matrix.values[i].imag();
142 }
143 }
144
145
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 MPI_Bcast(values_real.data(), matrix.nnz, MPI_DOUBLE, 0, MPI_COMM_WORLD);
146
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 MPI_Bcast(values_imag.data(), matrix.nnz, MPI_DOUBLE, 0, MPI_COMM_WORLD);
147
148
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
24 if (rank != 0) {
149
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 12 times.
54 for (int i = 0; i < matrix.nnz; ++i) {
150 42 matrix.values[i] = Complex(values_real[i], values_imag[i]);
151 }
152 }
153 }
154
155 bool IsNonZero(const Complex &val) {
156 return std::abs(val.real()) > kEpsilon || std::abs(val.imag()) > kEpsilon;
157 }
158
159 44 Complex ComputeScalarProduct(const CCSMatrix &at, const CCSMatrix &b, int row_a, int col_b) {
160 Complex sum = Complex(0.0, 0.0);
161
162 44 int ks = at.col_ptrs[row_a];
163 44 int ls = b.col_ptrs[col_b];
164 44 int kf = at.col_ptrs[row_a + 1];
165 44 int lf = b.col_ptrs[col_b + 1];
166
167
2/2
✓ Branch 0 taken 59 times.
✓ Branch 1 taken 44 times.
103 while ((ks < kf) && (ls < lf)) {
168
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 48 times.
59 if (at.row_indices[ks] < b.row_indices[ls]) {
169 11 ks++;
170
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 34 times.
48 } else if (at.row_indices[ks] > b.row_indices[ls]) {
171 14 ls++;
172 } else {
173 sum += at.values[ks] * b.values[ls];
174 34 ks++;
175 34 ls++;
176 }
177 }
178
179 44 return sum;
180 }
181
182 void ComputeLocalColumns(int start_col, int local_cols, const CCSMatrix &at, const CCSMatrix &b,
183 std::vector<std::vector<int>> &col_rows, std::vector<std::vector<Complex>> &col_vals) {
184 12 #pragma omp parallel for schedule(static) default(none) shared(start_col, local_cols, at, b, col_rows, col_vals)
185 for (int j_local = 0; j_local < local_cols; ++j_local) {
186 int global_col = start_col + j_local;
187
188 std::vector<int> rows;
189 std::vector<Complex> vals;
190 rows.reserve(100);
191 vals.reserve(100);
192
193 for (int i = 0; i < at.cols; i++) {
194 Complex sum = ComputeScalarProduct(at, b, i, global_col);
195 if (IsNonZero(sum)) {
196 rows.push_back(i);
197 vals.push_back(sum);
198 }
199 }
200
201 col_rows[j_local] = std::move(rows);
202 col_vals[j_local] = std::move(vals);
203 }
204 }
205
206 12 void LocVectors(int local_cols, const std::vector<std::vector<int>> &col_rows,
207 const std::vector<std::vector<Complex>> &col_vals, std::vector<int> &local_row_indices,
208 std::vector<Complex> &local_values) {
209
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 12 times.
29 for (int j = 0; j < local_cols; ++j) {
210 17 local_row_indices.insert(local_row_indices.end(), col_rows[j].begin(), col_rows[j].end());
211 17 local_values.insert(local_values.end(), col_vals[j].begin(), col_vals[j].end());
212 }
213 12 }
214
215 12 void GatherResults(int rank, int size, int local_nnz, const std::vector<int> &local_row_indices,
216 const std::vector<Complex> &local_values, std::vector<int> &global_row_indices,
217 std::vector<double> &global_values_real, std::vector<double> &global_values_imag, int total_nnz) {
218
1/2
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
12 std::vector<int> recv_counts(size, 0);
219
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Gather(&local_nnz, 1, MPI_INT, recv_counts.data(), 1, MPI_INT, 0, MPI_COMM_WORLD);
220
221
1/4
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
12 std::vector<int> displs(size, 0);
222
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank == 0) {
223
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 for (int i = 1; i < size; ++i) {
224 6 displs[i] = displs[i - 1] + recv_counts[i - 1];
225 }
226 }
227
228 if (rank == 0) {
229
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 global_row_indices.resize(total_nnz);
230 }
231
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Gatherv(local_row_indices.data(), local_nnz, MPI_INT, global_row_indices.data(), recv_counts.data(),
232 displs.data(), MPI_INT, 0, MPI_COMM_WORLD);
233
234
1/4
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
12 std::vector<double> local_values_real(local_nnz);
235
1/4
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
12 std::vector<double> local_values_imag(local_nnz);
236
2/2
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 12 times.
41 for (int i = 0; i < local_nnz; ++i) {
237 29 local_values_real[i] = local_values[i].real();
238 29 local_values_imag[i] = local_values[i].imag();
239 }
240
241
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank == 0) {
242
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 global_values_real.resize(total_nnz);
243 }
244
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Gatherv(local_values_real.data(), local_nnz, MPI_DOUBLE, global_values_real.data(), recv_counts.data(),
245 displs.data(), MPI_DOUBLE, 0, MPI_COMM_WORLD);
246
247
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank == 0) {
248
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 global_values_imag.resize(total_nnz);
249 }
250
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Gatherv(local_values_imag.data(), local_nnz, MPI_DOUBLE, global_values_imag.data(), recv_counts.data(),
251 displs.data(), MPI_DOUBLE, 0, MPI_COMM_WORLD);
252 12 }
253
254 12 void BroadcastRes(int rank, int total_rows, int total_cols, int total_nnz, std::vector<int> &global_col_ptrs,
255 std::vector<int> &global_row_indices, std::vector<double> &global_values_real,
256 std::vector<double> &global_values_imag) {
257 12 int bcast_rows = total_rows;
258 12 int bcast_cols = total_cols;
259 12 int bcast_nnz = total_nnz;
260
261 12 MPI_Bcast(&bcast_rows, 1, MPI_INT, 0, MPI_COMM_WORLD);
262 12 MPI_Bcast(&bcast_cols, 1, MPI_INT, 0, MPI_COMM_WORLD);
263 12 MPI_Bcast(&bcast_nnz, 1, MPI_INT, 0, MPI_COMM_WORLD);
264
265 12 int col_ptrs_size = static_cast<int>(global_col_ptrs.size());
266 12 MPI_Bcast(&col_ptrs_size, 1, MPI_INT, 0, MPI_COMM_WORLD);
267
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank != 0) {
268 6 global_col_ptrs.resize(col_ptrs_size);
269 }
270 12 MPI_Bcast(global_col_ptrs.data(), col_ptrs_size, MPI_INT, 0, MPI_COMM_WORLD);
271
272
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank != 0) {
273 6 global_row_indices.resize(bcast_nnz);
274 }
275 12 MPI_Bcast(global_row_indices.data(), bcast_nnz, MPI_INT, 0, MPI_COMM_WORLD);
276
277
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank != 0) {
278 6 global_values_real.resize(bcast_nnz);
279 6 global_values_imag.resize(bcast_nnz);
280 }
281 12 MPI_Bcast(global_values_real.data(), bcast_nnz, MPI_DOUBLE, 0, MPI_COMM_WORLD);
282 12 MPI_Bcast(global_values_imag.data(), bcast_nnz, MPI_DOUBLE, 0, MPI_COMM_WORLD);
283 12 }
284
285 } // namespace
286
287 12 bool BarkalovaMMultMatrixCcsALL::RunImpl() {
288 try {
289 12 int rank = 0;
290 12 int size = 0;
291
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
292
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Comm_size(MPI_COMM_WORLD, &size);
293
294
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 CCSMatrix a = GetInput().first;
295
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 CCSMatrix b = GetInput().second;
296
297
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 BroadcastMatrix(a);
298
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 BroadcastMatrix(b);
299
300 12 CCSMatrix at;
301
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 TransponirMatr(a, at);
302
303 12 const int total_cols = b.cols;
304 12 const int total_rows = a.rows;
305
306 12 int cols_per_process = total_cols / size;
307 12 int remainder = total_cols % size;
308
309
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 3 times.
12 int start_col = (rank * cols_per_process) + std::min(rank, remainder);
310
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 3 times.
12 int local_cols = cols_per_process + (rank < remainder ? 1 : 0);
311
312
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 std::vector<std::vector<int>> col_rows(local_cols);
313
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 std::vector<std::vector<Complex>> col_vals(local_cols);
314
315 ComputeLocalColumns(start_col, local_cols, at, b, col_rows, col_vals);
316
317 12 std::vector<int> local_row_indices;
318 12 std::vector<Complex> local_values;
319
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 LocVectors(local_cols, col_rows, col_vals, local_row_indices, local_values);
320 12 int local_nnz = static_cast<int>(local_values.size());
321
322
1/4
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
12 std::vector<int> global_col_nnz(total_cols, 0);
323
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 12 times.
29 for (int j = 0; j < local_cols; ++j) {
324 17 global_col_nnz[start_col + j] = static_cast<int>(col_rows[j].size());
325 }
326
327
2/6
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
12 std::vector<int> recv_col_nnz(total_cols);
328
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 MPI_Allreduce(global_col_nnz.data(), recv_col_nnz.data(), total_cols, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
329
330
1/4
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
12 std::vector<int> global_col_ptrs = {0};
331
2/2
✓ Branch 0 taken 34 times.
✓ Branch 1 taken 12 times.
46 for (int j = 0; j < total_cols; ++j) {
332
1/4
✓ Branch 1 taken 34 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
34 global_col_ptrs.push_back(global_col_ptrs.back() + recv_col_nnz[j]);
333 }
334 12 int total_nnz = global_col_ptrs.back();
335
336 12 std::vector<int> global_row_indices;
337 12 std::vector<double> global_values_real;
338 12 std::vector<double> global_values_imag;
339
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 GatherResults(rank, size, local_nnz, local_row_indices, local_values, global_row_indices, global_values_real,
340 global_values_imag, total_nnz);
341
342
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 BroadcastRes(rank, total_rows, total_cols, total_nnz, global_col_ptrs, global_row_indices, global_values_real,
343 global_values_imag);
344
345
1/4
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
12 std::vector<Complex> global_values(total_nnz);
346
2/2
✓ Branch 0 taken 58 times.
✓ Branch 1 taken 12 times.
70 for (int i = 0; i < total_nnz; ++i) {
347 58 global_values[i] = Complex(global_values_real[i], global_values_imag[i]);
348 }
349
350 12 CCSMatrix c;
351 12 c.rows = total_rows;
352 12 c.cols = total_cols;
353 12 c.nnz = total_nnz;
354 c.values = std::move(global_values);
355 c.row_indices = std::move(global_row_indices);
356 c.col_ptrs = std::move(global_col_ptrs);
357
358
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 GetOutput() = c;
359 return true;
360
361
0/2
✗ Branch 12 not taken.
✗ Branch 13 not taken.
24 } catch (const std::exception &) {
362 return false;
363 }
364 }
365
366 12 bool BarkalovaMMultMatrixCcsALL::PostProcessingImpl() {
367 12 int rank = 0;
368 12 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
369
370
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
12 if (rank != 0) {
371 return true;
372 }
373
374 const auto &c = GetOutput();
375
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
6 if (c.rows <= 0 || c.cols <= 0) {
376 return false;
377 }
378
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (c.col_ptrs.size() != static_cast<size_t>(c.cols) + 1) {
379 return false;
380 }
381
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 6 times.
23 for (size_t i = 1; i < c.col_ptrs.size(); ++i) {
382
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 if (c.col_ptrs[i] < c.col_ptrs[i - 1]) {
383 return false;
384 }
385 }
386
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (std::cmp_not_equal(c.nnz, c.values.size()) || std::cmp_not_equal(c.nnz, c.row_indices.size())) {
387 return false;
388 }
389
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (c.col_ptrs[0] != 0) {
390 return false;
391 }
392
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (c.col_ptrs.back() != c.nnz) {
393 return false;
394 }
395 return true;
396 }
397
398 } // namespace barkalova_m_mult_matrix_ccs
399