Skip to content

Commit

Permalink
refactor: change c++ to use 2 spaces instead of 4
Browse files Browse the repository at this point in the history
  • Loading branch information
m-muecke committed Sep 6, 2024
1 parent 408de2a commit 3a2cbab
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 201 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ indent_size = 2
indent_size = 4

[*.{cpp,hpp}]
indent_size = 4
indent_size = 2

[{NEWS.md,DESCRIPTION,LICENSE}]
max_line_length = 80
30 changes: 15 additions & 15 deletions src/survival_assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ using namespace Rcpp;

// [[Rcpp::export]]
bool c_assert_surv(const NumericMatrix& mat) {
for (int i = 0; i < mat.nrow(); i++) {
if (mat(i, 0) < 0 || mat(i, 0) > 1) {
// check first element
return false;
}
for (int i = 0; i < mat.nrow(); i++) {
if (mat(i, 0) < 0 || mat(i, 0) > 1) {
// check first element
return false;
}

for (int j = 1; j < mat.ncol(); j++) {
// S(t) in [0,1]
if (mat(i, j) < 0 || mat(i, j) > 1) {
return false;
}
for (int j = 1; j < mat.ncol(); j++) {
// S(t) in [0,1]
if (mat(i, j) < 0 || mat(i, j) > 1) {
return false;
}

// S(t) should not increase!
if (mat(i, j) > mat(i, j - 1)) {
return false;
}
}
// S(t) should not increase!
if (mat(i, j) > mat(i, j - 1)) {
return false;
}
}
}

return true;
}
Loading

0 comments on commit 3a2cbab

Please sign in to comment.