KOKKOS_INLINE_FUNCTION void operator()(const size_type iter) const { size_type cl = 0, bf = 0, pt = 0; size_type outputRank(_output.rank()), rightRank(_rightInput.rank()); if (_hasField) Util::unrollIndex( cl, bf, pt, _output.dimension(0), _output.dimension(1), _output.dimension(2), iter ); else Util::unrollIndex( cl, pt, _output.dimension(0), _output.dimension(1), iter ); auto result = ( _hasField ? Kokkos::subview(_output, cl, bf, pt, Kokkos::ALL(), Kokkos::ALL()) : /**/ Kokkos::subview(_output, cl, pt, Kokkos::ALL(), Kokkos::ALL())); const auto right = ( outputRank == rightRank ? ( _hasField ? Kokkos::subview(_rightInput, cl, bf, pt, Kokkos::ALL(), Kokkos::ALL()) : /**/ Kokkos::subview(_rightInput, cl, pt, Kokkos::ALL(), Kokkos::ALL()) ) : /**/ ( _hasField ? Kokkos::subview(_rightInput, bf, pt, Kokkos::ALL(), Kokkos::ALL()) : /**/ Kokkos::subview(_rightInput, pt, Kokkos::ALL(), Kokkos::ALL()) ) ); const auto left = (_leftInput.dimension(1) == 1) ? Kokkos::subview(_leftInput, cl, 0) : /**/ Kokkos::subview(_leftInput, cl, pt); const size_type iend = result.dimension(0); const size_type jend = result.dimension(1); const auto val = left(); if (_reciprocal) for(size_type i = 0; i < iend; ++i) for(size_type j = 0; j < jend; ++j) result(i, j) = right(i, j)/val; else for(size_type i = 0; i < iend; ++i) for(size_type j = 0; j < jend; ++j) result(i, j) = right(i, j)*val; }
KOKKOS_INLINE_FUNCTION void operator()(const size_type iter) const { size_type cl, bf, pt; size_type leftRank(_leftInput.rank()), rightRank(_rightInput.rank()); if (_hasField) unrollIndex( cl, bf, pt, _output.dimension(0), _output.dimension(1), _output.dimension(2), iter ); else unrollIndex( cl, pt, _output.dimension(0), _output.dimension(1), iter); auto result = ( _hasField ? Kokkos::subview(_output, cl, bf, pt) : /**/ Kokkos::subview(_output, cl, pt)); const auto left = (_leftInput.dimension(1) == 1) ? Kokkos::subview(_leftInput, cl, 0, Kokkos::ALL(), Kokkos::ALL()) : /**/ Kokkos::subview(_leftInput, cl, pt, Kokkos::ALL(), Kokkos::ALL()); const auto right = (rightRank == leftRank + int(_hasField)) ? ( _hasField ? Kokkos::subview(_rightInput, cl, bf, pt, Kokkos::ALL(), Kokkos::ALL()) : /**/ Kokkos::subview(_rightInput, cl, pt, Kokkos::ALL(), Kokkos::ALL())) : ( _hasField ? Kokkos::subview(_rightInput, bf, pt, Kokkos::ALL(), Kokkos::ALL()) : /**/ Kokkos::subview(_rightInput, pt, Kokkos::ALL(), Kokkos::ALL())); const size_type iend = left.dimension(0); const size_type jend = left.dimension(1); value_type tmp(0); for(size_type i = 0; i < iend; ++i) for(size_type j = 0; j < jend; ++j) tmp += left(i, j)*right(i, j); result() = tmp; }