SHOGUN
v3.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
transfer
multitask
TaskGroup.cpp
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
* 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
Machine Learning Toolbox - Documentation