| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kamalagin_a_vec_mat_mult/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <cstdint> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "kamalagin_a_vec_mat_mult/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace kamalagin_a_vec_mat_mult { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
|
64 | KamalaginAVecMatMultSEQ::KamalaginAVecMatMultSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | GetOutput().clear(); | ||
| 15 | 64 | } | |
| 16 | |||
| 17 | 64 | bool KamalaginAVecMatMultSEQ::ValidationImpl() { | |
| 18 | const auto &[n, m, a_flat, x] = GetInput(); | ||
| 19 |
2/4✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
✗ Branch 3 not taken.
|
64 | if (n < 0 || m < 0) { |
| 20 | return false; | ||
| 21 | } | ||
| 22 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if (static_cast<std::size_t>(n) * static_cast<std::size_t>(m) != a_flat.size()) { |
| 23 | return false; | ||
| 24 | } | ||
| 25 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | if (static_cast<std::size_t>(m) != x.size()) { |
| 26 | ✗ | return false; | |
| 27 | } | ||
| 28 | return true; | ||
| 29 | } | ||
| 30 | |||
| 31 | 64 | bool KamalaginAVecMatMultSEQ::PreProcessingImpl() { | |
| 32 | const auto &[n, m, a_flat, x] = GetInput(); | ||
| 33 | (void)m; | ||
| 34 | (void)a_flat; | ||
| 35 | (void)x; | ||
| 36 | |||
| 37 | 64 | GetOutput().assign(static_cast<std::size_t>(n), 0); | |
| 38 | 64 | return true; | |
| 39 | } | ||
| 40 | |||
| 41 | 64 | bool KamalaginAVecMatMultSEQ::RunImpl() { | |
| 42 | const auto &[n, m, a_flat, x] = GetInput(); | ||
| 43 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
|
64 | if (n == 0) { |
| 44 | return true; | ||
| 45 | } | ||
| 46 | |||
| 47 | auto &y = GetOutput(); | ||
| 48 | 48 | const auto nn = static_cast<std::size_t>(n); | |
| 49 | 48 | const auto mm = static_cast<std::size_t>(m); | |
| 50 | |||
| 51 |
2/2✓ Branch 0 taken 2232 times.
✓ Branch 1 taken 48 times.
|
2280 | for (std::size_t i = 0; i < nn; ++i) { |
| 52 | std::int64_t sum = 0; | ||
| 53 | 2232 | const std::size_t row_off = i * mm; | |
| 54 |
2/2✓ Branch 0 taken 20848 times.
✓ Branch 1 taken 2232 times.
|
23080 | for (std::size_t j = 0; j < mm; ++j) { |
| 55 | 20848 | sum += static_cast<std::int64_t>(a_flat[row_off + j]) * static_cast<std::int64_t>(x[j]); | |
| 56 | } | ||
| 57 | 2232 | y[i] = static_cast<int>(sum); | |
| 58 | } | ||
| 59 | |||
| 60 | return true; | ||
| 61 | } | ||
| 62 | |||
| 63 | 64 | bool KamalaginAVecMatMultSEQ::PostProcessingImpl() { | |
| 64 | 64 | return true; | |
| 65 | } | ||
| 66 | |||
| 67 | } // namespace kamalagin_a_vec_mat_mult | ||
| 68 |