C Library Functions  - ismember (3)

NAME

ismember(3f) - [M_sets] Create a mask of A marking elements also in B

CONTENTS

Synopsis
Description
Options
Returns
Examples
Authors
License

SYNOPSIS

ismember(A,B)

DESCRIPTION

Identifies elements of the first set that are members of the second set as well.

The returned array is a mask of the first array containing a 1 (aka. "true") where the data in A is found in B. Elsewhere, the array contains 0 (aka. "false").

OPTIONS

A input array
B input array of values to find in vector A.

RETURNS

A mask of array A with a 1 at locations where the value in that position in A is also a value that occurs in B, and with a 0 at locations where that value in A was not found in B.

EXAMPLES

sample program:

   program demo_ismember
   use M_sets, only: ismember
   character(len=*),parameter :: g=’(*(g0,1x))’
   integer, allocatable       :: A(:)
   integer, allocatable       :: B(:)

write(*,g) ’ISMEMBER’, ’Determine which elements of A are also in B.’

A=[5,3,4,2] B=[2,4,4,4,6,8] write(*,g) ’A=’, A write(*,g) ’B=’, B write(*,g) ismember(A,B)

end program demo_ismember

Results:

 > ISMEMBER Determine which elements of A are also in B.
 > A= 5 3 4 2
 > B= 2 4 4 4 6 8
 > 0 0 1 1

AUTHORS

John S. Urban, 2023-07-20

LICENSE

CC0-1.0


Nemo Release 3.1 ismember (3) February 23, 2025
Generated by manServer 1.08 from d570aea7-2650-43e1-97f3-4d79aaae6223 using man macros.