Skip to content

Commit dde9b47

Browse files
authored
Merge pull request #1628 from bstatcomp/generalize_operators
Generalize operator-like functions
2 parents 8fbce61 + 9529ccc commit dde9b47

29 files changed

+429
-775
lines changed

stan/math/fwd/fun.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <stan/math/fwd/fun/determinant.hpp>
2424
#include <stan/math/fwd/fun/digamma.hpp>
2525
#include <stan/math/fwd/fun/divide.hpp>
26-
#include <stan/math/fwd/fun/dot_product.hpp>
2726
#include <stan/math/fwd/fun/dot_self.hpp>
2827
#include <stan/math/fwd/fun/Eigen_NumTraits.hpp>
2928
#include <stan/math/fwd/fun/erf.hpp>

stan/math/fwd/fun/columns_dot_product.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ inline Eigen::Matrix<fvar<T>, 1, C1> columns_dot_product(
1616
check_matching_dims("columns_dot_product", "v1", v1, "v2", v2);
1717
Eigen::Matrix<fvar<T>, 1, C1> ret(1, v1.cols());
1818
for (size_type j = 0; j < v1.cols(); ++j) {
19-
Eigen::Matrix<fvar<T>, R1, C1> ccol1 = v1.col(j);
20-
Eigen::Matrix<fvar<T>, R2, C2> ccol2 = v2.col(j);
19+
Eigen::Matrix<fvar<T>, R1, 1> ccol1 = v1.col(j);
20+
Eigen::Matrix<fvar<T>, R2, 1> ccol2 = v2.col(j);
2121
ret(0, j) = dot_product(ccol1, ccol2);
2222
}
2323
return ret;
@@ -30,8 +30,8 @@ inline Eigen::Matrix<fvar<T>, 1, C1> columns_dot_product(
3030
check_matching_dims("columns_dot_product", "v1", v1, "v2", v2);
3131
Eigen::Matrix<fvar<T>, 1, C1> ret(1, v1.cols());
3232
for (size_type j = 0; j < v1.cols(); ++j) {
33-
Eigen::Matrix<fvar<T>, R1, C1> ccol1 = v1.col(j);
34-
Eigen::Matrix<double, R2, C2> ccol = v2.col(j);
33+
Eigen::Matrix<fvar<T>, R1, 1> ccol1 = v1.col(j);
34+
Eigen::Matrix<double, R2, 1> ccol = v2.col(j);
3535
ret(0, j) = dot_product(ccol1, ccol);
3636
}
3737
return ret;
@@ -44,8 +44,8 @@ inline Eigen::Matrix<fvar<T>, 1, C1> columns_dot_product(
4444
check_matching_dims("columns_dot_product", "v1", v1, "v2", v2);
4545
Eigen::Matrix<fvar<T>, 1, C1> ret(1, v1.cols());
4646
for (size_type j = 0; j < v1.cols(); ++j) {
47-
Eigen::Matrix<double, R1, C1> ccol = v1.col(j);
48-
Eigen::Matrix<fvar<T>, R2, C2> ccol2 = v2.col(j);
47+
Eigen::Matrix<double, R1, 1> ccol = v1.col(j);
48+
Eigen::Matrix<fvar<T>, R2, 1> ccol2 = v2.col(j);
4949
ret(0, j) = dot_product(ccol, ccol2);
5050
}
5151
return ret;

stan/math/fwd/fun/columns_dot_self.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <stan/math/prim/fun/Eigen.hpp>
55
#include <stan/math/fwd/core.hpp>
6+
#include <stan/math/fwd/fun/typedefs.hpp>
67
#include <stan/math/fwd/fun/dot_self.hpp>
78

89
namespace stan {

stan/math/fwd/fun/dot_product.hpp

-215
This file was deleted.

stan/math/fwd/fun/dot_self.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stan/math/prim/err.hpp>
55
#include <stan/math/prim/fun/Eigen.hpp>
66
#include <stan/math/fwd/core.hpp>
7-
#include <stan/math/fwd/fun/dot_product.hpp>
7+
#include <stan/math/prim/fun/dot_product.hpp>
88

99
namespace stan {
1010
namespace math {

0 commit comments

Comments
 (0)