1 | // $Id$ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2006 Jari Häkkinen, Markus Ringnér, Peter Johansson |
---|
5 | Copyright (C) 2007 Jari Häkkinen, Peter Johansson |
---|
6 | |
---|
7 | This file is part of the yat library, http://trac.thep.lu.se/yat |
---|
8 | |
---|
9 | The yat library is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License as |
---|
11 | published by the Free Software Foundation; either version 2 of the |
---|
12 | License, or (at your option) any later version. |
---|
13 | |
---|
14 | The yat library is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with this program; if not, write to the Free Software |
---|
21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
22 | 02111-1307, USA. |
---|
23 | */ |
---|
24 | |
---|
25 | #include "utility.h" |
---|
26 | #include "DataLookup1D.h" |
---|
27 | #include "DataLookupWeighted1D.h" |
---|
28 | #include "yat/utility/Vector.h" |
---|
29 | |
---|
30 | |
---|
31 | namespace theplu { |
---|
32 | namespace yat { |
---|
33 | namespace classifier { |
---|
34 | |
---|
35 | void convert(const DataLookup1D& lookup, utility::Vector& vector) |
---|
36 | { |
---|
37 | vector = utility::Vector(lookup.size()); |
---|
38 | for(u_int i=0; i<lookup.size(); i++) |
---|
39 | vector(i)=lookup(i); |
---|
40 | } |
---|
41 | |
---|
42 | void convert(const DataLookupWeighted1D& lookup, utility::Vector& value, |
---|
43 | utility::Vector& weight) |
---|
44 | { |
---|
45 | |
---|
46 | value = utility::Vector(lookup.size()); |
---|
47 | weight = utility::Vector(lookup.size()); |
---|
48 | for(u_int i=0; i<lookup.size(); i++){ |
---|
49 | value(i)=lookup.data(i); |
---|
50 | weight(i)=lookup.weight(i); |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | }}} // of namespace classifier, yat, and theplu |
---|