GRASS 8 Programmer's Manual
8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
mult.c
Go to the documentation of this file.
1
/* Author: Bill Hoff,2-114C,8645,3563478 (hoff) at uicsl */
2
3
/*!
4
* \fn int G_math_complex_mult (double *v1[2], int size1, double *v2[2], int
5
* size2, double *v3[2], int size3)
6
*
7
* \brief Multiply two complex vectors, point by point
8
*
9
* Vectors are in the form: real, imaginary (each a floating number).
10
* A vector can be of any size. Computes <b>v3</b> = <b>v1</b> *
11
* <b>v2</b>. <b>v3</b> should as big as the biggest of <b>v1</b> and
12
* <b>v2</b>.
13
*
14
* \param v1
15
* \param size1
16
* \param v2
17
* \param size2
18
* \param v3
19
* \param size3
20
* \return int
21
*/
22
int
G_math_complex_mult
(
double
*v1[2],
int
size1
,
double
*v2[2],
int
size2
,
23
double
*v3[2],
int
size3
)
24
{
25
int
i, n;
26
27
n = (
size1
<
size2
?
size1
:
size2
);
/* get the smaller size */
28
for
(i = 0; i < n; i++) {
29
*(v3[0] + i) =
30
*(v1[0] + i) * *(v2[0] + i) - *(v1[1] + i) * *(v2[1] + i);
31
*(v3[1] + i) =
32
*(v1[0] + i) * *(v2[1] + i) + *(v2[0] + i) * *(v1[1] + i);
33
}
34
35
/* if unequal size, zero out remaining elements of larger vector */
36
if
(
size1
!=
size2
)
37
for
(i = n; i <
size3
; i++) {
38
*(v3[0] + i) = 0.0;
39
*(v3[1] + i) = 0.0;
40
}
41
42
return
0;
43
}
AMI_STREAM
Definition
ami_stream.h:153
G_math_complex_mult
int G_math_complex_mult(double *v1[2], int size1, double *v2[2], int size2, double *v3[2], int size3)
Definition
mult.c:22
lib
gmath
mult.c
Generated on Sun Apr 12 2026 06:59:15 for GRASS 8 Programmer's Manual by
1.9.8