Lines Matching full:cols
44 static elem_t* new_matrix(const int rows, const int cols) in new_matrix() argument
47 assert(cols > 0); in new_matrix()
48 return malloc(rows * cols * sizeof(elem_t)); in new_matrix()
58 static void init_matrix(elem_t* const a, const int rows, const int cols) in init_matrix() argument
65 a[i * cols + j] = 1.0 / (1 + abs(i-j)); in init_matrix()
72 const elem_t* const a, const int rows, const int cols) in print_matrix() argument
78 for (j = 0; j < cols; j++) in print_matrix()
80 printf("%g ", a[i * cols + j]); in print_matrix()
158 static void gj(elem_t* const a, const int rows, const int cols) in gj() argument
169 if (a[k * cols + i] > a[j * cols + i]) in gj()
176 for (k = 0; k < cols; k++) in gj()
178 const elem_t t = a[i * cols + k]; in gj()
179 a[i * cols + k] = a[j * cols + k]; in gj()
180 a[j * cols + k] = t; in gj()
184 if (a[i * cols + i] != 0) in gj()
186 for (k = cols - 1; k >= 0; k--) in gj()
188 a[i * cols + k] /= a[i * cols + i]; in gj()
202 const elem_t factor = a[j * cols + i]; in gj()
203 for (k = 0; k < cols; k++) in gj()
205 a[j * cols + k] -= a[i * cols + k] * factor; in gj()
217 const elem_t factor = a[j * cols + i]; in gj()
218 for (k = 0; k < cols; k++) in gj()
220 a[j * cols + k] -= a[i * cols + k] * factor; in gj()