GCC Code Coverage Report


Directory: ./
File: tasks/pikhotskiy_r_multiplication_of_sparse_matrices/common/include/common.hpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 1 1 100.0%
Branches: 2 6 33.3%

Line Branch Exec Source
1 #pragma once
2
3 #include <string>
4 #include <tuple>
5 #include <vector>
6
7 #include "task/include/task.hpp"
8
9 namespace pikhotskiy_r_multiplication_of_sparse_matrices {
10
11 5376 struct SparseMatrixCRS {
12 int rows;
13 int cols;
14 std::vector<double> values;
15 std::vector<int> col_indices;
16 std::vector<int> row_ptr;
17
18
1/2
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
120 SparseMatrixCRS() : rows(0), cols(0) {}
19
1/4
✓ Branch 1 taken 1032 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1032 SparseMatrixCRS(int r, int c) : rows(r), cols(c), row_ptr(r + 1, 0) {}
20 };
21
22 using InType = std::tuple<SparseMatrixCRS, SparseMatrixCRS>;
23 using OutType = SparseMatrixCRS;
24 using TestType = std::tuple<SparseMatrixCRS, SparseMatrixCRS, std::string>;
25 using BaseTask = ppc::task::Task<InType, OutType>;
26
27 SparseMatrixCRS DenseToCRS(const std::vector<double> &dense, int rows, int cols);
28
29 std::vector<double> CRSToDense(const SparseMatrixCRS &sparse);
30
31 SparseMatrixCRS TransposeCRS(const SparseMatrixCRS &matrix);
32
33 bool CompareSparseMatrices(const SparseMatrixCRS &a, const SparseMatrixCRS &b, double eps = 1e-9);
34
35 } // namespace pikhotskiy_r_multiplication_of_sparse_matrices
36