RWalib C Array Library User Guide > Relational Operations > alibLe
  

alibLe
Applies the <= operator element-wise to scalar or array arguments. Like most of the relational operations, this routine returns a Boolean array of 0's and 1's. alibCount and alibFind can be used to count and retrieve the indices of the true values (the 1's). Often a Boolean array is combined with another as input to one of the logical array operations, which in turn produces another Boolean array. The PV-WAVE API for this routine is the operator LE.
Prototypes
void alibLeb( wvlong m, wvlong n, UCHAR *p, UCHAR *q, UCHAR *r )
void alibLes( wvlong m, wvlong n, short *p, short *q, UCHAR *r )
void alibLei( wvlong m, wvlong n, int *p, int *q, UCHAR *r )
void alibLel( wvlong m, wvlong n, wvlong *p, wvlong *q, UCHAR *r )
void alibLef( wvlong m, wvlong n, float *p, float *q, UCHAR *r )
void alibLed( wvlong m, wvlong n, double *p, double *q, UCHAR *r )
Parameters
m — (Input) The number of elements in the first array operand. A value of 0 indicates that the first operand is a scalar.
n — (Input) The number of elements in the second array operand. A value of 0 indicates that the second operand is a scalar. If both operands are arrays then n must equal m.
*p — (Input) The pointer to the first operand.
*q — (Input) The pointer to the second operand.
*r — (Input/Output) The destination array. On return, array r contains the the result of applying <= to the two operands, element-wise. For UCHAR inputs this operation can be done in-place, i.e., r can equal p or q.
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
   /* make up some data for the examples */
   UCHAR *b;
   UCHAR b0[9]={0,8,1,7,2,6,3,5,4}, b1[9]={1,8,2,6,3,6,4,4,5}, b2=4;
   /* make output arrays */
   b = (UCHAR*)malloc(9*sizeof(UCHAR));
   printf( "\n\n show arrays b0 and b1" );
      alibinit( NULL, NULL, NULL, NULL );
      alibPrintArrayb( 1, 1, 1, 9, b0, NULL );
      alibPrintArrayb( 1, 1, 1, 9, b1, NULL );
   printf( "\n\n show where b0 is less than or equal to b2=4" );
      alibLeb( 9, 0, b0, &b2, b );
      alibPrintArrayb( 1, 1, 1, 9, b, NULL );
   printf( "\n\n show where b2=4 is less than or equal to b1" );
      alibLeb( 0, 9, &b2, b1, b );
      alibPrintArrayb( 1, 1, 1, 9, b, NULL );
   printf( "\n\n show where b1 is less than or equal to b0" );
      alibLeb( 9, 9, b1, b0, b );
      alibPrintArrayb( 1, 1, 1, 9, b, NULL );
}
Output:
 
 show arrays b0 and b1
 
   0   8   1   7   2   6   3   5   4
 
   1   8   2   6   3   6   4   4   5
 
 show where b0 is less than or equal to b2=4
 
   1   0   1   0   1   0   1   0   1
 
 show where b2=4 is less than or equal to b1
 
   0   1   0   1   0   1   1   1   1
 
 show where b1 is less than or equal to b0
 
   0   1   0   1   0   1   0   1   0

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