SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
11 
12 using namespace shogun;
13 
15 {
16  init();
17 }
18 
20 {
22 }
23 
24 void CTaskGroup::init()
25 {
26  m_tasks = new CDynamicObjectArray(true);
27 }
28 
30 {
31  m_tasks->append_element(task);
32 }
33 
35 {
36  return m_tasks->get_num_elements();
37 }
38 
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