44// #include "cell-bones.hpp"
55// #include "barraycell-bones.hpp"
66
7- #ifndef BARRAY_BONES_HPP
7+ #ifndef BARRAY_BONES_HPP
88#define BARRAY_BONES_HPP 1
99
1010template <typename Cell_Type, typename Data_Type>
@@ -15,7 +15,7 @@ class BArrayCell_const;
1515
1616/* *
1717 * @brief Baseline class for binary arrays.
18- *
18+ *
1919 * `BArray` class objects are arbitrary arrays
2020 * in which non-empty cells hold data of type `Cell_Type`. The non-empty cells
2121 * are stored by row and indexed using `unordered_map`s, i.e.
@@ -43,34 +43,34 @@ class BArray {
4343 static const bool dense = false ;
4444
4545public:
46-
47- /* *
46+
47+ /* *
4848 * This is as a reference, if we need to iterate through the cells and we need
4949 * to keep track which were visited, we use this as a reference. So that if
5050 * cell.visited = true and visited = true, it means that we haven't been here
5151 * yet. Ideally, any routine using this->visited should switch it at the
5252 * beginning of the routine.
5353 */
5454 bool visited = false ;
55-
55+
5656
5757 /* *
5858 * @name Constructors
59- *
59+ *
6060 * @param N_ Number of rows
6161 * @param M_ Number of columns
6262 * @param source An unsigned vector ranging from 0 to N_
6363 * @param target An size_t vector ranging from 0 to M_
6464 * @param target When `true` tries to add repeated observations.
6565 */
6666 // /@{
67-
67+
6868 /* * @brief Zero-size array */
6969 BArray () : N(0u ), M(0u ), NCells(0u ), el_ij(0u ), el_ji(0u ) {};
70-
70+
7171 /* * @brief Empty array */
7272 BArray (size_t N_, size_t M_) : N(N_), M(M_), NCells(0u ), el_ij(N_), el_ji(M_) {};
73-
73+
7474 /* * @brief Edgelist with data */
7575 BArray (
7676 size_t N_, size_t M_,
@@ -79,18 +79,18 @@ class BArray {
7979 const std::vector< Cell_Type > & value,
8080 bool add = true
8181 );
82-
82+
8383 /* * @brief Edgelist with no data (simpler) */
8484 BArray (
8585 size_t N_, size_t M_,
8686 const std::vector< size_t > & source,
8787 const std::vector< size_t > & target,
8888 bool add = true
8989 );
90-
90+
9191 /* * @brief Copy constructor */
9292 BArray (const BArray<Cell_Type,Data_Type> & Array_, bool copy_data = false );
93-
93+
9494 /* * @brief Assignment constructor */
9595 BArray<Cell_Type,Data_Type> & operator =(const BArray<Cell_Type,Data_Type> & Array_);
9696
@@ -100,20 +100,20 @@ class BArray {
100100 /* * @brief Move assignment */
101101 BArray<Cell_Type,Data_Type> & operator =(BArray<Cell_Type,Data_Type> && x) noexcept ;
102102 // /@}
103-
103+
104104 bool operator ==(const BArray<Cell_Type,Data_Type> & Array_);
105105
106106 ~BArray ();
107-
107+
108108 // In principle, copy can be faster by using openmp on the rows
109109 // since those are independent.
110110 // BArray(BArray & A);
111-
111+
112112 /* *
113113 * @brief Set the data object
114- *
115- * @param data_
116- * @param delete_data_
114+ *
115+ * @param data_
116+ * @param delete_data_
117117 */
118118 // /@{
119119 void set_data (Data_Type * data_, bool delete_data_ = false );
@@ -123,11 +123,11 @@ class BArray {
123123 const Data_Type & D () const ;
124124 void flush_data ();
125125 // /@}
126-
126+
127127 // Function to access the elements
128128 // bool check_cell
129129 void out_of_range (size_t i, size_t j) const ;
130- Cell_Type get_cell (size_t i, size_t j, bool check_bounds = true ) const ;
130+ Cell_Type get_cell (size_t i, size_t j, bool check_bounds = true ) const ;
131131 std::vector< Cell_Type > get_col_vec (size_t i, bool check_bounds = true ) const ;
132132 std::vector< Cell_Type > get_row_vec (size_t i, bool check_bounds = true ) const ;
133133 void get_col_vec (std::vector< Cell_Type > * x, size_t i, bool check_bounds = true ) const ;
@@ -137,12 +137,12 @@ class BArray {
137137
138138 /* *
139139 * @brief Get the edgelist
140- *
140+ *
141141 * `Entries` is a class with three objects: Two `std::vector` with the row and
142142 * column coordinates respectively, and one `std::vector` with the corresponding
143143 * value of the cell.
144- *
145- * @return Entries<Cell_Type>
144+ *
145+ * @return Entries<Cell_Type>
146146 */
147147 Entries<Cell_Type> get_entries () const ;
148148
@@ -170,64 +170,64 @@ class BArray {
170170 * delete/add), or, in the case of `swap_cells`, check if either of both
171171 * cells exists/don't exist.
172172 */
173- // /@{
173+ // /@{
174174 BArray<Cell_Type,Data_Type> & operator +=(const std::pair<size_t , size_t > & coords);
175175 BArray<Cell_Type,Data_Type> & operator -=(const std::pair<size_t , size_t > & coords);
176176 BArrayCell<Cell_Type,Data_Type> operator ()(size_t i, size_t j, bool check_bounds = true );
177177 const Cell_Type operator ()(size_t i, size_t j, bool check_bounds = true ) const ;
178-
178+
179179 void rm_cell (size_t i, size_t j, bool check_bounds = true , bool check_exists = true );
180-
180+
181181 void insert_cell (size_t i, size_t j, const Cell< Cell_Type > & v, bool check_bounds, bool check_exists);
182182 void insert_cell (size_t i, size_t j, Cell< Cell_Type > && v, bool check_bounds, bool check_exists);
183183 void insert_cell (size_t i, size_t j, Cell_Type v, bool check_bounds, bool check_exists);
184-
184+
185185 void swap_cells (
186186 size_t i0, size_t j0, size_t i1, size_t j1, bool check_bounds = true ,
187187 int check_exists = CHECK::BOTH,
188188 int * report = nullptr
189189 );
190-
190+
191191 void toggle_cell (size_t i, size_t j, bool check_bounds = true , int check_exists = EXISTS::UKNOWN);
192192 void toggle_lock (size_t i, size_t j, bool check_bounds = true );
193193 // /@}
194-
194+
195195 /* *@name Column/row wise interchange*/
196196 // /@{
197197 void swap_rows (size_t i0, size_t i1, bool check_bounds = true );
198198 void swap_cols (size_t j0, size_t j1, bool check_bounds = true );
199-
199+
200200 void zero_row (size_t i, bool check_bounds = true );
201201 void zero_col (size_t j, bool check_bounds = true );
202202 // /@}
203-
203+
204204 void transpose ();
205205 void clear (bool hard = true );
206206 void resize (size_t N_, size_t M_);
207207 void reserve ();
208208
209209 // Advances operators
210210 // void toggle_iterator
211-
211+
212212 // Misc
213213 void print (const char * fmt = nullptr , ...) const ;
214214 void print_n (size_t nrow, size_t ncol, const char * fmt = nullptr , ...) const ;
215215
216216 /* *
217217 * @name Arithmetic operators
218- *
218+ *
219219 */
220220 // /@{
221221 BArray<Cell_Type,Data_Type>& operator +=(const BArray<Cell_Type,Data_Type>& rhs);
222222 BArray<Cell_Type,Data_Type>& operator +=(const Cell_Type & rhs);
223223
224224 BArray<Cell_Type,Data_Type>& operator -=(const BArray<Cell_Type,Data_Type>& rhs);
225225 BArray<Cell_Type,Data_Type>& operator -=(const Cell_Type & rhs);
226-
226+
227227 BArray<Cell_Type,Data_Type>& operator /=(const Cell_Type & rhs);
228228 BArray<Cell_Type,Data_Type>& operator *=(const Cell_Type & rhs);
229229 // /@}
230-
230+
231231 // /**
232232 // * @name Casting between types
233233 // */
0 commit comments