summaryrefslogtreecommitdiff
path: root/include/phat/representations/sparse_pivot_column.h
diff options
context:
space:
mode:
authorjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-05-14 09:59:44 +0000
committerjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-05-14 09:59:44 +0000
commit595ce965ef6e07c554a91ebb8b41c8e1c06b8b32 (patch)
tree47f7578d613334b6a37e50028f20f60e316b1782 /include/phat/representations/sparse_pivot_column.h
parentfb02e45712d44f217dfbd71910ea533894c065e6 (diff)
cleaned up pivot column source
git-svn-id: https://phat.googlecode.com/svn/trunk@85 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d
Diffstat (limited to 'include/phat/representations/sparse_pivot_column.h')
-rw-r--r--include/phat/representations/sparse_pivot_column.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/include/phat/representations/sparse_pivot_column.h b/include/phat/representations/sparse_pivot_column.h
index f4eab8b..9e39950 100644
--- a/include/phat/representations/sparse_pivot_column.h
+++ b/include/phat/representations/sparse_pivot_column.h
@@ -27,33 +27,33 @@ namespace phat {
protected:
std::set< index > m_data;
+ void add_index( const index idx ) {
+ std::pair< std::set< index >::iterator, bool > result = m_data.insert( idx );
+ if( result.second == false )
+ m_data.erase( result.first );
+ }
+
public:
void init( const index total_size ) {
m_data.clear();
}
- void add_column( const column& col ) {
+ void add_col( const column& col ) {
for( index idx = 0; idx < (index) col.size(); idx++ )
add_index( col[ idx ] );
}
- void add_index( const index idx ) {
- std::pair< std::set< index >::iterator, bool > result = m_data.insert( idx );
- if( result.second == false )
- m_data.erase( result.first );
- }
-
- index max_index() {
+ index get_max_index() {
return m_data.empty() ? -1 : *m_data.rbegin();
}
- void get_column_and_clear( column& col ) {
+ void get_col_and_clear( column& col ) {
col.clear();
col.assign( m_data.begin(), m_data.end() );
m_data.clear();
}
- bool empty() {
+ bool is_empty() {
return m_data.empty();
}
@@ -62,18 +62,18 @@ namespace phat {
}
void remove_max() {
- add_index( max_index() );
+ add_index( get_max_index() );
}
void set_col( const column& col ) {
clear();
- add_column( col );
+ add_col( col );
}
void get_col( column& col ) {
col.clear();
- get_column_and_clear( col );
- add_column( col );
+ get_col_and_clear( col );
+ add_col( col );
}
};