source: trunk/yat/classifier/utility.cc @ 1746

Last change on this file since 1746 was 1746, checked in by Peter, 13 years ago

Merged patch release 0.4.3 to the trunk. Delta 0.4.3 - 0.4.2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 1.5 KB
Line 
1// $Id$
2
3/*
4  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
5  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
6  Copyright (C) 2008 Peter Johansson
7
8  This file is part of the yat library, http://dev.thep.lu.se/yat
9
10  The yat library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License as
12  published by the Free Software Foundation; either version 3 of the
13  License, or (at your option) any later version.
14
15  The yat library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with yat. If not, see <http://www.gnu.org/licenses/>.
22*/
23
24#include "utility.h"
25#include "DataLookup1D.h"
26#include "DataLookupWeighted1D.h"
27#include "yat/utility/Vector.h"
28
29
30namespace theplu {
31namespace yat {
32namespace classifier {
33
34  void convert(const DataLookup1D& lookup, utility::Vector& vector) 
35  {
36    vector = utility::Vector(lookup.size());
37    for(size_t i=0; i<lookup.size(); i++)
38      vector(i)=lookup(i);
39  }
40
41  void convert(const DataLookupWeighted1D& lookup, utility::Vector& value,
42               utility::Vector& weight) 
43  {
44   
45    value = utility::Vector(lookup.size());
46    weight = utility::Vector(lookup.size());
47    for(size_t i=0; i<lookup.size(); i++){
48      value(i)=lookup.data(i);
49      weight(i)=lookup.weight(i);
50    }
51  }
52
53}}} // of namespace classifier, yat, and theplu
Note: See TracBrowser for help on using the repository browser.