Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hrue committed Dec 7, 2024
1 parent 7ec519f commit faa7567
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion gmrflib/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,6 @@ int GMRFLib_graph_union(GMRFLib_graph_tp **union_graph, GMRFLib_graph_tp **graph
GMRFLib_ged_insert_graph(ged, graph_array[i], 0);
}
GMRFLib_ged_build(union_graph, ged);
GMRFLib_graph_prepare(*union_graph);
GMRFLib_ged_free(ged);

return GMRFLib_SUCCESS;
Expand Down
12 changes: 10 additions & 2 deletions gmrflib/pre-opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,11 @@ int GMRFLib_preopt_init(GMRFLib_preopt_tp **preopt, int npred, int nf, int **c,
GMRFLib_idxval_free(ivs[k]);
}

GMRFLib_idxval_to_matrix(&((*preopt)->A), A_idxval, npred, N, nt);
SHOW_TIME("A_idxval");

GMRFLib_idxval_to_matrix(&((*preopt)->A), A_idxval, npred, N, nt);
SHOW_TIME("A_idxval to matrix");

// need also At_.. below, if (pA)
At_idxval = GMRFLib_idxval_ncreate_x(N, nf + nbeta, nt);
if (0) {
Expand Down Expand Up @@ -679,6 +681,7 @@ int GMRFLib_preopt_init(GMRFLib_preopt_tp **preopt, int npred, int nf, int **c,
GMRFLib_ged_build(&g, ged);
GMRFLib_ged_free(ged);
assert(g->n == gen_len_At);

SHOW_TIME("like graph-2");

AtA_idxval = Calloc(gen_len_At, GMRFLib_idxval_tp **);
Expand Down Expand Up @@ -710,6 +713,7 @@ int GMRFLib_preopt_init(GMRFLib_preopt_tp **preopt, int npred, int nf, int **c,
}
}
}

SHOW_TIME("AtA_idxval");

if (debug_detailed) {
Expand All @@ -734,6 +738,7 @@ int GMRFLib_preopt_init(GMRFLib_preopt_tp **preopt, int npred, int nf, int **c,
}
}
}

#pragma omp parallel for num_threads(nt)
for (int i = 0; i < g->n; i++) {
GMRFLib_idxval_prepare(AtA_idxval[i], 1 + g->lnnbs[i], 1);
Expand Down Expand Up @@ -767,10 +772,13 @@ int GMRFLib_preopt_init(GMRFLib_preopt_tp **preopt, int npred, int nf, int **c,
GMRFLib_graph_tp *g_arr[2];
g_arr[0] = (*preopt)->latent_graph;
g_arr[1] = (*preopt)->like_graph;
GMRFLib_graph_union(&((*preopt)->preopt_graph), g_arr, 2);

SHOW_TIME("admin-2");

GMRFLib_graph_union(&((*preopt)->preopt_graph), g_arr, 2);

SHOW_TIME("graph-union");

#if !defined(WINDOWS)
if (getenv("INLA_INTERNAL_DUMP_GRAPH")) {
static int count = 0;
Expand Down

0 comments on commit faa7567

Please sign in to comment.