Skip to content

Commit 9529ccc

Browse files
committed
addressed remaining review comments
1 parent 5290f6b commit 9529ccc

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

stan/math/fwd/fun/multiply.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ inline auto multiply(const Mat1& m1, const Mat2& m2) {
3535
Eigen::Matrix<value_type_t<Mat1>, 1, Mat1::ColsAtCompileTime> crow
3636
= m1.row(i);
3737
for (size_type j = 0; j < m2.cols(); j++) {
38-
auto ccol = m2.col(j);
39-
result(i, j) = dot_product(crow, ccol);
38+
result(i, j) = dot_product(crow, m2.col(j));
4039
}
4140
}
4241
return result;

stan/math/prim/fun/trace_gen_quad_form.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ template <typename TD, typename TA, typename TB,
3232
typename = require_all_eigen_t<TD, TA, TB>,
3333
typename = require_all_not_var_t<value_type_t<TD>, value_type_t<TA>,
3434
value_type_t<TB>>,
35-
typename = require_any_not_same_vt<double, TD, TA, TB>>
35+
typename = require_any_not_eigen_vt<std::is_arithmetic, TD, TA, TB>>
3636
inline auto trace_gen_quad_form(const TD &D, const TA &A, const TB &B) {
3737
check_square("trace_gen_quad_form", "A", A);
3838
check_square("trace_gen_quad_form", "D", D);
@@ -44,7 +44,7 @@ inline auto trace_gen_quad_form(const TD &D, const TA &A, const TB &B) {
4444
/**
4545
* Return the trace of D times the quadratic form of B and A.
4646
* That is, `trace_gen_quad_form(D, A, B) = trace(D * B' * A * B).`
47-
* This is the double-only overload to allow Eigen's expression
47+
* This is the overload for arithmetic types to allow Eigen's expression
4848
* templates to be used for efficiency.
4949
*
5050
* @tparam TD type of the first matrix or expression
@@ -60,8 +60,7 @@ inline auto trace_gen_quad_form(const TD &D, const TA &A, const TB &B) {
6060
* be multiplied by D.
6161
*/
6262
template <typename TD, typename TA, typename TB,
63-
typename = require_all_eigen_t<TD, TA, TB>,
64-
typename = require_all_same_vt<double, TD, TA, TB>>
63+
typename = require_all_eigen_vt<std::is_arithmetic, TD, TA, TB>>
6564
inline double trace_gen_quad_form(const TD &D, const TA &A, const TB &B) {
6665
check_square("trace_gen_quad_form", "A", A);
6766
check_square("trace_gen_quad_form", "D", D);

0 commit comments

Comments
 (0)