RWalib C Array Library User Guide > Trigonometric Functions > alibArg
  

alibArg
Returns the angle of each element in a complex array. The PV-WAVE API for this routine is the ATAN Function.
Prototypes
void alibArgc( wvlong n, COMPLEX *p, float *r )
void alibArgz( wvlong n, DCOMPLEX *p, double *r )
Parameters
n — (Input) The number of elements in the source array.
*p — (Input) The n-element source array.
*r — (Input/Output) The n-element destination array. On return, array r contains the angle of each element in array p.
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
   /* make up some input data for the examples */
   COMPLEX  c0[8]={-1,-1,0,-2,3,-3,1,0,2,2,0,4,-5,5,-4,0};
   /* make an output array */
   float  c[8];
   printf( "\n\n print (4,2) matrix c0" );
      alibinit( NULL, NULL, NULL, NULL );
      alibPrintArrayc( 1, 1, 4, 2, c0, NULL );
   printf( "\n\n print the angle for each element in c0" );
      alibArgc( 8, c0, c );
      alibPrintArrayf( 1, 1, 4, 2, c, NULL );
}
 
Output:
 
 print (4,2) matrix c0
 
( -1.000e+00, -1.000e+00) (  0.000e+00, -2.000e+00) 
(  3.000e+00, -3.000e+00) (  1.000e+00,  0.000e+00) 
(  2.000e+00,  2.000e+00) (  0.000e+00,  4.000e+00) 
( -5.000e+00,  5.000e+00) ( -4.000e+00,  0.000e+00) 
 
 print the angle for each element in c0
 
  -2.356e+00  -1.571e+00
  -7.854e-01   0.000e+00
   7.854e-01   1.571e+00
   2.356e+00   3.142e+00
 

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.