提交 644943fe 编写于 作者: M Marius Muja

Make accum_dist inline

上级 1edcea1b
......@@ -93,7 +93,7 @@ struct L2_Simple
}
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
return (a-b)*(a-b);
}
......@@ -156,7 +156,7 @@ struct L2
* Squared root is omitted for efficiency.
*/
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
return (a-b)*(a-b);
}
......@@ -212,7 +212,7 @@ struct L1
* Partial distance, used by the kd-tree.
*/
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
return abs(a-b);
}
......@@ -273,7 +273,7 @@ struct MinkowskiDistance
* Partial distance, used by the kd-tree.
*/
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
return pow(static_cast<ResultType>(abs(a-b)),order);
}
......@@ -380,7 +380,7 @@ struct HistIntersectionDistance
* Partial distance, used by the kd-tree.
*/
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
return (a+b-2*(a<b?a:b));
}
......@@ -426,7 +426,7 @@ struct HellingerDistance
* Partial distance, used by the kd-tree.
*/
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
return (sqrt(static_cast<ResultType>(a)) - sqrt(static_cast<ResultType>(b)));
}
......@@ -469,7 +469,7 @@ struct ChiSquareDistance
* Partial distance, used by the kd-tree.
*/
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
ResultType result = ResultType();
ResultType sum, diff;
......@@ -520,7 +520,7 @@ struct KL_Divergence
* Partial distance, used by the kd-tree.
*/
template <typename U, typename V>
ResultType accum_dist(const U& a, const V& b, int dim) const
inline ResultType accum_dist(const U& a, const V& b, int dim) const
{
ResultType result = ResultType();
ResultType ratio = a / b;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册