GRASS GIS 7 Programmer's Manual
7.8.2(2019)-exported
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 size2, double *v3[2], int size3)
5
*
6
* \brief Multiply two complex vectors, point by point
7
*
8
* Vectors are in the form: real, imaginary (each a floating number).
9
* A vector can be of any size. Computes <b>v3</b> = <b>v1</b> *
10
* <b>v2</b>. <b>v3</b> should as big as the biggest of <b>v1</b> and
11
* <b>v2</b>.
12
*
13
* \param v1
14
* \param size1
15
* \param v2
16
* \param size2
17
* \param v3
18
* \param size3
19
* \return int
20
*/
21
22
int
23
G_math_complex_mult
(
double
*v1[2],
int
size1,
double
*v2[2],
int
size2,
double
*v3[2],
24
int
size3)
25
{
26
int
i, n;
27
28
n = (size1 < size2 ? size1 : size2);
/* get the smaller size */
29
for
(i = 0; i < n; i++) {
30
*(v3[0] + i) =
31
*(v1[0] + i) * *(v2[0] + i) - *(v1[1] + i) * *(v2[1] + i);
32
*(v3[1] + i) =
33
*(v1[0] + i) * *(v2[1] + i) + *(v2[0] + i) * *(v1[1] + i);
34
}
35
36
/* if unequal size, zero out remaining elements of larger vector */
37
if
(size1 != size2)
38
for
(i = n; i < size3; i++) {
39
*(v3[0] + i) = 0.0;
40
*(v3[1] + i) = 0.0;
41
}
42
43
return
0;
44
}
G_math_complex_mult
int G_math_complex_mult(double *v1[2], int size1, double *v2[2], int size2, double *v3[2], int size3)
Multiply two complex vectors, point by point.
Definition:
mult.c:23
gmath
mult.c
Generated on Tue Mar 24 2020 14:13:52 for GRASS GIS 7 Programmer's Manual by
1.8.17