diff options
author | jan.reininghaus@gmail.com <jan.reininghaus@gmail.com@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d> | 2013-05-12 20:42:59 +0000 |
---|---|---|
committer | jan.reininghaus@gmail.com <jan.reininghaus@gmail.com@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d> | 2013-05-12 20:42:59 +0000 |
commit | fb02e45712d44f217dfbd71910ea533894c065e6 (patch) | |
tree | 77928bd2a11345ced14cec6ca9b07086e09948ce /include/phat/representations/vector_set.h | |
parent | 7569a4005dc119d7a62990aeb4abe263716617a5 (diff) |
simplified pivot column representations
git-svn-id: https://phat.googlecode.com/svn/trunk@84 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d
Diffstat (limited to 'include/phat/representations/vector_set.h')
-rw-r--r-- | include/phat/representations/vector_set.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/include/phat/representations/vector_set.h b/include/phat/representations/vector_set.h index dadf1b3..ea6df09 100644 --- a/include/phat/representations/vector_set.h +++ b/include/phat/representations/vector_set.h @@ -24,9 +24,8 @@ namespace phat { class vector_set { protected: - typedef std::set< index > internal_column; std::vector< dimension > dims; - std::vector< internal_column > matrix; + std::vector< std::set< index > > matrix; public: // overall number of cells in boundary_matrix @@ -69,7 +68,7 @@ namespace phat { // removes the maximal index of a column void _remove_max( index idx ) { - internal_column::iterator it = matrix[ idx ].end(); + std::set< index >::iterator it = matrix[ idx ].end(); it--; matrix[ idx ].erase( it ); } @@ -84,17 +83,12 @@ namespace phat { // adds column 'source' to column 'target' void _add_to( index source, index target ) { - for( internal_column::iterator it = matrix[ source ].begin(); it != matrix[ source ].end(); it++ ) - _toggle( target, *it ); - } - - //// toggles given index pair - void _toggle( index col_idx, index row_idx ) { - internal_column& col = matrix[ col_idx ]; - std::pair< internal_column::iterator, bool > result = col.insert( row_idx ); - if( !result.second ) { - col.erase( result.first ); - } + for( std::set< index >::iterator it = matrix[ source ].begin(); it != matrix[ source ].end(); it++ ) { + std::set< index >& col = matrix[ target ]; + std::pair< std::set< index >::iterator, bool > result = col.insert( *it ); + if( !result.second ) + col.erase( result.first ); + } } }; } |