GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
cvmul.c
Go to the documentation of this file.
1 /* cvmul.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 "ccmath.h"
9 void cvmul(Cpx * u, Cpx * a, Cpx * v, int n)
10 {
11  Cpx *q;
12 
13  int i, j;
14 
15  for (i = 0; i < n; ++i, ++u) {
16  u->re = u->im = 0.;
17  for (j = 0, q = v; j < n; ++j, ++a, ++q) {
18  u->re += a->re * q->re - a->im * q->im;
19  u->im += a->im * q->re + a->re * q->im;
20  }
21  }
22 }
23 
24 Cpx cvnrm(Cpx * u, Cpx * v, int n)
25 {
26  int k;
27 
28  Cpx z;
29 
30  z.re = z.im = 0.;
31  for (k = 0; k < n; ++k, ++u, ++v) {
32  z.re += u->re * v->re + u->im * v->im;
33  z.im += u->re * v->im - u->im * v->re;
34  }
35  return z;
36 }
void cvmul(Cpx *u, Cpx *a, Cpx *v, int n)
Definition: cvmul.c:9
Cpx cvnrm(Cpx *u, Cpx *v, int n)
Definition: cvmul.c:24
double re
Definition: ccmath.h:38
double im
Definition: ccmath.h:38
Definition: la.h:54