C Library Functions  - setdiff (3)

NAME

setdiff(3f) - [M_sets] return setdiff values in array A

CONTENTS

Synopsis
Description
Options
Example
Authors
License

SYNOPSIS

setdiff(A,B, setOrder)

DESCRIPTION

Set difference of two arrays.
  C = setdiff(A,B) returns the data in A that is not in B, with no repetitions. C is in sorted order by default.

OPTIONS

A input array
B input array
setOrder
  May be "sort" or "stable"

EXAMPLE

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) July 22, 2023
Generated by manServer 1.08 from d989c703-5e0f-4972-82a7-e7d421115e02 using man macros.