From e3fb1f0fe6faf0be7fe2138e25e8f405a1adf1b9 Mon Sep 17 00:00:00 2001 From: stevebronder Date: Fri, 7 May 2021 13:35:55 -0400 Subject: [PATCH 1/2] csr_matrix_times_vector2 now uses csr_matrix_times_vector --- inst/include/csr_matrix_times_vector2.hpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/inst/include/csr_matrix_times_vector2.hpp b/inst/include/csr_matrix_times_vector2.hpp index 9c708d10e..edbbec644 100644 --- a/inst/include/csr_matrix_times_vector2.hpp +++ b/inst/include/csr_matrix_times_vector2.hpp @@ -4,20 +4,14 @@ /* * This works exactly like csr_matrix_times_vector but faster and less safe */ -template -inline -Eigen::Matrix::type, - Eigen::Dynamic, 1> -csr_matrix_times_vector2(const int& m, - const int& n, - const Eigen::Matrix& w, - const std::vector& v, - const std::vector& u, - const Eigen::Matrix& b, - std::ostream* pstream__) { - Eigen::Map > - sm(m, n, w.size(), &u[0], &v[0], &w[0]); - return sm * b; + template + Eigen::Matrix, + stan::value_type_t>, -1, 1> + csr_matrix_times_vector2(const int& m, const int& n, const T2__& w_arg__, + const std::vector& v, + const std::vector& u, const T5__& b_arg__, + std::ostream* pstream__) { + return stan::math::csr_matrix_times_vector(m, n, w_arg__, v, u, b_arg__); } /* This specialization is slower than the above templated version From e0fb4fcbfbf1f06d9a51829d69a84f9144831c67 Mon Sep 17 00:00:00 2001 From: stevebronder Date: Fri, 7 May 2021 20:24:35 -0400 Subject: [PATCH 2/2] also include the old version for backwards compatability --- inst/include/csr_matrix_times_vector2.hpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/inst/include/csr_matrix_times_vector2.hpp b/inst/include/csr_matrix_times_vector2.hpp index edbbec644..19678a657 100644 --- a/inst/include/csr_matrix_times_vector2.hpp +++ b/inst/include/csr_matrix_times_vector2.hpp @@ -1,5 +1,21 @@ -#ifndef RSTANARM__CSR_MATRIX_TIMES_VECTOR2_HPP -#define RSTANARM__CSR_MATRIX_TIMES_VECTOR2_HPP +#ifndef RSTANARM_CSR_MATRIX_TIMES_VECTOR2_HPP +#define RSTANARM_CSR_MATRIX_TIMES_VECTOR2_HPP + +template +inline +Eigen::Matrix::type, + Eigen::Dynamic, 1> +csr_matrix_times_vector2(const int& m, + const int& n, + const Eigen::Matrix& w, + const std::vector& v, + const std::vector& u, + const Eigen::Matrix& b, + std::ostream* pstream__) { + Eigen::Map > + sm(m, n, w.size(), &u[0], &v[0], &w[0]); + return sm * b; +} /* * This works exactly like csr_matrix_times_vector but faster and less safe