| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "viderman_a_strip_matvec_mult/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <utility> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "viderman_a_strip_matvec_mult/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace viderman_a_strip_matvec_mult { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 190 times.
✗ Branch 2 not taken.
|
190 | VidermanAStripMatvecMultSEQ::VidermanAStripMatvecMultSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 |
1/2✓ Branch 1 taken 190 times.
✗ Branch 2 not taken.
|
380 | GetInput() = InType(in); |
| 14 | 190 | } | |
| 15 | |||
| 16 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 182 times.
|
190 | bool VidermanAStripMatvecMultSEQ::ValidationImpl() { |
| 17 | const InType &input = GetInput(); | ||
| 18 | const auto &matrix = input.first; | ||
| 19 | const auto &vector = input.second; | ||
| 20 | |||
| 21 |
3/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 182 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
190 | if (matrix.empty() && vector.empty()) { |
| 22 | return true; | ||
| 23 | } | ||
| 24 | |||
| 25 |
2/4✓ Branch 0 taken 182 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 182 times.
✗ Branch 3 not taken.
|
182 | if (matrix.empty() || vector.empty()) { |
| 26 | return false; | ||
| 27 | } | ||
| 28 | |||
| 29 | const size_t cols = matrix[0].size(); | ||
| 30 |
2/2✓ Branch 0 taken 618 times.
✓ Branch 1 taken 182 times.
|
800 | for (const auto &row : matrix) { |
| 31 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 618 times.
|
618 | if (row.size() != cols) { |
| 32 | return false; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | 182 | return cols == vector.size(); | |
| 37 | } | ||
| 38 | |||
| 39 | 190 | bool VidermanAStripMatvecMultSEQ::PreProcessingImpl() { | |
| 40 | 190 | return true; | |
| 41 | } | ||
| 42 | |||
| 43 |
2/2✓ Branch 0 taken 182 times.
✓ Branch 1 taken 8 times.
|
190 | bool VidermanAStripMatvecMultSEQ::RunImpl() { |
| 44 | const InType &input = GetInput(); | ||
| 45 | const auto &matrix = input.first; | ||
| 46 | const auto &vector = input.second; | ||
| 47 | auto &result = GetOutput(); | ||
| 48 | |||
| 49 |
3/4✓ Branch 0 taken 182 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 182 times.
|
190 | if (matrix.empty() || vector.empty()) { |
| 50 | result.clear(); | ||
| 51 | 8 | return true; | |
| 52 | } | ||
| 53 | |||
| 54 | 182 | result.resize(matrix.size()); | |
| 55 |
2/2✓ Branch 0 taken 618 times.
✓ Branch 1 taken 182 times.
|
800 | for (size_t i = 0; i < matrix.size(); ++i) { |
| 56 | double sum = 0.0; | ||
| 57 |
2/2✓ Branch 0 taken 2538 times.
✓ Branch 1 taken 618 times.
|
3156 | for (size_t j = 0; j < matrix[i].size(); ++j) { |
| 58 | 2538 | sum += matrix[i][j] * vector[j]; | |
| 59 | } | ||
| 60 | 618 | result[i] = sum; | |
| 61 | } | ||
| 62 | |||
| 63 | return true; | ||
| 64 | } | ||
| 65 | |||
| 66 | 190 | bool VidermanAStripMatvecMultSEQ::PostProcessingImpl() { | |
| 67 | 190 | return true; | |
| 68 | } | ||
| 69 | |||
| 70 | } // namespace viderman_a_strip_matvec_mult | ||
| 71 |