20 #include <grass/N_pde.h> 186 "Allocate memory for a sparse linear equation system with %i rows\n",
190 "Allocate memory for a regular linear equation system with %i rows\n",
196 les->
x = (
double *)
G_calloc(cols,
sizeof(
double));
197 for (i = 0; i <
cols; i++)
203 les->
b = (
double *)
G_calloc(cols,
sizeof(
double));
204 for (i = 0; i <
cols; i++)
258 for (i = 0; i < les->
rows; i++) {
259 for (j = 0; j < les->
cols; j++) {
261 for (k = 0; k < les->
Asp[i]->
cols; k++) {
263 fprintf(stdout,
"%4.5f ", les->
Asp[i]->
values[k]);
268 fprintf(stdout,
"%4.5f ", 0.0);
271 fprintf(stdout,
" * %4.5f", les->
x[i]);
273 fprintf(stdout,
" = %4.5f ", les->
b[i]);
275 fprintf(stdout,
"\n");
280 for (i = 0; i < les->
rows; i++) {
281 for (j = 0; j < les->
cols; j++) {
282 fprintf(stdout,
"%4.5f ", les->
A[i][j]);
285 fprintf(stdout,
" * %4.5f", les->
x[i]);
287 fprintf(stdout,
" = %4.5f ", les->
b[i]);
289 fprintf(stdout,
"\n");
307 G_debug(2,
"Releasing memory of a sparse linear equation system\n");
309 G_debug(2,
"Releasing memory of a regular linear equation system\n");
N_les * N_alloc_nquad_les_Ax_b(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A...
N_les * N_alloc_les_Ax_b(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A, vector x and vector b.
void G_math_free_spmatrix(G_math_spvector **, int)
Release the memory of the sparse matrix.
void G_free(void *)
Free allocated memory.
double ** G_alloc_matrix(int, int)
Matrix memory allocation.
N_les * N_alloc_les(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A, vector x and vector b.
void N_free_les(N_les *les)
Release the memory of the linear equation system.
N_les * N_alloc_les_Ax(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A and vector x...
void N_print_les(N_les *les)
prints the linear equation system to stdout
N_les * N_alloc_nquad_les_Ax(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A and vector x...
N_les * N_alloc_nquad_les_A(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A...
N_les * N_alloc_les_param(int cols, int rows, int type, int parts)
Allocate memory for a quadratic or not quadratic linear equation system.
N_les * N_alloc_nquad_les(int cols, int rows, int type)
Allocate memory for a (not) quadratic linear equation system which includes the Matrix A...
N_les * N_alloc_les_A(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A.
G_math_spvector ** G_math_alloc_spmatrix(int)
Allocate memory for a sparse matrix.
int cols
Number of columns for 2D data.
void G_free_matrix(double **)
Matrix memory deallocation.
int rows
Number of rows for 2D data.
int G_debug(int, const char *,...) __attribute__((format(printf
The linear equation system (les) structure.