diff --git a/batched/dense/impl/KokkosBatched_ApplyHouseholder_Serial_Internal.hpp b/batched/dense/impl/KokkosBatched_ApplyHouseholder_Serial_Internal.hpp index 6c8178b5cd..33b59b81b2 100644 --- a/batched/dense/impl/KokkosBatched_ApplyHouseholder_Serial_Internal.hpp +++ b/batched/dense/impl/KokkosBatched_ApplyHouseholder_Serial_Internal.hpp @@ -101,7 +101,8 @@ struct SerialApplyRightHouseholderInternal { // A2 -= w1 * u2' (ger with conjugate) for (int j = 0; j < n; ++j) - for (int i = 0; i < m; ++i) A2[i * as0 + j * as1] -= w1[i * ws0] * Kokkos::ArithTraits::conj(u2[j * u2s]); + for (int i = 0; i < m; ++i) + A2[i * as0 + j * as1] -= w1[i * ws0] * Kokkos::ArithTraits::conj(u2[j * u2s]); return 0; } diff --git a/batched/dense/impl/KokkosBatched_SVD_Serial_Internal.hpp b/batched/dense/impl/KokkosBatched_SVD_Serial_Internal.hpp index 108c0223f1..6b4461e5ec 100644 --- a/batched/dense/impl/KokkosBatched_SVD_Serial_Internal.hpp +++ b/batched/dense/impl/KokkosBatched_SVD_Serial_Internal.hpp @@ -179,8 +179,9 @@ struct SerialSVDInternal { As0, As1, work, 1); } if (U) { - KokkosBatched::SerialApplyRightHouseholderInternal::invoke( - m, m - i - 1, &tau, &SVDIND(A, i + 1, i), As0, &SVDIND(U, 0, i), Us0, &SVDIND(U, 0, i + 1), Us0, Us1, work, 1); + KokkosBatched::SerialApplyRightHouseholderInternal::invoke(m, m - i - 1, &tau, &SVDIND(A, i + 1, i), + As0, &SVDIND(U, 0, i), Us0, + &SVDIND(U, 0, i + 1), Us0, Us1, work, 1); } // Zero out A subdiag explicitly (NOTE: may not be necessary...) for (int j = i + 1; j < m; j++) { diff --git a/batched/dense/unit_test/Test_Batched_SerialQR.hpp b/batched/dense/unit_test/Test_Batched_SerialQR.hpp index d24f1d8c3a..375b1d1664 100644 --- a/batched/dense/unit_test/Test_Batched_SerialQR.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialQR.hpp @@ -60,11 +60,15 @@ struct qrFunctor { } // Call ApplyQ on Q - for(int idx = 0; idx < w.extent_int(0); ++idx) { w(idx) = 0.0; } + for (int idx = 0; idx < w.extent_int(0); ++idx) { + w(idx) = 0.0; + } KokkosBatched::SerialApplyQ::invoke(A, tau, Q, w); // Now apply Q' to Q - for(int idx = 0; idx < w.extent_int(0); ++idx) { w(idx) = 0.0; } + for (int idx = 0; idx < w.extent_int(0); ++idx) { + w(idx) = 0.0; + } KokkosBatched::SerialApplyQ::invoke(A, tau, Q, w); // At this point Q stores Q'Q @@ -94,12 +98,14 @@ struct qrFunctor { if (rowIdx <= colIdx) { if (Kokkos::abs(B(rowIdx, colIdx) - A(rowIdx, colIdx)) > tol * Kokkos::abs(A(rowIdx, colIdx))) { error += 1; - Kokkos::printf("B stores R\nmatIdx=%d, B(%d, %d)=%e instead of %e.\n", matIdx, rowIdx, colIdx, B(rowIdx, colIdx), A(rowIdx, colIdx)); + Kokkos::printf("B stores R\nmatIdx=%d, B(%d, %d)=%e instead of %e.\n", matIdx, rowIdx, colIdx, + B(rowIdx, colIdx), A(rowIdx, colIdx)); } } else { if (Kokkos::abs(B(rowIdx, colIdx)) > 1000 * tol) { error += 1; - Kokkos::printf("B stores R\nmatIdx=%d, B(%d, %d)=%e instead of 0.0.\n", matIdx, rowIdx, colIdx, B(rowIdx, colIdx)); + Kokkos::printf("B stores R\nmatIdx=%d, B(%d, %d)=%e instead of 0.0.\n", matIdx, rowIdx, colIdx, + B(rowIdx, colIdx)); } } } @@ -344,9 +350,9 @@ void test_QR_batch() { using ExecutionSpace = typename Device::execution_space; - { // Square matrix case - constexpr int numMat = 314; // 314 - constexpr int maxMatSize = 36; // 36 + { // Square matrix case + constexpr int numMat = 314; // 314 + constexpr int maxMatSize = 36; // 36 Kokkos::View tau("tau", numMat, maxMatSize); Kokkos::View tmp("work buffer", numMat, maxMatSize); Kokkos::View As("A matrices", numMat, maxMatSize, maxMatSize); @@ -371,10 +377,10 @@ void test_QR_batch() { EXPECT_EQ(global_error_h(), 0); } - { // Rectangular matrix case - constexpr int numMat = 2; // 314 - constexpr int numRows = 3; // 42 - constexpr int numCols = 2; // 36 + { // Rectangular matrix case + constexpr int numMat = 2; // 314 + constexpr int numRows = 3; // 42 + constexpr int numCols = 2; // 36 Kokkos::View tau("tau", numMat, numCols); Kokkos::View tmp("work buffer", numMat, numCols); Kokkos::View As("A matrices", numMat, numRows, numCols); @@ -393,13 +399,19 @@ void test_QR_batch() { { typename Kokkos::View::HostMirror As_h = Kokkos::create_mirror_view(As); Kokkos::deep_copy(As_h, As); - As_h(0, 0, 0) = 3.0; As_h(0, 0, 1) = 5.0; - As_h(0, 1, 0) = 4.0; As_h(0, 1, 1) = 0.0; - As_h(0, 2, 0) = 0.0; As_h(0, 2, 1) = -3.0; - - As_h(1, 0, 0) = 3.0; As_h(1, 0, 1) = 5.0; - As_h(1, 1, 0) = 4.0; As_h(1, 1, 1) = 0.0; - As_h(1, 2, 0) = 0.0; As_h(1, 2, 1) = -3.0; + As_h(0, 0, 0) = 3.0; + As_h(0, 0, 1) = 5.0; + As_h(0, 1, 0) = 4.0; + As_h(0, 1, 1) = 0.0; + As_h(0, 2, 0) = 0.0; + As_h(0, 2, 1) = -3.0; + + As_h(1, 0, 0) = 3.0; + As_h(1, 0, 1) = 5.0; + As_h(1, 1, 0) = 4.0; + As_h(1, 1, 1) = 0.0; + As_h(1, 2, 0) = 0.0; + As_h(1, 2, 1) = -3.0; Kokkos::deep_copy(As, As_h); }