GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-f4d8c62acd
cmmult.c
Go to the documentation of this file.
1 /* cmmult.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 
9 #include <stdlib.h>
10 #include "ccmath.h"
11 
12 void cmmult(Cpx *cm, Cpx *a, Cpx *b, int n, int m, int l)
13 {
14  Cpx z, *q0, *p, *q;
15 
16  int i, j, k;
17 
18  q0 = (Cpx *)calloc(m, sizeof(Cpx));
19  for (i = 0; i < l; ++i, ++cm) {
20  for (k = 0, p = b + i; k < m; p += l)
21  q0[k++] = *p;
22  for (j = 0, p = a, q = cm; j < n; ++j, q += l) {
23  for (k = 0, z.re = z.im = 0.; k < m; ++k, ++p) {
24  z.re += p->re * q0[k].re - p->im * q0[k].im;
25  z.im += p->im * q0[k].re + p->re * q0[k].im;
26  }
27  *q = z;
28  }
29  }
30  free(q0);
31 }
void cmmult(Cpx *cm, Cpx *a, Cpx *b, int n, int m, int l)
Definition: cmmult.c:12
double b
Definition: r_raster.c:39
double l
Definition: r_raster.c:39
void free(void *)
Definition: la.h:54
double re
Definition: ccmath.h:39
double im
Definition: ccmath.h:39