RWalib C Array Library User Guide > Relational Operations > alibGreater
  

alibGreater
Returns the element-wise maximum of scalar or array arguments. The PV-WAVE API for this routine is the Maximum Operator >.
Prototypes
void alibGreaterb( wvlong m, wvlong n, UCHAR *p, UCHAR *q, UCHAR *r )
void alibGreaters( wvlong m, wvlong n, short *p, short *q, short *r )
void alibGreateri( wvlong m, wvlong n, int *p, int *q, int *r )
void alibGreaterl( wvlong m, wvlong n, wvlong *p, wvlong *q, wvlong *r )
void alibGreaterf( wvlong m, wvlong n, float *p, float *q, float *r )
void alibGreaterd( wvlong m, wvlong n, double *p, double *q, double *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 element-wise maximum of the two operands. The 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  b0[9]={0,8,1,7,2,6,3,5,4}, b1[9]={0,7,2,6,3,5,3,4,1}, b2=4, *b;
   /* make output array */
   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 the element-wise greater of b0 and b2=4" );
      alibGreaterb( 9, 0, b0, &b2, b );
      alibPrintArrayb( 1, 1, 1, 9, b, NULL );
   printf( "\n\n show the element-wise greater of b2=4 and b1" );
      alibGreaterb( 0, 9, &b2, b1, b );
      alibPrintArrayb( 1, 1, 1, 9, b, NULL );
   printf( "\n\n show the element-wise greater of b1 and b0" );
      alibGreaterb( 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
 
   0   7   2   6   3   5   3   4   1
 
 show the element-wise greater of b0 and b2=4
 
   4   8   4   7   4   6   4   5   4
 
 show the element-wise greater of b2=4 and b1
 
   4   7   4   6   4   5   4   4   4
 
 show the element-wise greater of b1 and b0
 
   0   8   2   7   3   6   3   5   4

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