GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-6596d49e63
cmmul.c
Go to the documentation of this file.
1 /* cmmul.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 "ccmath.h"
10 
11 void cmmul(Cpx *c, Cpx *a, Cpx *b, int n)
12 {
13  Cpx s, *p, *q;
14 
15  int i, j, k;
16 
17  trncm(b, n);
18  for (i = 0; i < n; ++i, a += n) {
19  for (j = 0, q = b; j < n; ++j) {
20  for (k = 0, p = a, s.re = s.im = 0.; k < n; ++k) {
21  s.re += p->re * q->re - p->im * q->im;
22  s.im += p->im * q->re + p->re * q->im;
23  ++p;
24  ++q;
25  }
26  *c++ = s;
27  }
28  }
29  trncm(b, n);
30 }
void trncm(Cpx *a, int n)
Definition: trncm.c:11
void cmmul(Cpx *c, Cpx *a, Cpx *b, int n)
Definition: cmmul.c:11
double b
Definition: r_raster.c:39
Definition: ccmath.h:38
double re
Definition: ccmath.h:39
double im
Definition: ccmath.h:39