SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
distance
MahalanobisDistance.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 2012 Fernando José Iglesias García
8
* Copyright (C) 2012 Fernando José Iglesias García
9
*/
10
11
#ifndef _MAHALANOBISDISTANCE_H__
12
#define _MAHALANOBISDISTANCE_H__
13
14
#ifdef HAVE_LAPACK
15
16
#include <
shogun/lib/common.h
>
17
#include <
shogun/distance/RealDistance.h
>
18
19
namespace
shogun
20
{
50
class
CMahalanobisDistance
:
public
CRealDistance
51
{
52
public
:
54
CMahalanobisDistance
();
55
61
CMahalanobisDistance
(
CDenseFeatures<float64_t>
* l,
CDenseFeatures<float64_t>
* r);
62
virtual
~CMahalanobisDistance
();
63
70
virtual
bool
init
(
CFeatures
* l,
CFeatures
* r);
71
73
virtual
void
cleanup
();
74
79
virtual
EDistanceType
get_distance_type
() {
return
D_MAHALANOBIS
; }
80
85
inline
virtual
EFeatureType
get_feature_type
() {
return
F_DREAL
; }
86
91
virtual
const
char
*
get_name
()
const
{
return
"MahalanobisDistance"
; }
92
98
virtual
bool
get_disable_sqrt
() {
return
disable_sqrt
; };
99
105
virtual
void
set_disable_sqrt
(
bool
state) {
disable_sqrt
=state; };
106
112
virtual
bool
get_use_mean
() {
return
use_mean
; };
113
119
virtual
void
set_use_mean
(
bool
state) {
use_mean
=state; };
120
121
protected
:
131
virtual
float64_t
compute
(int32_t idx_a, int32_t idx_b);
132
133
private
:
134
void
init();
135
136
protected
:
138
bool
disable_sqrt
;
139
141
bool
use_mean
;
142
144
SGVector<float64_t>
mean
;
146
SGMatrix<float64_t>
icov
;
147
};
148
149
}
// namespace shogun
150
#endif
/* HAVE_LAPACK */
151
#endif
/* _MAHALANOBISDISTANCE_H__ */
SHOGUN
Machine Learning Toolbox - Documentation