| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "scalar_product/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "scalar_product/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace scalar_product { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
|
140 | ScalarProductSEQ::ScalarProductSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 140 | GetOutput() = 0; | |
| 14 | 140 | } | |
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | bool ScalarProductSEQ::ValidationImpl() { |
| 17 | const auto &vector_a = GetInput().first; | ||
| 18 | const auto &vector_b = GetInput().second; | ||
| 19 |
2/4✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 140 times.
|
140 | return vector_a.size() == vector_b.size() && !vector_a.empty(); |
| 20 | } | ||
| 21 | |||
| 22 | 140 | bool ScalarProductSEQ::PreProcessingImpl() { | |
| 23 | 140 | GetOutput() = 0; | |
| 24 | 140 | return true; | |
| 25 | } | ||
| 26 | |||
| 27 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | bool ScalarProductSEQ::RunImpl() { |
| 28 | const auto &vector_a = GetInput().first; | ||
| 29 | const auto &vector_b = GetInput().second; | ||
| 30 | |||
| 31 |
2/4✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✗ Branch 3 not taken.
|
140 | if (vector_a.empty() || vector_b.empty()) { |
| 32 | return false; | ||
| 33 | } | ||
| 34 | |||
| 35 | int dot_product = 0; | ||
| 36 | size_t size = vector_a.size(); | ||
| 37 | |||
| 38 |
2/2✓ Branch 0 taken 39036 times.
✓ Branch 1 taken 140 times.
|
39176 | for (size_t i = 0; i < size; ++i) { |
| 39 | 39036 | dot_product += vector_a[i] * vector_b[i]; | |
| 40 | } | ||
| 41 | |||
| 42 | 140 | GetOutput() = dot_product; | |
| 43 | |||
| 44 | 140 | return true; | |
| 45 | } | ||
| 46 | |||
| 47 | 140 | bool ScalarProductSEQ::PostProcessingImpl() { | |
| 48 | 140 | return true; | |
| 49 | } | ||
| 50 | |||
| 51 | } // namespace scalar_product | ||
| 52 |