| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kruglova_a_vertical_ribbon_matvec/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "kruglova_a_vertical_ribbon_matvec/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace kruglova_a_vertical_ribbon_matvec { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | KruglovaAVerticalRibbMatSEQ::KruglovaAVerticalRibbMatSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | GetOutput() = {}; | ||
| 14 | 40 | } | |
| 15 | |||
| 16 | 40 | bool KruglovaAVerticalRibbMatSEQ::ValidationImpl() { | |
| 17 | 40 | const int rows = std::get<0>(GetInput()); | |
| 18 | 40 | const int cols = std::get<1>(GetInput()); | |
| 19 | const std::vector<double> &matrix = std::get<2>(GetInput()); | ||
| 20 | const std::vector<double> &vec = std::get<3>(GetInput()); | ||
| 21 | |||
| 22 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if (rows <= 0 || cols <= 0) { |
| 23 | return false; | ||
| 24 | } | ||
| 25 | |||
| 26 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if (matrix.size() != static_cast<size_t>(rows) * static_cast<size_t>(cols)) { |
| 27 | return false; | ||
| 28 | } | ||
| 29 | |||
| 30 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if (vec.size() != static_cast<size_t>(cols)) { |
| 31 | ✗ | return false; | |
| 32 | } | ||
| 33 | return true; | ||
| 34 | } | ||
| 35 | |||
| 36 | 40 | bool KruglovaAVerticalRibbMatSEQ::PreProcessingImpl() { | |
| 37 | 40 | const int rows = std::get<0>(GetInput()); | |
| 38 | 40 | GetOutput().assign(rows, 0.0); | |
| 39 | 40 | return true; | |
| 40 | } | ||
| 41 | |||
| 42 | 40 | bool KruglovaAVerticalRibbMatSEQ::RunImpl() { | |
| 43 | 40 | const int rows = std::get<0>(GetInput()); | |
| 44 | 40 | const int cols = std::get<1>(GetInput()); | |
| 45 | const std::vector<double> &matrix = std::get<2>(GetInput()); | ||
| 46 | const std::vector<double> &vec_b = std::get<3>(GetInput()); | ||
| 47 | |||
| 48 | std::vector<double> &res_y = GetOutput(); | ||
| 49 | |||
| 50 |
2/2✓ Branch 0 taken 6080 times.
✓ Branch 1 taken 40 times.
|
6120 | for (int i = 0; i < rows; ++i) { |
| 51 | double sum = 0.0; | ||
| 52 |
2/2✓ Branch 0 taken 900800 times.
✓ Branch 1 taken 6080 times.
|
906880 | for (int j = 0; j < cols; ++j) { |
| 53 | 900800 | sum += matrix[(i * cols) + j] * vec_b[j]; | |
| 54 | } | ||
| 55 | 6080 | res_y[i] = sum; | |
| 56 | } | ||
| 57 | |||
| 58 | 40 | return true; | |
| 59 | } | ||
| 60 | |||
| 61 | 40 | bool KruglovaAVerticalRibbMatSEQ::PostProcessingImpl() { | |
| 62 | 40 | return true; | |
| 63 | } | ||
| 64 | |||
| 65 | } // namespace kruglova_a_vertical_ribbon_matvec | ||
| 66 |