All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
dist.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_ARR_FUN_DIST_HPP
#define STAN_MATH_PRIM_ARR_FUN_DIST_HPP
#include <vector>
#include <cstddef>
#include <cmath>
namespace stan {
namespace math {
inline double dist(const std::vector<double>& x,
const std::vector<double>& y) {
using std::sqrt;
double result = 0;
for (size_t i = 0; i < x.size(); ++i) {
double diff = x[i] - y[i];
result += diff * diff;
}
return sqrt(result);
}
}
}
#endif
stan::math::sqrt
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:15
stan::math::dist
double dist(const std::vector< double > &x, const std::vector< double > &y)
Definition: dist.hpp:11

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