GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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 #include <stdlib.h>
9 #include "ccmath.h"
10 void hmgen(Cpx * h, double *ev, Cpx * u, int n)
11 {
12  Cpx *v, *p;
13 
14  int i, j;
15 
16  double e;
17 
18  v = (Cpx *) calloc(n * n, sizeof(Cpx));
19  cmcpy(v, u, n * n);
20  hconj(v, n);
21  for (i = 0, p = v; i < n; ++i) {
22  for (j = 0, e = ev[i]; j < n; ++j, ++p) {
23  p->re *= e;
24  p->im *= e;
25  }
26  }
27  cmmul(h, u, v, n);
28  free(v);
29 }
void hconj(Cpx *u, int n)
Definition: hconj.c:9
void cmcpy(Cpx *a, Cpx *b, int n)
Definition: cmcpy.c:9
void cmmul(Cpx *c, Cpx *a, Cpx *b, int n)
Definition: cmmul.c:9
void hmgen(Cpx *h, double *ev, Cpx *u, int n)
Definition: hmgen.c:10
void free(void *)
double re
Definition: ccmath.h:38
double im
Definition: ccmath.h:38
Definition: la.h:54