GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73378
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
Cpx cvnrm(Cpx *u, Cpx *v, int n)
Definition: cvmul.c:24
void cvmul(Cpx *vp, Cpx *mat, Cpx *v, int n)
Definition: cvmul.c:9
double re
Definition: ccmath.h:38
double im
Definition: ccmath.h:38
Definition: la.h:54