Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
709 B
2
Indexable
Never
node_t* initial_node(int m, int n, double** a, double* b, double* c) {
    node_t* p = calloc(1, sizeof(node_t));
    p->a = make_matrix(m+1, n+1);
    p->b = calloc(m+1, sizeof(double));
    p->c = calloc(n+1, sizeof(double));
    p->x = calloc(n+1, sizeof(double));
    p->min = calloc(n, sizeof(double));
    p->max = calloc(n, sizeof(double));
    p->m = m;
    p->n = n;
    p->next = NULL;
    int i, j;
    for(i = 0; i < m; i++) {
        p->b[i] = b[i];
        for(j = 0; j < n + 1; j++) {
            p->a[i][j] = a[i][j];
        }
    }
    for(i = 0; i < n; i++) {
        p->c[i] = c[i];
        p->min[i] = -HUGE_VAL;
        p->max[i] = HUGE_VAL;
    }
    return p;
}