SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IndexBlock.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/IndexBlock.h>
11 
12 using namespace shogun;
13 
15  m_block_name("block"),
16  m_min_index(0), m_max_index(0),
17  m_weight(1.0), m_sub_blocks(NULL)
18 {
19  m_sub_blocks = new CList(true);
20  SG_REF(m_sub_blocks);
21 }
22 
24  float64_t weight, const char* name) :
25  CSGObject(), m_block_name(name),
26  m_min_index(min_index), m_max_index(max_index),
27  m_weight(weight), m_sub_blocks(NULL)
28 {
29  m_sub_blocks = new CList(true);
30  SG_REF(m_sub_blocks);
31 }
32 
34 {
35  SG_UNREF(m_sub_blocks);
36 }
37 
39 {
40  ASSERT(sub_block->get_min_index()>=m_min_index);
41  ASSERT(sub_block->get_max_index()<=m_max_index);
42  m_sub_blocks->append_element(sub_block);
43 }
44 
46 {
47  SG_REF(m_sub_blocks);
48  return m_sub_blocks;
49 }
50 
52 {
53  return m_sub_blocks->get_num_elements();
54 }

SHOGUN Machine Learning Toolbox - Documentation