Stan Math Library: stan/math/prim/mat/fun/columns_dot_product.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

columns_dot_product.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_COLUMNS_DOT_PRODUCT_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_COLUMNS_DOT_PRODUCT_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/mat/fun/typedefs.hpp>
6 #include <stan/math/prim/mat/err/check_matching_sizes.hpp>
7
8 namespace stan {
9 namespace math {
10
20 template<int R1, int C1, int R2, int C2>
21 inline Eigen::Matrix<double, 1, C1>
22 columns_dot_product(const Eigen::Matrix<double, R1, C1>& v1,
23 const Eigen::Matrix<double, R2, C2>& v2) {
24 stan::math::check_matching_sizes("columns_dot_product",
25 "v1", v1,
26 "v2", v2);
27 Eigen::Matrix<double, 1, C1> ret(1, v1.cols());
28 for (size_type j = 0; j < v1.cols(); ++j) {
29 ret(j) = v1.col(j).dot(v2.col(j));
30 }
31 return ret;
32 }
33
34 }
35 }
36 #endif
stan::math::columns_dot_product
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)
Definition: columns_dot_product.hpp:18
stan
Definition: log_sum_exp.hpp:8
check_matching_sizes.hpp
stan::math::size_type
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double e.
Definition: typedefs.hpp:13
stan::math::check_matching_sizes
bool check_matching_sizes(const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
Return true if two structures at the same size.
Definition: check_matching_sizes.hpp:29
Eigen.hpp
typedefs.hpp

[ Stan Home Page ] © 2011–2016, Stan Development Team.