Skip to content

Commit

Permalink
Indent only
Browse files Browse the repository at this point in the history
  • Loading branch information
hrue committed Dec 5, 2024
1 parent 327bea7 commit 03035ed
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 47 deletions.
3 changes: 1 addition & 2 deletions gmrflib/approx-inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -3331,8 +3331,7 @@ GMRFLib_gcpo_groups_tp *GMRFLib_gcpo_build(int thread_id, GMRFLib_ai_store_tp *a
assert(build_ai_store != NULL);

double *isd = Calloc(mnpred, double);
groups = GMRFLib_idxval_ncreate_x(Npred, 1 + IABS((int) gcpo_param->num_level_sets),
GMRFLib_openmp->max_threads_outer);
groups = GMRFLib_idxval_ncreate_x(Npred, 1 + IABS((int) gcpo_param->num_level_sets), GMRFLib_openmp->max_threads_outer);
GMRFLib_ai_add_Qinv_to_ai_store(ai_store);
GMRFLib_ai_add_Qinv_to_ai_store(build_ai_store);

Expand Down
2 changes: 1 addition & 1 deletion gmrflib/domin-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ int GMRFLib_opt_estimate_hessian(double *hessian, double *x, double *log_dens_mo

char first_entry = 1;
int replace_from = -1;
int replace_to = 2*n;
int replace_to = 2 * n;

#pragma omp parallel for num_threads(GMRFLib_openmp->max_threads_outer)
for (int ii = 0; ii < 2 * n + 1; ii++) {
Expand Down
24 changes: 12 additions & 12 deletions gmrflib/fmesher-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,21 +566,21 @@ int GMRFLib_matrix_add_graph_and_hash(GMRFLib_matrix_tp *M, int nt)
map_id_init_hint(M->htable[k], nnbs_r[k] + 1);
}
Free(nnbs_r);

if (nt == 1) {
for (int k = 0; k < M->elems; k++) {
map_id_set(M->htable[M->j[k]], M->i[k], M->values[k]);
}
} else {
int lim[nt+1];
int lim[nt + 1];
lim[0] = 0;
for(int k = 1; k < nt + 1; k++) {
for (int k = 1; k < nt + 1; k++) {
lim[k] = (M->ncol * k) / nt;
}
#pragma omp parallel for num_threads(nt)
for(int kk = 0; kk < nt; kk++) {
for (int kk = 0; kk < nt; kk++) {
int cut_low = lim[kk];
int cut_high = lim[kk+1];
int cut_high = lim[kk + 1];
for (int k = 0; k < M->elems; k++) {
if (cut_low <= M->j[k] && M->j[k] < cut_high) {
map_id_set(M->htable[M->j[k]], M->i[k], M->values[k]);
Expand All @@ -601,15 +601,15 @@ int GMRFLib_matrix_add_graph_and_hash(GMRFLib_matrix_tp *M, int nt)
map_id_set(M->htable[M->i[k]], M->j[k], M->values[k]);
}
} else {
int lim[nt+1];
int lim[nt + 1];
lim[0] = 0;
for(int k = 1; k < nt + 1; k++) {
for (int k = 1; k < nt + 1; k++) {
lim[k] = (M->nrow * k) / nt;
}
#pragma omp parallel for num_threads(nt)
for(int kk = 0; kk < nt; kk++) {
for (int kk = 0; kk < nt; kk++) {
int cut_low = lim[kk];
int cut_high = lim[kk+1];
int cut_high = lim[kk + 1];
for (int k = 0; k < M->elems; k++) {
if (cut_low <= M->i[k] && M->i[k] < cut_high) {
map_id_set(M->htable[M->i[k]], M->j[k], M->values[k]);
Expand Down Expand Up @@ -910,8 +910,8 @@ int GMRFLib_idxval_to_matrix(GMRFLib_matrix_tp **M, GMRFLib_idxval_tp **idxval,
if (nt <= 0) {
nt = GMRFLib_OPENMP_NUM_THREADS_LEVEL();
}
int nelm = 0;

int nelm = 0;
for (int i = 0; i < nrow; i++) {
nelm += idxval[i]->n;
}
Expand All @@ -935,7 +935,7 @@ int GMRFLib_idxval_to_matrix(GMRFLib_matrix_tp **M, GMRFLib_idxval_tp **idxval,
} else {
int *kk = Calloc(nrow, int);
for (int i = 1; i < nrow; i++) {
kk[i] = kk[i-1] + idxval[i-1]->n;
kk[i] = kk[i - 1] + idxval[i - 1]->n;
}
#pragma omp parallel for num_threads(nt)
for (int i = 0; i < nrow; i++) {
Expand Down
44 changes: 22 additions & 22 deletions gmrflib/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,29 +570,29 @@ int *GMRFLib_bsearch(int key, int n, int *array)

int GMRFLib_graph_is_nb_ORIG(int node, int nnode, GMRFLib_graph_tp *graph)
{
int imin, imax;
if (node < nnode) {
imin = node;
imax = nnode;
} else {
imin = nnode;
imax = node;
}

int m = graph->lnnbs[imin];
if (m) {
int *nb = graph->lnbs[imin];
if (imax <= nb[m - 1]) {
return (GMRFLib_bsearch(imax, m, nb) != NULL);
}
}

return 0;
int imin, imax;
if (node < nnode) {
imin = node;
imax = nnode;
} else {
imin = nnode;
imax = node;
}

int m = graph->lnnbs[imin];
if (m) {
int *nb = graph->lnbs[imin];
if (imax <= nb[m - 1]) {
return (GMRFLib_bsearch(imax, m, nb) != NULL);
}
}

return 0;
}

int GMRFLib_graph_is_nb(int node, int nnode, GMRFLib_graph_tp *graph)
{
if (node < nnode) {
if (node < nnode) {
if (graph->lnnbs[node] <= graph->lnnbs[nnode]) {
int m = graph->lnnbs[node];
if (m) {
Expand Down Expand Up @@ -620,7 +620,7 @@ int GMRFLib_graph_is_nb(int node, int nnode, GMRFLib_graph_tp *graph)
}
}

return 0;
return 0;
}

int GMRFLib_graph_is_nb_g_________NOT_IN_USE(int node, int nnode, GMRFLib_graph_tp *graph, int *g)
Expand Down Expand Up @@ -1049,10 +1049,10 @@ int GMRFLib_graph_duplicate(GMRFLib_graph_tp **graph_new, GMRFLib_graph_tp *grap
} else {
int *arr = Calloc(n, int);
for (int i = 1; i < n; i++) {
arr[i] = arr[i-1] + g->nnbs[i-1];
arr[i] = arr[i - 1] + g->nnbs[i - 1];
}
#pragma omp parallel for num_threads(NUM_THREADS_GRAPH(g))
for (int i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
if (g->nnbs[i]) {
hold_idx = arr[i];
g->nbs[i] = &hold[hold_idx];
Expand Down
2 changes: 1 addition & 1 deletion gmrflib/idxval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ int GMRFLib_str_is_member(GMRFLib_str_tp *hold, char *s, int case_sensitive, int
return 0;
}

int (*cmp)(const char *, const char *) =(case_sensitive ? strcmp : strcasecmp);
int (*cmp)(const char *, const char *) = (case_sensitive ? strcmp : strcasecmp);
for (int i = 0; i < hold->n; i++) {
if (cmp(s, hold->str[i]) == 0) {
if (idx_match) {
Expand Down
2 changes: 1 addition & 1 deletion gmrflib/idxval.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ int GMRFLib_idx_uniq(GMRFLib_idx_tp * hold);
int GMRFLib_idxval_add(GMRFLib_idxval_tp ** hold, int idx, double val);
int GMRFLib_idxval_addto(GMRFLib_idxval_tp ** hold, int idx, double val);
int GMRFLib_idxval_create(GMRFLib_idxval_tp ** hold);
int GMRFLib_idxval_create_x(GMRFLib_idxval_tp ** hold, int len);
int GMRFLib_idxval_create_x(GMRFLib_idxval_tp ** hold, int len);
int GMRFLib_idxval_free(GMRFLib_idxval_tp * hold);
int GMRFLib_idxval_info_printf(FILE * fp, GMRFLib_idxval_tp * hold, const char *msg);
int GMRFLib_idxval_nprune(GMRFLib_idxval_tp ** a, int n, int nt);
Expand Down
10 changes: 5 additions & 5 deletions gmrflib/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2111,9 +2111,9 @@ int GMRFLib_is_sorted_ddec_plain(int n, double *a)

int GMRFLib_is_sorted(void *a, size_t n, size_t size, int (*cmp)(const void *, const void *))
{
if((cmp ==(void *) GMRFLib_icmp) && size == sizeof(int)) {
if ( (cmp == (void *) GMRFLib_icmp) && size == sizeof(int)) {
// increasing ints
return GMRFLib_is_sorted_iinc(n,(int *) a);
return GMRFLib_is_sorted_iinc(n, (int *) a);
} else if (cmp == (void *) GMRFLib_icmp_r && size == sizeof(int)) {
// decreasing ints
return GMRFLib_is_sorted_idec(n, (int *) a);
Expand All @@ -2133,15 +2133,15 @@ int GMRFLib_is_sorted(void *a, size_t n, size_t size, int (*cmp)(const void *, c
void GMRFLib_qsort(void *a, size_t n, size_t size, int (*cmp)(const void *, const void *))
{
// sort if not sorted
if(n > 0 && !GMRFLib_is_sorted(a, n, size, cmp)) {
if (n > 0 && !GMRFLib_is_sorted(a, n, size, cmp)) {
QSORT_FUN(a, n, size, cmp);
}
}

void GMRFLib_qsort2(void *x, size_t nmemb, size_t size_x, void *y, size_t size_y, int (*compar)(const void *, const void *))
{
if(!y) {
return (GMRFLib_qsort(x, nmemb, size_x, compar));
if (!y) {
return(GMRFLib_qsort(x, nmemb, size_x, compar));
}

if (nmemb == 0) {
Expand Down
4 changes: 2 additions & 2 deletions inlaprog/src/inla-likelihood.c
Original file line number Diff line number Diff line change
Expand Up @@ -5857,9 +5857,9 @@ int loglikelihood_mix_gaussian(int thread_id, double *__restrict logll, double *

int loglikelihood_mix_core(int thread_id, double *__restrict logll, double *__restrict x, int m, int idx, double *x_vec, double *y_cdf, void *arg,
int (*func_quadrature)(int, double **, double **, int *, void *arg),
int (*func_simpson)(int, double **, double **, int *, void *arg), char **arg_str)
int(*func_simpson)(int, double **, double **, int *, void *arg), char **arg_str)
{
Data_section_tp *ds = (Data_section_tp *) arg;
Data_section_tp *ds =(Data_section_tp *) arg;
if (m == 0) {
if (arg) {
return (ds->mix_loglikelihood(thread_id, NULL, NULL, 0, 0, NULL, NULL, arg, arg_str));
Expand Down
2 changes: 1 addition & 1 deletion inlaprog/src/inla.h
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ int loglikelihood_logperiodogram(int thread_id, double *logll, double *x, int m,
int loglikelihood_mgamma(int thread_id, double *logll, double *x, int m, int idx, double *x_vec, double *y_cdf, void *arg, char **arg_str);
int loglikelihood_mgammasurv(int thread_id, double *logll, double *x, int m, int idx, double *x_vec, double *y_cdf, void *arg, char **arg_str);
int loglikelihood_mix_core(int thread_id, double *logll, double *x, int m, int idx, double *x_vec, double *y_cdf, void *arg,
int (*quadrature)(int, double **, double **, int *, void *), int (*simpson)(int, double **, double **, int *, void *),
int (*quadrature)(int, double **, double **, int *, void *), int(*simpson)(int, double **, double **, int *, void *),
char **arg_str);
int loglikelihood_mix_loggamma(int thread_id, double *logll, double *x, int m, int idx, double *x_vec, double *y_cdf, void *arg, char **arg_str);
int loglikelihood_mix_mloggamma(int thread_id, double *logll, double *x, int m, int idx, double *x_vec, double *y_cdf, void *arg, char **arg_str);
Expand Down

0 comments on commit 03035ed

Please sign in to comment.