Loading...
Searching...
No Matches
cmmult.c
Go to the documentation of this file.
/* cmmult.c CCMATH mathematics library source code.
*
* Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
* This code may be redistributed under the terms of the GNU library
* public license (LGPL). ( See the lgpl.license file for details.)
* ------------------------------------------------------------------------
*/
#include <stdlib.h>
#include "ccmath.h"
void cmmult(Cpx *cm, Cpx *a, Cpx *b, int n, int m, int l)
{
Cpx z, *q0, *p, *q;
int i, j, k;
q0 = (Cpx *)calloc(m, sizeof(Cpx));
for (i = 0; i < l; ++i, ++cm) {
for (k = 0, p = b + i; k < m; p += l)
q0[k++] = *p;
for (j = 0, p = a, q = cm; j < n; ++j, q += l) {
for (k = 0, z.re = z.im = 0.; k < m; ++k, ++p) {
z.re += p->re * q0[k].re - p->im * q0[k].im;
z.im += p->im * q0[k].re + p->re * q0[k].im;
}
*q = z;
}
}
free(q0);
}
ccmath.h
Cpx
struct complex Cpx
Definition ccmath.h:41
cmmult
void cmmult(Cpx *cm, Cpx *a, Cpx *b, int n, int m, int l)
Definition cmmult.c:12
b
double b
Definition driver/set_window.c:5
l
double l
Definition driver/set_window.c:5
complex::re
double re
Definition ccmath.h:39
complex::im
double im
Definition ccmath.h:39