alibDouble
Converts an array to type
double. This returns the real part of complex input. The PV-WAVE API for this routine is the
DOUBLE Function.
Prototypes
void alibDoubleb( wvlong n, UCHAR *p, double *r )
void alibDoubles( wvlong n, short *p, double *r )
void alibDoublei( wvlong n, int *p, double *r )
void alibDoublel( wvlong n, wvlong *p, double *r )
void alibDoublef( wvlong n, float *p, double *r )
void alibDoubled( wvlong n, double *p, double *r )
void alibDoublec( wvlong n, COMPLEX *p, double *r )
void alibDoublez( 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, r is the array obtained from array p by converting each of its elements to type double. If array p is complex then array r is the real part of p.
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
UCHAR b0[9] = {0,1,2,3,4,5,6,7,8};
COMPLEX c0[9] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
double *b;
double *c;
b = (double*)malloc(9*sizeof(double));
c = (double*)malloc(9*sizeof(double));
alibinit( NULL, NULL, NULL, NULL );
printf( "\n\n print the input arrays" );
alibPrintArrayb( 1, 1, 3, 3, b0, NULL );
alibPrintArrayc( 1, 1, 3, 3, c0, NULL );
alibDoubleb( 9, b0, b );
alibDoublec( 9, c0, c );
printf( "\n\n print the result arrays" );
alibPrintArrayd( 1, 1, 3, 3, b, NULL );
alibPrintArrayd( 1, 1, 3, 3, c, NULL );
}
Output:
print the input arrays
0 1 2
3 4 5
6 7 8
( 0.0e+00 1.0e+00 ) ( 2.0e+00 3.0e+00 ) ( 4.0e+00 5.0e+00 )
( 6.0e+00 7.0e+00 ) ( 8.0e+00 9.0e+00 ) ( 1.0e+01 1.1e+01 )
( 1.2e+01 1.3e+01 ) ( 1.4e+01 1.5e+01 ) ( 1.6e+01 1.7e+01 )
print the result arrays
0.000000e+00 1.000000e+00 2.000000e+00
3.000000e+00 4.000000e+00 5.000000e+00
6.000000e+00 7.000000e+00 8.000000e+00
0.000000e+00 2.000000e+00 4.000000e+00
6.000000e+00 8.000000e+00 1.000000e+01
1.200000e+01 1.400000e+01 1.600000e+01
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.