source: trunk/yat/classifier/DataLookup1D.h @ 747

Last change on this file since 747 was 747, checked in by Peter, 15 years ago

replaced includes in header files with forward declarations when possible. Added some includes in cc files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.6 KB
Line 
1#ifndef _theplu_yat_classifier_dataLookup1D_
2#define _theplu_yat_classifier_dataLookup1D_
3
4// $Id$
5
6/*
7  Copyright (C) The authors contributing to this file.
8
9  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include <cassert>
28#include <iostream>
29#include <vector>
30
31namespace theplu {
32namespace yat {
33namespace classifier { 
34
35  class DataLookup2D;
36
37  ///
38  /// Class for general vector view
39  ///
40
41  class DataLookup1D
42  {
43 
44  public:
45
46    ///
47    /// Constructor.
48    ///
49    /// @param row_vector if true DataLookup1D is looking into a
50    /// row of DataLookup2D, otherwise looking into a
51    /// column. @param index which row/column to look into.
52    ///
53    DataLookup1D(const DataLookup2D&, const size_t index, 
54                 const bool row_vector);
55
56    ///
57    /// Copy constructor
58    ///
59    DataLookup1D(const DataLookup1D&);
60
61    ///
62    /// Construct DataLookup1D that owns its underlying matrix. Object
63    /// has size @ size and all its element is equal to @a value.
64    ///
65    DataLookup1D(const size_t size, const double value=0); 
66
67    ///
68    ///
69    ///
70    virtual ~DataLookup1D();
71
72    ///
73    /// @return number of elements
74    ///
75    size_t size(void) const;
76
77    ///
78    /// @brief access operator
79    ///
80    double operator()(const size_t i) const;
81
82    ///
83    /// @brief access operator
84    ///
85    double operator[](const size_t i) const;
86
87    ///
88    /// scalar product
89    ///
90    double operator*(const DataLookup1D&) const;
91
92  private:
93    const DataLookup1D& operator=(const DataLookup1D&);
94
95    const bool column_vector_;
96    const size_t index_;
97    const DataLookup2D* matrix_;
98    const bool owner_;
99   
100  };
101
102  ///
103  /// @brief The output operator for DataLookup1D.
104  ///
105  /**
106   * Elements are separated by the character from the omanip fill.
107   * The following example will write the elements separated by tab.
108   *
109   @verbatim
110   char prev=s.fill('\t');
111   s << v;
112   s.fill(prev);
113   @endverbatim
114  */
115  std::ostream& operator<<(std::ostream& s, const DataLookup1D& v);
116 
117}}} // of namespace classifier, yat, and theplu
118
119#endif
Note: See TracBrowser for help on using the repository browser.