Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved task structures out of multitask submodule
- Loading branch information
Showing
26 changed files
with
561 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Copyright (C) 2012 Sergey Lisitsyn | ||
*/ | ||
|
||
#include <shogun/lib/IndexBlock.h> | ||
|
||
using namespace shogun; | ||
|
||
CIndexBlock::CIndexBlock() : CSGObject(), | ||
m_block_name("block"), | ||
m_min_index(0), m_max_index(0), | ||
m_weight(1.0), m_sub_blocks(NULL) | ||
{ | ||
m_sub_blocks = new CList(true); | ||
SG_REF(m_sub_blocks); | ||
} | ||
|
||
CIndexBlock::CIndexBlock(index_t min_index, index_t max_index, | ||
float64_t weight, const char* name) : | ||
CSGObject(), m_block_name(name), | ||
m_min_index(min_index), m_max_index(max_index), | ||
m_weight(weight), m_sub_blocks(NULL) | ||
{ | ||
m_sub_blocks = new CList(true); | ||
SG_REF(m_sub_blocks); | ||
} | ||
|
||
CIndexBlock::~CIndexBlock() | ||
{ | ||
SG_UNREF(m_sub_blocks); | ||
} | ||
|
||
void CIndexBlock::add_sub_block(CIndexBlock* sub_block) | ||
{ | ||
ASSERT(sub_block->get_min_index()>=m_min_index); | ||
ASSERT(sub_block->get_max_index()<=m_max_index); | ||
m_sub_blocks->append_element(sub_block); | ||
} | ||
|
||
CList* CIndexBlock::get_sub_blocks() | ||
{ | ||
SG_REF(m_sub_blocks); | ||
return m_sub_blocks; | ||
} | ||
|
||
int32_t CIndexBlock::get_num_sub_blocks() | ||
{ | ||
return m_sub_blocks->get_num_elements(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Copyright (C) 2012 Sergey Lisitsyn | ||
*/ | ||
|
||
#include <shogun/lib/IndexBlockGroup.h> | ||
|
||
using namespace shogun; | ||
|
||
CIndexBlockGroup::CIndexBlockGroup() : CIndexBlockRelation() | ||
{ | ||
m_blocks = new CList(true); | ||
} | ||
|
||
CIndexBlockGroup::~CIndexBlockGroup() | ||
{ | ||
SG_UNREF(m_blocks); | ||
} | ||
|
||
void CIndexBlockGroup::add_block(CIndexBlock* block) | ||
{ | ||
m_blocks->push(block); | ||
} | ||
|
||
void CIndexBlockGroup::remove_block(CIndexBlock* block) | ||
{ | ||
SG_NOTIMPLEMENTED; | ||
} | ||
|
||
SGVector<index_t> CIndexBlockGroup::get_SLEP_ind() | ||
{ | ||
check_blocks_list(m_blocks); | ||
int32_t n_sub_blocks = m_blocks->get_num_elements(); | ||
SG_DEBUG("Number of sub-blocks = %d\n", n_sub_blocks); | ||
SGVector<index_t> ind(n_sub_blocks+1); | ||
|
||
CIndexBlock* iterator = (CIndexBlock*)(m_blocks->get_first_element()); | ||
ind[0] = 0; | ||
int32_t i = 0; | ||
do | ||
{ | ||
ind[i+1] = iterator->get_max_index(); | ||
SG_UNREF(iterator); | ||
i++; | ||
} | ||
while ((iterator = (CIndexBlock*)m_blocks->get_next_element()) != NULL); | ||
|
||
return ind; | ||
} |
Oops, something went wrong.