| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "zavyalov_a_scalar_product/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstdlib> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "zavyalov_a_scalar_product/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace zavyalov_a_scalar_product { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | ZavyalovAScalarProductSEQ::ZavyalovAScalarProductSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 80 | GetOutput() = 0.0; | |
| 14 | 80 | } | |
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
|
80 | bool ZavyalovAScalarProductSEQ::ValidationImpl() { |
| 17 |
2/4✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 80 times.
|
80 | return (!std::get<0>(GetInput()).empty()) && (std::get<0>(GetInput()).size() == std::get<1>(GetInput()).size()); |
| 18 | } | ||
| 19 | |||
| 20 | 80 | bool ZavyalovAScalarProductSEQ::PreProcessingImpl() { | |
| 21 | 80 | return true; | |
| 22 | } | ||
| 23 | |||
| 24 | 80 | bool ZavyalovAScalarProductSEQ::RunImpl() { | |
| 25 | const auto &input = GetInput(); | ||
| 26 | const std::vector<double> &left = std::get<0>(input); | ||
| 27 | const std::vector<double> &right = std::get<1>(input); | ||
| 28 | |||
| 29 | double res = 0.0; | ||
| 30 |
2/2✓ Branch 0 taken 440 times.
✓ Branch 1 taken 80 times.
|
520 | for (size_t i = 0; i < left.size(); i++) { |
| 31 | 440 | res += left[i] * right[i]; | |
| 32 | } | ||
| 33 | 80 | GetOutput() = res; | |
| 34 | 80 | return true; | |
| 35 | } | ||
| 36 | |||
| 37 | 80 | bool ZavyalovAScalarProductSEQ::PostProcessingImpl() { | |
| 38 | 80 | return true; | |
| 39 | } | ||
| 40 | |||
| 41 | } // namespace zavyalov_a_scalar_product | ||
| 42 |