Skip to content

Commit

Permalink
Merge branch 'slep' of git://github.com/lisitsyn/shogun
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jun 16, 2012
2 parents 8d374f1 + 30c471d commit f3eb34d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/shogun/transfer/multitask/Task.cpp
Expand Up @@ -13,15 +13,17 @@ using namespace shogun;

CTask::CTask() : CSGObject(),
m_min_index(0), m_max_index(0),
m_task_name("task")
m_weight(1.0), m_task_name("task")
{
m_subtasks = new CList();
}

CTask::CTask(index_t min_index, index_t max_index, const char* name) :
CTask::CTask(index_t min_index, index_t max_index,
float64_t weight, const char* name) :
CSGObject(),
m_min_index(min_index),
m_max_index(max_index),
m_weight(weight),
m_task_name(name)
{
m_subtasks = new CList();
Expand Down
16 changes: 13 additions & 3 deletions src/shogun/transfer/multitask/Task.h
Expand Up @@ -26,9 +26,11 @@ class CTask : public CSGObject
/** constructor
* @param min_index smallest index of vector in task
* @param max_index largest index of vector in task
* @param weight weight (optional)
* @param name name of task (optional)
*/
CTask(index_t min_index, index_t max_index, const char* name="task");
CTask(index_t min_index, index_t max_index,
float64_t weight=1.0, const char* name="task");

/** destructor */
~CTask();
Expand All @@ -41,11 +43,16 @@ class CTask : public CSGObject
/** get min index */
index_t get_min_index() const { return m_min_index; }
/** set max index */
index_t set_min_index(index_t min_index) { m_min_index = min_index; }
void set_min_index(index_t min_index) { m_min_index = min_index; }
/** get min index */
index_t get_max_index() const { return m_max_index; }
/** set max index */
index_t set_max_index(index_t max_index) { m_max_index = max_index; }
void set_max_index(index_t max_index) { m_max_index = max_index; }
/** get weight */
float64_t get_weight() const { return m_weight; }
/** set weight */
void set_weight(float64_t weight) { m_weight = weight; }


/** get name */
virtual const char* get_name() const { return "Task"; };
Expand All @@ -64,6 +71,9 @@ class CTask : public CSGObject
/** rind */
index_t m_max_index;

/** weight */
float64_t m_weight;

/** subtasks */
CList* m_subtasks;

Expand Down
20 changes: 17 additions & 3 deletions src/shogun/transfer/multitask/TaskTree.cpp
Expand Up @@ -11,19 +11,32 @@

using namespace shogun;

CTaskTree::CTaskTree() : CTaskRelation()
CTaskTree::CTaskTree() : CTaskRelation(), m_root_task(NULL)
{

}

CTaskTree::CTaskTree(CTask* root_task) : CTaskRelation()
CTaskTree::CTaskTree(CTask* root_task) : CTaskRelation(),
m_root_task(NULL)
{

set_root_task(root_task);
}

CTaskTree::~CTaskTree()
{
SG_UNREF(m_root_task);
}

CTask* CTaskTree::get_root_task() const
{
return m_root_task;
}

void CTaskTree::set_root_task(CTask* root_task)
{
SG_REF(root_task);
SG_UNREF(m_root_task);
m_root_task = root_task;
}

SGVector<index_t> CTaskTree::get_SLEP_ind()
Expand All @@ -34,6 +47,7 @@ SGVector<index_t> CTaskTree::get_SLEP_ind()

SGVector<float64_t> CTaskTree::get_SLEP_ind_t()
{
return SGVector<float64_t>();
}

bool CTaskTree::is_valid() const
Expand Down
6 changes: 6 additions & 0 deletions src/shogun/transfer/multitask/TaskTree.h
Expand Up @@ -31,6 +31,12 @@ class CTaskTree : public CTaskRelation
/** destructor */
virtual ~CTaskTree();

/** get root task */
CTask* get_root_task() const;

/** set root task */
void set_root_task(CTask* root_task);

/** returns information about tasks in
* SLEP "ind" format
*/
Expand Down

0 comments on commit f3eb34d

Please sign in to comment.