| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "rychkova_d_sum_matrix_columns/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "rychkova_d_sum_matrix_columns/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace rychkova_d_sum_matrix_columns { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 98 times.
✗ Branch 2 not taken.
|
98 | RychkovaDSumMatrixColumnsSEQ::RychkovaDSumMatrixColumnsSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 |
1/2✓ Branch 1 taken 98 times.
✗ Branch 2 not taken.
|
98 | GetInput().resize(in.size()); |
| 13 |
2/2✓ Branch 0 taken 228 times.
✓ Branch 1 taken 98 times.
|
326 | for (size_t i = 0; i < in.size(); ++i) { |
| 14 |
1/2✓ Branch 1 taken 228 times.
✗ Branch 2 not taken.
|
228 | GetInput()[i] = in[i]; |
| 15 | } | ||
| 16 | 98 | GetOutput() = OutType{}; | |
| 17 | 98 | } | |
| 18 | |||
| 19 |
1/2✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
|
98 | bool RychkovaDSumMatrixColumnsSEQ::ValidationImpl() { |
| 20 | const auto &input = GetInput(); | ||
| 21 | |||
| 22 |
1/2✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
|
98 | if (input.empty()) { |
| 23 | return true; | ||
| 24 | } | ||
| 25 | |||
| 26 | size_t cols = input[0].size(); | ||
| 27 |
2/2✓ Branch 0 taken 228 times.
✓ Branch 1 taken 98 times.
|
326 | for (const auto &row : input) { |
| 28 |
1/2✓ Branch 0 taken 228 times.
✗ Branch 1 not taken.
|
228 | if (row.size() != cols) { |
| 29 | return false; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | 98 | return GetOutput().empty(); | |
| 34 | } | ||
| 35 | |||
| 36 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 98 times.
|
98 | bool RychkovaDSumMatrixColumnsSEQ::PreProcessingImpl() { |
| 37 | const auto &input = GetInput(); | ||
| 38 | |||
| 39 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 98 times.
|
98 | if (input.empty()) { |
| 40 | GetOutput().clear(); | ||
| 41 | ✗ | return true; | |
| 42 | } | ||
| 43 | |||
| 44 | const size_t cols = input[0].size(); | ||
| 45 | 98 | GetOutput().assign(cols, 0); | |
| 46 | 98 | return true; | |
| 47 | } | ||
| 48 | |||
| 49 |
1/2✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
|
98 | bool RychkovaDSumMatrixColumnsSEQ::RunImpl() { |
| 50 | const auto &input = GetInput(); | ||
| 51 | auto &output = GetOutput(); | ||
| 52 | |||
| 53 |
1/2✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
|
98 | if (input.empty()) { |
| 54 | return true; | ||
| 55 | } | ||
| 56 | |||
| 57 |
2/4✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 98 times.
|
98 | if (output.empty() || output.size() != input[0].size()) { |
| 58 | ✗ | output.assign(input[0].size(), 0); | |
| 59 | } | ||
| 60 | |||
| 61 |
2/2✓ Branch 0 taken 228 times.
✓ Branch 1 taken 98 times.
|
326 | for (const auto &row : input) { |
| 62 |
2/2✓ Branch 0 taken 476 times.
✓ Branch 1 taken 228 times.
|
704 | for (size_t j = 0; j < row.size(); ++j) { |
| 63 | 476 | output[j] += row[j]; | |
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | return true; | ||
| 68 | } | ||
| 69 | |||
| 70 | 98 | bool RychkovaDSumMatrixColumnsSEQ::PostProcessingImpl() { | |
| 71 | 98 | return true; | |
| 72 | } | ||
| 73 | |||
| 74 | } // namespace rychkova_d_sum_matrix_columns | ||
| 75 |