| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "artyushkina_vector/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <utility> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "artyushkina_vector/common/include/common.hpp" | ||
| 8 | |||
| 9 | #ifdef __GNUC__ | ||
| 10 | # pragma GCC diagnostic push | ||
| 11 | # pragma GCC diagnostic ignored "-Wnull-dereference" | ||
| 12 | #endif | ||
| 13 | |||
| 14 | namespace artyushkina_vector { | ||
| 15 | |||
| 16 |
1/2✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
|
56 | VerticalStripMatVecSEQ::VerticalStripMatVecSEQ(const InType &in) { |
| 17 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 18 | GetInput() = in; | ||
| 19 | 56 | GetOutput() = Vector{}; | |
| 20 | 56 | } | |
| 21 | |||
| 22 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | bool VerticalStripMatVecSEQ::ValidationImpl() { |
| 23 | const auto &[matrix, vector] = GetInput(); | ||
| 24 | |||
| 25 |
2/4✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 56 times.
|
56 | if (matrix.empty() || vector.empty()) { |
| 26 | return false; | ||
| 27 | } | ||
| 28 | |||
| 29 | const size_t rows = matrix.size(); | ||
| 30 | const size_t cols = matrix[0].size(); | ||
| 31 | const size_t vec_size = vector.size(); | ||
| 32 | |||
| 33 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 56 times.
|
120 | for (size_t i = 1; i < rows; ++i) { |
| 34 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | if (matrix[i].size() != cols) { |
| 35 | return false; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | 56 | return vec_size == cols; | |
| 40 | } | ||
| 41 | |||
| 42 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
56 | bool VerticalStripMatVecSEQ::PreProcessingImpl() { |
| 43 | GetOutput().clear(); | ||
| 44 | 56 | return true; | |
| 45 | } | ||
| 46 | |||
| 47 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | bool VerticalStripMatVecSEQ::RunImpl() { |
| 48 | const auto &[matrix, vector] = GetInput(); | ||
| 49 | |||
| 50 |
2/4✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 56 times.
|
56 | if (matrix.empty() || vector.empty()) { |
| 51 | ✗ | GetOutput() = Vector{}; | |
| 52 | ✗ | return true; | |
| 53 | } | ||
| 54 | |||
| 55 | const size_t rows = matrix.size(); | ||
| 56 | const size_t cols = matrix[0].size(); | ||
| 57 | |||
| 58 | 56 | Vector result(rows, 0.0); | |
| 59 | |||
| 60 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 56 times.
|
176 | for (size_t i = 0; i < rows; ++i) { |
| 61 | double sum = 0.0; | ||
| 62 |
2/2✓ Branch 0 taken 312 times.
✓ Branch 1 taken 120 times.
|
432 | for (size_t j = 0; j < cols; ++j) { |
| 63 | 312 | sum += matrix[i][j] * vector[j]; | |
| 64 | } | ||
| 65 | 120 | result[i] = sum; | |
| 66 | } | ||
| 67 | |||
| 68 |
1/2✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
|
56 | GetOutput() = result; |
| 69 | return true; | ||
| 70 | } | ||
| 71 | |||
| 72 | 56 | bool VerticalStripMatVecSEQ::PostProcessingImpl() { | |
| 73 | 56 | return true; | |
| 74 | } | ||
| 75 | |||
| 76 | } // namespace artyushkina_vector | ||
| 77 | |||
| 78 | #ifdef __GNUC__ | ||
| 79 | # pragma GCC diagnostic pop | ||
| 80 | #endif | ||
| 81 |