Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
dist.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__MATRIX__DIST_HPP__
2 #define __STAN__MATH__MATRIX__DIST_HPP__
3 
7 
8 namespace stan {
9  namespace math {
10 
20  template<int R1,int C1,int R2, int C2>
21  inline double dist(const Eigen::Matrix<double, R1, C1>& v1,
22  const Eigen::Matrix<double, R2, C2>& v2) {
23  validate_vector(v1,"dist");
24  validate_vector(v2,"dist");
25  validate_matching_sizes(v1,v2,"dist");
26  return (v1-v2).norm();
27  }
28 
38  template<int R1,int C1,int R2, int C2>
39  inline double squared_dist(const Eigen::Matrix<double, R1, C1>& v1,
40  const Eigen::Matrix<double, R2, C2>& v2) {
41  validate_vector(v1,"squared_dist");
42  validate_vector(v2,"squared_dist");
43  validate_matching_sizes(v1,v2,"squared_dist");
44  return (v1-v2).squaredNorm();
45  }
46  }
47 }
48 #endif

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