24 G_debug(2,
"G_math_cholesky_sband_decomposition(): n=%d bandwidth=%d",
27 for (i = 0; i < rows; i++) {
31 end = ((bandwidth - 0) < (i + 1) ? (bandwidth - 0) : (i + 1));
32 for (k = 1; k < end; k++)
33 sum -= T[i - k][k] * T[i - k][0 + k];
35 G_fatal_error(
_(
"Decomposition failed at row %i and col %i"), i, 0);
38 #pragma omp parallel for schedule(static) private(j, k, end, sum) \
39 shared(A, T, i, bandwidth)
40 for (j = 1; j < bandwidth; j++) {
42 end = ((bandwidth - j) < (i + 1) ? (bandwidth - j) : (i + 1));
43 for (k = 1; k < end; k++)
44 sum -= T[i - k][k] * T[i - k][j + k];
45 T[i][j] = sum / T[i][0];
95 int rows,
int bandwidth)
101 x[0] =
b[0] / T[0][0];
102 for (i = 1; i < rows; i++) {
105 start = ((i - bandwidth + 1) < 0 ? 0 : (i - bandwidth + 1));
107 for (j = start; j < i; j++)
108 x[i] -= T[j][i - j] *
x[j];
109 x[i] =
x[i] / T[i][0];
113 x[rows - 1] =
x[rows - 1] / T[rows - 1][0];
114 for (i = rows - 2; i >= 0; i--) {
117 end = (rows < (bandwidth + i) ? rows : (bandwidth + i));
118 for (j = i + 1; j < end; j++)
119 x[i] -= T[i][j - i] *
x[j];
120 x[i] =
x[i] / T[i][0];
144 for (i = 0; i < rows; i++) {
145 T[i][0] = 1.0 / T[i][0];
149 for (i = 0; i < rows; i++) {
151 invAdiag[i] = vect[0] * vect[0];
152 for (j = i + 1; j < rows; j++) {
155 start = ((j - bandwidth + 1) < i ? i : (j - bandwidth + 1));
157 for (k = start; k < j; k++) {
158 sum -= vect[k - i] * T[k][j - k];
160 vect[j - i] = sum * T[j][0];
161 invAdiag[i] += vect[j - i] * vect[j - i];
175 double *invAdiag,
int rows,
192 for (i = 0; i < rows; i++) {
193 T[i][0] = 1.0 / T[i][0];
197 for (i = 0; i < rows; i++) {
199 invAdiag[i] = vect[0] * vect[0];
200 for (j = i + 1; j < rows; j++) {
203 start = ((j - bandwidth + 1) < i ? i : (j - bandwidth + 1));
205 for (k = start; k < j; k++) {
206 sum -= vect[k - i] * T[k][j - k];
208 vect[j - i] = sum * T[j][0];
209 invAdiag[i] += vect[j - i] * vect[j - i];
void G_percent(long, long, int)
Print percent complete messages.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void G_free_matrix(double **)
Matrix memory deallocation.
double * G_alloc_vector(size_t)
Vector matrix memory allocation.
double ** G_alloc_matrix(int, int)
Matrix memory allocation.
void G_free_vector(double *)
Vector 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.
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_cholesky_sband_decomposition(double **A, double **T, int rows, int bandwidth)
Cholesky decomposition of a symmetric band matrix.
void G_math_solver_cholesky_sband_invert(double **A, double *x, double *b, double *invAdiag, int rows, int bandwidth)
void G_math_cholesky_sband_invert(double **A, double *invAdiag, int rows, int bandwidth)