MCPcopy Create free account
hub / github.com/android/ndk-samples / MultiplyWithOpenMP

Function MultiplyWithOpenMP

vectorization/src/main/cpp/omp_simd.h:38–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 */
37template <typename T, size_t M, size_t N, size_t P>
38Matrix<M, P, T> MultiplyWithOpenMP(const Matrix<M, N, T>& lhs,
39 const Matrix<N, P, T>& rhs) {
40 Matrix<M, P, T> result;
41#pragma omp simd
42 for (auto result_column_index = 0U; result_column_index < P;
43 result_column_index++) {
44 for (auto lhs_column_index = 0U; lhs_column_index < N; lhs_column_index++) {
45 auto lhs_column = lhs.column(lhs_column_index);
46 const T& scalar = rhs[lhs_column_index, result_column_index];
47 for (auto row = 0U; row < lhs_column.size(); row++) {
48 result[row, result_column_index] += lhs_column[row] * scalar;
49 }
50 }
51 }
52 return result;
53}
54
55} // namespace samples::vectorization

Callers 1

Calls 1

columnMethod · 0.80

Tested by

no test coverage detected