SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
transfer
multitask
TaskGroup.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/transfer/multitask/TaskGroup.h
>
11
12
using namespace
shogun;
13
14
CTaskGroup::CTaskGroup
() :
CTaskRelation
()
15
{
16
init();
17
}
18
19
CTaskGroup::~CTaskGroup
()
20
{
21
SG_UNREF
(
m_tasks
);
22
}
23
24
void
CTaskGroup::init()
25
{
26
m_tasks
=
new
CDynamicObjectArray
(
true
);
27
}
28
29
void
CTaskGroup::append_task
(
CTask
* task)
30
{
31
m_tasks
->
append_element
(task);
32
}
33
34
int32_t
CTaskGroup::get_num_tasks
()
const
35
{
36
return
m_tasks
->
get_num_elements
();
37
}
38
39
SGVector<index_t>
*
CTaskGroup::get_tasks_indices
()
const
40
{
41
int32_t n_tasks =
m_tasks
->
get_num_elements
();
42
SG_DEBUG
(
"Number of tasks = %d\n"
, n_tasks)
43
44
SGVector<index_t>
* tasks_indices = SG_MALLOC(
SGVector<index_t>
, n_tasks);
45
for
(int32_t i=0; i<n_tasks; i++)
46
{
47
CTask
* task = (
CTask
*)
m_tasks
->
get_element
(i);
48
tasks_indices[i] = task->
get_indices
();
49
SG_UNREF
(task);
50
}
51
52
return
tasks_indices;
53
}
SHOGUN
机器学习工具包 - 项目文档