23 G_debug(2,
"G_math_cholesky_sband_decomposition(): n=%d bandwidth=%d", rows, bandwidth);
25 for (i = 0; i < rows; i++) {
29 end = ((bandwidth - 0) < (i + 1) ? (bandwidth - 0) : (i + 1));
30 for (k = 1; k < end; k++)
31 sum -= T[i - k][k] * T[i - k][0 + k];
33 G_fatal_error(
_(
"Decomposition failed at row %i and col %i"), i, 0);
36 #pragma omp parallel for schedule (static) private(j, k, end, sum) shared(A, T, i, bandwidth) 37 for (j = 1; j < bandwidth; j++) {
39 end = ((bandwidth - j) < (i + 1) ? (bandwidth - j) : (i + 1));
40 for (k = 1; k < end; k++)
41 sum -= T[i - k][k] * T[i - k][j + k];
42 T[i][j] = sum / T[i][0];
93 x[0] = b[0] / T[0][0];
94 for (i = 1; i < rows; i++) {
97 start = ((i - bandwidth + 1) < 0 ? 0 : (i - bandwidth + 1));
99 for (j = start; j < i; j++)
100 x[i] -= T[j][i - j] * x[j];
101 x[i] = x[i] / T[i][0];
105 x[rows - 1] = x[rows - 1] / T[rows - 1][0];
106 for (i = rows - 2; i >= 0; i--) {
109 end = (rows < (bandwidth + i) ? rows : (bandwidth + i));
110 for (j = i + 1; j < end; j++)
111 x[i] -= T[i][j - i] * x[j];
112 x[i] = x[i] / T[i][0];
135 for (i = 0; i < rows; i++) {
136 T[i][0] = 1.0 / T[i][0];
140 for (i = 0; i < rows; i++) {
142 invAdiag[i] = vect[0] * vect[0];
143 for (j = i + 1; j < rows; j++) {
146 start = ((j - bandwidth + 1) < i ? i : (j - bandwidth + 1));
148 for (k = start; k < j; k++) {
149 sum -= vect[k - i] * T[k][j - k];
151 vect[j - i] = sum * T[j][0];
152 invAdiag[i] += vect[j - i] * vect[j - i];
166 int rows,
int bandwidth)
182 for (i = 0; i < rows; i++) {
183 T[i][0] = 1.0 / T[i][0];
187 for (i = 0; i < rows; i++) {
189 invAdiag[i] = vect[0] * vect[0];
190 for (j = i + 1; j < rows; j++) {
193 start = ((j - bandwidth + 1) < i ? i : (j - bandwidth + 1));
195 for (k = start; k < j; k++) {
196 sum -= vect[k - i] * T[k][j - k];
198 vect[j - i] = sum * T[j][0];
199 invAdiag[i] += vect[j - i] * vect[j - i];
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_free_vector(double *)
Vector memory deallocation.
void G_math_cholesky_sband_invert(double **A, double *invAdiag, int rows, int bandwidth)
double ** G_alloc_matrix(int, int)
Matrix memory allocation.
double * G_alloc_vector(size_t)
Vector matrix memory allocation.
void G_math_cholesky_sband_decomposition(double **A, double **T, int rows, int bandwidth)
Cholesky decomposition of a symmetric band matrix.
void G_math_cholesky_sband_substitution(double **T, double *x, double *b, int rows, int bandwidth)
Forward and backward substitution of a lower tringular symmetric band matrix of A from system Ax = b...
void G_math_solver_cholesky_sband_invert(double **A, double *x, double *b, double *invAdiag, int rows, int bandwidth)
void G_percent(long, long, int)
Print percent complete messages.
void G_free_matrix(double **)
Matrix memory deallocation.
void G_math_solver_cholesky_sband(double **A, double *x, double *b, int rows, int bandwidth)
Cholesky symmetric band matrix solver for linear equation systems of type Ax = b. ...
int G_debug(int, const char *,...) __attribute__((format(printf