STK++ 0.9.13
STK::Kernel::Linear< Array > Class Template Reference

The Linear Kernel is a kernel of the form. More...

#include <STK_Kernel_Linear.h>

Inheritance diagram for STK::Kernel::Linear< Array >:
Inheritance graph

Public Types

typedef IKernelBase< Array > Base
 
typedef Array::Type Type
 
- Public Types inherited from STK::Kernel::IKernelBase< Array >
typedef Array::Type Type
 

Public Member Functions

 Linear ()
 Default constructor.
 
 Linear (Array const *p_data)
 constructor with a constant pointer on the data set
 
 Linear (Array const &data)
 constructor with a constant pointer on the data set
 
template<class Derived >
 Linear (Array const *p_data, ExprBase< Derived > const &param)
 constructor with an array of parameter.
 
template<class Derived >
 Linear (Array const &data, ExprBase< Derived > const &param)
 constructor with a constant pointer on the data set
 
virtual ~Linear ()
 destructor
 
template<class Derived >
void setParam (ExprBase< Derived > const &param)
 Set parameter using an array.
 
virtual Real diag (int i) const
 virtual method.
 
virtual Real comp (int i, int j) const
 virtual method implementation.
 
- Public Member Functions inherited from STK::Kernel::IKernelBase< Array >
 IKernelBase (Array const *p_data)
 constructor with a constant pointer on the data set
 
 IKernelBase (Array const &data)
 constructor with a constant reference on the data set
 
 IKernelBase (IKernelBase const &kernel)
 copy constructor
 
virtual ~IKernelBase ()
 destructor
 
Array constp_data () const
 
virtual bool run ()
 compute Gram matrix
 
virtual int nbSample () const
 
virtual int nbVariable () const
 
virtual Real value (Type const &v) const
 compute the value of the kernel for the given value
 
- Public Member Functions inherited from STK::Kernel::IKernel
 IKernel ()
 default constructor
 
 IKernel (IKernel const &kernel)
 copy constructor
 
virtual ~IKernel ()
 destructor
 
CSquareX constk () const
 
CSquareX constgram () const
 
Real kcomp (int i, int j) const
 
Real kdist (int i, int j) const
 
Real kdiag (int i) const
 
Real dist (int i, int j) const
 
- Public Member Functions inherited from STK::IRunnerBase
String consterror () const
 get the last error message.
 

Public Attributes

Array constp_data_
 pointer on the data set
 
CSquareX gram_
 the resulting gram_ matrix
 
- Public Attributes inherited from STK::Kernel::IKernelBase< Array >
CSquareX gram_
 the resulting gram_ matrix
 

Additional Inherited Members

- 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 inherited from STK::Kernel::IKernelBase< Array >
Array constp_data_
 pointer on the data set
 
- Protected Attributes inherited from STK::Kernel::IKernel
CSquareX gram_
 the resulting gram_ matrix
 
- 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 STK::Kernel::Linear< Array >

The Linear Kernel is a kernel of the form.

\[
k(x,y) = <x,y>.
\]

Definition at line 53 of file STK_Kernel_Linear.h.

Member Typedef Documentation

◆ Base

template<class Array >
typedef IKernelBase<Array> STK::Kernel::Linear< Array >::Base

Definition at line 56 of file STK_Kernel_Linear.h.

◆ Type

template<class Array >
typedef Array::Type STK::Kernel::Linear< Array >::Type

Definition at line 57 of file STK_Kernel_Linear.h.

Constructor & Destructor Documentation

◆ Linear() [1/5]

template<class Array >
STK::Kernel::Linear< Array >::Linear ( )
inline

Default constructor.

Definition at line 63 of file STK_Kernel_Linear.h.

63: Base(0) {}
IKernelBase< Array > Base

◆ Linear() [2/5]

template<class Array >
STK::Kernel::Linear< Array >::Linear ( Array const p_data)
inline

constructor with a constant pointer on the data set

Parameters
p_dataa pointer on a data set that will be "kernelized"

Definition at line 67 of file STK_Kernel_Linear.h.

67: Base(p_data) {}

◆ Linear() [3/5]

template<class Array >
STK::Kernel::Linear< Array >::Linear ( Array const data)
inline

constructor with a constant pointer on the data set

Parameters
dataa reference on a data set that will be "kernelized"

Definition at line 71 of file STK_Kernel_Linear.h.

71: Base(data) {}

◆ Linear() [4/5]

template<class Array >
template<class Derived >
STK::Kernel::Linear< Array >::Linear ( Array const p_data,
ExprBase< Derived > const param 
)
inline

constructor with an array of parameter.

Parameters
p_dataa pointer on a data set that will be "kernelized"
paramarray of parameter

Definition at line 77 of file STK_Kernel_Linear.h.

77 : Base(p_data)
78 {}

◆ Linear() [5/5]

template<class Array >
template<class Derived >
STK::Kernel::Linear< Array >::Linear ( Array const data,
ExprBase< Derived > const param 
)
inline

constructor with a constant pointer on the data set

Parameters
dataa reference on a data set that will be "kernelized"
paramarray of parameter

Definition at line 84 of file STK_Kernel_Linear.h.

84 : Base(data)
85 {}

◆ ~Linear()

template<class Array >
virtual STK::Kernel::Linear< Array >::~Linear ( )
inlinevirtual

destructor

Definition at line 88 of file STK_Kernel_Linear.h.

88{}

Member Function Documentation

◆ comp()

template<class Array >
Real STK::Kernel::Linear< Array >::comp ( int  i,
int  j 
) const
virtual

virtual method implementation.

Returns
value of the kernel for the ith and jth individuals.
Parameters
i,jindexes of the individuals

Implements STK::Kernel::IKernel.

Definition at line 118 of file STK_Kernel_Linear.h.

119{ return hasRun_ ? gram_(i,j)
120 : p_data_->row(i).dot(p_data_->row(j));}
bool hasRun_
true if run has been used, false otherwise
Definition STK_IRunner.h:98
Array const * p_data_
pointer on the data set
CSquareX gram_
the resulting gram_ matrix
Real dot(ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y)
Compute the dot product.

◆ diag()

template<class Array >
Real STK::Kernel::Linear< Array >::diag ( int  i) const
inlinevirtual

virtual method.

Returns
diagonal value of the kernel for the ith individuals.
Parameters
iindex of the individual

Reimplemented from STK::Kernel::IKernel.

Definition at line 112 of file STK_Kernel_Linear.h.

113{ return hasRun_ ? gram_(i,i)
114 : p_data_->row(i).norm2();
115}

◆ setParam()

template<class Array >
template<class Derived >
void STK::Kernel::Linear< Array >::setParam ( ExprBase< Derived > const param)
inline

Set parameter using an array.

Parameters
paramarray of parameter

Definition at line 93 of file STK_Kernel_Linear.h.

93{}

Member Data Documentation

◆ gram_

template<class Array >
CSquareX STK::Kernel::IKernel::gram_

the resulting gram_ matrix

Definition at line 53 of file STK_Kernel_IKernel.h.

◆ p_data_

template<class Array >
Array const* STK::Kernel::IKernelBase< Array >::p_data_

pointer on the data set

Definition at line 90 of file STK_Kernel_IKernelBase.h.


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