| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "dilshodov_a_max_val_rows_matrix/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <limits> | ||
| 6 | |||
| 7 | #include "dilshodov_a_max_val_rows_matrix/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace dilshodov_a_max_val_rows_matrix { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
48 | MaxValRowsMatrixTaskSequential::MaxValRowsMatrixTaskSequential(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
48 | InType copy = in; |
| 14 | GetInput().swap(copy); | ||
| 15 | 48 | } | |
| 16 | |||
| 17 |
1/2✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
|
48 | bool MaxValRowsMatrixTaskSequential::ValidationImpl() { |
| 18 | const auto &input = GetInput(); | ||
| 19 |
1/2✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
|
48 | if (input.empty()) { |
| 20 | return false; | ||
| 21 | } | ||
| 22 | std::size_t cols = input[0].size(); | ||
| 23 |
1/2✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
|
48 | if (cols == 0) { |
| 24 | return false; | ||
| 25 | } | ||
| 26 | return std::ranges::all_of(input, [&](const auto &row) { return row.size() == cols; }); | ||
| 27 | } | ||
| 28 | |||
| 29 | 48 | bool MaxValRowsMatrixTaskSequential::PreProcessingImpl() { | |
| 30 | 48 | GetOutput().assign(GetInput().size(), std::numeric_limits<int>::min()); | |
| 31 | 48 | return true; | |
| 32 | } | ||
| 33 | |||
| 34 | 48 | bool MaxValRowsMatrixTaskSequential::RunImpl() { | |
| 35 | const auto &input = GetInput(); | ||
| 36 | auto &output = GetOutput(); | ||
| 37 | 48 | int rows = static_cast<int>(input.size()); | |
| 38 | |||
| 39 |
2/2✓ Branch 0 taken 1352 times.
✓ Branch 1 taken 48 times.
|
1400 | for (int i = 0; i < rows; ++i) { |
| 40 |
1/2✓ Branch 0 taken 1352 times.
✗ Branch 1 not taken.
|
2704 | output[i] = *std::max_element(input[i].begin(), input[i].end()); |
| 41 | } | ||
| 42 | |||
| 43 | 48 | return true; | |
| 44 | } | ||
| 45 | |||
| 46 | 48 | bool MaxValRowsMatrixTaskSequential::PostProcessingImpl() { | |
| 47 | 48 | return true; | |
| 48 | } | ||
| 49 | |||
| 50 | } // namespace dilshodov_a_max_val_rows_matrix | ||
| 51 |