SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
kernel
string
StringKernel.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 1999-2009 Soeren Sonnenburg
8
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9
*/
10
11
#ifndef _STRINGKERNEL_H___
12
#define _STRINGKERNEL_H___
13
14
#include <
shogun/kernel/Kernel.h
>
15
#include <
shogun/features/StringFeatures.h
>
16
17
namespace
shogun
18
{
24
template
<
class
ST>
class
CStringKernel
:
public
CKernel
25
{
26
public
:
31
CStringKernel
(int32_t cachesize=0) :
CKernel
(cachesize) {}
32
38
CStringKernel
(
CFeatures
*l,
CFeatures
*r) :
CKernel
(10)
39
{
40
init(l, r);
41
}
42
53
virtual
bool
init(
CFeatures
* l,
CFeatures
* r)
54
{
55
CKernel::init(l,r);
56
57
ASSERT
(l->
get_feature_class
()==
C_STRING
);
58
ASSERT
(r->
get_feature_class
()==
C_STRING
);
59
ASSERT
(l->
get_feature_type
()==this->
get_feature_type
());
60
ASSERT
(r->
get_feature_type
()==this->
get_feature_type
());
61
62
return
true
;
63
}
64
69
inline
virtual
EFeatureClass
get_feature_class
() {
return
C_STRING
; }
70
75
virtual
EFeatureType
get_feature_type
();
76
82
virtual
const
char
*
get_name
()
const
{
83
return
"StringKernel"
; }
84
92
virtual
EKernelType
get_kernel_type
()=0;
93
};
94
95
template
<>
inline
EFeatureType
CStringKernel<float64_t>::get_feature_type
() {
return
F_DREAL
; }
96
97
template
<>
inline
EFeatureType
CStringKernel<uint64_t>::get_feature_type
() {
return
F_ULONG
; }
98
99
template
<>
inline
EFeatureType
CStringKernel<int32_t>::get_feature_type
() {
return
F_INT
; }
100
101
template
<>
inline
EFeatureType
CStringKernel<uint16_t>::get_feature_type
() {
return
F_WORD
; }
102
103
template
<>
inline
EFeatureType
CStringKernel<int16_t>::get_feature_type
() {
return
F_SHORT
; }
104
105
template
<>
inline
EFeatureType
CStringKernel<uint8_t>::get_feature_type
() {
return
F_BYTE
; }
106
107
template
<>
inline
EFeatureType
CStringKernel<char>::get_feature_type
() {
return
F_CHAR
; }
108
}
109
#endif
/* _STRINGKERNEL_H__ */
110
SHOGUN
Machine Learning Toolbox - Documentation