SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
lib
IndexBlock.cpp
浏览该文件的文档.
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
* Copyright (C) 2012 Sergey Lisitsyn
8
*/
9
10
#include <
shogun/lib/IndexBlock.h
>
11
12
using namespace
shogun;
13
14
CIndexBlock::CIndexBlock
() :
CSGObject
(),
15
m_min_index(0), m_max_index(0),
16
m_weight(1.0), m_sub_blocks(NULL)
17
{
18
m_sub_blocks =
new
CList
(
true
);
19
SG_REF
(m_sub_blocks);
20
}
21
22
CIndexBlock::CIndexBlock
(
index_t
min_index,
index_t
max_index,
23
float64_t
weight,
const
char
* name) :
24
CSGObject
(), m_min_index(min_index), m_max_index(max_index),
25
m_weight(weight), m_sub_blocks(NULL)
26
{
27
m_sub_blocks =
new
CList
(
true
);
28
SG_REF
(m_sub_blocks);
29
}
30
31
CIndexBlock::~CIndexBlock
()
32
{
33
SG_UNREF
(m_sub_blocks);
34
}
35
36
void
CIndexBlock::add_sub_block
(
CIndexBlock
* sub_block)
37
{
38
ASSERT
(sub_block->
get_min_index
()>=m_min_index)
39
ASSERT
(sub_block->
get_max_index
()<=m_max_index)
40
m_sub_blocks->
append_element
(sub_block);
41
}
42
43
CList
*
CIndexBlock::get_sub_blocks
()
44
{
45
SG_REF
(m_sub_blocks);
46
return
m_sub_blocks;
47
}
48
49
int32_t
CIndexBlock::get_num_sub_blocks
()
50
{
51
return
m_sub_blocks->
get_num_elements
();
52
}
SHOGUN
机器学习工具包 - 项目文档