GCC Code Coverage Report


Directory: ./
File: tasks/pankov_matrix_vector/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 19 19 100.0%
Functions: 5 5 100.0%
Branches: 9 14 64.3%

Line Branch Exec Source
1 #include "pankov_matrix_vector/seq/include/ops_seq.hpp"
2
3 #include <cstddef>
4 #include <utility>
5 #include <vector>
6
7 #include "pankov_matrix_vector/common/include/common.hpp"
8
9 namespace pankov_matrix_vector {
10
11
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 PankovMatrixVectorSEQ::PankovMatrixVectorSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 InType temp(in);
14 48 std::swap(GetInput(), temp);
15 48 GetOutput() = std::vector<double>();
16 48 }
17
18 48 bool PankovMatrixVectorSEQ::ValidationImpl() {
19 48 return GetOutput().empty();
20 }
21
22 48 bool PankovMatrixVectorSEQ::PreProcessingImpl() {
23 const auto &input = GetInput();
24 const std::size_t rows = input.matrix.size();
25 48 GetOutput() = std::vector<double>(rows, 0.0);
26 48 return true;
27 }
28
29
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 bool PankovMatrixVectorSEQ::RunImpl() {
30 const auto &input = GetInput();
31 const auto &matrix = input.matrix;
32 const auto &vector = input.vector;
33 auto &result = GetOutput();
34
35 const std::size_t rows = matrix.size();
36
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 if (rows == 0) {
37 return true;
38 }
39
40 const std::size_t cols = matrix[0].size();
41
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (cols != vector.size()) {
42 return false;
43 }
44
45
2/2
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 88 times.
136 for (std::size_t i = 0; i < rows; ++i) {
46 88 result[i] = 0.0;
47
2/2
✓ Branch 0 taken 216 times.
✓ Branch 1 taken 88 times.
304 for (std::size_t j = 0; j < cols; ++j) {
48 216 result[i] += matrix[i][j] * vector[j];
49 }
50 }
51
52 return true;
53 }
54
55 48 bool PankovMatrixVectorSEQ::PostProcessingImpl() {
56 48 return !GetOutput().empty();
57 }
58
59 } // namespace pankov_matrix_vector
60