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