summaryrefslogtreecommitdiff
path: root/src/Bitmap_cubical_complex
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-12-22 07:57:35 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-12-22 07:57:35 +0000
commit5eae3bbe5c06a3b601b885ea9f2561743f4aeb1a (patch)
treeb69392275e34631adad7ac3f8c428b7d0d18eaed /src/Bitmap_cubical_complex
parentfd41fbbb321b36c143129b5a311e015bf7c44a6f (diff)
Changes according to Marc's comments from 18 December.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bitmap@947 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3afdd0423f3b36d8103360ef11fbb5f1c9a348a5
Diffstat (limited to 'src/Bitmap_cubical_complex')
-rw-r--r--src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp2
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h90
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h6
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h163
4 files changed, 93 insertions, 168 deletions
diff --git a/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp b/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
index 60cfc113..36c22344 100644
--- a/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
+++ b/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
@@ -85,7 +85,7 @@ The program will create random cubical complex of that sizes and compute persist
stringstream ss;
ss << "randomComplex_persistence";
- std::ofstream out((char*)ss.str().c_str());
+ std::ofstream out(ss.str().c_str());
pcoh.output_diagram(out);
out.close();
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
index b8887e71..c082caba 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
@@ -45,7 +45,6 @@ public:
//*********************************************//
//Typedefs and typenames
//*********************************************//
- friend class Simplex_handle;
typedef size_t Simplex_key;
typedef T Filtration_value;
typedef Simplex_key Simplex_handle;
@@ -83,7 +82,7 @@ public:
* in the following directions and vector of element of a type T
* with filtration on top dimensional cells.
**/
- Bitmap_cubical_complex( std::vector<unsigned>& dimensions , std::vector<T>& top_dimensional_cells ):
+ Bitmap_cubical_complex( const std::vector<unsigned>& dimensions , const std::vector<T>& top_dimensional_cells ):
Bitmap_cubical_complex_base<T>(dimensions,top_dimensional_cells),
key_associated_to_simplex(this->total_number_of_cells+1)
{
@@ -114,7 +113,7 @@ public:
static Simplex_handle null_simplex()
{
if ( globalDbg ){cerr << "Simplex_handle null_simplex()\n";}
- return std::numeric_limits<int>::max();
+ return std::numeric_limits<Simplex_handle>::max();
}
@@ -129,22 +128,22 @@ public:
/**
* Return dimension of a cell pointed by the Simplex_handle.
**/
- inline unsigned dimension(const Simplex_handle& sh)const
+ inline unsigned dimension(Simplex_handle sh)const
{
if ( globalDbg ){cerr << "unsigned dimension(const Simplex_handle& sh)\n";}
- if ( sh != std::numeric_limits<int>::max() ) return this->get_dimension_of_a_cell( sh );
+ if ( sh != std::numeric_limits<Simplex_handle>::max() ) return this->get_dimension_of_a_cell( sh );
return -1;
}
/**
* Return the filtration of a cell pointed by the Simplex_handle.
**/
- T filtration(const Simplex_handle& sh)
+ T filtration(Simplex_handle sh)
{
if ( globalDbg ){cerr << "T filtration(const Simplex_handle& sh)\n";}
//Returns the filtration value of a simplex.
- if ( sh != std::numeric_limits<int>::max() ) return this->data[sh];
- return std::numeric_limits<int>::max();
+ if ( sh != std::numeric_limits<Simplex_handle>::max() ) return this->data[sh];
+ return std::numeric_limits<Simplex_handle>::max();
}
/**
@@ -153,16 +152,16 @@ public:
static Simplex_key null_key()
{
if ( globalDbg ){cerr << "Simplex_key null_key()\n";}
- return std::numeric_limits<int>::max();
+ return std::numeric_limits<Simplex_handle>::max();
}
/**
* Return the key of a cube pointed by the Simplex_handle.
**/
- Simplex_key key(const Simplex_handle& sh)const
+ Simplex_key key(Simplex_handle sh)const
{
if ( globalDbg ){cerr << "Simplex_key key(const Simplex_handle& sh)\n";}
- if ( sh != std::numeric_limits<int>::max() )
+ if ( sh != std::numeric_limits<Simplex_handle>::max() )
{
return this->key_associated_to_simplex[sh];
}
@@ -175,7 +174,7 @@ public:
Simplex_handle simplex(Simplex_key key)
{
if ( globalDbg ){cerr << "Simplex_handle simplex(Simplex_key key)\n";}
- if ( key != std::numeric_limits<int>::max() )
+ if ( key != std::numeric_limits<Simplex_handle>::max() )
{
return this->simplex_associated_to_key[ key ];
}
@@ -185,23 +184,10 @@ public:
/**
* Assign key to a cube pointed by the Simplex_handle
**/
- void assign_key(Simplex_handle& sh, Simplex_key key)
+ void assign_key(Simplex_handle sh, Simplex_key key)
{
if ( globalDbg ){cerr << "void assign_key(Simplex_handle& sh, Simplex_key key)\n";}
-
-
-
-
-
-
-
-
-if ( key == std::numeric_limits<int>::max() ) return;//TODO FAKE!!! CHEATING!!!
-
-
-
-
-
+ if ( key == std::numeric_limits<Simplex_handle>::max() ) return;
this->key_associated_to_simplex[sh] = key;
this->simplex_associated_to_key[key] = sh;
}
@@ -222,33 +208,9 @@ if ( key == std::numeric_limits<int>::max() ) return;//TODO FAKE!!! CHEATING!!!
/**
* Boundary_simplex_range class provides ranges for boundary iterators.
**/
- typedef typename std::vector< Simplex_handle >::iterator Boundary_simplex_iterator;
- class Boundary_simplex_range
- {
- //Range giving access to the simplices in the boundary of a simplex.
- //.begin() and .end() return type Boundary_simplex_iterator.
- public:
- typedef Boundary_simplex_iterator const_iterator;
- Boundary_simplex_range(const Simplex_handle& sh , Bitmap_cubical_complex<T>* CC_):sh(sh),CC(CC_)
- {
- this->boundary_elements = this->CC->get_boundary_of_a_cell( sh );
- }
- Boundary_simplex_iterator begin()
- {
- if ( globalDbg ){cerr << "Boundary_simplex_iterator begin\n";}
- return this->boundary_elements.begin();
+ typedef typename std::vector< Simplex_handle >::iterator Boundary_simplex_iterator;
+ typedef typename std::vector< Simplex_handle > Boundary_simplex_range;
- }
- Boundary_simplex_iterator end()
- {
- if ( globalDbg ){cerr << "Boundary_simplex_iterator end()\n";}
- return this->boundary_elements.end();
- }
- private:
- Simplex_handle sh;
- Bitmap_cubical_complex<T>* CC;
- std::vector< Simplex_handle > boundary_elements;
- };
/**
@@ -341,13 +303,10 @@ if ( key == std::numeric_limits<int>::max() ) return;//TODO FAKE!!! CHEATING!!!
/**
* boundary_simplex_range creates an object of a Boundary_simplex_range class
* that provides ranges for the Boundary_simplex_iterator.
- **/
- Boundary_simplex_range boundary_simplex_range(Simplex_handle& sh)
- {
- if ( globalDbg ){cerr << "Boundary_simplex_range boundary_simplex_range(Simplex_handle& sh)\n";}
- //Returns a range giving access to all simplices of the boundary of a simplex,
- //i.e. the set of codimension 1 subsimplices of the Simplex.
- return Boundary_simplex_range(sh,this);
+ **/
+ Boundary_simplex_range boundary_simplex_range(Simplex_handle sh)
+ {
+ return this->get_boundary_of_a_cell(sh);
}
/**
@@ -513,13 +472,12 @@ void Bitmap_cubical_complex<T>::initialize_simplex_associated_to_key()
if ( globalDbg )
{
cerr << "void Bitmap_cubical_complex<T>::initialize_elements_ordered_according_to_filtration() \n";
- }
- std::vector<size_t> data_of_elements_from_bitmap( this->data.size() );
- std::iota (std::begin(data_of_elements_from_bitmap), std::end(data_of_elements_from_bitmap), 0);
- std::sort( data_of_elements_from_bitmap.begin() ,
- data_of_elements_from_bitmap.end() ,
+ }
+ this->simplex_associated_to_key = std::vector<size_t>( this->data.size() );
+ std::iota (std::begin(simplex_associated_to_key), std::end(simplex_associated_to_key), 0);
+ std::sort( simplex_associated_to_key.begin() ,
+ simplex_associated_to_key.end() ,
is_before_in_filtration<T>(this) );
- this->simplex_associated_to_key = data_of_elements_from_bitmap;
}
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h
index 3a17b4a0..c13d96e1 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex/counter.h
@@ -51,7 +51,7 @@ public:
* Constructor of a counter class. It takes only the parameter which is the end value of the counter.
* The default beginning value is a vector of the same length as the endd, filled-in with zeros.
**/
- counter(std::vector<unsigned> const& endd): begin(endd.size(),0), end(endd), current(endd.size(),0){}
+ counter(const std::vector<unsigned>& endd): begin(endd.size(),0), end(endd), current(endd.size(),0){}
//counter(std::vector< int >& endd)
//{
// for ( size_t i = 0 ; i != endd.size() ; ++i )
@@ -67,7 +67,7 @@ public:
* Constructor of a counter class. It takes as the input beginn and end vector.
* It assumes that begin vector is lexicographically below the end vector.
**/
- counter(std::vector< unsigned >& beginn , std::vector< unsigned >& endd):begin(beginn),end(endd),current(endd.size(),0)
+ counter(const std::vector< unsigned >& beginn , const std::vector< unsigned >& endd):begin(beginn),end(endd),current(endd.size(),0)
{
if ( beginn.size() != endd.size() )
throw "In constructor of a counter, begin and end vectors do not have the same size. Program terminate";
@@ -112,7 +112,7 @@ public:
* Its aim is to find an counter corresponding to the element the following
* boundary element is identified with when periodic boundary conditions are imposed.
**/
- std::vector< unsigned > find_opposite( std::vector< bool >& directionsForPeriodicBCond )
+ std::vector< unsigned > find_opposite( const std::vector< bool >& directionsForPeriodicBCond )
{
std::vector< unsigned > result;
for ( size_t i = 0 ; i != this->current.size() ; ++i )
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
index 4e63b9c3..fdc8511c 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
@@ -44,19 +44,19 @@ namespace Cubical_complex
/**
- * This is a class implementing a basic bitmap data structure to store cubical complexes.
+ * This is a class implementing a basic bitmap data structure to store cubical complexes.
* It implements only the most basic subroutines.
- * The idea of the bitmap is the following. Our aim is to have a memory efficient
- * data structure to store d-dimensional cubical complex
+ * The idea of the bitmap is the following. Our aim is to have a memory efficient
+ * data structure to store d-dimensional cubical complex
* C being a cubical decomposition
- * of a rectangular region of a space. This is achieved by storing C as a
- * vector of bits (this is where the name 'bitmap' came from).
+ * of a rectangular region of a space. This is achieved by storing C as a
+ * vector of bits (this is where the name 'bitmap' came from).
* Each cell is represented by a single
- * bit (in case of black and white bitmaps, or by a single element of a type T
- * (here T is a filtration type of a bitmap, typically a double).
+ * bit (in case of black and white bitmaps, or by a single element of a type T
+ * (here T is a filtration type of a bitmap, typically a double).
* All the informations needed for homology and
- * persistent homology computations (like dimension of a cell, boundary and
- * coboundary elements of a cell, are then obtained from the
+ * persistent homology computations (like dimension of a cell, boundary and
+ * coboundary elements of a cell, are then obtained from the
* position of the element in C.
* The default filtration used in this implementation is the lower star filtration.
*/
@@ -65,49 +65,49 @@ class Bitmap_cubical_complex_base
{
public:
/**
- * There are a few constructors of a Bitmap_cubical_complex_base class.
- * First one, that takes vector<unsigned>, creates an empty bitmap of a dimension equal
+ * There are a few constructors of a Bitmap_cubical_complex_base class.
+ * First one, that takes vector<unsigned>, creates an empty bitmap of a dimension equal
* the number of elements in the
* input vector and size in the i-th dimension equal the number in the position i-of the input vector.
*/
- Bitmap_cubical_complex_base( std::vector<unsigned>& sizes );
+ Bitmap_cubical_complex_base( const std::vector<unsigned>& sizes );
/**
- * The second constructor takes as a input a Perseus style file. For more details,
- * please consult the documentations of
+ * The second constructor takes as a input a Perseus style file. For more details,
+ * please consult the documentations of
* Perseus software as well as examples attached to this
* implementation.
**/
Bitmap_cubical_complex_base( const char* perseus_style_file );
/**
- * The last constructor of a Bitmap_cubical_complex_base class accepts vector of dimensions (as the first one)
+ * The last constructor of a Bitmap_cubical_complex_base class accepts vector of dimensions (as the first one)
* together with vector of filtration values of top dimensional cells.
**/
- Bitmap_cubical_complex_base( std::vector<unsigned>& dimensions , const std::vector<T>& top_dimensional_cells );
+ Bitmap_cubical_complex_base( const std::vector<unsigned>& dimensions , const std::vector<T>& top_dimensional_cells );
/**
- * The functions get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell
- * and get_cell_data are the basic
+ * The functions get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell
+ * and get_cell_data are the basic
* functions that compute boundary / coboundary / dimension and the filtration
- * value form a position of a cell in the structure of a bitmap. The input parameter of all of those function is a
+ * value form a position of a cell in the structure of a bitmap. The input parameter of all of those function is a
* non-negative integer, indicating a position of a cube in the data structure.
- * In the case of functions that compute (co)boundary, the output is a vector if non-negative integers pointing to
+ * In the case of functions that compute (co)boundary, the output is a vector if non-negative integers pointing to
* the positions of (co)boundary element of the input cell.
*/
inline std::vector< size_t > get_boundary_of_a_cell( size_t cell )const;
/**
- * The functions get_coboundary_of_a_cell, get_coboundary_of_a_cell,
- * get_dimension_of_a_cell and get_cell_data are the basic
+ * The functions get_coboundary_of_a_cell, get_coboundary_of_a_cell,
+ * get_dimension_of_a_cell and get_cell_data are the basic
* functions that compute boundary / coboundary / dimension and the filtration
- * value form a position of a cell in the structure of a bitmap.
- * The input parameter of all of those function is a non-negative integer,
+ * value form a position of a cell in the structure of a bitmap.
+ * The input parameter of all of those function is a non-negative integer,
* indicating a position of a cube in the data structure.
- * In the case of functions that compute (co)boundary, the output is a vector if
- * non-negative integers pointing to the
+ * In the case of functions that compute (co)boundary, the output is a vector if
+ * non-negative integers pointing to the
* positions of (co)boundary element of the input cell.
**/
inline std::vector< size_t > get_coboundary_of_a_cell( size_t cell )const;
/**
- * In the case of get_dimension_of_a_cell function, the output is a non-negative integer
+ * In the case of get_dimension_of_a_cell function, the output is a non-negative integer
* indicating the dimension of a cell.
**/
inline unsigned get_dimension_of_a_cell( size_t cell )const;
@@ -118,11 +118,11 @@ public:
/**
- * Typical input used to construct a baseBitmap class is a filtration given at the top dimensional cells.
+ * Typical input used to construct a baseBitmap class is a filtration given at the top dimensional cells.
* Then, there are a few ways one can pick the filtration of lower dimensional
- * cells. The most typical one is by so called lower star filtration. This function is always called by any
+ * cells. The most typical one is by so called lower star filtration. This function is always called by any
* constructor which takes the top dimensional cells. If you use such a constructor,
- * then there is no need to call this function. Call it only if you are putting the filtration
+ * then there is no need to call this function. Call it only if you are putting the filtration
* of the cells by your own (for instance by using Top_dimensional_cells_iterator).
**/
void impose_lower_star_filtration();//assume that top dimensional cells are already set.
@@ -149,7 +149,7 @@ public:
//ITERATORS
/**
- * Iterator through all cells in the complex (in order they appear in the structure -- i.e.
+ * Iterator through all cells in the complex (in order they appear in the structure -- i.e.
* in lexicographical order).
**/
typedef typename std::vector< T >::iterator all_cells_iterator;
@@ -174,7 +174,7 @@ public:
}
/**
- * Iterator through top dimensional cells of the complex. The cells appear in order they are stored
+ * Iterator through top dimensional cells of the complex. The cells appear in order they are stored
* in the structure (i.e. in lexicographical order)
**/
class Top_dimensional_cells_iterator : std::iterator< std::input_iterator_tag, double >
@@ -184,7 +184,7 @@ public:
{
this->counter = std::vector<size_t>(b.dimension());
std::fill( this->counter.begin() , this->counter.end() , 0 );
- }
+ }
Top_dimensional_cells_iterator operator++()
{
//first find first element of the counter that can be increased:
@@ -298,7 +298,7 @@ protected:
std::vector<unsigned> multipliers;
std::vector<T> data;
size_t total_number_of_cells;
- void set_up_containers( std::vector<unsigned>& sizes )
+ void set_up_containers( const std::vector<unsigned>& sizes )
{
unsigned multiplier = 1;
for ( size_t i = 0 ; i != sizes.size() ; ++i )
@@ -315,7 +315,7 @@ protected:
this->data = data;
}
- size_t compute_position_in_bitmap( std::vector< unsigned >& counter )
+ size_t compute_position_in_bitmap( const std::vector< unsigned >& counter )
{
size_t position = 0;
for ( size_t i = 0 ; i != this->multipliers.size() ; ++i )
@@ -337,9 +337,9 @@ protected:
return counter;
}
- std::vector< size_t >
+ std::vector< size_t >
generate_vector_of_shifts_for_bitmaps_with_periodic_boundary_conditions
- ( std::vector< bool >& directions_for_periodic_b_cond );
+ ( const std::vector< bool >& directions_for_periodic_b_cond );
};
@@ -348,7 +348,7 @@ protected:
template <typename K>
ostream& operator << ( ostream & out , const Bitmap_cubical_complex_base<K>& b )
{
- for ( typename Bitmap_cubical_complex_base<K>::all_cells_const_iterator
+ for ( typename Bitmap_cubical_complex_base<K>::all_cells_const_iterator
it = b.all_cells_const_begin() ; it != b.all_cells_const_end() ; ++it )
{
out << *it << " ";
@@ -359,14 +359,14 @@ ostream& operator << ( ostream & out , const Bitmap_cubical_complex_base<K>& b )
template <typename T>
Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base
-( std::vector<unsigned>& sizes )
+( const std::vector<unsigned>& sizes )
{
this->set_up_containers( sizes );
}
template <typename T>
Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base
-( std::vector<unsigned>& sizes_in_following_directions , const std::vector<T>& top_dimensional_cells )
+( const std::vector<unsigned>& sizes_in_following_directions , const std::vector<T>& top_dimensional_cells )
{
this->set_up_containers( sizes_in_following_directions );
@@ -377,7 +377,7 @@ Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base
}
if ( number_of_top_dimensional_elements != top_dimensional_cells.size() )
{
- cerr <<
+ cerr <<
"Error in constructor\
Bitmap_cubical_complex_base\
( std::vector<size_t> sizes_in_following_directions , std::vector<float> top_dimensional_cells ).\
@@ -432,10 +432,10 @@ Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base( const char* perseus
inFiltration >> filtrationLevel;
if ( dbg )
{
- cerr << "Cell of an index : "
- << it.compute_index_in_bitmap()
- << " and dimension: "
- << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
+ cerr << "Cell of an index : "
+ << it.compute_index_in_bitmap()
+ << " and dimension: "
+ << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
<< " get the value : " << filtrationLevel << endl;
}
*it = filtrationLevel;
@@ -449,51 +449,18 @@ Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base( const char* perseus
template <typename T>
std::vector< size_t > Bitmap_cubical_complex_base<T>::get_boundary_of_a_cell( size_t cell )const
{
- bool bdg = false;
- //first of all, we need to take the list of coordinates in which the cell has nonzero length.
- //We do it by using modified version to compute dimension of a cell:
- std::vector< unsigned > dimensions_in_which_cell_has_nonzero_length;
- unsigned dimension = 0;
+ std::vector< size_t > boundary_elements;
size_t cell1 = cell;
for ( size_t i = this->multipliers.size() ; i != 0 ; --i )
{
unsigned position = cell1/multipliers[i-1];
if ( position%2 == 1 )
- {
- dimensions_in_which_cell_has_nonzero_length.push_back(i-1);
- dimension++;
+ {
+ boundary_elements.push_back( cell - multipliers[ i-1 ] );
+ boundary_elements.push_back( cell + multipliers[ i-1 ] );
}
cell1 = cell1%multipliers[i-1];
}
-
- if (bdg)
- {
- cerr << "dimensions_in_which_cell_has_nonzero_length : \n";
- for ( size_t i = 0 ; i != dimensions_in_which_cell_has_nonzero_length.size() ; ++i )
- {
- cerr << dimensions_in_which_cell_has_nonzero_length[i] << endl;
- }
- getchar();
- }
-
- std::vector< size_t > boundary_elements( 2*dimensions_in_which_cell_has_nonzero_length.size() );
- if ( dimensions_in_which_cell_has_nonzero_length.size() == 0 )return boundary_elements;
- for ( size_t i = 0 ; i != dimensions_in_which_cell_has_nonzero_length.size() ; ++i )
- {
- //boundary_elements.push_back( cell - multipliers[ dimensions_in_which_cell_has_nonzero_length[i] ] );
- //boundary_elements.push_back( cell + multipliers[ dimensions_in_which_cell_has_nonzero_length[i] ] );
- boundary_elements[2*i] = cell - multipliers[ dimensions_in_which_cell_has_nonzero_length[i] ];
- boundary_elements[2*i+1] = cell + multipliers[ dimensions_in_which_cell_has_nonzero_length[i] ];
-
-
-
- if (bdg) cerr << "multipliers[dimensions_in_which_cell_has_nonzero_length[i]] : "
- << multipliers[dimensions_in_which_cell_has_nonzero_length[i]] << endl;
- if (bdg) cerr << "cell - multipliers[dimensions_in_which_cell_has_nonzero_length[i]] : "
- << cell - multipliers[dimensions_in_which_cell_has_nonzero_length[i]] << endl;
- if (bdg) cerr << "cell + multipliers[dimensions_in_which_cell_has_nonzero_length[i]] : "
- << cell + multipliers[dimensions_in_which_cell_has_nonzero_length[i]] << endl;
- }
return boundary_elements;
}
@@ -504,7 +471,7 @@ template <typename T>
std::vector< size_t > Bitmap_cubical_complex_base<T>::get_coboundary_of_a_cell( size_t cell )const
{
bool bdg = false;
- //first of all, we need to take the list of coordinates in which the cell has nonzero length.
+ //first of all, we need to take the list of coordinates in which the cell has nonzero length.
//We do it by using modified version to compute dimension of a cell:
std::vector< unsigned > dimensions_in_which_cell_has_zero_length;
unsigned dimension = 0;
@@ -547,20 +514,20 @@ std::vector< size_t > Bitmap_cubical_complex_base<T>::get_coboundary_of_a_cell(
cerr << "Dimension : " << i << endl;
if (counter[dimensions_in_which_cell_has_zero_length[i]] == 0)
{
- cerr << "In dimension : " << i
+ cerr << "In dimension : " << i
<< " we cannot substract, since we will jump out of a Bitmap_cubical_complex_base \n";
}
- if ( counter[dimensions_in_which_cell_has_zero_length[i]]
- ==
+ if ( counter[dimensions_in_which_cell_has_zero_length[i]]
+ ==
2*this->sizes[dimensions_in_which_cell_has_zero_length[i]] )
{
- cerr << "In dimension : " << i
+ cerr << "In dimension : " << i
<< " we cannot substract, since we will jump out of a Bitmap_cubical_complex_base \n";
}
}
- if ( (cell > multipliers[dimensions_in_which_cell_has_zero_length[i]])
+ if ( (cell > multipliers[dimensions_in_which_cell_has_zero_length[i]])
&& (counter[dimensions_in_which_cell_has_zero_length[i]] != 0) )
//if ( counter[dimensions_in_which_cell_has_zero_length[i]] != 0 )
{
@@ -570,13 +537,13 @@ std::vector< size_t > Bitmap_cubical_complex_base<T>::get_coboundary_of_a_cell(
}
coboundary_elements.push_back( cell - multipliers[dimensions_in_which_cell_has_zero_length[i]] );
}
- if (
- (cell + multipliers[dimensions_in_which_cell_has_zero_length[i]] < this->data.size()) &&
- (counter[dimensions_in_which_cell_has_zero_length[i]]
- !=
- 2*this->sizes[dimensions_in_which_cell_has_zero_length[i]])
+ if (
+ (cell + multipliers[dimensions_in_which_cell_has_zero_length[i]] < this->data.size()) &&
+ (counter[dimensions_in_which_cell_has_zero_length[i]]
+ !=
+ 2*this->sizes[dimensions_in_which_cell_has_zero_length[i]])
)
- //if ( counter[dimensions_in_which_cell_has_zero_length[i]] !=
+ //if ( counter[dimensions_in_which_cell_has_zero_length[i]] !=
//2*this->sizes[dimensions_in_which_cell_has_zero_length[i]] )
{
coboundary_elements.push_back( cell + multipliers[dimensions_in_which_cell_has_zero_length[i]] );
@@ -629,12 +596,12 @@ void Bitmap_cubical_complex_base<T>::impose_lower_star_filtration()
{
bool dbg = false;
- //this vector will be used to check which elements have already been taken care of
+ //this vector will be used to check which elements have already been taken care of
//in imposing lower star filtration:
std::vector<bool> is_this_cell_considered( this->data.size() , false );
std::vector<size_t> indices_to_consider;
- //we assume here that we already have a filtration on the top dimensional cells and
+ //we assume here that we already have a filtration on the top dimensional cells and
//we have to extend it to lower ones.
typename Bitmap_cubical_complex_base<T>::Top_dimensional_cells_iterator it(*this);
for ( it = this->top_dimensional_cells_begin() ; it != this->top_dimensional_cells_end() ; ++it )
@@ -699,7 +666,7 @@ bool compareFirstElementsOfTuples( const std::pair< std::pair< T , size_t > , ch
template <typename T>
std::vector< size_t > Bitmap_cubical_complex_base<T>::
generate_vector_of_shifts_for_bitmaps_with_periodic_boundary_conditions
-( std::vector< bool >& directions_for_periodic_b_cond )
+( const std::vector< bool >& directions_for_periodic_b_cond )
{
bool dbg = false;
if ( this->sizes.size() != directions_for_periodic_b_cond.size() )
@@ -758,4 +725,4 @@ generate_vector_of_shifts_for_bitmaps_with_periodic_boundary_conditions
}
-} \ No newline at end of file
+}