34 #include <grass/interpf.h>
43 static double *A =
NULL;
48 fprintf(stderr,
"Cannot allocate memory for A\n");
79 int n1, k1, k2, k, i1,
l, m, i, j;
80 double fstar2 = params->
fi * params->
fi / 4.;
82 double rsin = 0, rcos = 0, teta,
101 for (k = 1; k <= n_points; k++) {
110 for (k = 1; k <= n_points; k++) {
114 if (params->
rsm < 0.) {
115 A[i1] = -points[k - 1].
sm;
124 for (
l = k2;
l <= n_points;
l++) {
125 xx = points[k - 1].
x - points[
l - 1].
x;
126 yy = points[k - 1].
y - points[
l - 1].
y;
130 xxr = xx * rcos + yy * rsin;
131 yyr = yy * rcos - xx * rsin;
134 r = scale * xx * xx + yy * yy;
135 rfsta2 = fstar2 * (scale * xx * xx + yy * yy);
138 r = xx * xx + yy * yy;
139 rfsta2 = fstar2 * (xx * xx + yy * yy);
143 fprintf(stderr,
"ident. points in segm.\n");
144 fprintf(stderr,
"x[%d]=%f, x[%d]=%f, y[%d]=%f, y[%d]=%f\n",
145 k - 1, points[k - 1].
x,
l - 1, points[
l - 1].
x, k - 1,
146 points[k - 1].y,
l - 1, points[
l - 1].y);
156 for (k = 1; k <= n1; k++) {
159 for (
l = k2;
l <= n1;
l++) {
160 m = (
l - 1) * n1 + k;
162 amaxa =
amax1(A[m], amaxa);
166 for (i = 0; i <= n_points; i++) {
167 for (j = 0; j <= n_points; j++) {
173 G_debug(3,
"calling G_ludcmp() n=%d indx=%d", n_points, *indx);
174 if (
G_ludcmp(matrix, n_points + 1, indx, &d) <= 0) {
176 fprintf(stderr,
"G_ludcmp() failed! n=%d d=%.2f\n", n_points, d);
int G_debug(int, const char *,...) __attribute__((format(printf
int G_ludcmp(double **, int, int *, double *)
LU decomposition.
double * G_alloc_vector(size_t)
Vector matrix memory allocation.
double amax1(double, double)
int IL_matrix_create_alloc(struct interp_params *params, struct triple *points, int n_points, double **matrix, int *indx, double *A)
Creates system of linear equations from interpolated points.
int IL_matrix_create(struct interp_params *params, struct triple *points, int n_points, double **matrix, int *indx)