24 #include <grass/gmath.h>
25 #include <grass/gis.h>
26 #include <grass/gisdefs.h>
28 #define EPSILON 0.00000000000000001
51 #pragma omp for schedule (static) private(i, j, tmp)
52 for (i = 0; i < rows; i++) {
54 for (j = 0; j < Asp[i]->cols; j++) {
55 tmp += Asp[i]->values[j] * x[Asp[i]->index[j]];
85 #pragma omp for schedule (static) private(i, j, tmp)
86 for (i = 0; i < rows; i++) {
88 for (j = cols - 1; j >= 0; j--) {
89 tmp += A[i][j] * x[j];
119 #pragma omp for schedule (static) private(i, j, tmp)
120 for (i = 0; i < rows; i++) {
122 for (j = cols - 1; j >= 0; j--) {
123 tmp += A[i][j] * x[j];
151 #pragma omp for schedule (static) private(i, j)
152 for (i = 0; i < rows; i++) {
153 for (j = cols - 1; j >= 0; j--) {
154 A[i][j] = x[i] * y[j];
181 #pragma omp for schedule (static) private(i, j)
182 for (i = 0; i < rows; i++) {
183 for (j = cols - 1; j >= 0; j--) {
184 A[i][j] = x[i] * y[j];
212 double *z,
int rows,
int cols)
220 #pragma omp for schedule (static) private(i, j, tmp)
221 for (i = 0; i < rows; i++) {
223 for (j = cols - 1; j >= 0; j--) {
224 tmp += A[i][j] * x[j] + y[j];
229 else if (b == -1.0) {
230 #pragma omp for schedule (static) private(i, j, tmp)
231 for (i = 0; i < rows; i++) {
233 for (j = cols - 1; j >= 0; j--) {
234 tmp += a * A[i][j] * x[j] - y[j];
240 #pragma omp for schedule (static) private(i, j, tmp)
241 for (i = 0; i < rows; i++) {
243 for (j = cols - 1; j >= 0; j--) {
244 tmp += A[i][j] * x[j];
249 else if (a == -1.0) {
250 #pragma omp for schedule (static) private(i, j, tmp)
251 for (i = 0; i < rows; i++) {
253 for (j = cols - 1; j >= 0; j--) {
254 tmp += b * y[j] - A[i][j] * x[j];
260 #pragma omp for schedule (static) private(i, j, tmp)
261 for (i = 0; i < rows; i++) {
263 for (j = cols - 1; j >= 0; j--) {
264 tmp += a * A[i][j] * x[j] + b * y[j];
294 float *z,
int rows,
int cols)
302 #pragma omp for schedule (static) private(i, j, tmp)
303 for (i = 0; i < rows; i++) {
305 for (j = cols - 1; j >= 0; j--) {
306 tmp += A[i][j] * x[j] + y[j];
311 else if (b == -1.0) {
312 #pragma omp for schedule (static) private(i, j, tmp)
313 for (i = 0; i < rows; i++) {
315 for (j = cols - 1; j >= 0; j--) {
316 tmp += a * A[i][j] * x[j] - y[j];
322 #pragma omp for schedule (static) private(i, j, tmp)
323 for (i = 0; i < rows; i++) {
325 for (j = cols - 1; j >= 0; j--) {
326 tmp += A[i][j] * x[j];
331 else if (a == -1.0) {
332 #pragma omp for schedule (static) private(i, j, tmp)
333 for (i = 0; i < rows; i++) {
335 for (j = cols - 1; j >= 0; j--) {
336 tmp += b * y[j] - A[i][j] * x[j];
342 #pragma omp for schedule (static) private(i, j, tmp)
343 for (i = 0; i < rows; i++) {
345 for (j = cols - 1; j >= 0; j--) {
346 tmp += a * A[i][j] * x[j] + b * y[j];
377 #pragma omp for schedule (static) private(i, j, tmp)
378 for (i = 0; i < rows; i++)
379 for (j = 0; j < i; j++) {
410 #pragma omp for schedule (static) private(i, j, tmp)
411 for (i = 0; i < rows; i++)
412 for (j = 0; j < i; j++) {
int G_math_d_A_T(double **A, int rows)
Compute the transposition of matrix A. Matrix A will be overwritten.
void G_math_d_Ax(double **A, double *x, double *y, int rows, int cols)
Compute the matrix - vector product of matrix A and vector x.
int G_math_f_A_T(float **A, int rows)
void G_math_d_x_dyad_y(double *x, double *y, double **A, int rows, int cols)
Compute the dyadic product of two vectors. The result is stored in the matrix A.
void G_math_d_aAx_by(double **A, double *x, double *y, double a, double b, double *z, int rows, int cols)
Compute the scaled matrix - vector product of matrix double **A and vector x and y.
void G_math_f_Ax(float **A, float *x, float *y, int rows, int cols)
Compute the matrix - vector product of matrix A and vector x.
void G_math_f_x_dyad_y(float *x, float *y, float **A, int rows, int cols)
Compute the dyadic product of twMo vectors. The result is stored in the matrix A. ...
void G_math_f_aAx_by(float **A, float *x, float *y, float a, float b, float *z, int rows, int cols)
Compute the scaled matrix - vector product of matrix A and vectors x and y.
void G_math_Ax_sparse(G_math_spvector **Asp, double *x, double *y, int rows)
Compute the matrix - vector product of sparse matrix **Asp and vector x.