| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "Terekhov_D_Horizontal_matrix_vector/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <utility> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "Terekhov_D_Horizontal_matrix_vector/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace terekhov_d_horizontal_matrix_vector { | ||
| 10 | |||
| 11 | 512 | TerekhovDHorizontalMatrixVectorSEQ::TerekhovDHorizontalMatrixVectorSEQ(InType in) : input_(std::move(in)) { | |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | 512 | GetOutput() = std::vector<double>(); | |
| 14 | 512 | } | |
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
|
512 | bool TerekhovDHorizontalMatrixVectorSEQ::ValidationImpl() { |
| 17 | const auto &matrix_a = input_.first; | ||
| 18 | const auto &vector_b = input_.second; | ||
| 19 | |||
| 20 |
2/4✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 512 times.
|
512 | if (matrix_a.empty() || vector_b.empty()) { |
| 21 | return false; | ||
| 22 | } | ||
| 23 | |||
| 24 | size_t cols_a = matrix_a[0].size(); | ||
| 25 |
2/2✓ Branch 0 taken 528 times.
✓ Branch 1 taken 512 times.
|
1040 | for (size_t i = 1; i < matrix_a.size(); i++) { |
| 26 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 528 times.
|
528 | if (matrix_a[i].size() != cols_a) { |
| 27 | return false; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | 512 | return cols_a == vector_b.size(); | |
| 32 | } | ||
| 33 | |||
| 34 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 512 times.
|
512 | bool TerekhovDHorizontalMatrixVectorSEQ::PreProcessingImpl() { |
| 35 | GetOutput().clear(); | ||
| 36 | 512 | return true; | |
| 37 | } | ||
| 38 | |||
| 39 | 512 | bool TerekhovDHorizontalMatrixVectorSEQ::RunImpl() { | |
| 40 | const auto &matrix_a = input_.first; | ||
| 41 | const auto &vector_b = input_.second; | ||
| 42 | |||
| 43 | size_t rows_a = matrix_a.size(); | ||
| 44 | size_t cols_a = matrix_a[0].size(); | ||
| 45 | |||
| 46 | auto &output = GetOutput(); | ||
| 47 | 512 | output = std::vector<double>(rows_a, 0.0); | |
| 48 | |||
| 49 |
2/2✓ Branch 0 taken 1040 times.
✓ Branch 1 taken 512 times.
|
1552 | for (size_t i = 0; i < rows_a; i++) { |
| 50 |
2/2✓ Branch 0 taken 2144 times.
✓ Branch 1 taken 1040 times.
|
3184 | for (size_t j = 0; j < cols_a; j++) { |
| 51 | 2144 | output[i] += matrix_a[i][j] * vector_b[j]; | |
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | 512 | return true; | |
| 56 | } | ||
| 57 | |||
| 58 | 512 | bool TerekhovDHorizontalMatrixVectorSEQ::PostProcessingImpl() { | |
| 59 | 512 | return true; | |
| 60 | } | ||
| 61 | |||
| 62 | } // namespace terekhov_d_horizontal_matrix_vector | ||
| 63 |