| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "luzan_e_matrix_horis_rib_mult_sheme/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <tuple> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "luzan_e_matrix_horis_rib_mult_sheme/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace luzan_e_matrix_horis_rib_mult_sheme { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | LuzanEMatrixHorisRibMultShemeSEQ::LuzanEMatrixHorisRibMultShemeSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | GetOutput() = {}; | ||
| 15 | 72 | } | |
| 16 | |||
| 17 | 72 | bool LuzanEMatrixHorisRibMultShemeSEQ::ValidationImpl() { | |
| 18 | bool res = true; | ||
| 19 | 72 | int height = std::get<1>(GetInput()); | |
| 20 | 72 | int width = std::get<2>(GetInput()); | |
| 21 |
1/2✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
|
72 | int vec_height = std::get<4>(GetInput()); |
| 22 | |||
| 23 | // matrix check | ||
| 24 |
1/2✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
|
72 | res = std::get<0>(GetInput()).size() == static_cast<size_t>(height) * static_cast<size_t>(width) && height > 0 && |
| 25 |
1/2✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
|
72 | width > 0; |
| 26 | |||
| 27 | // vec check | ||
| 28 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | res = res && std::get<3>(GetInput()).size() == static_cast<size_t>(vec_height); |
| 29 | |||
| 30 | // matrix & vec sizes cmp. | ||
| 31 | 72 | res = res && (width == vec_height); | |
| 32 | |||
| 33 | 72 | return res; | |
| 34 | } | ||
| 35 | |||
| 36 | 72 | bool LuzanEMatrixHorisRibMultShemeSEQ::PreProcessingImpl() { | |
| 37 | 72 | int height = std::get<1>(GetInput()); | |
| 38 | // int width = std::get<2>(GetInput()); | ||
| 39 | // int vec_height = std::get<4>(GetInput()); | ||
| 40 | |||
| 41 | 72 | GetOutput().resize(height); | |
| 42 |
2/2✓ Branch 0 taken 24976 times.
✓ Branch 1 taken 72 times.
|
25048 | for (int cell = 0; cell < height; cell++) { |
| 43 | 24976 | GetOutput()[cell] = 0; | |
| 44 | } | ||
| 45 | 72 | return true; | |
| 46 | } | ||
| 47 | |||
| 48 | 72 | bool LuzanEMatrixHorisRibMultShemeSEQ::RunImpl() { | |
| 49 | 72 | int height = std::get<1>(GetInput()); | |
| 50 | 72 | int width = std::get<2>(GetInput()); | |
| 51 | // int vec_height = std::get<4>(GetInput()); | ||
| 52 | |||
| 53 | const std::tuple_element_t<0, InType> &mat = std::get<0>(GetInput()); | ||
| 54 | const std::tuple_element_t<3, InType> &vec = std::get<3>(GetInput()); | ||
| 55 | int tmp_sum = 0; | ||
| 56 |
2/2✓ Branch 0 taken 24976 times.
✓ Branch 1 taken 72 times.
|
25048 | for (int row = 0; row < height; row++) { |
| 57 | tmp_sum = 0; | ||
| 58 |
2/2✓ Branch 0 taken 8167360 times.
✓ Branch 1 taken 24976 times.
|
8192336 | for (int col = 0; col < width; col++) { |
| 59 | 8167360 | tmp_sum += mat[(width * row) + col] * vec[col]; | |
| 60 | } | ||
| 61 | 24976 | GetOutput()[row] += tmp_sum; | |
| 62 | } | ||
| 63 | 72 | return true; | |
| 64 | } | ||
| 65 | |||
| 66 | 72 | bool LuzanEMatrixHorisRibMultShemeSEQ::PostProcessingImpl() { | |
| 67 | 72 | return true; | |
| 68 | } | ||
| 69 | |||
| 70 | } // namespace luzan_e_matrix_horis_rib_mult_sheme | ||
| 71 |