alibIndex
Fills an array with some sequence of evenly spaced numbers. The PV-WAVE API's for this routine are the
LINSPACE Function and the *INDGEN routines.
Prototypes
void alibIndexb( wvlong n, UCHAR s, UCHAR i, UCHAR *p )
void alibIndexs( wvlong n, short s, short i, short *p )
void alibIndexi( wvlong n, int s, int i, int *p )
void alibIndexl( wvlong n, wvlong s, wvlong i, wvlong *p )
void alibIndexf( wvlong n, float s, float i, float *p )
void alibIndexd( wvlong n, double s, double i, double *p )
void alibIndexc( wvlong n, COMPLEX s, COMPLEX i, COMPLEX *p )
void alibIndexz( wvlong n, DCOMPLEX s, DCOMPLEX i, DCOMPLEX *p )
Parameters
n — (Input) The number of elements in the array to be populated.
s — (Input) The start value for the sequence of evenly spaced numbers.
i — (Input) The increment for the sequence of evenly spaced numbers.
*p — (Input/Output) The array to be populated. On return, p contains the sequence of n evenly spaced numbers starting with s and incremented by i.
Example
Here we make and print a 9-element array starting with 2 and incremented by 3.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
wvlong n = 9;
UCHAR *b;
b = (UCHAR*)malloc(n*sizeof(UCHAR));
alibinit( NULL, NULL, NULL, NULL );
alibIndexb( n, 2, 3, b );
alibPrintArrayb( 1, 1, 1, n, b, NULL );
}
Output:
2 5 8 11 14 17 20 23 26
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.