From ce369702d88a679d906677d9266a17cb72d78ff7 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Fri, 7 Apr 2017 07:34:32 +0200 Subject: Added some missing const-ness --- src/routines/level1/xaxpy.cpp | 10 +++++----- src/routines/level2/xgemv.cpp | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/routines') diff --git a/src/routines/level1/xaxpy.cpp b/src/routines/level1/xaxpy.cpp index 39f61ef4..310562a0 100644 --- a/src/routines/level1/xaxpy.cpp +++ b/src/routines/level1/xaxpy.cpp @@ -44,12 +44,12 @@ void Xaxpy::DoAxpy(const size_t n, const T alpha, TestVectorY(n, y_buffer, y_offset, y_inc); // Determines whether or not the fast-version can be used - bool use_fast_kernel = (x_offset == 0) && (x_inc == 1) && - (y_offset == 0) && (y_inc == 1) && - IsMultiple(n, db_["WGS"]*db_["WPT"]*db_["VW"]); + const auto use_fast_kernel = (x_offset == 0) && (x_inc == 1) && + (y_offset == 0) && (y_inc == 1) && + IsMultiple(n, db_["WGS"]*db_["WPT"]*db_["VW"]); // If possible, run the fast-version of the kernel - auto kernel_name = (use_fast_kernel) ? "XaxpyFast" : "Xaxpy"; + const auto kernel_name = (use_fast_kernel) ? "XaxpyFast" : "Xaxpy"; // Retrieves the Xaxpy kernel from the compiled binary auto kernel = Kernel(program_, kernel_name); @@ -79,7 +79,7 @@ void Xaxpy::DoAxpy(const size_t n, const T alpha, RunKernel(kernel, queue_, device_, global, local, event_); } else { - auto n_ceiled = Ceil(n, db_["WGS"]*db_["WPT"]); + const auto n_ceiled = Ceil(n, db_["WGS"]*db_["WPT"]); auto global = std::vector{n_ceiled/db_["WPT"]}; auto local = std::vector{db_["WGS"]}; RunKernel(kernel, queue_, device_, global, local, event_); diff --git a/src/routines/level2/xgemv.cpp b/src/routines/level2/xgemv.cpp index 3b5b5e8b..b7e8081b 100644 --- a/src/routines/level2/xgemv.cpp +++ b/src/routines/level2/xgemv.cpp @@ -70,14 +70,14 @@ void Xgemv::MatVec(const Layout layout, const Transpose a_transpose, if (m == 0 || n == 0) { throw BLASError(StatusCode::kInvalidDimension); } // Computes whether or not the matrix has an alternative layout (row or column-major). - auto a_altlayout = (layout == Layout::kRowMajor); + const auto a_altlayout = (layout == Layout::kRowMajor); auto a_one = (a_altlayout) ? n : m; - auto a_two = (a_altlayout) ? m : n; + const auto a_two = (a_altlayout) ? m : n; // Swap m and n if the matrix is transposed - auto a_transposed = (a_transpose != Transpose::kNo); - auto m_real = (a_transposed) ? n : m; - auto n_real = (a_transposed) ? m : n; + const auto a_transposed = (a_transpose != Transpose::kNo); + const auto m_real = (a_transposed) ? n : m; + const auto n_real = (a_transposed) ? m : n; // Special adjustments for banded matrices if (kl != 0 || ku != 0) { @@ -85,10 +85,10 @@ void Xgemv::MatVec(const Layout layout, const Transpose a_transpose, } // Determines whether the kernel needs to perform rotated access ('^' is the XOR operator) - auto a_rotated = a_transposed ^ a_altlayout; + const auto a_rotated = a_transposed ^ a_altlayout; // In case of complex data-types, the transpose can also become a conjugate transpose - auto a_conjugate = (a_transpose == Transpose::kConjugate); + const auto a_conjugate = (a_transpose == Transpose::kConjugate); // Tests the matrix and the vectors for validity if (packed) { TestMatrixAP(n, a_buffer, a_offset); } @@ -107,8 +107,8 @@ void Xgemv::MatVec(const Layout layout, const Transpose a_transpose, IsMultiple(a_ld, db_["VW3"]); // If possible, run the fast-version (rotated or non-rotated) of the kernel - auto kernel_name = "Xgemv"; - auto m_ceiled = Ceil(m_real, db_["WGS1"]*db_["WPT1"]); + auto kernel_name = std::string{"Xgemv"}; + const auto m_ceiled = Ceil(m_real, db_["WGS1"]*db_["WPT1"]); auto global_size = m_ceiled / db_["WPT1"]; auto local_size = db_["WGS1"]; if (fast_kernel) { -- cgit v1.2.3