MLPACK
1.0.11
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
mlpack
core
metrics
mahalanobis_distance.hpp
Go to the documentation of this file.
1
/***
2
* @file mahalanobis_dstance.h
3
* @author Ryan Curtin
4
*
5
* The Mahalanobis distance.
6
*
7
* This file is part of MLPACK 1.0.11.
8
*
9
* MLPACK is free software: you can redistribute it and/or modify it under the
10
* terms of the GNU Lesser General Public License as published by the Free
11
* Software Foundation, either version 3 of the License, or (at your option) any
12
* later version.
13
*
14
* MLPACK is distributed in the hope that it will be useful, but WITHOUT ANY
15
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17
* details (LICENSE.txt).
18
*
19
* You should have received a copy of the GNU General Public License along with
20
* MLPACK. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
#ifndef __MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP
23
#define __MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP
24
25
#include <
mlpack/core.hpp
>
26
27
namespace
mlpack {
28
namespace
metric {
29
62
template
<
bool
TakeRoot = true>
63
class
MahalanobisDistance
64
{
65
public
:
70
MahalanobisDistance
() { }
71
78
MahalanobisDistance
(
const
size_t
dimensionality) :
79
covariance
(arma::eye<arma::mat>(dimensionality, dimensionality)) { }
80
87
MahalanobisDistance
(
const
arma::mat&
covariance
) : covariance(covariance) { }
88
99
// Return String of Object
100
std::string
ToString
()
const
;
101
template
<
typename
VecType1,
typename
VecType2>
102
double
Evaluate
(
const
VecType1& a,
const
VecType2& b);
103
109
const
arma::mat&
Covariance
()
const
{
return
covariance
; }
110
116
arma::mat&
Covariance
() {
return
covariance
; }
117
private
:
119
arma::mat
covariance
;
120
};
121
122
};
// namespace distance
123
};
// namespace mlpack
124
125
#include "mahalanobis_distance_impl.hpp"
126
127
#endif
Generated by
1.8.3.1