| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "../include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cmath> | ||
| 5 | #include <cstddef> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "kruglova_a_max_diff_adjacent/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace kruglova_a_max_diff_adjacent { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | KruglovaAMaxDiffAdjacentSEQ::KruglovaAMaxDiffAdjacentSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | GetInput() = in; |
| 15 | 32 | GetOutput() = 0.0F; | |
| 16 | 32 | } | |
| 17 | |||
| 18 | 32 | bool KruglovaAMaxDiffAdjacentSEQ::ValidationImpl() { | |
| 19 | 32 | return true; | |
| 20 | } | ||
| 21 | |||
| 22 | 32 | bool KruglovaAMaxDiffAdjacentSEQ::PreProcessingImpl() { | |
| 23 | 32 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
|
32 | bool KruglovaAMaxDiffAdjacentSEQ::RunImpl() { |
| 27 | const auto &vec = this->GetInput(); | ||
| 28 | auto &out = this->GetOutput(); | ||
| 29 | |||
| 30 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
|
32 | if (vec.size() < 2) { |
| 31 | 8 | out = 0.0F; | |
| 32 | 8 | return true; | |
| 33 | } | ||
| 34 | |||
| 35 | 24 | float max_diff = std::abs(vec[1] - vec[0]); | |
| 36 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 24 times.
|
120 | for (size_t i = 1; i < vec.size(); ++i) { |
| 37 | 96 | float diff = std::abs(vec[i] - vec[i - 1]); | |
| 38 | 96 | max_diff = std::max(diff, max_diff); | |
| 39 | } | ||
| 40 | 24 | out = max_diff; | |
| 41 | 24 | return true; | |
| 42 | } | ||
| 43 | |||
| 44 | 32 | bool KruglovaAMaxDiffAdjacentSEQ::PostProcessingImpl() { | |
| 45 | 32 | return true; | |
| 46 | } | ||
| 47 | |||
| 48 | } // namespace kruglova_a_max_diff_adjacent | ||
| 49 |