GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
hmgen.c
Go to the documentation of this file.
1 /* hmgen.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 hmgen(Cpx *h, double *ev, Cpx *u, int n)
13 {
14  Cpx *v, *p;
15 
16  int i, j;
17 
18  double e;
19 
20  v = (Cpx *)calloc(n * n, sizeof(Cpx));
21  cmcpy(v, u, n * n);
22  hconj(v, n);
23  for (i = 0, p = v; i < n; ++i) {
24  for (j = 0, e = ev[i]; j < n; ++j, ++p) {
25  p->re *= e;
26  p->im *= e;
27  }
28  }
29  cmmul(h, u, v, n);
30  free(v);
31 }
void cmmul(Cpx *c, Cpx *a, Cpx *b, int n)
Definition: cmmul.c:11
void cmcpy(Cpx *a, Cpx *b, int n)
Definition: cmcpy.c:11
void hconj(Cpx *u, int n)
Definition: hconj.c:11
void hmgen(Cpx *h, double *ev, Cpx *u, int n)
Definition: hmgen.c:12
void free(void *)
Definition: ccmath.h:38
double re
Definition: ccmath.h:39
double im
Definition: ccmath.h:39