| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "shvetsova_k_mult_matrix_complex_col/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <complex> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "shvetsova_k_mult_matrix_complex_col/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace shvetsova_k_mult_matrix_complex_col { | ||
| 10 | |||
| 11 |
1/2✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
|
40 | ShvetsovaKMultMatrixComplexSEQ::ShvetsovaKMultMatrixComplexSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | GetOutput() = MatrixCCS(0, 0, std::vector<int>{0}, std::vector<int>{}, std::vector<std::complex<double>>{}); |
| 15 | 40 | } | |
| 16 | |||
| 17 | 40 | bool ShvetsovaKMultMatrixComplexSEQ::ValidationImpl() { | |
| 18 | 40 | return true; | |
| 19 | } | ||
| 20 | |||
| 21 | 40 | bool ShvetsovaKMultMatrixComplexSEQ::PreProcessingImpl() { | |
| 22 | const auto &matrix_a = std::get<0>(GetInput()); | ||
| 23 | const auto &matrix_b = std::get<1>(GetInput()); | ||
| 24 | |||
| 25 | auto &matrix_c = GetOutput(); | ||
| 26 | 40 | matrix_c.rows = matrix_a.rows; | |
| 27 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | matrix_c.cols = matrix_b.cols; |
| 28 | matrix_c.row_ind.clear(); | ||
| 29 | matrix_c.values.clear(); | ||
| 30 | matrix_c.col_ptr.clear(); | ||
| 31 | 40 | matrix_c.col_ptr.push_back(0); | |
| 32 | 40 | return true; | |
| 33 | } | ||
| 34 | |||
| 35 | 40 | bool ShvetsovaKMultMatrixComplexSEQ::RunImpl() { | |
| 36 | const MatrixCCS &matrix_a = std::get<0>(GetInput()); | ||
| 37 | const MatrixCCS &matrix_b = std::get<1>(GetInput()); | ||
| 38 | auto &matrix_c = GetOutput(); | ||
| 39 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 40 times.
|
112 | for (int i = 0; i < matrix_b.cols; i++) { |
| 40 | 72 | std::vector<std::complex<double>> column_c(matrix_a.rows); | |
| 41 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 72 times.
|
152 | for (int j = matrix_b.col_ptr[i]; j < matrix_b.col_ptr[i + 1]; j++) { |
| 42 | 80 | int tmp_ind = matrix_b.row_ind[j]; | |
| 43 | 80 | std::complex tmp_val = matrix_b.values[j]; | |
| 44 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 80 times.
|
160 | for (int ind = matrix_a.col_ptr[tmp_ind]; ind < matrix_a.col_ptr[tmp_ind + 1]; ind++) { |
| 45 | 80 | int row = matrix_a.row_ind[ind]; | |
| 46 | 80 | std::complex val_a = matrix_a.values[ind]; | |
| 47 | 80 | column_c[row] += tmp_val * val_a; | |
| 48 | } | ||
| 49 | } | ||
| 50 | int counter = 0; | ||
| 51 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 72 times.
|
208 | for (size_t k = 0; k < column_c.size(); k++) { |
| 52 | if (column_c[k] != 0.0) { | ||
| 53 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | matrix_c.row_ind.push_back(static_cast<int>(k)); |
| 54 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 64 times.
|
72 | matrix_c.values.push_back(column_c[k]); |
| 55 | 72 | counter++; | |
| 56 | } | ||
| 57 | } | ||
| 58 |
2/6✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
72 | matrix_c.col_ptr.push_back(matrix_c.col_ptr[static_cast<int>(matrix_c.col_ptr.size()) - 1] + counter); |
| 59 | } | ||
| 60 | 40 | return true; | |
| 61 | } | ||
| 62 | |||
| 63 | 40 | bool ShvetsovaKMultMatrixComplexSEQ::PostProcessingImpl() { | |
| 64 | 40 | return true; | |
| 65 | } | ||
| 66 | |||
| 67 | } // namespace shvetsova_k_mult_matrix_complex_col | ||
| 68 |