diff --git a/gmrflib/graph.c b/gmrflib/graph.c index 3d04b6e6e..e3d3c3c46 100644 --- a/gmrflib/graph.c +++ b/gmrflib/graph.c @@ -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; diff --git a/gmrflib/pre-opt.c b/gmrflib/pre-opt.c index 9f8d73c64..aefd9a764 100644 --- a/gmrflib/pre-opt.c +++ b/gmrflib/pre-opt.c @@ -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) { @@ -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 **); @@ -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) { @@ -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); @@ -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;