SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
kernel
string
StringKernel.h
浏览该文件的文档.
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
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
机器学习工具包 - 项目文档