19 #include <grass/N_pde.h>
190 "Allocate memory for a sparse linear equation system with %i "
195 "Allocate memory for a regular linear equation system with %i "
202 les->
x = (
double *)
G_calloc(cols,
sizeof(
double));
203 for (i = 0; i < cols; i++)
208 les->
b = (
double *)
G_calloc(cols,
sizeof(
double));
209 for (i = 0; i < cols; i++)
262 for (i = 0; i < les->
rows; i++) {
263 for (j = 0; j < les->
cols; j++) {
265 for (k = 0; (
unsigned int)k < les->Asp[i]->cols; k++) {
266 if (les->
Asp[i]->
index[k] == (
unsigned int)j) {
267 fprintf(stdout,
"%4.5f ", les->
Asp[i]->
values[k]);
272 fprintf(stdout,
"%4.5f ", 0.0);
275 fprintf(stdout,
" * %4.5f", les->
x[i]);
277 fprintf(stdout,
" = %4.5f ", les->
b[i]);
279 fprintf(stdout,
"\n");
284 for (i = 0; i < les->
rows; i++) {
285 for (j = 0; j < les->
cols; j++) {
286 fprintf(stdout,
"%4.5f ", les->
A[i][j]);
289 fprintf(stdout,
" * %4.5f", les->
x[i]);
291 fprintf(stdout,
" = %4.5f ", les->
b[i]);
293 fprintf(stdout,
"\n");
310 G_debug(2,
"Releasing memory of a sparse linear equation system\n");
312 G_debug(2,
"Releasing memory of a regular linear equation system\n");
void G_free(void *)
Free allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf
void G_free_matrix(double **)
Matrix memory deallocation.
void G_math_free_spmatrix(G_math_spvector **, int)
Release the memory of the sparse matrix.
G_math_spvector ** G_math_alloc_spmatrix(int)
Allocate memory for a sparse matrix.
double ** G_alloc_matrix(int, int)
Matrix memory allocation.
void N_print_les(N_les *les)
prints the linear equation system to stdout
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_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_les_Ax(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A and vector x.
N_les * N_alloc_les(int rows, int type)
Allocate memory for a quadratic linear equation system which includes the Matrix A,...
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...
void N_free_les(N_les *les)
Release the memory of the linear equation system.
N_les * N_alloc_les_Ax_b(int rows, int type)
Allocate memory for a 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.
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,...
The linear equation system (les) structure.