Beispiel #1
0
/*!
  \brief Deallocates a \c GMRFLib_wa_problem_tp -object and it's members, allocated by 
  \c GMRFLib_init_wa_problem.

  \param[in,out] wa_problem A \c GMRFLib_wa_problem_tp -object, allocated by \c
  GMRFLib_init_wa_problem(). At output, \a wa_problem and it's members have been deallocated.

  \note DO NOT USE \c GMRFLib_free_wa_problem() to deallocate a wa-problem created by \c
  GMRFLib_init_nwa_problem(), as the internal data structures are different.

  \sa GMRFLib_init_wa_problem
 */
int GMRFLib_free_wa_problem(GMRFLib_wa_problem_tp *wa_problem)
{
    if (wa_problem)
    {
	int i, n;
	GMRFLib_waQfunc_arg_tp *arg;

	n   = wa_problem->graph->n;
	arg = (GMRFLib_waQfunc_arg_tp *)wa_problem->Qfunc_arg;

	if (arg->neigb_info)
	{
	    for(i=0;i<arg->n_neigb_info;i++)
	    {
		if (arg->neigb_info[i])
		{
		    FREE(arg->neigb_info[i]->node_list);
		    FREE(arg->neigb_info[i]);
		}
	    }
	    FREE(arg->neigb_info);
	    spmatrix_free(&(arg->neigb_idx_hash));
	}
	
	GMRFLib_free_graph(wa_problem->graph);
	GMRFLib_free_graph(arg->waQgraph);
	GMRFLib_free_graph(arg->wagraph);

	FREE(wa_problem->Qfunc_arg);
	FREE(wa_problem);
    }
    return GMRFLib_SUCCESS;
}
Beispiel #2
0
/**
  \brief Free a editable graph-object

  \param[in] ged The editable graph-object to be free'd.

  \sa GMRFLib_ged_init()
 */
int GMRFLib_ged_free(GMRFLib_ged_tp * ged)
{
	spmatrix_free(&(ged->Q));
	map_ii_free(&(ged->tags));
	Free(ged);

	return GMRFLib_SUCCESS;
}