IndexBlockGroup.cpp

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Copyright (C) 2012 Sergey Lisitsyn
00008  */
00009 
00010 #include <shogun/lib/IndexBlockGroup.h>
00011 
00012 using namespace shogun;
00013 
00014 CIndexBlockGroup::CIndexBlockGroup() : CIndexBlockRelation()
00015 {
00016     m_blocks = new CList(true);
00017 }
00018 
00019 CIndexBlockGroup::~CIndexBlockGroup()
00020 {
00021     SG_UNREF(m_blocks);
00022 }
00023 
00024 void CIndexBlockGroup::add_block(CIndexBlock* block)
00025 {
00026     m_blocks->push(block);
00027 }
00028 
00029 void CIndexBlockGroup::remove_block(CIndexBlock* block)
00030 {
00031     SG_NOTIMPLEMENTED;
00032 }
00033 
00034 SGVector<index_t> CIndexBlockGroup::get_SLEP_ind()
00035 {
00036     check_blocks_list(m_blocks);
00037     int32_t n_sub_blocks = m_blocks->get_num_elements();
00038     SG_DEBUG("Number of sub-blocks = %d\n", n_sub_blocks);
00039     SGVector<index_t> ind(n_sub_blocks+1);
00040 
00041     CIndexBlock* iterator = (CIndexBlock*)(m_blocks->get_first_element());
00042     ind[0] = 0;
00043     int32_t i = 0;
00044     do
00045     {
00046         ind[i+1] = iterator->get_max_index();
00047         SG_UNREF(iterator);
00048         i++;
00049     }
00050     while ((iterator = (CIndexBlock*)m_blocks->get_next_element()) != NULL);
00051     //ind.display_vector("ind");
00052 
00053     return ind;
00054 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation