| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "chernov_t_max_matrix_columns/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "chernov_t_max_matrix_columns/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace chernov_t_max_matrix_columns { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
16 | ChernovTMaxMatrixColumnsSEQ::ChernovTMaxMatrixColumnsSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | 16 | GetOutput() = std::vector<int>(); | |
| 15 | 16 | } | |
| 16 | |||
| 17 | 16 | bool ChernovTMaxMatrixColumnsSEQ::ValidationImpl() { | |
| 18 | 16 | std::size_t m = std::get<0>(GetInput()); | |
| 19 | 16 | std::size_t n = std::get<1>(GetInput()); | |
| 20 | std::vector<int> &matrix = std::get<2>(GetInput()); | ||
| 21 | |||
| 22 |
2/4✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
|
16 | valid_ = (m > 0) && (n > 0) && (matrix.size() == m * n); |
| 23 | 16 | return valid_; | |
| 24 | } | ||
| 25 | |||
| 26 | 16 | bool ChernovTMaxMatrixColumnsSEQ::PreProcessingImpl() { | |
| 27 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (!valid_) { |
| 28 | return false; | ||
| 29 | } | ||
| 30 | |||
| 31 | 16 | rows_ = std::get<0>(GetInput()); | |
| 32 | 16 | cols_ = std::get<1>(GetInput()); | |
| 33 | 16 | input_matrix_ = std::get<2>(GetInput()); | |
| 34 | |||
| 35 | 16 | return true; | |
| 36 | } | ||
| 37 | |||
| 38 | 16 | bool ChernovTMaxMatrixColumnsSEQ::RunImpl() { | |
| 39 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (!valid_) { |
| 40 | return false; | ||
| 41 | } | ||
| 42 | |||
| 43 | 16 | std::vector<int> result(cols_); | |
| 44 | |||
| 45 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 16 times.
|
56 | for (std::size_t col = 0; col < cols_; ++col) { |
| 46 | 40 | int max_val = input_matrix_[col]; | |
| 47 | |||
| 48 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 40 times.
|
104 | for (std::size_t row = 1; row < rows_; ++row) { |
| 49 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | std::size_t index = (row * cols_) + col; |
| 50 | 64 | max_val = std::max(input_matrix_[index], max_val); | |
| 51 | } | ||
| 52 | 40 | result[col] = max_val; | |
| 53 | } | ||
| 54 | |||
| 55 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
16 | GetOutput() = result; |
| 56 | return true; | ||
| 57 | } | ||
| 58 | |||
| 59 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | bool ChernovTMaxMatrixColumnsSEQ::PostProcessingImpl() { |
| 60 | input_matrix_.clear(); | ||
| 61 | 16 | return true; | |
| 62 | } | ||
| 63 | |||
| 64 | } // namespace chernov_t_max_matrix_columns | ||
| 65 |