| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kazennova_a_fox_algorithm/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "kazennova_a_fox_algorithm/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace kazennova_a_fox_algorithm { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | KazennovaATestTaskSEQ::KazennovaATestTaskSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | GetInput() = in; |
| 13 | 32 | } | |
| 14 | |||
| 15 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | bool KazennovaATestTaskSEQ::ValidationImpl() { |
| 16 | const auto &in = GetInput(); | ||
| 17 | |||
| 18 |
2/4✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
|
32 | if (in.A.data.empty() || in.B.data.empty()) { |
| 19 | return false; | ||
| 20 | } | ||
| 21 | |||
| 22 |
4/8✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 32 times.
✗ Branch 7 not taken.
|
32 | if (in.A.rows <= 0 || in.A.cols <= 0 || in.B.rows <= 0 || in.B.cols <= 0) { |
| 23 | return false; | ||
| 24 | } | ||
| 25 | |||
| 26 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if (in.A.cols != in.B.rows) { |
| 27 | ✗ | return false; | |
| 28 | } | ||
| 29 | |||
| 30 | return true; | ||
| 31 | } | ||
| 32 | |||
| 33 | 32 | bool KazennovaATestTaskSEQ::PreProcessingImpl() { | |
| 34 | const auto &in = GetInput(); | ||
| 35 | |||
| 36 | 32 | GetOutput().rows = in.A.rows; | |
| 37 | 32 | GetOutput().cols = in.B.cols; | |
| 38 | 32 | GetOutput().data.assign(static_cast<size_t>(in.A.rows) * static_cast<size_t>(in.B.cols), 0.0); | |
| 39 | |||
| 40 | 32 | return true; | |
| 41 | } | ||
| 42 | |||
| 43 | 32 | bool KazennovaATestTaskSEQ::RunImpl() { | |
| 44 | const auto &in = GetInput(); | ||
| 45 | auto &out = GetOutput(); | ||
| 46 | |||
| 47 | 32 | const int m = in.A.rows; | |
| 48 | 32 | const int n = in.B.cols; | |
| 49 | 32 | const int k = in.A.cols; | |
| 50 | |||
| 51 | const auto &a = in.A.data; | ||
| 52 | const auto &b = in.B.data; | ||
| 53 | auto &c = out.data; | ||
| 54 | |||
| 55 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 32 times.
|
192 | for (int i = 0; i < m; ++i) { |
| 56 |
2/2✓ Branch 0 taken 1104 times.
✓ Branch 1 taken 160 times.
|
1264 | for (int j = 0; j < n; ++j) { |
| 57 | double sum = 0.0; | ||
| 58 |
2/2✓ Branch 0 taken 9280 times.
✓ Branch 1 taken 1104 times.
|
10384 | for (int k_idx = 0; k_idx < k; ++k_idx) { |
| 59 | 9280 | const size_t a_idx = (static_cast<size_t>(i) * k) + k_idx; | |
| 60 | 9280 | const size_t b_idx = (static_cast<size_t>(k_idx) * n) + j; | |
| 61 | 9280 | sum += a[a_idx] * b[b_idx]; | |
| 62 | } | ||
| 63 | 1104 | c[(static_cast<size_t>(i) * n) + j] = sum; | |
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | 32 | return true; | |
| 68 | } | ||
| 69 | |||
| 70 | 32 | bool KazennovaATestTaskSEQ::PostProcessingImpl() { | |
| 71 | 32 | return !GetOutput().data.empty(); | |
| 72 | } | ||
| 73 | |||
| 74 | } // namespace kazennova_a_fox_algorithm | ||
| 75 |