
Matrices and Sets of Linear Equations 245
41 display_mat(ga);
42 /
*
Compute scalar multiplication of matrix ga
*
/
43 gsl_matrix_scale (ga, x);
44 printf("\nMatrix ga after scalar mul: \n");
45 display_mat(ga);
46 /
*
matrix element multiplication and div of ga and gb
*
/
47 gsl_matrix_mul_elements (ga, gb);
48 gsl_matrix_div_elements (ga, gb);
49 printf("\nMatrix ga after matrix element mul and div: \n");
50 display_mat(ga);
51 return 0;
52 } // end main
53 void display_mat(gsl_matrix
*
gslmat) {
54 int m = gslmat->size1; // get number of rows
55 int n = gslmat->size2; // get number of cols
56 int i, j;
57 double val;
58 for (i = 0; i < m; i++) {
59 for (j = 0; j <