STK++ 0.9.13
STK_IReducer.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::Reduct
27 * created on: 17 avr. 2010
28 * Purpose: Abstract class for the computation of the Index in the SLAAM.
29 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
30 *
31 **/
32
37#ifndef STK_IREDUCER_H
38#define STK_IREDUCER_H
39
40#include <Sdk.h>
41
42namespace STK
43{
44
58template<class Array, class Weights>
59class IReducer: public IRunnerUnsupervised<Array, Weights>
60{
61 protected:
68 IReducer( Array const* p_data);
72 IReducer( Array const& data);
77
78 public:
80 virtual ~IReducer();
84 inline int dim() const { return dim_;}
88 inline Array* p_reduced() const { return p_reduced_; }
92 inline void setDimension( const int& dim) { dim_ = dim;}
94 inline void clear()
95 { if (p_reduced_) { delete p_reduced_; p_reduced_ = 0;} }
96
97 protected:
99 int dim_;
102};
103
104/* Default constructor. */
105template<class Array, class Weights>
106IReducer<Array, Weights>::IReducer(): Runner(), dim_(0), p_reduced_(0) {}
107
108/* Constructor with a pointer on the constant data set.
109 * @param p_data the data set to reduce.
110 **/
111template<class Array, class Weights>
113 : Runner(p_data), dim_(0), p_reduced_(0)
114{}
115/* Constructor with a constant reference on the data set.
116 * @param data the data set to reduce.
117 * */
118template<class Array, class Weights>
120 : Runner(data), dim_(0), p_reduced_(0)
121{}
122/* Copy constructor.
123 * @param data The data set to reduce.
124 * */
125template<class Array, class Weights>
127 : Runner(reducer), dim_(reducer.dim_), p_reduced_(0)
128{
129 if (reducer.p_reduced_)
130 { p_reduced_ = reducer.p_reduced_->clone();}
131}
132
133/*
134 * Destructor
135 */
136template<class Array, class Weights>
138{ if (p_reduced_) delete p_reduced_;}
139
140
141} // namespace STK
142
143#endif /* STK_IREDUCER_H */
This file include all the other header files of the project Sdk.
Interface base class for reducing methods.
IReducer()
Default constructor.
Array * p_reduced_
The reduced data set.
void setDimension(const int &dim)
set the number of dimension.
IReducer(Array const &data)
Constructor with a constant reference on the data set.
int dim() const
get the number of dimension.
IReducer(IReducer const &reducer)
Copy constructor.
int dim_
dimension of the reduced data set
Array * p_reduced() const
get a pointer on the reduced data set
IReducer(Array const *p_data)
Constructor with a pointer on the constant data set.
virtual ~IReducer()
virtual destructor.
IRunnerUnsupervised< Array, Weights > Runner
void clear()
clear allocated memory
Abstract class for all classes making unsupervised learning.
Array const * p_data() const
get the data set
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
The namespace STK is the main domain space of the Statistical ToolKit project.