STK++ 0.9.13
STK::IReducer< Array, Weights > Class Template Reference

Interface base class for reducing methods. More...

#include <STK_IReducer.h>

Inheritance diagram for STK::IReducer< Array, Weights >:
Inheritance graph

Public Member Functions

virtual ~IReducer ()
 virtual destructor.
 
int dim () const
 get the number of dimension.
 
Array * p_reduced () const
 get a pointer on the reduced data set
 
void setDimension (const int &dim)
 set the number of dimension.
 
void clear ()
 clear allocated memory
 
- Public Member Functions inherited from STK::IRunnerUnsupervised< Array, Weights >
Array constp_data () const
 get the data set
 
virtual void setData (Array const *p_data)
 Set the data set.
 
virtual void setData (Array const &data)
 Set the data set.
 
virtual bool run ()=0
 run the computations.
 
virtual bool run (Weights const &weights)=0
 run the weighted computations.
 
- Public Member Functions inherited from STK::IRunnerBase
String consterror () const
 get the last error message.
 

Protected Types

typedef IRunnerUnsupervised< Array, WeightsRunner
 

Protected Member Functions

 IReducer ()
 Default constructor.
 
 IReducer (Array const *p_data)
 Constructor with a pointer on the constant data set.
 
 IReducer (Array const &data)
 Constructor with a constant reference on the data set.
 
 IReducer (IReducer const &reducer)
 Copy constructor.
 
- Protected Member Functions inherited from STK::IRunnerUnsupervised< Array, Weights >
 IRunnerUnsupervised ()
 default constructor.
 
 IRunnerUnsupervised (Array const *const p_data)
 constructor with a pointer on the constant data set
 
 IRunnerUnsupervised (Array const &data)
 constructor with a constant reference on the data set
 
 IRunnerUnsupervised (IRunnerUnsupervised const &runner)
 copy constructor
 
 ~IRunnerUnsupervised ()
 destructor
 
- Protected Member Functions inherited from STK::IRunnerBase
 IRunnerBase ()
 default constructor
 
 IRunnerBase (IRunnerBase const &runner)
 copy constructor
 
virtual ~IRunnerBase ()
 destructor
 
virtual void update ()
 update the runner.
 

Protected Attributes

int dim_
 dimension of the reduced data set
 
Array * p_reduced_
 The reduced data set.
 
- Protected Attributes inherited from STK::IRunnerUnsupervised< Array, Weights >
Array constp_data_
 A pointer on the original data set.
 
- Protected Attributes inherited from STK::IRunnerBase
String msg_error_
 String with the last error message.
 
bool hasRun_
 true if run has been used, false otherwise
 

Detailed Description

template<class Array, class Weights>
class STK::IReducer< Array, Weights >

Interface base class for reducing methods.

A reducer is a class implementing a dimension reduction techniques.

The class receives a matrix in input of size (n,p).

  • n is the number of samples,
  • p is the number of variables. The observations can be weighted.

The derived class will compute a reduced data set of dimension (n,d). At this level there is no assumption about the type of the data that will be reduced. However, it is expected they can be part of a linear space.

Definition at line 59 of file STK_IReducer.h.

Member Typedef Documentation

◆ Runner

template<class Array , class Weights >
typedef IRunnerUnsupervised<Array, Weights> STK::IReducer< Array, Weights >::Runner
protected

Definition at line 62 of file STK_IReducer.h.

Constructor & Destructor Documentation

◆ IReducer() [1/4]

template<class Array , class Weights >
STK::IReducer< Array, Weights >::IReducer ( )
protected

Default constructor.

Definition at line 106 of file STK_IReducer.h.

106: Runner(), dim_(0), p_reduced_(0) {}
Array * p_reduced_
The reduced data set.
int dim_
dimension of the reduced data set
IRunnerUnsupervised< Array, Weights > Runner

◆ IReducer() [2/4]

template<class Array , class Weights >
STK::IReducer< Array, Weights >::IReducer ( Array const p_data)
protected

Constructor with a pointer on the constant data set.

Parameters
p_dataa pointer on the data set to reduce.

Definition at line 112 of file STK_IReducer.h.

113 : Runner(p_data), dim_(0), p_reduced_(0)
114{}
Array const * p_data() const
get the data set

◆ IReducer() [3/4]

template<class Array , class Weights >
STK::IReducer< Array, Weights >::IReducer ( Array const data)
protected

Constructor with a constant reference on the data set.

Parameters
datathe data set to reduce.

Definition at line 119 of file STK_IReducer.h.

120 : Runner(data), dim_(0), p_reduced_(0)
121{}

◆ IReducer() [4/4]

template<class Array , class Weights >
STK::IReducer< Array, Weights >::IReducer ( IReducer< Array, Weights > const reducer)
protected

Copy constructor.

Use the operator = of the clas ArrayXX

Parameters
reducerThe reducer to copy.

Definition at line 126 of file STK_IReducer.h.

127 : Runner(reducer), dim_(reducer.dim_), p_reduced_(0)
128{
129 if (reducer.p_reduced_)
130 { p_reduced_ = reducer.p_reduced_->clone();}
131}

References STK::IReducer< Array, Weights >::p_reduced_.

◆ ~IReducer()

template<class Array , class Weights >
STK::IReducer< Array, Weights >::~IReducer ( )
virtual

virtual destructor.

Delete reduced data set if allocated.

Definition at line 137 of file STK_IReducer.h.

138{ if (p_reduced_) delete p_reduced_;}

Member Function Documentation

◆ clear()

template<class Array , class Weights >
void STK::IReducer< Array, Weights >::clear ( )
inline

clear allocated memory

Definition at line 94 of file STK_IReducer.h.

95 { if (p_reduced_) { delete p_reduced_; p_reduced_ = 0;} }

References STK::IReducer< Array, Weights >::p_reduced_.

◆ dim()

template<class Array , class Weights >
int STK::IReducer< Array, Weights >::dim ( ) const
inline

get the number of dimension.

Returns
The number of dimension computed

Definition at line 84 of file STK_IReducer.h.

84{ return dim_;}

References STK::IReducer< Array, Weights >::dim_.

Referenced by STK::IReducer< Array, Weights >::setDimension().

◆ p_reduced()

template<class Array , class Weights >
Array * STK::IReducer< Array, Weights >::p_reduced ( ) const
inline

get a pointer on the reduced data set

Returns
a constant pointer on the data set

Definition at line 88 of file STK_IReducer.h.

88{ return p_reduced_; }

References STK::IReducer< Array, Weights >::p_reduced_.

◆ setDimension()

template<class Array , class Weights >
void STK::IReducer< Array, Weights >::setDimension ( const int dim)
inline

set the number of dimension.

Parameters
dimthe number of dimension to set

Definition at line 92 of file STK_IReducer.h.

92{ dim_ = dim;}
int dim() const
get the number of dimension.

References STK::IReducer< Array, Weights >::dim(), and STK::IReducer< Array, Weights >::dim_.

Member Data Documentation

◆ dim_

template<class Array , class Weights >
int STK::IReducer< Array, Weights >::dim_
protected

dimension of the reduced data set

Definition at line 99 of file STK_IReducer.h.

Referenced by STK::IReducer< Array, Weights >::dim(), and STK::IReducer< Array, Weights >::setDimension().

◆ p_reduced_

template<class Array , class Weights >
Array* STK::IReducer< Array, Weights >::p_reduced_
protected

The documentation for this class was generated from the following file: