C Library Functions  - setdiff (3)

NAME

setdiff(3f) - [M_sets] Find the values in A that are not in B

CONTENTS

Synopsis
Description
Options
Examples
Authors
License

SYNOPSIS

setdiff(A,B, setOrder)

DESCRIPTION

setdiff(3f) returns the data in A that is not in B, with no repetitions.

OPTIONS

A input array
B input array
setOrder
  May be "sort" or "stable". If "stable" the values are returned in the order discovered. The default is "sorted", which returns the data in ascending order.

EXAMPLES

sample program:

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

write(*,g) ’SETDIFF’,’Find the values in A that are not in B.’ A=[3, 6, 2, 1, 5, 1, 1] B=[2, 4, 6] write(*,g) ’A=’, A write(*,g) ’B=’, B write(*,g) setdiff(A, B) write(*,g) setdiff([4, 1, 3, 2, 5], [2, 1], ’sorted’) write(*,g) setdiff([4, 1, 3, 2, 5], [2, 1], ’stable’)

end program demo_setdiff

Results:

 > SETDIFF Find the values in A that are not in B.
 > A= 3 6 2 1 5 1 1
 > B= 2 4 6
 > 1 3 5
 > 3 4 5
 > 4 3 5

AUTHORS

John S. Urban, 2023-07-20

LICENSE

CC0-1.0


Nemo Release 3.1 setdiff (3) February 23, 2025
Generated by manServer 1.08 from 2daec418-fb29-4ce7-b207-dcc11651b194 using man macros.