| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
columns_dot_product.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUN_COLUMNS_DOT_PRODUCT_HPP
2 #define STAN_MATH_REV_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_vector.hpp>
7 #include <stan/math/prim/mat/err/check_matching_sizes.hpp>
8 #include <stan/math/prim/scal/fun/value_of.hpp>
9 #include <stan/math/rev/core.hpp>
10 #include <stan/math/rev/mat/fun/typedefs.hpp>
11 #include <stan/math/rev/scal/fun/value_of.hpp>
12 #include <stan/math/rev/mat/fun/dot_product.hpp>
13 #include <boost/utility/enable_if.hpp>
14 #include <boost/type_traits.hpp>
15 #include <vector>
16
17 namespace stan {
18 namespace math {
19
20 template<typename T1, int R1, int C1, typename T2, int R2, int C2>
21 inline
22 typename boost::enable_if_c<boost::is_same<T1, var>::value ||
23 boost::is_same<T2, var>::value,
24 Eigen::Matrix<var, 1, C1> >::type
25 columns_dot_product(const Eigen::Matrix<T1, R1, C1>& v1,
26 const Eigen::Matrix<T2, R2, C2>& v2) {
27 stan::math::check_matching_sizes("dot_product",
28 "v1", v1,
29 "v2", v2);
30 Eigen::Matrix<var, 1, C1> ret(1, v1.cols());
31 for (size_type j = 0; j < v1.cols(); ++j) {
32 ret(j) = var(new dot_product_vari<T1, T2>(v1.col(j), v2.col(j)));
33 }
34 return ret;
35 }
36
37 }
38 }
39 #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
core.hpp
check_matching_sizes.hpp
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:32
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
typedefs.hpp
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
dot_product.hpp
Eigen.hpp
check_vector.hpp
value_of.hpp
value_of.hpp
typedefs.hpp

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