24 #include <grass/gmath.h>
25 #include <grass/gis.h>
53 #pragma omp parallel for schedule (static) reduction(+:s)
54 for (i = rows - 1; i >= 0; i--) {
85 #pragma omp parallel for schedule (static) reduction(+:s)
86 for (i = rows - 1; i >= 0; i--) {
117 #pragma omp parallel for schedule (static) reduction(+:s)
118 for (i = rows - 1; i >= 0; i--) {
147 max = fabs(x[rows - 1]);
148 for (i = rows - 2; i >= 0; i--) {
149 if (max < fabs(x[i]))
179 #pragma omp for schedule (static)
180 for (i = rows - 1; i >= 0; i--) {
184 else if ((a == 1.0) && (b == 1.0)) {
185 #pragma omp for schedule (static)
186 for (i = rows - 1; i >= 0; i--) {
190 else if ((a == 1.0) && (b == -1.0)) {
191 #pragma omp for schedule (static)
192 for (i = rows - 1; i >= 0; i--) {
197 #pragma omp for schedule (static)
198 for (i = rows - 1; i >= 0; i--) {
199 z[i] = a * (x[i] + y[i]);
202 else if (b == -1.0) {
203 #pragma omp for schedule (static)
204 for (i = rows - 1; i >= 0; i--) {
205 z[i] = a * x[i] - y[i];
209 #pragma omp for schedule (static)
210 for (i = rows - 1; i >= 0; i--) {
211 z[i] = a * x[i] + y[i];
215 #pragma omp for schedule (static)
216 for (i = rows - 1; i >= 0; i--) {
217 z[i] = a * x[i] + b * y[i];
238 y = memcpy(y, x, rows *
sizeof(
double));
269 #pragma omp parallel for schedule (static) reduction(+:s)
270 for (i = rows - 1; i >= 0; i--) {
301 #pragma omp parallel for schedule (static) reduction(+:s)
302 for (i = rows - 1; i >= 0; i--) {
335 #pragma omp parallel for schedule (static) private(i) reduction(+:s, count)
336 for (i = 0; i < rows; i++) {
366 max = fabs(x[rows - 1]);
367 for (i = rows - 2; i >= 0; i--) {
368 if (max < fabs(x[i]))
397 #pragma omp for schedule (static)
398 for (i = rows - 1; i >= 0; i--) {
402 else if ((a == 1.0) && (b == 1.0)) {
403 #pragma omp for schedule (static)
404 for (i = rows - 1; i >= 0; i--) {
408 else if ((a == 1.0) && (b == -1.0)) {
409 #pragma omp for schedule (static)
410 for (i = rows - 1; i >= 0; i--) {
415 #pragma omp for schedule (static)
416 for (i = rows - 1; i >= 0; i--) {
417 z[i] = a * (x[i] + y[i]);
420 else if (b == -1.0) {
421 #pragma omp for schedule (static)
422 for (i = rows - 1; i >= 0; i--) {
423 z[i] = a * x[i] - y[i];
427 #pragma omp for schedule (static)
428 for (i = rows - 1; i >= 0; i--) {
429 z[i] = a * x[i] + y[i];
433 #pragma omp for schedule (static)
434 for (i = rows - 1; i >= 0; i--) {
435 z[i] = a * x[i] + b * y[i];
456 y = memcpy(y, x, rows *
sizeof(
float));
487 #pragma omp parallel for schedule (static) reduction(+:s)
488 for (i = rows - 1; i >= 0; i--) {
519 #pragma omp parallel for schedule (static) reduction(+:s)
520 for (i = rows - 1; i >= 0; i--) {
551 #pragma omp parallel for schedule (static) reduction(+:s)
552 for (i = rows - 1; i >= 0; i--) {
581 max = fabs(x[rows - 1]);
582 for (i = rows - 2; i >= 0; i--) {
583 if (max < fabs(x[i]))
612 #pragma omp for schedule (static)
613 for (i = rows - 1; i >= 0; i--) {
617 else if ((a == 1.0) && (b == 1.0)) {
618 #pragma omp for schedule (static)
619 for (i = rows - 1; i >= 0; i--) {
623 else if ((a == 1.0) && (b == -1.0)) {
624 #pragma omp for schedule (static)
625 for (i = rows - 1; i >= 0; i--) {
630 #pragma omp for schedule (static)
631 for (i = rows - 1; i >= 0; i--) {
632 z[i] = a * (x[i] + y[i]);
635 else if (b == -1.0) {
636 #pragma omp for schedule (static)
637 for (i = rows - 1; i >= 0; i--) {
638 z[i] = a * x[i] - y[i];
642 #pragma omp for schedule (static)
643 for (i = rows - 1; i >= 0; i--) {
644 z[i] = a * x[i] + y[i];
648 #pragma omp for schedule (static)
649 for (i = rows - 1; i >= 0; i--) {
650 z[i] = a * x[i] + b * y[i];
671 y = memcpy(y, x, rows *
sizeof(
int));
void G_math_f_x_dot_y(float *x, float *y, float *value, int rows)
Compute the dot product of vector x and y.
void G_math_i_max_norm(int *x, int *value, int rows)
Compute the maximum norm of vector x.
void G_math_f_ax_by(float *x, float *y, float *z, float a, float b, int rows)
Scales vectors x and y with the scalars a and b and adds them.
void G_math_d_max_norm(double *x, double *value, int rows)
Compute the maximum norm of vector x.
void G_math_d_x_dot_y(double *x, double *y, double *value, int rows)
Compute the dot product of vector x and y.
void G_math_f_copy(float *x, float *y, int rows)
Copy the vector x to y.
void G_math_f_max_norm(float *x, float *value, int rows)
Compute the maximum norm of vector x.
void G_math_f_asum_norm(float *x, float *value, int rows)
Compute the asum norm of vector x.
void G_math_i_copy(int *x, int *y, int rows)
Copy the vector x to y.
void G_math_d_euclid_norm(double *x, double *value, int rows)
Compute the euclid norm of vector x.
void G_math_d_copy(double *x, double *y, int rows)
Copy the vector x to y.
void G_math_d_asum_norm(double *x, double *value, int rows)
Compute the asum norm of vector x.
void G_math_i_x_dot_y(int *x, int *y, double *value, int rows)
Compute the dot product of vector x and y.
void G_math_i_ax_by(int *x, int *y, int *z, int a, int b, int rows)
Scales vectors x and y with the scalars a and b and adds them.
void G_math_f_euclid_norm(float *x, float *value, int rows)
Compute the euclid norm of vector x.
void G_math_i_asum_norm(int *x, double *value, int rows)
Compute the asum norm of vector x.
void G_math_d_ax_by(double *x, double *y, double *z, double a, double b, int rows)
Scales vectors x and y with the scalars a and b and adds them.
void G_math_i_euclid_norm(int *x, double *value, int rows)
Compute the euclid norm of vector x.