Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csr_matrix_times_vector2 now uses csr_matrix_times_vector #514

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions inst/include/csr_matrix_times_vector2.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#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

/*
* This works exactly like csr_matrix_times_vector but faster and less safe
*/
template <typename T2__, typename T5__>
inline
Eigen::Matrix<typename boost::math::tools::promote_args<T2__, T5__>::type,
Expand All @@ -20,6 +17,19 @@ csr_matrix_times_vector2(const int& m,
return sm * b;
}

/*
* This works exactly like csr_matrix_times_vector but faster and less safe
*/
template <typename T2__, typename T5__>
Eigen::Matrix<stan::promote_args_t<stan::value_type_t<T2__>,
stan::value_type_t<T5__>>, -1, 1>
csr_matrix_times_vector2(const int& m, const int& n, const T2__& w_arg__,
const std::vector<int>& v,
const std::vector<int>& u, const T5__& b_arg__,
std::ostream* pstream__) {
return stan::math::csr_matrix_times_vector(m, n, w_arg__, v, u, b_arg__);
Comment on lines +23 to +30

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this is related to a specific version of stanc3 > v2.26.1, after stan-dev/stanc3#865.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I did exactly this but idt we need the macro branch? I think the compiler should be able to figure out which version to use

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is resolved now:

* checking whether packagerstanarmcan be installed ... OK

I'll re-check with the development version of rstan, after it's merged.

}

/* This specialization is slower than the above templated version
stan::math::vector_v
csr_matrix_times_vector2(const int& m,
Expand Down