SHOGUN
v3.2.0
src
shogun
mathematics
munkres.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 John Weaver
3
*
4
* 2012: Ported to shogun by Chiyuan Zhang
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program; if not, write to the Free Software Foundation, Inc.,
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
*/
20
21
#if !defined(_MUNKRES_H_)
22
#define _MUNKRES_H_
23
24
#include <
shogun/lib/DataType.h
>
25
#include <
shogun/lib/SGMatrix.h
>
26
27
#include <list>
28
#include <utility>
29
30
namespace
shogun
31
{
32
34
class
Munkres
35
{
36
public
:
38
Munkres
(
SGMatrix<double>
&m)
39
:mask_matrix(m.num_rows, m.num_cols, true), matrix(m.num_rows, m.num_cols, true), ref_m(m)
40
{
41
}
42
44
void
solve
()
45
{
46
solve
(ref_m);
47
}
48
50
~Munkres
()
51
{
52
}
53
54
private
:
55
static
const
int
NORMAL=0;
56
static
const
int
STAR=1;
57
static
const
int
PRIME=2;
58
59
void
solve
(
SGMatrix<double>
&m);
60
61
inline
bool
find_uncovered_in_matrix(
double
,
int
&,
int
&);
62
inline
bool
pair_in_list(
const
std::pair<int,int> &,
const
std::list<std::pair<int,int> > &);
63
int
step1(
void
);
64
int
step2(
void
);
65
int
step3(
void
);
66
int
step4(
void
);
67
int
step5(
void
);
68
int
step6(
void
);
69
SGMatrix<int>
mask_matrix;
70
SGMatrix<double>
matrix;
71
bool
*row_mask;
72
bool
*col_mask;
73
int
saverow, savecol;
74
75
SGMatrix<double>
&ref_m;
76
};
77
78
}
// namespace shogun
79
80
#endif
/* !defined(_MUNKRES_H_) */
DataType.h
SGMatrix.h
shogun::Munkres
Munkres.
Definition:
munkres.h:34
shogun::Munkres::~Munkres
~Munkres()
Definition:
munkres.h:50
shogun::Munkres::solve
void solve()
Definition:
munkres.h:44
shogun::SGMatrix< double >
shogun
all of classes and functions are contained in the shogun namespace
Definition:
class_list.h:16
shogun::Munkres::Munkres
Munkres(SGMatrix< double > &m)
Definition:
munkres.h:38
SHOGUN
Machine Learning Toolbox - Documentation