41 G_message(
_(
"Starting direct gauss elimination solver"));
69 G_message(
_(
"Starting direct lu decomposition solver"));
79#pragma omp for schedule(static) private(i)
80 for (i = 0; i < rows; i++) {
90#pragma omp for schedule(static) private(i)
91 for (i = 0; i < rows; i++) {
125 G_message(
_(
"Starting cholesky decomposition solver"));
128 G_warning(
_(
"Unable to solve the linear equation system"));
156 for (k = 0; k < rows - 1; k++) {
157#pragma omp parallel for schedule(static) private(i, j, tmpval) \
158 shared(k, A, b, rows)
159 for (i = k + 1; i < rows; i++) {
160 tmpval = A[i][k] / A[k][k];
162 for (
j = k + 1;
j < rows;
j++) {
188 for (k = 0; k < rows - 1; k++) {
189#pragma omp parallel for schedule(static) private(i, j) shared(k, A, rows)
190 for (i = k + 1; i < rows; i++) {
191 A[i][k] = A[i][k] / A[k][k];
192 for (
j = k + 1;
j < rows;
j++) {
193 A[i][
j] = A[i][
j] - A[i][k] * A[k][
j];
217 int i = 0,
j = 0, k = 0;
230 for (k = 0; k < rows; k++) {
231#pragma omp parallel for schedule(static) private(i, j, sum_2) shared(A, k) \
233 for (
j = 0;
j < k;
j++) {
237 if (0 > (A[k][k] -
sum_1)) {
238 G_warning(
"Matrix is not positive definite. break.");
251#pragma omp parallel for schedule(static) private(i, j, sum_2) \
252 shared(A, k, sum_1, colsize)
254 for (i = k + 1; i <
colsize; i++) {
256 for (
j = 0;
j < k;
j++) {
259 A[i][k] = (A[i][k] -
sum_2) / A[k][k];
263#pragma omp parallel for schedule(static) private(i, k) shared(A, rows)
264 for (k = 0; k < rows; k++) {
265 for (i = k + 1; i < rows; i++) {
287 for (i = rows - 1; i >= 0; i--) {
288 for (
j = i + 1;
j < rows;
j++) {
289 b[i] =
b[i] - A[i][
j] *
x[
j];
291 x[i] = (
b[i]) / A[i][i];
313 for (i = 0; i < rows; i++) {
315 for (
j = 0;
j < i;
j++) {
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
void G_message(const char *,...) __attribute__((format(printf
double * G_alloc_vector(size_t)
Vector matrix memory allocation.
#define G_UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int G_math_solver_lu(double **A, double *x, double *b, int rows)
The LU solver for quardatic matrices.
void G_math_lu_decomposition(double **A, double *b, int rows)
lu decomposition
int G_math_solver_gauss(double **A, double *x, double *b, int rows)
The gauss elimination solver for quardatic matrices.
void G_math_forward_substitution(double **A, double *x, double *b, int rows)
forward substitution
int G_math_solver_cholesky(double **A, double *x, double *b, int bandwidth, int rows)
The choleksy decomposition solver for quardatic, symmetric positive definite matrices.
void G_math_backward_substitution(double **A, double *x, double *b, int rows)
backward substitution
void G_math_gauss_elimination(double **A, double *b, int rows)
Gauss elimination.
int G_math_cholesky_decomposition(double **A, int rows, int bandwidth)
cholesky decomposition for symmetric, positive definite matrices with bandwidth optimization