GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "romanov_m_horizontal_matrix_vector/seq/include/ops_seq.hpp"
2
3 #include <cstddef>
4 #include <tuple>
5 #include <vector>
6
7 #include "romanov_m_horizontal_matrix_vector/common/include/common.hpp"
8
9 namespace romanov_m_horizontal_matrix_vector {
10
11
1/2
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
64 RomanovMHorizontalMatrixVectorSEQ::RomanovMHorizontalMatrixVectorSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = in;
14 GetOutput() = {};
15 64 }
16
17 64 bool RomanovMHorizontalMatrixVectorSEQ::ValidationImpl() {
18 const auto &mat = std::get<0>(GetInput());
19 64 const int r = std::get<1>(GetInput());
20 64 const int c = std::get<2>(GetInput());
21 const auto &v = std::get<3>(GetInput());
22
23
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
64 if (r <= 0 || c <= 0) {
24 return false;
25 }
26
27
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
64 const std::size_t expected_size = static_cast<std::size_t>(r) * static_cast<std::size_t>(c);
28
29
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
64 if (mat.size() != expected_size) {
30 return false;
31 }
32
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
64 if (v.size() != static_cast<std::size_t>(c)) {
33 return false;
34 }
35
36 return true;
37 }
38
39 64 bool RomanovMHorizontalMatrixVectorSEQ::PreProcessingImpl() {
40 64 GetOutput().resize(static_cast<std::size_t>(std::get<1>(GetInput())));
41 64 return true;
42 }
43
44 64 bool RomanovMHorizontalMatrixVectorSEQ::RunImpl() {
45 const auto &matrix = std::get<0>(GetInput());
46 64 const int rows = std::get<1>(GetInput());
47 64 const int cols = std::get<2>(GetInput());
48 const auto &vec = std::get<3>(GetInput());
49
50 auto &res = GetOutput();
51
52
2/2
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 64 times.
232 for (int i = 0; i < rows; ++i) {
53 double temp = 0.0;
54
2/2
✓ Branch 0 taken 656 times.
✓ Branch 1 taken 168 times.
824 for (int j = 0; j < cols; ++j) {
55 656 const std::size_t idx =
56 656 (static_cast<std::size_t>(i) * static_cast<std::size_t>(cols)) + static_cast<std::size_t>(j);
57 656 temp += matrix[idx] * vec[static_cast<std::size_t>(j)];
58 }
59 168 res[static_cast<std::size_t>(i)] = temp;
60 }
61
62 64 return true;
63 }
64
65 64 bool RomanovMHorizontalMatrixVectorSEQ::PostProcessingImpl() {
66 64 return true;
67 }
68
69 } // namespace romanov_m_horizontal_matrix_vector
70