source: trunk/yat/classifier/DataLookupWeighted1D.cc @ 680

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

Addresses #153. Introduced yat namespace. Removed alignment namespace. Clean up of code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1// $Id: DataLookupWeighted1D.cc 680 2006-10-11 17:49:03Z jari $
2
3/*
4  Copyright (C) The authors contributing to this file.
5
6  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
7
8  The yat library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12
13  The yat library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22*/
23
24#include "DataLookupWeighted1D.h"
25#include "MatrixLookupWeighted.h"
26
27#include <cassert>
28#include <iostream>
29#include <iomanip>
30
31namespace theplu {
32namespace yat {
33namespace classifier {
34
35  DataLookupWeighted1D::DataLookupWeighted1D(const MatrixLookupWeighted& m, 
36                                             const size_t i, 
37                             const bool row_vector)
38    : column_vector_(!row_vector), index_(i), matrix_(&m), owner_(false)
39  {
40    assert( !column_vector_ || i<m.columns());
41    assert( column_vector_ || i<m.rows());
42  }
43 
44
45  DataLookupWeighted1D::DataLookupWeighted1D(const size_t size, 
46                                             const double value,
47                                             const double weight)
48    : column_vector_(false), index_(0), owner_(true)
49  {
50    matrix_ = new MatrixLookupWeighted(1,size,value,weight);
51  }
52
53 
54  DataLookupWeighted1D::DataLookupWeighted1D(const DataLookupWeighted1D& other)
55    : column_vector_(other.column_vector_), index_(other.index_),
56      matrix_(other.matrix_), owner_(false)
57  {
58  }
59
60  DataLookupWeighted1D::~DataLookupWeighted1D()
61  {
62    if (owner_)
63      delete matrix_;
64  }
65
66
67}}} // of namespace classifier, yat, and theplu
Note: See TracBrowser for help on using the repository browser.