Пример #1
0
line_trainer_path::~line_trainer_path()
{
    int node_size = phin->node_u->node_size;
    phin = NULL;
    if (expTable != NULL) {free(expTable); expTable = NULL;}
    neg_samples = 0;
    if (dp_cnt != NULL)
    {
        for (int k = 0; k != node_size; k++) if (dp_cnt[k] != NULL)
            free(dp_cnt[k]);
        free(dp_cnt);
        dp_cnt = NULL;
    }
    path.clear();
    path_node.clear();
    path_link.clear();
    path_size = 0;
    if (neg_table != NULL)
    {
        for (int k = 1; k != path_size; k++) if (neg_table[k] != NULL)
            free(neg_table[k]);
        free(neg_table);
        neg_table = NULL;
    }
    if (smp_init != NULL)
    {
        ransampl_free(smp_init);
        smp_init = NULL;
    }
    if (smp_dp != NULL)
    {
        for (int i = 0; i != path_size; i++) for (int j = 0; j != node_size; j++) if (smp_dp[i][j] != NULL)
        {
            ransampl_free(smp_dp[i][j]);
            smp_dp[i][j] = NULL;
        }
        for (int i = 0; i != path_size; i++) {free(smp_dp[i]); smp_dp[i] = NULL;}
        free(smp_dp);
        smp_dp = NULL;
    }
}
Пример #2
0
line_link::~line_link()
{
    node_u = NULL;
    node_v = NULL;
    if (expTable != NULL) {free(expTable); expTable = NULL;}
    if (ws != NULL) {ransampl_free(ws); ws = NULL;}
    edge_cnt = 0;
    if (edge_u != NULL) {free(edge_u); edge_u = NULL;}
    if (edge_v != NULL) {free(edge_v); edge_v = NULL;}
    if (edge_w != NULL) {free(edge_w); edge_w = NULL;}
    link_file[0] = 0;
    if (graph != NULL) {delete [] graph; graph = NULL;}
    
}
Пример #3
0
line_trainer_edge::~line_trainer_edge()
{
    edge_tp = 0;
    phin = NULL;
    if (expTable != NULL) {free(expTable); expTable = NULL;}
    if (u_nb_cnt != NULL) {free(u_nb_cnt); u_nb_cnt = NULL;}
    if (u_nb_id != NULL) {free(u_nb_id); u_nb_id = NULL;}
    if (u_nb_wei != NULL) {free(u_nb_wei); u_nb_wei = NULL;}
    if (u_wei != NULL) {free(u_wei); u_wei = NULL;}
    if (v_wei != NULL) {free(v_wei); v_wei = NULL;}
    if (smp_u != NULL)
    {
        ransampl_free(smp_u);
        smp_u = NULL;
    }
    if (smp_u_nb != NULL)
    {
        free(smp_u_nb);
        smp_u_nb = NULL;
    }
    neg_samples = 0;
    if (neg_table != NULL) {free(neg_table); neg_table = NULL;}
}