Skip to content

Commit 98c27ec

Browse files
style: pre-commit fixes
1 parent 4a2f250 commit 98c27ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2291
-2282
lines changed

.vscode/c_cpp_properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
}
2525
],
2626
"version": 4
27-
}
27+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@
7171
"valarray": "cpp",
7272
"variant": "cpp"
7373
}
74-
}
74+
}

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ find_package(pybind11 CONFIG REQUIRED)
1111
# Include the include/barry library
1212
include_directories(include/barry)
1313

14-
python_add_library(_core MODULE src/main.cpp src/terms.cpp src/model.cpp WITH_SOABI)
14+
python_add_library(_core MODULE src/main.cpp src/terms.cpp src/model.cpp
15+
WITH_SOABI)
1516
target_link_libraries(_core PRIVATE pybind11::headers)
1617
target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION})
1718

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build:
2-
pip3 install .
3-
2+
pip3 install .
3+
44
update:
5-
rsync -avz ../barry/include/barry include/
5+
rsync -avz ../barry/include/barry include/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ m.term_formula(obj, "{y0}")
6666
m.term_formula(obj, "{y1}")
6767
m.term_formula(obj, "{0y0, y1}")
6868
obj.init()
69-
obj.print()
69+
obj.print()
7070
```
7171

7272
Num. of Arrays : 6

README.qmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ERGMs. More information in [this preprint](https://arxiv.org/abs/2211.00627).
4242
- `pip install ./pydefm`
4343

4444

45-
# Examples
45+
# Examples
4646

4747
## Base setup
4848

@@ -64,7 +64,7 @@ x = np.array([1, 2.0, 3.4, 3, 1, 2])
6464
id = np.array([1, 1, 1, 2, 2, 2])
6565
```
6666

67-
Once we have the needed data -- the binary array `y`, the covariates `x` and the ids `id` -- we can create a `defm` object.
67+
Once we have the needed data -- the binary array `y`, the covariates `x` and the ids `id` -- we can create a `defm` object.
6868

6969
```{python}
7070
# Creating the object
@@ -83,7 +83,7 @@ m.term_formula(obj, "{y0}")
8383
m.term_formula(obj, "{y1}")
8484
m.term_formula(obj, "{0y0, y1}")
8585
obj.init()
86-
obj.print()
86+
obj.print()
8787
```
8888

8989
```{python}
@@ -122,4 +122,4 @@ m.simulate(obj, par)
122122

123123
# Acknowledgements
124124

125-
This port work was supported by the Office of the Assistant Secretary of Defense for Health Affairs through the Epilepsy Research Program under Award No. HT94252310221. Opinions, interpretations, conclusions, and recommendations are those of the author and are not necessarily endorsed by the Department of Defense.
125+
This port work was supported by the Office of the Assistant Secretary of Defense for Health Affairs through the Epilepsy Research Program under Award No. HT94252310221. Opinions, interpretations, conclusions, and recommendations are those of the author and are not necessarily endorsed by the Department of Defense.

include/barry/barray-bones.hpp

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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

1010
template<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

4545
public:
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
// */

include/barry/barray-iterator.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@
33
// #include "typedefs.hpp"
44
// #include "barray-bones.hpp"
55

6-
#ifndef BARRAY_ITERATOR_HPP
6+
#ifndef BARRAY_ITERATOR_HPP
77
#define BARRAY_ITERATOR_HPP 1
88

99
template<typename Cell_Type, typename Data_Type>
1010
class ConstBArrayRowIter {
1111
public:
12-
12+
1313
size_t current_row, current_col;
1414
typename Row_type<Cell_Type>::const_iterator iter;
1515
const BArray<Cell_Type,Data_Type> * Array;
16-
16+
1717
ConstBArrayRowIter(const BArray<Cell_Type,Data_Type> * Array_) : Array(Array_) {
18-
18+
1919
// Finding the first entry of the iterator
2020
for (size_t i = 0u; i < Array->nrow(); ++i)
2121
if (A_ROW(i).size() != 0u) {
2222
iter = A_ROW(i).begin();
2323
break;
2424
}
25-
25+
2626
return;
2727

2828
};
2929
~ConstBArrayRowIter() {};
30-
30+
3131
// operat
32-
32+
3333
};
3434

3535
#endif

include/barry/barray-meat-operators.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ BARRAY_TEMPLATE(BARRAY_TYPE()&, operator+=) (
3535

3636
// Must be compatible
3737
checkdim_(*this, rhs);
38-
38+
3939
for (size_t i = 0u; i < nrow(); ++i)
4040
for (size_t j = 0u; j < ncol(); ++j)
4141
this->operator()(i, j) += rhs.get_cell(i, j);
@@ -62,7 +62,7 @@ BARRAY_TEMPLATE(BARRAY_TYPE()&, operator-=) (
6262

6363
// Must be compatible
6464
checkdim_(*this, rhs);
65-
65+
6666
for (size_t i = 0u; i < nrow(); ++i) {
6767
for (size_t j = 0u; j < ncol(); ++j) {
6868
this->operator()(i, j) -= rhs.get_cell(i, j);
@@ -126,4 +126,4 @@ BARRAY_TEMPLATE(BARRAY_TYPE()&, operator/=) (
126126
#undef ROW
127127
#undef COL
128128

129-
#endif
129+
#endif

0 commit comments

Comments
 (0)