| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "ovchinnikov_m_max_values_in_matrix_rows/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <limits> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "ovchinnikov_m_max_values_in_matrix_rows/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace ovchinnikov_m_max_values_in_matrix_rows { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
48 | OvchinnikovMMaxValuesInMatrixRowsSEQ::OvchinnikovMMaxValuesInMatrixRowsSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 | GetInput() = in; | ||
| 15 | static_cast<void>(GetOutput()); | ||
| 16 | 48 | } | |
| 17 | |||
| 18 | 48 | bool OvchinnikovMMaxValuesInMatrixRowsSEQ::ValidationImpl() { | |
| 19 | 48 | return true; | |
| 20 | } | ||
| 21 | |||
| 22 | 48 | bool OvchinnikovMMaxValuesInMatrixRowsSEQ::PreProcessingImpl() { | |
| 23 | 48 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 | 48 | bool OvchinnikovMMaxValuesInMatrixRowsSEQ::RunImpl() { | |
| 27 | 48 | size_t lines = std::get<0>(GetInput()); | |
| 28 | 48 | size_t cols = std::get<1>(GetInput()); | |
| 29 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 8 times.
|
48 | if (lines == 0 || cols == 0) { |
| 30 | return true; | ||
| 31 | } | ||
| 32 | const auto &matrix = std::get<2>(GetInput()); | ||
| 33 | 40 | std::vector<int> result(cols, std::numeric_limits<int>::min()); | |
| 34 | |||
| 35 |
2/2✓ Branch 0 taken 104 times.
✓ Branch 1 taken 40 times.
|
144 | for (size_t i = 0; i < lines; ++i) { |
| 36 |
2/2✓ Branch 0 taken 520 times.
✓ Branch 1 taken 104 times.
|
624 | for (size_t j = 0; j < cols; ++j) { |
| 37 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 272 times.
|
768 | result[j] = std::max(result[j], matrix[(i * cols) + j]); |
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | GetOutput() = result; |
| 42 | return true; | ||
| 43 | } | ||
| 44 | |||
| 45 | 48 | bool OvchinnikovMMaxValuesInMatrixRowsSEQ::PostProcessingImpl() { | |
| 46 | 48 | return true; | |
| 47 | } | ||
| 48 | |||
| 49 | } // namespace ovchinnikov_m_max_values_in_matrix_rows | ||
| 50 |