GRASS Programmer's Manual  6.5.svn(2012)-r51648
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
cmmul.c
Go to the documentation of this file.
00001 /*  cmmul.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 "ccmath.h"
00009 void cmmul(Cpx * c, Cpx * a, Cpx * b, int n)
00010 {
00011     Cpx s, *p, *q;
00012 
00013     int i, j, k;
00014 
00015     trncm(b, n);
00016     for (i = 0; i < n; ++i, a += n) {
00017         for (j = 0, q = b; j < n; ++j) {
00018             for (k = 0, p = a, s.re = s.im = 0.; k < n; ++k) {
00019                 s.re += p->re * q->re - p->im * q->im;
00020                 s.im += p->im * q->re + p->re * q->im;
00021                 ++p;
00022                 ++q;
00023             }
00024             *c++ = s;
00025         }
00026     }
00027     trncm(b, n);
00028 }