1 #ifndef STAN_MATH_FWD_MAT_FUN_COLUMNS_DOT_PRODUCT_HPP 2 #define STAN_MATH_FWD_MAT_FUN_COLUMNS_DOT_PRODUCT_HPP 12 template <
typename T,
int R1,
int C1,
int R2,
int C2>
14 const Eigen::Matrix<
fvar<T>, R1, C1>& v1,
15 const Eigen::Matrix<
fvar<T>, R2, C2>& v2) {
17 Eigen::Matrix<fvar<T>, 1, C1> ret(1, v1.cols());
18 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);
26 template <
typename T,
int R1,
int C1,
int R2,
int C2>
28 const Eigen::Matrix<
fvar<T>, R1, C1>& v1,
29 const Eigen::Matrix<double, R2, C2>& v2) {
31 Eigen::Matrix<fvar<T>, 1, C1> ret(1, v1.cols());
32 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);
40 template <
typename T,
int R1,
int C1,
int R2,
int C2>
42 const Eigen::Matrix<double, R1, C1>& v1,
43 const Eigen::Matrix<
fvar<T>, R2, C2>& v2) {
45 Eigen::Matrix<fvar<T>, 1, C1> ret(1, v1.cols());
46 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);
Eigen::Matrix< fvar< T >, 1, C1 > columns_dot_product(const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
void check_matching_dims(const char *function, const char *name1, const matrix_cl &y1, const char *name2, const matrix_cl &y2)
Check if two matrix_cls have the same dimensions.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double e.
fvar< T > dot_product(const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type.