int main(int ac, char** av) { grid_t g; gsl_matrix* a; gsl_vector* x; gsl_vector* b; gsl_permutation* p; int s; int i; grid_init_once(&g); alloc_linear_system(&g, &a, &x, &b); generate_a(&g, a); p = gsl_permutation_alloc(a->size1); gsl_linalg_LU_decomp(a, p, &s); for (i = 1; i < ac; ++i) { grid_load_string(&g, av[i]); generate_b(&g, b); gsl_linalg_LU_solve(a, p, b, x); print_vector(x); printf("---\n"); } gsl_permutation_free(p); free_linear_system(a, x, b); return 0; }
static void __attribute__((unused)) generate_ab (const grid_t* g, gsl_matrix* a, gsl_vector* b) { /* generate both a and b matrices */ generate_a(g, a); generate_b(g, b); }
void test_generation_b(size_t m) { size_t b_size = bits_in_number(m); size_t w_size = size_in_words(m); word *b = (word *)malloc(b_size * sizeof(word)); printf("TEST GENERATION B\n"); generate_b(b, m); printBinaryRepresentation2(b, w_size, m + 1); free(b); }