RWalib C Array Library User Guide > Arithmetic Operations > alibConj
  

alibConj
Returns the conjugate of each element in a complex array. The PV-WAVE API for this routine is the CONJ Function.
Prototypes
void alibConjc( wvlong n, COMPLEX *p, COMPLEX *r )
void alibConjz( wvlong n, DCOMPLEX *p, DCOMPLEX *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 conjugate of each element in array p. The operation can be done in-place, i.e., r can equal p.
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
    /* make some example data */
        COMPLEX  c0[6] = {0,1,2,-3,-4,5,-6,-7,8,9,10,-11};
    /* make an output array */
        COMPLEX  c[6];
    printf( "\n\n print the input array as a (2,3) matrix" );
        alibinit( NULL, NULL, NULL, NULL );
        alibPrintArrayc( 1, 1, 2, 3, c0, NULL );
    printf( "\n\n print the element-wise conjugate of the input array" );
        alibConjc( 6, c0, c );
        alibPrintArrayc( 1, 1, 2, 3, c, NULL );
    printf( "\n\n now repeat the operation in-place" );
        alibConjc( 6, c0, c0 );
        alibPrintArrayc( 1, 1, 2, 3, c0, NULL );
}
 
Output:
 
 print the input array as a (2,3) matrix
 
(  0.000e+00,  1.000e+00) (  2.000e+00, -3.000e+00) ( -4.000e+00,  5.000e+00) 
( -6.000e+00, -7.000e+00) (  8.000e+00,  9.000e+00) (  1.000e+01, -1.100e+01) 
 
 print the element-wise conjugate of the input array
 
(  0.000e+00, -1.000e+00) (  2.000e+00,  3.000e+00) ( -4.000e+00, -5.000e+00) 
( -6.000e+00,  7.000e+00) (  8.000e+00, -9.000e+00) (  1.000e+01,  1.100e+01) 
 
 now repeat the operation in-place
 
(  0.000e+00, -1.000e+00) (  2.000e+00,  3.000e+00) ( -4.000e+00, -5.000e+00) 
( -6.000e+00,  7.000e+00) (  8.000e+00, -9.000e+00) (  1.000e+01,  1.100e+01) 

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.