581 |
04 May 06 |
markus |
// $Id$ |
581 |
04 May 06 |
markus |
2 |
|
675 |
10 Oct 06 |
jari |
3 |
/* |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2006 Jari Häkkinen, Markus Ringnér |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2012 Peter Johansson |
581 |
04 May 06 |
markus |
7 |
|
1437 |
25 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
581 |
04 May 06 |
markus |
9 |
|
675 |
10 Oct 06 |
jari |
The yat library is free software; you can redistribute it and/or |
675 |
10 Oct 06 |
jari |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
675 |
10 Oct 06 |
jari |
License, or (at your option) any later version. |
581 |
04 May 06 |
markus |
14 |
|
675 |
10 Oct 06 |
jari |
The yat library is distributed in the hope that it will be useful, |
675 |
10 Oct 06 |
jari |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
675 |
10 Oct 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
675 |
10 Oct 06 |
jari |
General Public License for more details. |
581 |
04 May 06 |
markus |
19 |
|
675 |
10 Oct 06 |
jari |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
675 |
10 Oct 06 |
jari |
22 |
*/ |
675 |
10 Oct 06 |
jari |
23 |
|
2881 |
18 Nov 12 |
peter |
24 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
25 |
|
680 |
11 Oct 06 |
jari |
26 |
#include "utility.h" |
680 |
11 Oct 06 |
jari |
27 |
#include "DataLookup1D.h" |
779 |
05 Mar 07 |
peter |
28 |
#include "DataLookupWeighted1D.h" |
1120 |
21 Feb 08 |
peter |
29 |
#include "yat/utility/Vector.h" |
675 |
10 Oct 06 |
jari |
30 |
|
675 |
10 Oct 06 |
jari |
31 |
|
581 |
04 May 06 |
markus |
32 |
namespace theplu { |
680 |
11 Oct 06 |
jari |
33 |
namespace yat { |
581 |
04 May 06 |
markus |
34 |
namespace classifier { |
581 |
04 May 06 |
markus |
35 |
|
4200 |
19 Aug 22 |
peter |
36 |
void convert(const DataLookup1D& lookup, utility::Vector& vector) |
581 |
04 May 06 |
markus |
37 |
{ |
1120 |
21 Feb 08 |
peter |
38 |
vector = utility::Vector(lookup.size()); |
1271 |
09 Apr 08 |
peter |
39 |
for(size_t i=0; i<lookup.size(); i++) |
581 |
04 May 06 |
markus |
40 |
vector(i)=lookup(i); |
581 |
04 May 06 |
markus |
41 |
} |
581 |
04 May 06 |
markus |
42 |
|
1120 |
21 Feb 08 |
peter |
43 |
void convert(const DataLookupWeighted1D& lookup, utility::Vector& value, |
4200 |
19 Aug 22 |
peter |
44 |
utility::Vector& weight) |
779 |
05 Mar 07 |
peter |
45 |
{ |
4200 |
19 Aug 22 |
peter |
46 |
|
1120 |
21 Feb 08 |
peter |
47 |
value = utility::Vector(lookup.size()); |
1120 |
21 Feb 08 |
peter |
48 |
weight = utility::Vector(lookup.size()); |
1271 |
09 Apr 08 |
peter |
49 |
for(size_t i=0; i<lookup.size(); i++){ |
779 |
05 Mar 07 |
peter |
50 |
value(i)=lookup.data(i); |
779 |
05 Mar 07 |
peter |
51 |
weight(i)=lookup.weight(i); |
779 |
05 Mar 07 |
peter |
52 |
} |
779 |
05 Mar 07 |
peter |
53 |
} |
779 |
05 Mar 07 |
peter |
54 |
|
680 |
11 Oct 06 |
jari |
55 |
}}} // of namespace classifier, yat, and theplu |