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
lib
IndexBlockGroup.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/lib/IndexBlockGroup.h
>
11
12
using namespace
shogun;
13
14
CIndexBlockGroup::CIndexBlockGroup
() :
CIndexBlockRelation
()
15
{
16
m_blocks
=
new
CList
(
true
);
17
}
18
19
CIndexBlockGroup::~CIndexBlockGroup
()
20
{
21
SG_UNREF
(
m_blocks
);
22
}
23
24
void
CIndexBlockGroup::add_block
(
CIndexBlock
* block)
25
{
26
m_blocks
->
push
(block);
27
}
28
29
void
CIndexBlockGroup::remove_block
(
CIndexBlock
* block)
30
{
31
SG_NOTIMPLEMENTED
32
}
33
34
SGVector<index_t>
CIndexBlockGroup::get_SLEP_ind
()
35
{
36
check_blocks_list
(
m_blocks
);
37
int32_t n_sub_blocks =
m_blocks
->
get_num_elements
();
38
SG_DEBUG
(
"Number of sub-blocks = %d\n"
, n_sub_blocks)
39
SGVector<index_t>
ind(n_sub_blocks+1);
40
41
CIndexBlock
* iterator = (
CIndexBlock
*)(
m_blocks
->
get_first_element
());
42
ind[0] = 0;
43
int32_t i = 0;
44
do
45
{
46
ind[i+1] = iterator->
get_max_index
();
47
SG_UNREF
(iterator);
48
i++;
49
}
50
while
((iterator = (
CIndexBlock
*)
m_blocks
->
get_next_element
()) != NULL);
51
//ind.display_vector("ind");
52
53
return
ind;
54
}
SHOGUN
Machine Learning Toolbox - Documentation