GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-1d42e580e2
cmmult.c
Go to the documentation of this file.
1
/* cmmult.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
9
#include <stdlib.h>
10
#include "
ccmath.h
"
11
12
void
cmmult
(
Cpx
*cm,
Cpx
*a,
Cpx
*
b
,
int
n,
int
m,
int
l
)
13
{
14
Cpx
z, *q0, *p, *q;
15
16
int
i, j, k;
17
18
q0 = (
Cpx
*)calloc(m,
sizeof
(
Cpx
));
19
for
(i = 0; i <
l
; ++i, ++cm) {
20
for
(k = 0, p =
b
+ i; k < m; p +=
l
)
21
q0[k++] = *p;
22
for
(j = 0, p = a, q = cm; j < n; ++j, q +=
l
) {
23
for
(k = 0, z.
re
= z.
im
= 0.; k < m; ++k, ++p) {
24
z.
re
+= p->
re
* q0[k].
re
- p->
im
* q0[k].
im
;
25
z.
im
+= p->
im
* q0[k].
re
+ p->
re
* q0[k].
im
;
26
}
27
*q = z;
28
}
29
}
30
free
(q0);
31
}
ccmath.h
cmmult
void cmmult(Cpx *cm, Cpx *a, Cpx *b, int n, int m, int l)
Definition:
cmmult.c:12
b
double b
Definition:
r_raster.c:39
l
double l
Definition:
r_raster.c:39
free
void free(void *)
complex
Definition:
ccmath.h:38
complex::re
double re
Definition:
ccmath.h:39
complex::im
double im
Definition:
ccmath.h:39
lib
external
ccmath
cmmult.c
Generated on Sat Oct 12 2024 06:58:44 for GRASS GIS 8 Programmer's Manual by
1.9.1