| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "zaharov_g_matrix_col_sum/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "zaharov_g_matrix_col_sum/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace zaharov_g_matrix_col_sum { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
|
56 | ZaharovGMatrixColSumSEQ::ZaharovGMatrixColSumSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 |
1/2✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
|
56 | InType tmp(in); |
| 14 | GetInput().swap(tmp); | ||
| 15 | 56 | } | |
| 16 | |||
| 17 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | bool ZaharovGMatrixColSumSEQ::ValidationImpl() { |
| 18 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | if (GetInput().empty()) { |
| 19 | return true; | ||
| 20 | } | ||
| 21 | |||
| 22 | size_t cols = GetInput()[0].size(); | ||
| 23 | 56 | return std::all_of(GetInput().begin(), GetInput().end(), [cols](const auto &row) { return row.size() == cols; }); | |
| 24 | } | ||
| 25 | |||
| 26 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
56 | bool ZaharovGMatrixColSumSEQ::PreProcessingImpl() { |
| 27 | GetOutput().clear(); | ||
| 28 | 56 | return true; | |
| 29 | } | ||
| 30 | |||
| 31 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | bool ZaharovGMatrixColSumSEQ::RunImpl() { |
| 32 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | if (GetInput().empty()) { |
| 33 | return true; | ||
| 34 | } | ||
| 35 | |||
| 36 | 56 | OutType out(GetInput()[0].size()); | |
| 37 | |||
| 38 |
2/2✓ Branch 0 taken 208 times.
✓ Branch 1 taken 56 times.
|
264 | for (size_t i = 0; i < GetInput()[0].size(); i++) { |
| 39 | double sum = 0; | ||
| 40 | |||
| 41 |
2/2✓ Branch 0 taken 624 times.
✓ Branch 1 taken 208 times.
|
832 | for (const auto &row : GetInput()) { |
| 42 | 624 | sum += row[i]; | |
| 43 | } | ||
| 44 | |||
| 45 | 208 | out[i] = sum; | |
| 46 | } | ||
| 47 |
1/2✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
|
56 | GetOutput() = out; |
| 48 | return true; | ||
| 49 | } | ||
| 50 | |||
| 51 | 56 | bool ZaharovGMatrixColSumSEQ::PostProcessingImpl() { | |
| 52 | 56 | return true; | |
| 53 | } | ||
| 54 | |||
| 55 | } // namespace zaharov_g_matrix_col_sum | ||
| 56 |