~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/external/ccmath/utrnhm.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  utrnhm.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 utrnhm(Cpx * hm, Cpx * a, Cpx * b, int n)
 
11
{
 
12
    Cpx z, *q0, *p, *s, *t;
 
13
 
 
14
    int i, j, k;
 
15
 
 
16
    q0 = (Cpx *) calloc(n, sizeof(Cpx));
 
17
    for (i = 0; i < n; ++i) {
 
18
        for (j = 0, t = b; j < n; ++j) {
 
19
            z.re = z.im = 0.;
 
20
            for (k = 0, s = a + i * n; k < n; ++k, ++s, ++t) {
 
21
                z.re += t->re * s->re + t->im * s->im;
 
22
                z.im += t->im * s->re - t->re * s->im;
 
23
            }
 
24
            q0[j] = z;
 
25
        }
 
26
        for (j = 0, p = hm + i, t = a; j <= i; ++j, p += n) {
 
27
            z.re = z.im = 0.;
 
28
            for (k = 0, s = q0; k < n; ++k, ++t, ++s) {
 
29
                z.re += t->re * s->re - t->im * s->im;
 
30
                z.im += t->im * s->re + t->re * s->im;
 
31
            }
 
32
            *p = z;
 
33
            if (j < i) {
 
34
                z.im = -z.im;
 
35
                hm[i * n + j] = z;
 
36
            }
 
37
        }
 
38
    }
 
39
    free(q0);
 
40
}