GRASS Programmer's Manual  6.5.svn(2012)-r51648
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
hmgen.c
Go to the documentation of this file.
00001 /*  hmgen.c    CCMATH mathematics library source code.
00002  *
00003  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
00004  *  This code may be redistributed under the terms of the GNU library
00005  *  public license (LGPL). ( See the lgpl.license file for details.)
00006  * ------------------------------------------------------------------------
00007  */
00008 #include <stdlib.h>
00009 #include "ccmath.h"
00010 void hmgen(Cpx * h, double *ev, Cpx * u, int n)
00011 {
00012     Cpx *v, *p;
00013 
00014     int i, j;
00015 
00016     double e;
00017 
00018     v = (Cpx *) calloc(n * n, sizeof(Cpx));
00019     cmcpy(v, u, n * n);
00020     hconj(v, n);
00021     for (i = 0, p = v; i < n; ++i) {
00022         for (j = 0, e = ev[i]; j < n; ++j, ++p) {
00023             p->re *= e;
00024             p->im *= e;
00025         }
00026     }
00027     cmmul(h, u, v, n);
00028     free(v);
00029 }