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

Last change on this file since 1486 was 1486, checked in by Jari Häkkinen, 13 years ago

Addresses #436.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 1.6 KB
Line 
1// $Id$
2
3/*
4  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, 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 this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23  02111-1307, USA.
24*/
25
26#include "utility.h"
27#include "DataLookup1D.h"
28#include "DataLookupWeighted1D.h"
29#include "yat/utility/Vector.h"
30
31
32namespace theplu {
33namespace yat {
34namespace classifier {
35
36  void convert(const DataLookup1D& lookup, utility::Vector& vector) 
37  {
38    vector = utility::Vector(lookup.size());
39    for(size_t i=0; i<lookup.size(); i++)
40      vector(i)=lookup(i);
41  }
42
43  void convert(const DataLookupWeighted1D& lookup, utility::Vector& value,
44               utility::Vector& weight) 
45  {
46   
47    value = utility::Vector(lookup.size());
48    weight = utility::Vector(lookup.size());
49    for(size_t i=0; i<lookup.size(); i++){
50      value(i)=lookup.data(i);
51      weight(i)=lookup.weight(i);
52    }
53  }
54
55}}} // of namespace classifier, yat, and theplu
Note: See TracBrowser for help on using the repository browser.