| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kopilov_d_sum_val_col_mat/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "kopilov_d_sum_val_col_mat/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace kopilov_d_sum_val_col_mat { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | KopilovDSumValColMatSEQ::KopilovDSumValColMatSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 24 | GetOutput() = OutType{}; | |
| 14 | 24 | } | |
| 15 | |||
| 16 | 24 | bool KopilovDSumValColMatSEQ::ValidationImpl() { | |
| 17 | 24 | const int rows = GetInput().rows; | |
| 18 | 24 | const int cols = GetInput().cols; | |
| 19 | 24 | const std::size_t expected_size = static_cast<std::size_t>(rows) * static_cast<std::size_t>(cols); | |
| 20 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if (rows <= 0 || cols <= 0) { |
| 21 | return false; | ||
| 22 | } | ||
| 23 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if (GetInput().data.size() != expected_size) { |
| 24 | ✗ | return false; | |
| 25 | } | ||
| 26 | return true; | ||
| 27 | } | ||
| 28 | |||
| 29 | 24 | bool KopilovDSumValColMatSEQ::PreProcessingImpl() { | |
| 30 | 24 | const int cols = GetInput().cols; | |
| 31 | 24 | GetOutput().col_sum.assign(static_cast<std::size_t>(cols), 0.0); | |
| 32 | 24 | return true; | |
| 33 | } | ||
| 34 | |||
| 35 | 24 | bool KopilovDSumValColMatSEQ::RunImpl() { | |
| 36 | const InType input = GetInput(); | ||
| 37 | const int rows = input.rows; | ||
| 38 | const int cols = input.cols; | ||
| 39 | const std::vector<double> &matrix = input.data; | ||
| 40 | |||
| 41 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 24 times.
|
144 | for (int row = 0; row < rows; ++row) { |
| 42 |
2/2✓ Branch 0 taken 664 times.
✓ Branch 1 taken 120 times.
|
784 | for (int col = 0; col < cols; ++col) { |
| 43 | 664 | GetOutput().col_sum[static_cast<std::size_t>(col)] += | |
| 44 | 664 | matrix[(static_cast<std::size_t>(row) * static_cast<std::size_t>(cols)) + static_cast<std::size_t>(col)]; | |
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | 24 | return true; | |
| 49 | } | ||
| 50 | |||
| 51 | 24 | bool KopilovDSumValColMatSEQ::PostProcessingImpl() { | |
| 52 | 24 | return true; | |
| 53 | } | ||
| 54 | |||
| 55 | } // namespace kopilov_d_sum_val_col_mat | ||
| 56 |