GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
rmmult.c
Go to the documentation of this file.
1 /* rmmult.c CCMATH mathematics library source code.
2  *
3  * Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
4  * This code may be redistributed under the terms of the GNU library
5  * public license (LGPL). ( See the lgpl.license file for details.)
6  * ------------------------------------------------------------------------
7  */
8 #include <stdlib.h>
9 void rmmult(double *rm, double *a, double *b, int n, int m, int l)
10 {
11  double z, *q0, *p, *q;
12 
13  int i, j, k;
14 
15  q0 = (double *)calloc(m, sizeof(double));
16  for (i = 0; i < l; ++i, ++rm) {
17  for (k = 0, p = b + i; k < m; p += l)
18  q0[k++] = *p;
19  for (j = 0, p = a, q = rm; j < n; ++j, q += l) {
20  for (k = 0, z = 0.; k < m;)
21  z += *p++ * q0[k++];
22  *q = z;
23  }
24  }
25  free(q0);
26 }
double b
Definition: r_raster.c:39
double l
Definition: r_raster.c:39
void rmmult(double *rm, double *a, double *b, int n, int m, int l)
Definition: rmmult.c:9
void free(void *)