GCC Code Coverage Report


Directory: ./
File: tasks/kurpiakov_a_vert_tape_mat_vec_mul/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 22 22 100.0%
Functions: 5 5 100.0%
Branches: 16 24 66.7%

Line Branch Exec Source
1 #include "kurpiakov_a_vert_tape_mat_vec_mul/seq/include/ops_seq.hpp"
2
3 #include <cstddef>
4 #include <vector>
5
6 #include "kurpiakov_a_vert_tape_mat_vec_mul/common/include/common.hpp"
7
8 namespace kurpiakov_a_vert_tape_mat_vec_mul {
9
10
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 KurpiakovAVretTapeMulSEQ::KurpiakovAVretTapeMulSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12 GetInput() = in;
13 GetOutput() = {};
14 80 }
15
16 80 bool KurpiakovAVretTapeMulSEQ::ValidationImpl() {
17 const auto &[size, matrix, vector] = GetInput();
18
19
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 if (size < 0) {
20 return false;
21 }
22
23
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 72 times.
80 if (size == 0) {
24
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 return matrix.empty() && vector.empty();
25 }
26
27
1/2
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
72 auto expected_matrix_size = static_cast<size_t>(size) * static_cast<size_t>(size);
28
1/2
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
72 if (matrix.size() != expected_matrix_size) {
29 return false;
30 }
31
32
1/2
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
72 if (vector.size() != static_cast<size_t>(size)) {
33 return false;
34 }
35
36 return true;
37 }
38
39 80 bool KurpiakovAVretTapeMulSEQ::PreProcessingImpl() {
40 GetOutput() = {};
41 80 return true;
42 }
43
44 80 bool KurpiakovAVretTapeMulSEQ::RunImpl() {
45 80 const auto total_size = std::get<0>(GetInput());
46
47
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 72 times.
80 if (total_size == 0) {
48 GetOutput() = {};
49 8 return true;
50 }
51
52 const auto &in_vec = std::get<2>(GetInput());
53 const auto &in_mat = std::get<1>(GetInput());
54
55 72 OutType res_vec(static_cast<size_t>(total_size), 0);
56
2/2
✓ Branch 0 taken 152 times.
✓ Branch 1 taken 72 times.
224 for (int j = 0; j < total_size; j++) {
57
2/2
✓ Branch 0 taken 344 times.
✓ Branch 1 taken 152 times.
496 for (int i = 0; i < total_size; i++) {
58 344 res_vec[i] += in_mat[(i * total_size) + j] * in_vec[j];
59 }
60 }
61
62
1/2
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
72 GetOutput() = res_vec;
63 return true;
64 }
65
66 80 bool KurpiakovAVretTapeMulSEQ::PostProcessingImpl() {
67 80 return true;
68 }
69
70 } // namespace kurpiakov_a_vert_tape_mat_vec_mul
71