GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mult.c
Go to the documentation of this file.
1 /* Author: Bill Hoff,2-114C,8645,3563478 (hoff) at uicsl */
2 
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 }
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
int n
Definition: dataquad.c:291