SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
11 #include <shogun/lib/IndexBlock.h>
12 #include <shogun/lib/List.h>
13 
14 using namespace shogun;
15 
17 {
18  m_blocks = new CList(true);
19 }
20 
22 {
24 }
25 
27 {
28  m_blocks->push(block);
29 }
30 
32 {
34 }
35 
37 {
39  int32_t n_sub_blocks = m_blocks->get_num_elements();
40  SG_DEBUG("Number of sub-blocks = %d\n", n_sub_blocks)
41  SGVector<index_t> ind(n_sub_blocks+1);
42 
44  ind[0] = 0;
45  int32_t i = 0;
46  do
47  {
48  ind[i+1] = iterator->get_max_index();
49  SG_UNREF(iterator);
50  i++;
51  }
52  while ((iterator = (CIndexBlock*)m_blocks->get_next_element()) != NULL);
53  //ind.display_vector("ind");
54 
55  return ind;
56 }
bool push(CSGObject *data)
Definition: List.h:400
CSGObject * get_next_element()
Definition: List.h:185
void add_block(CIndexBlock *block)
class IndexBlockRelation
bool check_blocks_list(CList *blocks)
#define SG_NOTIMPLEMENTED
Definition: SGIO.h:139
SGVector< index_t > get_SLEP_ind()
CSGObject * get_first_element()
Definition: List.h:151
class IndexBlock used to represent contiguous indices of one group (e.g. block of related features) ...
Definition: IndexBlock.h:25
int32_t get_num_elements()
Definition: List.h:145
#define SG_UNREF(x)
Definition: SGObject.h:52
#define SG_DEBUG(...)
Definition: SGIO.h:107
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
index_t get_max_index() const
Definition: IndexBlock.h:49
void remove_block(CIndexBlock *block)
Class List implements a doubly connected list for low-level-objects.
Definition: List.h:84
Block< Matrix > block(Matrix matrix, index_t row_begin, index_t col_begin, index_t row_size, index_t col_size)
Definition: Block.h:102

SHOGUN Machine Learning Toolbox - Documentation