Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / doc / examples / linalglu.c
1 #include <stdio.h>
2 #include <gsl/gsl_linalg.h>
3
4 int
5 main (void)
6 {
7   double a_data[] = { 0.18, 0.60, 0.57, 0.96,
8                       0.41, 0.24, 0.99, 0.58,
9                       0.14, 0.30, 0.97, 0.66,
10                       0.51, 0.13, 0.19, 0.85 };
11
12   double b_data[] = { 1.0, 2.0, 3.0, 4.0 };
13
14   gsl_matrix_view m 
15     = gsl_matrix_view_array (a_data, 4, 4);
16
17   gsl_vector_view b
18     = gsl_vector_view_array (b_data, 4);
19
20   gsl_vector *x = gsl_vector_alloc (4);
21   
22   int s;
23
24   gsl_permutation * p = gsl_permutation_alloc (4);
25
26   gsl_linalg_LU_decomp (&m.matrix, p, &s);
27
28   gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x);
29
30   printf ("x = \n");
31   gsl_vector_fprintf (stdout, x, "%g");
32
33   gsl_permutation_free (p);
34   gsl_vector_free (x);
35   return 0;
36 }